-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Enable register with environment names & type #3480
Conversation
If you want to test this new functionality, then you have to create some testing environment using e.g. this REST API (replace localhost with your testing candlepin server):
Testing script (needs library.sh from https://github.com/jirihnidek/rhsm-dbus-examples/): #!/bin/bash
source ./library.sh
export username="admin"
export password="admin"
export org_id="donaldduck"
start_register_server
# Try to register using username and password
echo "Registering using org, username and password..."
dbus-send --address=${my_addr} --print-reply --dest='com.redhat.RHSM1.Register' \
'/com/redhat/RHSM1/Register' \
com.redhat.RHSM1.Register.Register \
string:"${org_id}" \
string:"${username}" \
string:"${password}" \
dict:string:string:"environment_names","env-name-1","environment_type","foo" \
dict:string:string:"","" \
string:"" | gawk '/string/{ $1 = ""; print $0; }' | sed 's/\"//' | sed 's/\(.*\)\"/\1/' > /root/register_output.json
print_registration_result $?
stop_register_server |
I was playing around with this through rhc, it seems to do everything we need it to! Any reason to keep this in draft? |
I would like to add more unit tests and maybe polish commit little bit. After that, I will convert it to PR and it will be ready for review. |
8a9bbeb
to
7092ac7
Compare
7092ac7
to
855f9ec
Compare
@rverdile The PR is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch behaves as it should. The code looks fine, from birds-eye point of view.
tried with rhc and looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good @jirihnidek. I have a couple small suggestions. I apologies if I my assumptions are incorrect. Please let me know if they are.
I am not easily able to test this with the condleping-container because I am on an arm64 and the container expects amd64. @m-horky had reported The patch behaves as it should. With him running it and me looking over the code I think we should be good once you respond to my feedback.
Thank you. Joe
9096534
to
5ba01cf
Compare
* Allow to register also with environment names. It is possible to use environment names with username & password and activation-keys & organization authentication * It is not allowed to use `environmets` and `environment_names` registration options together, because it is not possible to use env. IDs and names together on candlepin server * Introduce environment_type as another registration_option * When consumer object is returned and it contains environments, then all environments are checked if type of environment matches given environment_type. If type is missing or is different, then system is unregistered and exception is raised * Modified few unit tests related to environments * Added few unit tests
5ba01cf
to
8140ecc
Compare
@jvlcek The PR should be ready for review again. |
@jirihnidek Thank you for addressing all of my comments. I approve this PR now. However it appears I may not be authorized to officially mark this as approved. Regardless you have my approval to have this merged. |
to use environment names with username & password and
activation-keys & organization authentication
environmets
andenvironment_names
registration options together, because it is not possible to use
env. IDs and names together on candlepin server
then all environments are checked if type of environment
matches given environment_type. If type is missing or is
different, then system is unregistered and exception is
raised