Foreman 1.3.2 - using curl or CLI to add more web users

I need to be able to add web users automatically (aka - scripted) via some
sort of CLI or 'curl' request. Assuming I need to allow this user only
access to the provisioning module, what should i expect? The current
production.log showing the actual (and working) command, but I am unable to
translate it into the curl commands…

I would appreciate some real example of such an operation. It could be
great.

Thanks!
Etzion

> I need to be able to add web users automatically (aka - scripted) via some
> sort of CLI or 'curl' request. Assuming I need to allow this user only
> access to the provisioning module, what should i expect? The current
> production.log showing the actual (and working) command, but I am unable to
> translate it into the curl commands…
>
> I would appreciate some real example of such an operation. It could be
> great.
>

did you try out our CLI? see

··· On Wed, Feb 12, 2014 at 1:31 AM, Etzion Bar-Noy wrote:

Thanks!
Etzion


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/groups/opt_out.

Hi. I actually did. I worked very extensively with hammer up until now,
including (nearly) full automation of Foreman deployment. However:

hammer user create --login someuser --firstname some --lastname user
–mail someuser@domain.com --password 123456
Could not create the user:
Error: option '–auth-source-id' is required

hammer user create --login someuser --firstname some --lastname user
–mail someuser@domain.com --password 123456 --auth-source-id INTERNAL
Could not create the user:
Invalid username or password

hammer user create --login someuser --firstname some --lastname user
–mail someuser@domain.com --password 123456 --auth-source-id 1
Could not create the user:
Invalid username or password

I do not know what is auth-source-id and where do I get it. I do not think
the command responds correctly to either value I place there (I have only
internal, built-in admin user currently, and no plans of connecting the
system to ADS or any other LDAP service). Moreover - how do I set the roles
the user should get when it's created - the 'hammer user update' allows
specifying '–id' which is the resource ID. What is the resource ID? Is it
role from the roles menu? Is it something else?

Thanks!
Etzion

··· On Wednesday, 12 February 2014 08:35:03 UTC+2, ohad wrote: > > > > > On Wed, Feb 12, 2014 at 1:31 AM, Etzion Bar-Noy <etz...@barnoy.co.il > > wrote: > >> I need to be able to add web users automatically (aka - scripted) via >> some sort of CLI or 'curl' request. Assuming I need to allow this user only >> access to the provisioning module, what should i expect? The current >> production.log showing the actual (and working) command, but I am unable to >> translate it into the curl commands... >> >> I would appreciate some real example of such an operation. It could be >> great. >> > > did you try out our CLI? see > http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html > > >> >> Thanks! >> Etzion >> >> -- >> 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/groups/opt_out. >> > >

Hi Etzion,

–auth-source-id should be 1 in your case, which is 'INTERNAL' (not
connected to LDAP or anything). The last option is right.

I just tried: "hammer user create --login someuser --firstname some
–lastname user --mail someuser@domain.com --password 123456
–auth-source-id 1", after you type that in, it should ask for your
username and password, then you type your admin username and password and
it should work (it works on my Foreman).

Updating the roles is a little trickier and I believe hammer can only
update the login, firstname, lastname, email, admin flag, password, and
authentication source.
You can update the roles programatically using the API though,
https://gist.github.com/eLobato/8973253 is the format of the API response
for users, more info here Foreman or in IRC
#theforeman-dev #theforeman

··· On Wed, Feb 12, 2014 at 9:47 PM, Etzion Bar-Noy wrote:

Hi. I actually did. I worked very extensively with hammer up until now,
including (nearly) full automation of Foreman deployment. However:

hammer user create --login someuser --firstname some --lastname user
–mail someuser@domain.com --password 123456
Could not create the user:
Error: option ‘–auth-source-id’ is required

hammer user create --login someuser --firstname some --lastname user
–mail someuser@domain.com --password 123456 --auth-source-id INTERNAL
Could not create the user:
Invalid username or password

hammer user create --login someuser --firstname some --lastname user
–mail someuser@domain.com --password 123456 --auth-source-id 1
Could not create the user:
Invalid username or password

