Katello / katello-client-bootstrap

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

[RFE] create_host to succeed even if there is no environment_id attached to Host Group #93

Open ericzolf opened 8 years ago

ericzolf commented 8 years ago

As the subject says, create_host fails with an error that a null environment_id isn't acceptable.

Adding the following two lines solved the issue for me, but it sounds slightly ugly, because it assumes an ID of 1 for production, and I don't know if there are no side effects if the Puppet environment of the created host is set "forcefully" to production:

    if (return_puppetenv_for_hg(return_matching_foreman_key('hostgroups', 'title="%s"' % options.hostgroup, 'id', False)) == "production"):
        jsondata['host']['environment_id'] = 1 # Assuming production's ID is 1

bootstrap-envid_patch.txt

evgeni commented 8 years ago

bootstrap.py expects the HG to be set up properly: https://github.com/Katello/katello-client-bootstrap/blob/master/README.md#assumptions

if you do not have the HG set up to use puppet, you can skip it completelly with --skip-puppet

ericzolf commented 8 years ago

Hi Evgeni,

I'm fine with the fact that it's working as it should (it's not a bug, it's a feature), but it doesn't mean we can't change the way it works, and I think that there are customers using Puppet only for gathering facts, in which case, it doesn't make sense to care about the Puppet environment.

OK, I've rephrased it as RFE.

KR, Eric