Provisioned machine not booted automatically

I am having some issues provisioning hosts through foreman REST API (more
exactly using foreman-python). Once the host is created it does not boot
automatically, I need to send the start command. This workaround works with
provision_method=build, but with provision_method=image it doesn't because
the POST host doesn't return after the host is created, instead the
following error is received:
Failed to login via SSH to client07072015130432.lab.primarydata.com:
execution expired
Is there some flag I'm missing that will indicate to immediately boot the
host after creation?

> I am having some issues provisioning hosts through foreman REST API (more
> exactly using foreman-python). Once the host is created it does not boot
> automatically, I need to send the start command. This workaround works with
> provision_method=build, but with provision_method=image it doesn't because
> the POST host doesn't return after the host is created, instead the
> following error is received:
> Failed to login via SSH to client07072015130432.lab.primarydata.com:
> execution expired
> Is there some flag I'm missing that will indicate to immediately boot the
> host after creation?
I don't think there's any flag, the host should boot automatically.

Could you give us some logs (/var/log/foreman/production.log) to see
what happens when you send this POST request?

Best,

··· On 07/07, AG wrote: > > -- > 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

> Is there some flag I'm missing that will indicate to immediately boot the
> host after creation?

You must provide "boot": "true" otherwise we default to false. Reported
a bug:

http://projects.theforeman.org/issues/11099

Example JSON:

{
"host": {
"name": "hostapi1",
"build": "true",
"environment_id": "1",
"domain_id": "1",
"ip": "192.168.122.1",
"mac": "52:53:00:aa:bb:cc",
"ptable_id": "55",
"medium_id": "8",
"architecture_id": "1",
"operatingsystem_id": "1",
"root_pass": "changeme",
"location_id": "1",
"organization_id": "1"
}
}

··· -- Later, Lukas #lzap Zapletal

> Is there some flag I'm missing that will indicate to immediately boot the
> host after creation?

What kind of hypervisor is this one?

··· -- Later, Lukas #lzap Zapletal

2015-07-07 10:57:17 [I] About to start post launch script on
client07072015130432

2015-07-07 10:57:17 [I] Completed 200 OK in 970ms (Views: 832.3ms |
ActiveRecord: 77.8ms)

2015-07-07 10:57:18 [I] generating template to upload to
client07072015130432

2015-07-07 10:57:18 [I] Starting SSH provisioning script

2015-07-07 11:03:18 [W] Failed to login via SSH to client07072015130432:
execution expired/opt/rh/ruby193/root/usr/share/gems/gems/net-ssh-2.6.7/lib/
net/ssh/transport/session.rb:67:i

n `initialize'

/opt/rh/ruby193/root/usr/share/gems/gems/net-ssh-2.6.7/lib/net/ssh/transport/session.rb:67:in
`open'

/opt/rh/ruby193/root/usr/share/gems/gems/net-ssh-2.6.7/lib/net/ssh/transport/session.rb:67:in
`block in initialize'

/opt/rh/ruby193/root/usr/share/ruby/timeout.rb:69:in `timeout'

/opt/rh/ruby193/root/usr/share/ruby/timeout.rb:100:in `timeout'

/opt/rh/ruby193/root/usr/share/gems/gems/net-ssh-2.6.7/lib/net/ssh/transport/session.rb:67:in
`initialize'

/opt/rh/ruby193/root/usr/share/gems/gems/net-ssh-2.6.7/lib/net/ssh.rb:192:in `new'

/opt/rh/ruby193/root/usr/share/gems/gems/net-ssh-2.6.7/lib/net/ssh.rb:192:in
`start'

/opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.29.0/lib/fog/core/ssh.rb:63:in
`run'

/usr/share/foreman/app/services/foreman/provision/ssh.rb:83:in `block (2
levels) in initiate_connection!'

/opt/rh/ruby193/root/usr/share/ruby/timeout.rb:69:in `timeout'

/usr/share/foreman/app/services/foreman/provision/ssh.rb:82:in `block in
initiate_connection!'

/usr/share/foreman/app/services/foreman/provision/ssh.rb:80:in `initiate_connection!'

/usr/share/foreman/app/services/foreman/provision/ssh.rb:21:in `initialize'

/usr/share/foreman/app/models/concerns/orchestration/ssh_provision.rb:55:in
`new'

/usr/share/foreman/app/models/concerns/orchestration/ssh_provision.rb:55:in `setSSHWaitForResponse'

/usr/share/foreman/app/models/concerns/orchestration.rb:141:in `execute'

/usr/share/foreman/app/models/concerns/orchestration.rb:86:in `block in
process'

/usr/share/foreman/app/models/concerns/orchestration.rb:78:in `each'

/usr/share/foreman/app/models/concerns/orchestration.rb:78:in `process'