I do not know what is auth-source-id and where do I get it. I do not think
the command responds correctly to either value I place there (I have only
internal, built-in admin user currently, and no plans of connecting the
system to ADS or any other LDAP service). Moreover - how do I set the roles
the user should get when it’s created - the ‘hammer user update’ allows
specifying ‘–id’ which is the resource ID. What is the resource ID? Is it
role from the roles menu? Is it something else?

Thanks!
Etzion

On Wednesday, 12 February 2014 08:35:03 UTC+2, ohad wrote:

On Wed, Feb 12, 2014 at 1:31 AM, Etzion Bar-Noy etz...@barnoy.co.ilwrote:

I need to be able to add web users automatically (aka - scripted) via
some sort of CLI or ‘curl’ request. Assuming I need to allow this user only
access to the provisioning module, what should i expect? The current
production.log showing the actual (and working) command, but I am unable to
translate it into the curl commands…

I would appreciate some real example of such an operation. It could be
great.

did you try out our CLI? see http://blog.theforeman.org/
2013/11/hammer-cli-for-foreman-part-i-setup.html

Thanks!
Etzion


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/groups/opt_out.


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/groups/opt_out.


Daniel Lobato

@elobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30

So far, hammer was able to perform actions without asking me for login
details. However, the output I showed is the output I get. I will emphasise
that I use foreman 1.3.2 and RPM build of these tools under it.

Etzion

··· On Thursday, 13 February 2014 13:04:10 UTC+2, Daniel Lobato wrote: > > Hi Etzion, > > --auth-source-id should be 1 in your case, which is 'INTERNAL' (not > connected to LDAP or anything). The last option is right. > > I just tried: "hammer user create --login someuser --firstname some > --lastname user --mail some...@domain.com --password 123456 > --auth-source-id 1", after you type that in, it should ask for your > username and password, then you type your admin username and password and > it should work (it works on my Foreman). > > Updating the roles is a little trickier and I believe hammer can only > update the login, firstname, lastname, email, admin flag, password, and > authentication source. > You can update the roles programatically using the API though, > https://gist.github.com/eLobato/8973253 is the format of the API response > for users, more info here http://theforeman.org/api.html or in IRC > #theforeman-dev #theforeman > > > > On Wed, Feb 12, 2014 at 9:47 PM, Etzion Bar-Noy <etz...@barnoy.co.il > > wrote: > >> Hi. I actually did. I worked very extensively with hammer up until now, >> including (nearly) full automation of Foreman deployment. However: >> >> hammer user create --login someuser --firstname some --lastname user >> --mail some...@domain.com --password 123456 >> Could not create the user: >> Error: option '--auth-source-id' is required >> >> hammer user create --login someuser --firstname some --lastname user >> --mail some...@domain.com --password 123456 >> --auth-source-id INTERNAL >> Could not create the user: >> Invalid username or password >> >> hammer user create --login someuser --firstname some --lastname user >> --mail some...@domain.com --password 123456 >> --auth-source-id 1 >> Could not create the user: >> Invalid username or password >> >> I do not know what is auth-source-id and where do I get it. I do not >> think the command responds correctly to either value I place there (I have >> only internal, built-in admin user currently, and no plans of connecting >> the system to ADS or any other LDAP service). Moreover - how do I set the >> roles the user should get when it's created - the 'hammer user update' >> allows specifying '--id' which is the resource ID. What is the resource ID? >> Is it role from the roles menu? Is it something else? >> >> Thanks! >> Etzion >> >> On Wednesday, 12 February 2014 08:35:03 UTC+2, ohad wrote: >>> >>> >>> >>> >>> On Wed, Feb 12, 2014 at 1:31 AM, Etzion Bar-Noy wrote: >>> >>>> I need to be able to add web users automatically (aka - scripted) via >>>> some sort of CLI or 'curl' request. Assuming I need to allow this user only >>>> access to the provisioning module, what should i expect? The current >>>> production.log showing the actual (and working) command, but I am unable to >>>> translate it into the curl commands... >>>> >>>> I would appreciate some real example of such an operation. It could be >>>> great. >>>> >>> >>> did you try out our CLI? see http://blog.theforeman.org/ >>> 2013/11/hammer-cli-for-foreman-part-i-setup.html >>> >>> >>>> >>>> Thanks! >>>> Etzion >>>> >>>> -- >>>> 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/groups/opt_out. >>>> >>> >>> -- >> 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/groups/opt_out. >> > > > > -- > Daniel Lobato > > @elobatoss > blog.daniellobato.me > daniellobato.me > > GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30 >

