Katello / katello-client-bootstrap

Bootstrap Script for migrating systems to Foreman & Katello
GNU General Public License v2.0
52 stars 63 forks source link

Add a --set-auto-attach option #290

Closed olardit-sg closed 4 years ago

olardit-sg commented 5 years ago

In some cases we want to set the content-host's auto-attach value to false (or true). This is different from the auto-attach value used in the activation key(s) which is only used at registration time. If some auto-attach actions are triggered later on it will use the content-host's auto-attach value

For example, with a satellite in "Organization Environment Access" we typically have no subscription attached to the content-host (auto-attach = false and no sub on the AK), but if the content-host's auto-attach is set to true, at the next rhsmcertd run on the client, it will pick a subscription. This as been discussed with the support in https://access.redhat.com/support/cases/#/case/02196634 and in bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1676554

NB: I have added some pylint exclusions for distutils.util module. The module is in python since at least 2.4.3 (tested on RH5.3) and pylint on my system is also happy with this import ...

sideangleside commented 5 years ago

Firstly, thanks for the PR, as an FYI, bz1591383 will (once it lands in a build) disable auto-attach globally when the contentAccessMode is set to org_environment, making the need to set this explicitly on the client no longer required.

Also, while your patch works, it requires authentication (to use the API), so it wouldn't work when --skip foreman or --content-only are passed.

As an alternative, you can pass subscription-manager auto-attach --disable post registration to achieve the same effect.

olardit-sg commented 5 years ago

Hello, bz1591383 is a good news, it will definitely help! Regarding subscription-manager auto-attach --disable I first use this, but in this case I found out that the auto-attach flag value, even if effective on the host, was not reflecting on the satellite side. That's why I switched to doing an API call to have consistency. What about using subscription-manager only if --skip foreman or --content-only are passed? Also I don't know which of a new bootstrap.py version or a candlepin version will be incorporated first in satellite, so I don't know if it makes sense to go further with this. Let me know your thoughts

wbclark commented 4 years ago

@olardit-sg thank you for the contribution. Since the fix for bz1591383 is available with Satellite 6.6 and later, we'll close this PR as no longer needed. However if we are overlooking any additional use case for this feature which is not addressed by the above BZ, please feel free to reach out.