/usr/bin/foreman-node - must provide minion as an argument

Problem: /usr/bin/foreman-node:175:in `’: Must provide minion as an argument (RuntimeError)

If i am running highstate from foreman - the associated states will not be executed on salt-minion. cause the script foreman-node exits with error 1

All other things that are defined in env by top.sls will be executed without problems.

Expected outcome: highstate with associated states from foreman-ui

Foreman and Proxy versions: 2.4.1

Foreman and Proxy plugin versions:
Foreman
Version
2.41

Dynflow
Version
0.3.0

Registration
Version
2.4.1

SSH
Version
0.3.1

Salt
Version
3.1.2

Distribution and version: Ubuntu 18.04

Other relevant data: Salt 3003

Dear Community,

if a highstate will be initiated from Foreman - i receive following error:

/var/log/syslog:

/usr/bin/foreman-node:175:in `’: Must provide minion as an argument (RuntimeError)

ERROR ] Top function ext_nodes failed with error Command ‘[’/usr/bin/foreman-node’, ‘minion01.bla.ba’]’ returned non-zero exit status 1. for minion minion01.bla.ba

/var/log/foreman-proxy/proxy.log
Will run state.highstate for minion01.bla.ba Full command: /usr/bin/sudo -u root /usr/bin/salt --async minion01.bla.ba state.highstate
2021-06-28T17:55:18 08726a9c [I] Result: Executed command with job ID: 20210628155518016876

Best regards, Alex

Does the command work if you run “foreman-node minion01.bla.bla” on the foreman/smart-proxy manually?

1 Like

Hi Bernhard,

yes, the command is working. if i am right, classes should be recognized by foreman-node to build the highstate in addition to top.sls?


classes:

  • states.ntp
  • states.users
    parameters:
    hostname: test
    fqdn: test.bla.ba
    hostgroup: Test
    comment: Testmachine
    foreman_subnets:
    • name: test.test
      network: 200.200.200.0
      mask: 255.255.255.0
      gateway: ‘’
      dns_primary: ‘’
      dns_secondary: ‘’

what do you mean by classes? the sequence you shared looks like grains.

i mean states, in the report output script it’s defined as classes.

classes:
- states.certs
- states.certs.ca-certs
- states.certs.certs
- states.certs.package
- states.logrotate
- states.knownhosts
- states.motd
- states.needrestart
- states.ntp
- states.rsyslog
- states.sudo
- states.users
- states.vimrc-root

i recognized - that my saltuser is unable to call the /usr/bin/foreman-node.

saltuser@foreman01:/root$ /usr/bin/foreman-node [foreman01.bla.bla](http://foreman01.bla.bla/)
Could not get grains: 765: unexpected token at ''
Couldn't retrieve ENC data: Could not send facts to Foreman: exit

root got no problems to execute the foreman-node.

did a new install with debian and guess what? same result. actually i am lost with foreman and the saltplugin. perhaps you got a hint for me?

2021-07-16 16:32:09,559 [salt.daemons.masterapi:529 ][ERROR ][39149] Top function ext_nodes failed with error Command '['/usr/bin/foreman-node', 'foreman01.uuxoi.local']' returned non-zero exit status 1. for minion foreman01.uuxoi.local

executing foreman-node with root:

root@foreman01:~# /usr/bin/foreman-node foreman01.uuxoi.local
---
classes:
- states.logrotate
- states.motd
- states.ntp
parameters:
  hostname: foreman01
  fqdn: foreman01.uuxoi.local
  foreman_subnets: []
  foreman_interfaces:
  - ip: 192.168.0.30
    ip6: 
    mac: 00:0c:29:06:f9:c0
    name: foreman01.uuxoi.local
    attrs: {}

with saltuser:

saltuser@foreman01:/root$ /usr/bin/foreman-node foreman01.uuxoi.local
Could not get grains: 765: unexpected token at ''
Couldn't retrieve ENC data: Could not send facts to Foreman: exit

Foreman Output:

Best regards, Alex

Okay, i reverted to salt 2018 - now the logs are looking good for me.

3003-DS.1 seems to be Problem, are there any experience about newer version of salt in combination with foreman?