Well if you are not being asked for login details and you are getting that
error, it's possible that your login details are wrong. Can you check your
username/pass are correctly set in one of:

/etc/foreman/cli_config.yml.
~/.foreman/cli_config.yml
./config/cli_config.yml

If so, and you're able to run other hammer commands without that error, I'd
recommend updating to the latest hammer-cli and hammer-foreman-cli version.

··· On Thu, Feb 13, 2014 at 12:37 PM, Etzion Bar-Noy wrote:

So far, hammer was able to perform actions without asking me for login
details. However, the output I showed is the output I get. I will emphasise
that I use foreman 1.3.2 and RPM build of these tools under it.

Etzion

On Thursday, 13 February 2014 13:04:10 UTC+2, Daniel Lobato wrote:

Hi Etzion,

–auth-source-id should be 1 in your case, which is ‘INTERNAL’ (not
connected to LDAP or anything). The last option is right.

I just tried: “hammer user create --login someuser --firstname some
–lastname user --mail some...@domain.com --password 123456
–auth-source-id 1”, after you type that in, it should ask for your
username and password, then you type your admin username and password and
it should work (it works on my Foreman).

Updating the roles is a little trickier and I believe hammer can only
update the login, firstname, lastname, email, admin flag, password, and
authentication source.
You can update the roles programatically using the API though,
https://gist.github.com/eLobato/8973253 is the format of the API
response for users, more info here Foreman or in
IRC #theforeman-dev #theforeman

On Wed, Feb 12, 2014 at 9:47 PM, Etzion Bar-Noy etz...@barnoy.co.ilwrote:

Hi. I actually did. I worked very extensively with hammer up until now,
including (nearly) full automation of Foreman deployment. However:

hammer user create --login someuser --firstname some --lastname user
–mail some...@domain.com --password 123456

Could not create the user:
Error: option ‘–auth-source-id’ is required

hammer user create --login someuser --firstname some --lastname user
–mail some...@domain.com --password 123456 --auth-source-id INTERNAL

Could not create the user:
Invalid username or password

hammer user create --login someuser --firstname some --lastname user
–mail some...@domain.com --password 123456 --auth-source-id 1

Could not create the user:
Invalid username or password

I do not know what is auth-source-id and where do I get it. I do not
think the command responds correctly to either value I place there (I have
only internal, built-in admin user currently, and no plans of connecting
the system to ADS or any other LDAP service). Moreover - how do I set the
roles the user should get when it’s created - the 'hammer user update’
allows specifying ‘–id’ which is the resource ID. What is the resource ID?
Is it role from the roles menu? Is it something else?

Thanks!
Etzion

On Wednesday, 12 February 2014 08:35:03 UTC+2, ohad wrote:

On Wed, Feb 12, 2014 at 1:31 AM, Etzion Bar-Noy etz...@barnoy.co.ilwrote:

I need to be able to add web users automatically (aka - scripted) via
some sort of CLI or ‘curl’ request. Assuming I need to allow this user only
access to the provisioning module, what should i expect? The current
production.log showing the actual (and working) command, but I am unable to
translate it into the curl commands…

I would appreciate some real example of such an operation. It could be
great.

did you try out our CLI? see http://blog.theforeman.org/201
3/11/hammer-cli-for-foreman-part-i-setup.html

Thanks!
Etzion


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/groups/opt_out.


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/groups/opt_out.


