Foreman 1.7.4 + salt 2014.7.5: undefined method `merge' for nil:NilClass

2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod ][ERROR
] Command '/usr/bin/foreman-node testvm.xxxx.com' failed with return
code: 1
2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod ][ERROR
] output: Could not get grains: undefined method `merge' for nil:NilClass
2015-04-29 15:12:43,176 [salt.loaded.int.pillar.puppet
][CRITICAL] YAML data from /usr/bin/foreman-node failed to parse

I am not seeing grains in foreman, nor do I see salt states. Salt states
are not applied to builds, but 'run salt' highstate does work on
provisioned systems.

> 2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod ][ERROR
> ] Command '/usr/bin/foreman-node testvm.xxxx.com' failed with return
> code: 1
> 2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod ][ERROR
> ] output: Could not get grains: undefined method `merge' for nil:NilClass
> 2015-04-29 15:12:43,176 [salt.loaded.int.pillar.puppet
> ][CRITICAL] YAML data from /usr/bin/foreman-node failed to parse
>
> I am not seeing grains in foreman, nor do I see salt states. Salt states
> are not applied to builds, but 'run salt' highstate does work on
> provisioned systems.

You have to add the states manually to Foreman, we don't import them
yet (Feature #8473: Import list of Salt environments and States from the Master - Salt - Foreman).

Can you run '/usr/bin/foreman-node testvm.xxxx.com' on the salt master? What is
returned? I'd guess it's not returning YAML it sounds like your
/etc/salt/foreman.yaml is misconfigured (see:
Foreman :: Plugin Manuals). You can
also check /var/log/foreman/production.log.

Also does the testvm.xxxx.com minion return grains if you do this?
salt 'testvm.xxxx.com' grains.items

  • Stephen
··· On Thu, Apr 30, 2015 at 02:29:47PM -0700, Brian Williams 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.

Thanks - I upgraded to Foreman 1.8 - latest and salt 2014.7.5, now I see
this in salt logs.

2015-05-14 15:23:45,410 [salt.loaded.int.module.cmdmod ][ERROR
] Command '/usr/bin/foreman-node testvm01.xxxx.com' failed with retu
rn code: 1
2015-05-14 15:23:45,411 [salt.loaded.int.module.cmdmod ][ERROR
] output: Could not get grains: undefined method `merge' for nil:Nil
Class
2015-05-14 15:23:45,412 [salt.loaded.int.pillar.puppet
][CRITICAL] YAML data from /usr/bin/foreman-node failed to parse
[root@ntpforeman salt]# /usr/bin/foreman-node testvm01.xxxx.com

··· --- classes: - vim parameters: puppetmaster: ntpforeman.xxxx.com hostgroup: NTP root_pw: $1$7S7go7WC$aA3yLRp/FRJfDBp9/e0Ub. puppet_ca: ntpforeman.xxxx.com foreman_env: development owner_name: Admin User owner_email: root@xxxx.com foreman_subnets: - network: 10.137.244.0 mask: 255.255.252.0 name: 10.137.244.0 vlanid: '' gateway: 10.137.247.254 dns_primary: '' dns_secondary: '' from: '' to: '' boot_mode: Static ipam: None foreman_interfaces: - mac: 00:0c:29:91:36:50 ip: 10.137.247.246 type: Interface name: testvm01.xxxx.com attrs: network: 10.137.244.0 netmask: 255.255.252.0 mtu: '1500' virtual: false link: true identifier: eth0 managed: true primary: true provision: true subnet: network: 10.137.244.0 mask: 255.255.252.0 name: 10.137.244.0 vlanid: '' gateway: 10.137.247.254 dns_primary: '' dns_secondary: '' from: '' to: '' boot_mode: Static ipam: None salt_master: ntpforeman.xxxx.com

I imported a salt state - ‘vim’ successfully in foreman. Yet it is not
being applied, and I am not seeing salt states when provisioining thru
foreman-discovery. Even though I choose salt master, and environment, the
salt states tab asks me to specify and environment.

Any thoughts?

Thanks

On Sunday, May 3, 2015 at 4:27:03 PM UTC-5, Stephen Benjamin wrote:

On Thu, Apr 30, 2015 at 02:29:47PM -0700, Brian Williams wrote:

2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod
][ERROR
] Command ‘/usr/bin/foreman-node testvm.xxxx.com’ failed with return
code: 1
2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod
][ERROR
] output: Could not get grains: undefined method `merge’ for
nil:NilClass
2015-04-29 15:12:43,176 [salt.loaded.int.pillar.puppet
][CRITICAL] YAML data from /usr/bin/foreman-node failed to parse

I am not seeing grains in foreman, nor do I see salt states. Salt states
are not applied to builds, but ‘run salt’ highstate does work on
provisioned systems.

You have to add the states manually to Foreman, we don’t import them
yet (Feature #8473: Import list of Salt environments and States from the Master - Salt - Foreman).

Can you run ‘/usr/bin/foreman-node testvm.xxxx.com’ on the salt master?
What is
returned? I’d guess it’s not returning YAML it sounds like your
/etc/salt/foreman.yaml is misconfigured (see:
Foreman :: Plugin Manuals). You can
also check /var/log/foreman/production.log.

Also does the testvm.xxxx.com minion return grains if you do this?
salt ‘testvm.xxxx.com’ grains.items

  • Stephen


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.

> From: "Brian Williams" <brianrwlms@gmail.com>
> To: foreman-users@googlegroups.com
> Cc: stephen@redhat.com
> Sent: Thursday, May 14, 2015 11:15:36 PM
> Subject: Re: [foreman-users] Foreman 1.8 + salt 2014.7.5: undefined method merge&#39; for nil:NilClass (updated) &gt; &gt; Thanks - I upgraded to Foreman 1.8 - latest and salt 2014.7.5, now I see &gt; this in salt logs. &gt; &gt; 2015-05-14 15:23:45,410 [salt.loaded.int.module.cmdmod ][ERROR &gt; ] Command &#39;/usr/bin/foreman-node testvm01.xxxx.com&#39; failed with retu &gt; rn code: 1 &gt; 2015-05-14 15:23:45,411 [salt.loaded.int.module.cmdmod ][ERROR &gt; ] output: Could not get grains: undefined methodmerge' for nil:Nil
> Class

You might see this if the minion has no cached grains, have you ever
used the minion before? It should go away when you run salt &lt;hostname&gt; grains.items.

> 2015-05-14 15:23:45,412 [salt.loaded.int.pillar.puppet
> ][CRITICAL] YAML data from /usr/bin/foreman-node failed to parse
> [root@ntpforeman salt]# /usr/bin/foreman-node testvm01.xxxx.com
> —
> classes:
> - vim
> parameters:
> puppetmaster: ntpforeman.xxxx.com
> hostgroup: NTP
> root_pw: $1$7S7go7WC$aA3yLRp/FRJfDBp9/e0Ub.
> puppet_ca: ntpforeman.xxxx.com
> foreman_env: development
> owner_name: Admin User
> owner_email: root@xxxx.com
> foreman_subnets:
> - network: 10.137.244.0
> mask: 255.255.252.0
> name: 10.137.244.0
> vlanid: ''
> gateway: 10.137.247.254
> dns_primary: ''
> dns_secondary: ''
> from: ''
> to: ''
> boot_mode: Static
> ipam: None
> foreman_interfaces:
> - mac: 00:0c:29:91:36:50
> ip: 10.137.247.246
> type: Interface
> name: testvm01.xxxx.com
> attrs:
> network: 10.137.244.0
> netmask: 255.255.252.0
> mtu: '1500'
> virtual: false
> link: true
> identifier: eth0
> managed: true
> primary: true
> provision: true
> subnet:
> network: 10.137.244.0
> mask: 255.255.252.0
> name: 10.137.244.0
> vlanid: ''
> gateway: 10.137.247.254
> dns_primary: ''
> dns_secondary: ''
> from: ''
> to: ''
> boot_mode: Static
> ipam: None
> salt_master: ntpforeman.xxxx.com

Is this really the output of the command? It doesn't look right, environment is missing, and
salt_master shouldn't be at that indentation level.

> I imported a salt state - 'vim' successfully in foreman. Yet it is not
> being applied

Have you have you configured /etc/salt/master? It has this?

master_tops:
ext_nodes: /usr/bin/foreman-node

The missing environment output from foreman-node could be the source of the problems, but assuming
foreman-node returns the right output, not sure why Salt wouldn't do the right thing.

What happens if you run: salt -v <hostname> state.highstate?

> and I am not seeing salt states when provisioining thru
> foreman-discovery. Even though I choose salt master, and environment, the
> salt states tab asks me to specify and environment.

Could you file a bug? Foreman

I had a quick look and it seems like it might be easy to fix so it works with discovery.

Thanks

··· ----- Original Message -----

Any thoughts?

Thanks

On Sunday, May 3, 2015 at 4:27:03 PM UTC-5, Stephen Benjamin wrote:

On Thu, Apr 30, 2015 at 02:29:47PM -0700, Brian Williams wrote:

2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod
][ERROR
] Command ‘/usr/bin/foreman-node testvm.xxxx.com’ failed with return
code: 1
2015-04-29 15:12:43,175 [salt.loaded.int.module.cmdmod
][ERROR
] output: Could not get grains: undefined method `merge’ for
nil:NilClass
2015-04-29 15:12:43,176 [salt.loaded.int.pillar.puppet
][CRITICAL] YAML data from /usr/bin/foreman-node failed to parse

I am not seeing grains in foreman, nor do I see salt states. Salt states
are not applied to builds, but ‘run salt’ highstate does work on
provisioned systems.

You have to add the states manually to Foreman, we don’t import them
yet (Feature #8473: Import list of Salt environments and States from the Master - Salt - Foreman).

Can you run ‘/usr/bin/foreman-node testvm.xxxx.com’ on the salt master?
What is
returned? I’d guess it’s not returning YAML it sounds like your
/etc/salt/foreman.yaml is misconfigured (see:
Foreman :: Plugin Manuals). You can
also check /var/log/foreman/production.log.

Also does the testvm.xxxx.com minion return grains if you do this?
salt ‘testvm.xxxx.com’ grains.items

  • Stephen


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 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.