How do I get a run that does nothing to not 'ERROR: Minions returned with non-zero exit code'

1,495 views
Skip to first unread message

dean.s...@eduserv.org.uk

unread,
Aug 11, 2016, 6:33:30 AM8/11/16
to Salt-users
Hi,

If I run a salt cmd  where the states don't run because there is a jinja check for pillar data then I get an Error:

sysctl]# salt <id>  state.sls <state> test=True
jid: 20160811103841702116
<id>:

Summary
-----------
Succeeded: 0
Failed:   0
-----------
Total states run:    0
ERROR: Minions returned with non-zero exit code

If I add a placeholder state that always runs then the there is no error

Is there a config entry that changes this behaviour or has it been changed in later versions?

This is running 2015.5.5 on both master and minion

Best Regards

Andrew Klopper

unread,
Aug 11, 2016, 6:38:59 AM8/11/16
to salt-...@googlegroups.com

Hi

 

Coincidently, I happened across this in the documentation yesterday:

 

salt.states.test.nop(name**kwargs)

A no-op state that does nothing. Useful in conjunction with the use requisite, or in templates which could otherwise be empty due to jinja rendering

New in version 2015.8.1.

 

It does seem as if your approach of having a placeholder state is the way this is supposed to be addressed. Unfortunately, test.nop would appear to not be available in your version.

 

Regards

Andrew

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Klopper

unread,
Aug 11, 2016, 6:40:13 AM8/11/16
to salt-...@googlegroups.com

Hi

 

It seems that test.nop is just an alias to this, which is available in your version:

 

salt.states.test.succeed_without_changes(name)

Returns successful.

New in version 2014.7.0.

name

A unique string.

 

Regards

Andrew

 

From: salt-...@googlegroups.com [mailto:salt-...@googlegroups.com] On Behalf Of dean.s...@eduserv.org.uk


Sent: 11 August 2016 12:34 PM
To: Salt-users <salt-...@googlegroups.com>

--

dean.s...@eduserv.org.uk

unread,
Aug 11, 2016, 8:14:28 AM8/11/16
to Salt-users
Yes that works, thanks.

dean.s...@eduserv.org.uk

unread,
Aug 11, 2016, 8:50:56 AM8/11/16
to Salt-users
In the end I used the following, because I couldn't change the comment getting: 'Warnings: 'comment' is an invalid keyword argument for 'test.succeed_without_changes':

#needed if run has no failures or successes
sysctl_always_run:
  test.configurable_test_state:
    - changes: False
    - result:  True
    - comment: 'needed if run has no failures or successes'

dean.s...@eduserv.org.uk

unread,
Aug 12, 2016, 5:13:58 AM8/12/16
to Salt-users

Nick Su

unread,
Mar 26, 2019, 9:42:16 AM3/26/19
to Salt-users

Hi , 

Thank you for your years old post gived me some tips , however I am wondering since test.nop is an alias to succeed_without_changes, which means it will never be changed, right ?

I am wondering whether this two sls makes any different:
echo:
  test.show_notification:
    - name: echo
    - text: result

changes:
  test.succeed_with_changes:
    - name: test changes
    - onchanges:
      - test: dummy
    - onchanges_in:
      - test: echo

dummy:
  test.nop
echo:
  test.show_notification:
    - name: echo
    - text: result

changes:
  test.succeed_with_changes:
    - name: test changes
    - onchanges_in:
      - test: echo



在 2016年8月11日星期四 UTC+8下午6:40:13,Andrew Klopper写道:
Reply all
Reply to author
Forward
0 new messages