Daniel Lobato

@elobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30


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/groups/opt_out.


Daniel Lobato

@elobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30

Other hammer commands work flawlessly, without asking for credentials.
Assuming there is no newer RPM available for hammer. What are the other
methods of installing them?

The culprit is I am required to deliver the system (and its likes), as a
fully automated deployment. I need to be able to download hammer files so
that later I would be able to install it without Internet connection
whatsoever. How should I approach to it?

Etzion

··· On Thursday, 13 February 2014 13:49:08 UTC+2, Daniel Lobato wrote: > > Well if you are not being asked for login details and you are getting that > error, it's possible that your login details are wrong. Can you check your > username/pass are correctly set in one of: > > /etc/foreman/cli_config.yml. > ~/.foreman/cli_config.yml > ./config/cli_config.yml > > If so, and you're able to run other hammer commands without that error, > I'd recommend updating to the latest hammer-cli and hammer-foreman-cli > version. > > > On Thu, Feb 13, 2014 at 12:37 PM, Etzion Bar-Noy <etz...@barnoy.co.il > > wrote: > >> So far, hammer was able to perform actions without asking me for login >> details. However, the output I showed is the output I get. I will emphasise >> that I use foreman 1.3.2 and RPM build of these tools under it. >> >> Etzion >> >> >> On Thursday, 13 February 2014 13:04:10 UTC+2, Daniel Lobato wrote: >> >>> Hi Etzion, >>> >>> --auth-source-id should be 1 in your case, which is 'INTERNAL' (not >>> connected to LDAP or anything). The last option is right. >>> >>> I just tried: "hammer user create --login someuser --firstname some >>> --lastname user --mail some...@domain.com --password 123456 >>> --auth-source-id 1", after you type that in, it should ask for your >>> username and password, then you type your admin username and password and >>> it should work (it works on my Foreman). >>> >>> Updating the roles is a little trickier and I believe hammer can only >>> update the login, firstname, lastname, email, admin flag, password, and >>> authentication source. >>> You can update the roles programatically using the API though, >>> https://gist.github.com/eLobato/8973253 is the format of the API >>> response for users, more info here http://theforeman.org/api.html or in >>> IRC #theforeman-dev #theforeman >>> >>> >>> >>> On Wed, Feb 12, 2014 at 9:47 PM, Etzion Bar-Noy wrote: >>> >>>> Hi. I actually did. I worked very extensively with hammer up until now, >>>> including (nearly) full automation of Foreman deployment. However: >>>> >>>> hammer user create --login someuser --firstname some --lastname user >>>> --mail some...@domain.com --password 123456 >>>> >>>> Could not create the user: >>>> Error: option '--auth-source-id' is required >>>> >>>> hammer user create --login someuser --firstname some --lastname user >>>> --mail some...@domain.com --password 123456 --auth-source-id INTERNAL >>>> >>>> Could not create the user: >>>> Invalid username or password >>>> >>>> hammer user create --login someuser --firstname some --lastname user >>>> --mail some...@domain.com --password 123456 --auth-source-id 1 >>>> >>>> Could not create the user: >>>> Invalid username or password >>>> >>>> I do not know what is auth-source-id and where do I get it. I do not >>>> think the command responds correctly to either value I place there (I have >>>> only internal, built-in admin user currently, and no plans of connecting >>>> the system to ADS or any other LDAP service). Moreover - how do I set the >>>> roles the user should get when it's created - the 'hammer user update' >>>> allows specifying '--id' which is the resource ID. What is the resource ID? >>>> Is it role from the roles menu? Is it something else? >>>> >>>> Thanks! >>>> Etzion >>>> >>>> On Wednesday, 12 February 2014 08:35:03 UTC+2, ohad wrote: >>>>> >>>>> >>>>> >>>>> >>>>> On Wed, Feb 12, 2014 at 1:31 AM, Etzion Bar-Noy wrote: >>>>> >>>>>> I need to be able to add web users automatically (aka - scripted) via >>>>>> some sort of CLI or 'curl' request. Assuming I need to allow this user only >>>>>> access to the provisioning module, what should i expect? The current >>>>>> production.log showing the actual (and working) command, but I am unable to >>>>>> translate it into the curl commands... >>>>>> >>>>>> I would appreciate some real example of such an operation. It could >>>>>> be great. >>>>>> >>>>> >>>>> did you try out our CLI? see http://blog.theforeman.org/201 >>>>> 3/11/hammer-cli-for-foreman-part-i-setup.html >>>>> >>>>> >>>>>> >>>>>> Thanks! >>>>>> Etzion >>>>>> >>>>>> -- >>>>>> 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/groups/opt_out. >>>>>> >>>>> >>>>> -- >>>> 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/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> Daniel Lobato >>> >>> @elobatoss >>> blog.daniellobato.me >>> daniellobato.me >>> >>> GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30 >>> >> -- >> 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/groups/opt_out. >> > > > > -- > Daniel Lobato > > @elobatoss > blog.daniellobato.me > daniellobato.me > > GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30 >