/usr/share/foreman/app/models/concerns/orchestration.rb:23:in `post_commit'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/
active_support/callbacks.rb:405:in `_run__3891664409900489917__commit__3907139994587051005__callbacks'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
`__run_callback'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_commit_callbacks'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/
active_support/callbacks.rb:81:in `run_callbacks'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:263:in
`committed!'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:372:in
`block in commit_transaction_records'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/
active_record/connection_adapters/abstract/database_statements.rb:370:in `each'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:370:in
`commit_transaction_records'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:218:in
`transaction'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/
active_record/transactions.rb:208:in `transaction'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in
`with_transaction_returning_status'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
`block in save'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/
active_record/transactions.rb:252:in `rollback_active_record_state!'

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:in
`save'

/usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in `save_with_type'

/usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:87:in `create'

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in
`send_action'

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in
`process_action'

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/
action_controller/metal/rendering.rb:10:in `process_action'

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in
`block in process_action'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:562:in
`block (5 levels) in
_run__1158342753634146888__process_action__3897775485187017792__callbacks'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/
active_support/callbacks.rb:215:in `block in
_conditional_callback_around_7499'

/usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in `
disable_json_root'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
`_conditional_callback_around_7499'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/
active_support/callbacks.rb:539:in `block (4 levels) in
_run__1158342753634146888__process_action__3897775485187017792__callbacks'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
`block in _conditional_callback_around_7498'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:in
`around'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/
active_support/callbacks.rb:310:in `_callback_around_2287'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
`_conditional_callback_around_7498'

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:516:in
`block (3 levels) in
_run__1158342753634146888__process_action__3897775485187017792__callbacks'

2015-07-07 11:03:18 [W] Rolling back due to a problem: [Wait for
client07072015130432 to come online 2001 failed

I have added part of the exception stack trace, please let me know if you
need more info
Thanks

··· On Tuesday, July 7, 2015 at 3:46:08 PM UTC+3, Daniel Lobato wrote: > > On 07/07, AG wrote: > > I am having some issues provisioning hosts through foreman REST API > (more > > exactly using foreman-python). Once the host is created it does not boot > > automatically, I need to send the start command. This workaround works > with > > provision_method=build, but with provision_method=image it doesn't > because > > the POST host doesn't return after the host is created, instead the > > following error is received: > > Failed to login via SSH to client07072015130432.lab.primarydata.com: > > execution expired > > Is there some flag I'm missing that will indicate to immediately boot > the > > host after creation? > I don't think there's any flag, the host should boot automatically. > > Could you give us some logs (/var/log/foreman/production.log) to see > what happens when you send this POST request? > > Best, > > > > -- > > 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 >

Do you mean hosts/power? If not, there is not boot attribute, getting this
error if I add boot to the input json:
"error": {"message":"unknown attribute: boot"}

··· On Mon, Jul 13, 2015 at 1:30 PM, Lukas Zapletal wrote:

Is there some flag I’m missing that will indicate to immediately boot the
host after creation?

You must provide “boot”: “true” otherwise we default to false. Reported
a bug:

Bug #11099: Build mode not set by default for new hosts via API - Foreman

Example JSON:

{
“host”: {
“name”: “hostapi1”,
“build”: “true”,
“environment_id”: “1”,
“domain_id”: “1”,
“ip”: “192.168.122.1”,
“mac”: “52:53:00:aa:bb:cc”,
“ptable_id”: “55”,
“medium_id”: “8”,
“architecture_id”: “1”,
“operatingsystem_id”: “1”,
“root_pass”: “changeme”,
“location_id”: “1”,
“organization_id”: “1”
}
}


Later,
Lukas #lzap Zapletal


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/YO6obzkdmVk/unsubscribe.
To unsubscribe from this group and all its topics, 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.


Best Regards
Adrian Ghidalovici
Automation and Infrastructure Engineer

We are working with vmware vsphere

··· On Mon, Jul 13, 2015 at 4:33 PM, Lukas Zapletal wrote:

Is there some flag I’m missing that will indicate to immediately boot the
host after creation?

What kind of hypervisor is this one?


Later,
Lukas #lzap Zapletal


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/YO6obzkdmVk/unsubscribe.
To unsubscribe from this group and all its topics, 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.


Best Regards
Adrian Ghidalovici
Automation and Infrastructure Engineer

Sorry I mean "build", that was a typo:

··· > > "build": "true",


Later,
Lukas #lzap Zapletal

Thanks Lukas, build was always set, but it doesn't influence booting
behaviour.

··· On Mon, Jul 13, 2015 at 4:16 PM, Lukas Zapletal wrote:

Sorry I mean “build”, that was a typo:

"build": "true",


Later,
Lukas #lzap Zapletal


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/YO6obzkdmVk/unsubscribe.
To unsubscribe from this group and all its topics, 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.


Best Regards
Adrian Ghidalovici
Automation and Infrastructure Engineer