Hello,

I have a number of hosts I would like to rebuild to a certain OS so I want 
to do this client side via the API with a Python script.

I have this function:-

def change_os(buildhost):
    msg = "Changing host OS"
    log_message(msg, 'INFO')
    data = {
             "name": buildhost,
             "build": "true",
             "medium_id": '25',
             "operatingsystem_id": '40'
           }
    oschange = put_json(FMN_API + "hosts/" + buildhost,json.dumps(data))

Where buildhost is passed in as an argument (I have hard-coded medium_id, 
and operatingsystem_id for now although they will
be arguments also.

I get a "Record Not Found" from the logs. Where this get function works fine

def host_info(buildhost):
    host_info = get_json(FMN_API + "hosts/" + buildhost)
    return host_info

Any ideas on where I am going wrong ?

Thanks
Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to