I will have to test it. I attempted to upgrade (in my process, not an
upgrade process per-se) theForeman to version 1.4, and found several
incompatibilities which make this process a hard one. Can I use raw API
commands to work around it? I find the API a little too complex for me, not
being a developer, and would love to have a CURL string which will perform
the little task I brought up initially.

Thanks
Etzion

··· On Thursday, 13 February 2014 14:02:15 UTC+2, Dominic Cleal wrote: > > On 13/02/14 11:58, Etzion Bar-Noy wrote: > > Other hammer commands work flawlessly, without asking for credentials. > > Assuming there is no newer RPM available for hammer. What are the other > > methods of installing them? > > > > The culprit is I am required to deliver the system (and its likes), as a > > fully automated deployment. I need to be able to download hammer files > > so that later I would be able to install it without Internet connection > > whatsoever. How should I approach to it? > > Looks like you're hitting http://projects.theforeman.org/issues/3948, > which was fixed in Foreman 1.4.0. > > The newer version of Hammer is available in the Foreman 1.4 repos, so > you could try it, but my understanding is that it's made to work with > Foreman 1.4 and not 1.3. I'm aware of a couple of areas that it might > be incompatible with 1.3 in. Generally I'd suggest updating both > Foreman and Hammer together. > > -- > Dominic Cleal > Red Hat Engineering >

Looks like you're hitting Bug #3948: Cant update user data - Hammer CLI - Foreman,
which was fixed in Foreman 1.4.0.

The newer version of Hammer is available in the Foreman 1.4 repos, so
you could try it, but my understanding is that it's made to work with
Foreman 1.4 and not 1.3. I'm aware of a couple of areas that it might
be incompatible with 1.3 in. Generally I'd suggest updating both
Foreman and Hammer together.

··· On 13/02/14 11:58, Etzion Bar-Noy wrote: > Other hammer commands work flawlessly, without asking for credentials. > Assuming there is no newer RPM available for hammer. What are the other > methods of installing them? > > The culprit is I am required to deliver the system (and its likes), as a > fully automated deployment. I need to be able to download hammer files > so that later I would be able to install it without Internet connection > whatsoever. How should I approach to it?


Dominic Cleal
Red Hat Engineering

Yes indeed, ask away about the API.

Here's the description Foreman

··· On Thu, Feb 13, 2014 at 3:06 PM, Etzion Bar-Noy wrote:

I will have to test it. I attempted to upgrade (in my process, not an
upgrade process per-se) theForeman to version 1.4, and found several
incompatibilities which make this process a hard one. Can I use raw API
commands to work around it? I find the API a little too complex for me, not
being a developer, and would love to have a CURL string which will perform
the little task I brought up initially.

Thanks
Etzion

On Thursday, 13 February 2014 14:02:15 UTC+2, Dominic Cleal wrote:

On 13/02/14 11:58, Etzion Bar-Noy wrote:

