Skip to content
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: Added support for environments during registration #121

Closed
wants to merge 1 commit into from

Conversation

jirihnidek
Copy link
Contributor

  • It is possible to specify environments during connecting (RHSM registration) using CLI option --environment
  • It is possible to specify multiple environmets
  • Added beforeCoonectAction checking combinations of CLI options

* It is possible to specify environments during connecting
  (RHSM registration) using CLI option --environment
* It is possible to specify multiple environmets
* Added beforeCoonectAction checking combinations of CLI options
@jirihnidek
Copy link
Contributor Author

To test this functionality it is necessary to create some testing environments. If you use local candlepin server, then you create new environments using following commands:

curl --stderr /dev/null --insecure --user admin:admin --request POST \
  --data '{"id": "env-id-1", "name": "env-name-1", "description": "Testing environment num. 1"}' \
  --header 'accept: application/json' --header 'content-type: application/json' \
  https://localhost:8443/candlepin/owners/donaldduck/environments
curl --stderr /dev/null --insecure --user admin:admin --request POST \
  --data '{"id": "env-id-2", "name": "env-name-2", "description": "Testing environment num. 2"}' \
  --header 'accept: application/json' --header 'content-type: application/json' \
  https://localhost:8443/candlepin/owners/donaldduck/environments

Then you can test connecting system using rhc using following command:

./rhc connect --username admin --password admin --organization donaldduck \
  --environment env-id-1 --environment env-id-2

As you can see, you can use CLI option --environment multiple times, because system could become member of more environments.

There is no command that could be used for getting list of valid environments, because there is no D-Bus API for getting such list. User just has to know IDs of environments.

It is also reason why rhc does not ask for environment (like subscription-manager), when no environment is provided using CLI option, but organization contains some environments. In that case system will be just registered, but system will not belong to any environment.

@jirihnidek
Copy link
Contributor Author

/packit build

@jirihnidek
Copy link
Contributor Author

jirihnidek commented Jun 25, 2024

Build started 10:40 ...
... most of build started 10:46 and finished during 1 minute.

It means that you have to wait 6 minutes in some queue.

@Lorquas Lorquas self-requested a review July 10, 2024 15:53
Copy link
Member

@Lorquas Lorquas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me, concise and easy to follow. Thanks for the environment steps. I tested this against a rhel-9 machine and selinux denied rhc from accessing subscription-manager?

Outside of that the environments successfully connect, and the activation-key errors in the beforeConnectAction work as expected.

LGTM after a rebase.

@rehana-raj
Copy link

We agreed to delay merging of this PR until we confirm the requirements with depend teams.

@jirihnidek
Copy link
Contributor Author

Closing this PR due to this: https://issues.redhat.com/browse/RHEL-53436 We can reopen later, when needed.

@jirihnidek jirihnidek closed this Sep 27, 2024
@jirihnidek jirihnidek deleted the jhnidek/environments branch September 27, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants