API v2

I am experimenting with the Foreman API. I need to write a script that
spins up a cluster. In our environment a cluster is a series of machines
that define an environment. This includes adding compute resources, compute
profiles, subnets, etc.

It seems the API is lacking in certain areas. For instance listing the
compute resources. It doesn't allow you to determine what locations that
compute resource is tied to (or when creating one you can't tie it to a
location). Same goes for things such as host groups creation.

Is there a way to get and set this information?

Thanks

> I am experimenting with the Foreman API. I need to write a script that
> spins up a cluster. In our environment a cluster is a series of machines
> that define an environment. This includes adding compute resources, compute
> profiles, subnets, etc.
>
> It seems the API is lacking in certain areas. For instance listing the
> compute resources. It doesn't allow you to determine what locations that
> compute resource is tied to (or when creating one you can't tie it to a
> location). Same goes for things such as host groups creation.
>
> Is there a way to get and set this information?

I think you're misguided as it seems like the docs in
Foreman are a bit outdated as the code shows
it's definitely possible
https://github.com/theforeman/foreman/blob/develop/app/controllers/api/v2/compute_resources_controller.rb#L46

Just pass in the same JSON a key "location_id" or "location_name" and
that should set the location in your newly created compute resource.

Same logic would work for the PUT (update) request, and for host groups.

Hope this helps

··· On 07/26, Matthew Ceroni wrote:

Thanks


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.


Daniel Lobato Garcia

@eLobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato

Thanks for the post. Appreciate it.

Follow-up on compute profiles + compute resources. This is accessed through
the compute attributes API call. I see calls to create and update a compute
attribute. But is there a way to get all compute profiles associated with a
specific compute resource?

Thanks again.

··· On Monday, July 27, 2015 at 7:28:44 AM UTC-7, Daniel Lobato wrote: > > On 07/26, Matthew Ceroni wrote: > > I am experimenting with the Foreman API. I need to write a script that > > spins up a cluster. In our environment a cluster is a series of machines > > that define an environment. This includes adding compute resources, > compute > > profiles, subnets, etc. > > > > It seems the API is lacking in certain areas. For instance listing the > > compute resources. It doesn't allow you to determine what locations that > > compute resource is tied to (or when creating one you can't tie it to a > > location). Same goes for things such as host groups creation. > > > > Is there a way to get and set this information? > > I think you're misguided as it seems like the docs in > http://theforeman.org/api_v2.html are a bit outdated as the code shows > it's definitely possible > > https://github.com/theforeman/foreman/blob/develop/app/controllers/api/v2/compute_resources_controller.rb#L46 > > Just pass in the same JSON a key "location_id" or "location_name" and > that should set the location in your newly created compute resource. > > Same logic would work for the PUT (update) request, and for host groups. > > Hope this helps > > > > > Thanks > > > > -- > > 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. > > > -- > Daniel Lobato Garcia > > @eLobatoss > blog.daniellobato.me > daniellobato.me > > GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30 > Keybase: https://keybase.io/elobato >