Other hammer commands work flawlessly, without asking for credentials.
Assuming there is no newer RPM available for hammer. What are the other
methods of installing them?

The culprit is I am required to deliver the system (and its likes), as
a
fully automated deployment. I need to be able to download hammer files
so that later I would be able to install it without Internet connection
whatsoever. How should I approach to it?

Looks like you’re hitting Bug #3948: Cant update user data - Hammer CLI - Foreman,
which was fixed in Foreman 1.4.0.

The newer version of Hammer is available in the Foreman 1.4 repos, so
you could try it, but my understanding is that it’s made to work with
Foreman 1.4 and not 1.3. I’m aware of a couple of areas that it might
be incompatible with 1.3 in. Generally I’d suggest updating both
Foreman and Hammer together.


Dominic Cleal
Red Hat Engineering


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/groups/opt_out.


Daniel Lobato

@elobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30

Hi.
I was able to do so with a nightly build of hammer (only this package:
rubygem-hammer_cli-0.0.18-1.el6.noarch.rpm<http://yum.theforeman.org/nightly/el6/x86_64/rubygem-hammer_cli-0.0.18-1.el6.noarch.rpm>
from here: http://yum.theforeman.org/nightly/el6/x86_64/ ), however, this
package is broken in other aspects. So - I need to upgrade to this package
after most of my automation takes place. Then I can run the command:
hammer user create --login someuser --password "somepassword" --mail
user@localhost.com --auth-source-id 1

Then I can assign roles using the API in the following manner:
curl -k -u admin:changeme -H "Content-Type:application/json" -H
"Accept:application/json,version=2" -X PUT -d
"{&quot;user&quot;:{&quot;id&quot;:&quot;2&quot;,&quot;role_ids&quot;:[&quot;&quot;,&quot;&quot;,&quot;1&quot;,&quot;4&quot;,&quot;5&quot;]}}"
https://foreman.mgmt/api/users/2-someuser | prettify_json.rb

Thanks. Not perfect, but I sure can use it now.

Etzion

··· On Friday, 14 February 2014 01:17:37 UTC+2, Daniel Lobato wrote: > > Yes indeed, ask away about the API. > > Here's the description http://theforeman.org/api.html > > > On Thu, Feb 13, 2014 at 3:06 PM, Etzion Bar-Noy <etz...@barnoy.co.il > > wrote: > >> I will have to test it. I attempted to upgrade (in my process, not an >> upgrade process per-se) theForeman to version 1.4, and found several >> incompatibilities which make this process a hard one. Can I use raw API >> commands to work around it? I find the API a little too complex for me, not >> being a developer, and would love to have a CURL string which will perform >> the little task I brought up initially. >> >> Thanks >> Etzion >> >> >> On Thursday, 13 February 2014 14:02:15 UTC+2, Dominic Cleal wrote: >>> >>> On 13/02/14 11:58, Etzion Bar-Noy wrote: >>> > Other hammer commands work flawlessly, without asking for credentials. >>> > Assuming there is no newer RPM available for hammer. What are the >>> other >>> > methods of installing them? >>> > >>> > The culprit is I am required to deliver the system (and its likes), as >>> a >>> > fully automated deployment. I need to be able to download hammer files >>> > so that later I would be able to install it without Internet >>> connection >>> > whatsoever. How should I approach to it? >>> >>> Looks like you're hitting http://projects.theforeman.org/issues/3948, >>> which was fixed in Foreman 1.4.0. >>> >>> The newer version of Hammer is available in the Foreman 1.4 repos, so >>> you could try it, but my understanding is that it's made to work with >>> Foreman 1.4 and not 1.3. I'm aware of a couple of areas that it might >>> be incompatible with 1.3 in. Generally I'd suggest updating both >>> Foreman and Hammer together. >>> >>> -- >>> Dominic Cleal >>> Red Hat Engineering >>> >> -- >> 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/groups/opt_out. >> > > > > -- > Daniel Lobato > > @elobatoss > blog.daniellobato.me > daniellobato.me > > GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30 >