Hi,
Can anyone tell me how to set the content view and environment for a single
host? I can't see a way to do it here -
http://www.katello.org/docs/api/apidoc.html.
As a work around I have been trying this -
http://www.katello.org/docs/api/apidoc/systems_bulk_actions/environment_content_view.html,
but that seems like a sledge hammer. If that is the best way of
acomplishing the goal then I have a problem with my code, which looks like
this:
data = {'organization_id': org_id,
'included': {'ids': host_ids},
'content_view_id': cv_id,
'environment_id': lce_id}
json_print(data)
result = json_put('%ssystems/bulk/environment_content_view' % (katello_url
), json.dumps(data))
json_print(result)
And gives this:
{
"content_view_id": 4,
"environment_id": 2,
"included": {
"ids": [
"2"
]
},
"organization_id": 3
}
{
"displayMessage": "Action unauthorized to be performed on selected
systems.",
"errors": [
"Action unauthorized to be performed on selected systems."
]
}
I know my account has permissions to set the cv & env of a single host. Is
there something relating to bulk actions my account might not be enabled
for?
Thanks in advance for any assistance.
Regards,
David
You can PUT /katello/api/systems
For documentation, visit https://$server/apidoc/v2/systems/update.html
Another handy trick, on some UI pages, is to watch the traffic from the browser to the server (shift-ctrl-i in firefox or chrome). In this case, try changing the env/cv of a content host and note the API call.
···
----- Original Message -----
> Hi,
>
> Can anyone tell me how to set the content view and environment for a single
> host? I can't see a way to do it here -
> http://www.katello.org/docs/api/apidoc.html.
>
> As a work around I have been trying this -
> http://www.katello.org/docs/api/apidoc/systems_bulk_actions/environment_content_view.html,
> but that seems like a sledge hammer. If that is the best way of
> acomplishing the goal then I have a problem with my code, which looks like
> this:
>
> data = {'organization_id': org_id,
> 'included': {'ids': host_ids},
> 'content_view_id': cv_id,
> 'environment_id': lce_id}
>
>
> json_print(data)
> result = json_put('%ssystems/bulk/environment_content_view' % (katello_url
> ), json.dumps(data))
> json_print(result)
>
> And gives this:
>
> {
> "content_view_id": 4,
> "environment_id": 2,
> "included": {
> "ids": [
> "2"
> ]
> },
> "organization_id": 3
> }
> {
> "displayMessage": "Action unauthorized to be performed on selected
> systems.",
> "errors": [
> "Action unauthorized to be performed on selected systems."
> ]
> }
>
>
> I know my account has permissions to set the cv & env of a single host. Is
> there something relating to bulk actions my account might not be enabled
> for?
>
> Thanks in advance for any assistance.
>
> Regards,
> David
>
> --
> 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 foreman-users+unsubscribe@googlegroups.com.
> To post to this group, send email to foreman-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/foreman-users.
> For more options, visit https://groups.google.com/d/optout.
>
Hi Tom,
Thanks for that - very useful!
I have it working now, with this:
data = {'id': system_uuid,
'content_view_id': cv_id,
'environment_id': lce_id}
result = json_put('%s/systems/%s' % (katello_url, system_id), json.dumps(
data))
But following your tip to use the server's documentation I can see that
call is deprecated. It's fine for now though - thanks very much for your
help!
Regards,
David
···
On Tuesday, 10 November 2015 18:25:41 UTC, Tom McKay wrote:
>
>
>
> ----- Original Message -----
> > Hi,
> >
> > Can anyone tell me how to set the content view and environment for a
> single
> > host? I can't see a way to do it here -
> > http://www.katello.org/docs/api/apidoc.html.
> >
> > As a work around I have been trying this -
> >
> http://www.katello.org/docs/api/apidoc/systems_bulk_actions/environment_content_view.html,
>
> > but that seems like a sledge hammer. If that is the best way of
> > acomplishing the goal then I have a problem with my code, which looks
> like
> > this:
> >
> > data = {'organization_id': org_id,
> > 'included': {'ids': host_ids},
> > 'content_view_id': cv_id,
> > 'environment_id': lce_id}
> >
> >
> > json_print(data)
> > result = json_put('%ssystems/bulk/environment_content_view' %
> (katello_url
> > ), json.dumps(data))
> > json_print(result)
> >
> > And gives this:
> >
> > {
> > "content_view_id": 4,
> > "environment_id": 2,
> > "included": {
> > "ids": [
> > "2"
> > ]
> > },
> > "organization_id": 3
> > }
> > {
> > "displayMessage": "Action unauthorized to be performed on selected
> > systems.",
> > "errors": [
> > "Action unauthorized to be performed on selected systems."
> > ]
> > }
> >
> >
> > I know my account has permissions to set the cv & env of a single host.
> Is
> > there something relating to bulk actions my account might not be enabled
> > for?
> >
> > Thanks in advance for any assistance.
> >
> > Regards,
> > David
> >
> > --
> > 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 foreman-user...@googlegroups.com .
> > To post to this group, send email to forema...@googlegroups.com
> .
> > Visit this group at http://groups.google.com/group/foreman-users.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> You can PUT /katello/api/systems
>
> For documentation, visit https://$server/apidoc/v2/systems/update.html
>
> Another handy trick, on some UI pages, is to watch the traffic from the
> browser to the server (shift-ctrl-i in firefox or chrome). In this case,
> try changing the env/cv of a content host and note the API call.
>
>
> Hi Tom,
>
> Thanks for that - very useful!
>
> I have it working now, with this:
>
> data = {'id': system_uuid,
> 'content_view_id': cv_id,
> 'environment_id': lce_id}
>
>
> result = json_put('%s/systems/%s' % (katello_url, system_id), json.dumps(
> data))
>
> But following your tip to use the server's documentation I can see that
> call is deprecated. It's fine for now though - thanks very much for your
> help!
>
> Regards,
> David
>
All the /systems routes are marked deprecated because we will be merging the content-host (katello) with the host (foreman) in an upcoming release. At the moment, though, there is no replacement call to use; that is the correct usage.
···
----- Original Message -----
On Tuesday, 10 November 2015 18:25:41 UTC, Tom McKay wrote:
----- Original Message -----
Hi,
Can anyone tell me how to set the content view and environment for a
single
host? I can’t see a way to do it here -
http://www.katello.org/docs/api/apidoc.html.
As a work around I have been trying this -
http://www.katello.org/docs/api/apidoc/systems_bulk_actions/environment_content_view.html,
but that seems like a sledge hammer. If that is the best way of
acomplishing the goal then I have a problem with my code, which looks
like
this:
data = {‘organization_id’: org_id,
‘included’: {‘ids’: host_ids},
‘content_view_id’: cv_id,
‘environment_id’: lce_id}
json_print(data)
result = json_put(’%ssystems/bulk/environment_content_view’ %
(katello_url
), json.dumps(data))
json_print(result)
And gives this:
{
“content_view_id”: 4,
“environment_id”: 2,
“included”: {
“ids”: [
“2”
]
},
“organization_id”: 3
}
{
“displayMessage”: “Action unauthorized to be performed on selected
systems.”,
“errors”: [
“Action unauthorized to be performed on selected systems.”
]
}
I know my account has permissions to set the cv & env of a single host.
Is
there something relating to bulk actions my account might not be enabled
for?
Thanks in advance for any assistance.
Regards,
David
–
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 foreman-user...@googlegroups.com <javascript:>.
To post to this group, send email to forema...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
You can PUT /katello/api/systems
For documentation, visit https://$server/apidoc/v2/systems/update.html
Another handy trick, on some UI pages, is to watch the traffic from the
browser to the server (shift-ctrl-i in firefox or chrome). In this case,
try changing the env/cv of a content host and note the API call.
–
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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.