david-caro / python-foreman

Small low level python wrapper around Foreman API
GNU General Public License v2.0
57 stars 37 forks source link

problem with updating puppetclasses for a host #92

Open svenXY opened 5 years ago

svenXY commented 5 years ago

Hi, I'm trying to add a puppetclass to the puppetclasses of a host, but can't seem to find out how.

First attempt was something like:

pc = f.show_puppetclasses(p_id)
host = f.show_hosts(id)
host['puppetclasses'].append(pc)
f.update_hosts(id=host['id'], host=host)

but that does nothing and even returns an empty resultset

then

ppn = { 'puppetclass_id': 4212 }
f.update_hosts(id=host['id'], host=ppn)

this takes much longer and returns the host resultset, but the class is not added.

Maybe you have a hint?

Thanks, Sven