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

1.6.0 RFE Assign location without foreman #243

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

josephpisciotta
Copy link
Contributor

No description provided.

@sideangleside
Copy link
Member

I would change

if options.location:

to

if options.location and 'foreman' in options.skip:

While it doesn't hurt to do so, we really only want to write the location facts if/when --skip foreman is passed.

@josephpisciotta
Copy link
Contributor Author

Added that

@sideangleside
Copy link
Member

Did some testing on this. If we set location using the location.facts file above, then change the hosts location in the UI, on the next run of subscription-manager facts --update the host will be associated with the original location specified at registration.

Example:

  • I have two locations, RDU and BOS
  • I register a host to BOS using this patch ./bootstrap.py -o Example -L BOS -s foreman.example.com --skip foreman -a ak-Reg_To_Crash
  • I update the host to use a new location hammer host update --name bootstrap.example.com --location RDU
  • I run subscription-manager facts --update either manually or wait for it to occur at a later point.
  • The host's location will be updated to BOS

Thus, I would advise to delete the location.facts file after the host is registered.

@josephpisciotta
Copy link
Contributor Author

josephpisciotta commented Feb 1, 2018 via email

@sideangleside
Copy link
Member

Subscription-manager doesn't support Locations. (That's why we have to either create the host via the API or use the foreman_location fact).

@josephpisciotta
Copy link
Contributor Author

josephpisciotta commented Feb 1, 2018 via email

@evgeni
Copy link
Member

evgeni commented Feb 12, 2018

Yeah, I agree with @sideangleside, we should yank the file after we finished registering.
Given this also applies for migrations, I think the removal should happen somewhere here: https://github.com/josephpisciotta/katello-client-bootstrap/blob/515f06f18f9a7efa5df9915ede13884057cfdf5d/bootstrap.py#L1259 (like: after all the branches are done).

@josephpisciotta
Copy link
Contributor Author

I fixed that. I didn't see evgeni's suggestion but I removed the file after both registration and migration so all good.

Copy link
Member

@sideangleside sideangleside left a comment

Choose a reason for hiding this comment

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

You'd want the inverse here if 'foreman' in options.skip: (If foreman is in the list of options to be skipped, delete the file). It doesn't exist otherwise.

Also, place the file deletion in the location that @evgeni recommended. No need in having duplicated code.

Other than those changes, it looks good. Please squash this code to a singular commit Example

@josephpisciotta
Copy link
Contributor Author

@evgeni do you mean outside of the else? because if it is inside the else it won't run in the case that rhn exists and migration is being ran. it would need to be in a different if block

@sideangleside
Copy link
Member

You have a block of code here (https://github.com/josephpisciotta/katello-client-bootstrap/blob/master/bootstrap.py#L1257:L1258) that is unneeded. That code is unneeded (It attempts to delete the location.facts file when --skip foreman is NOT passed.

Other than that, the patches work as designed. Please fix the above and squash this work to a singluar commit. @evgeni , thoughts?

…reman

remove location fact after registration

Made suggested revisions

RFE for location without foreman
Copy link
Member

@evgeni evgeni left a comment

Choose a reason for hiding this comment

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

LGTM

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