FAQ
Hi all,

I am still trying to get my head around the nuances of state and
orchestration modules and appear to have a misunderstanding. Consider the
following module:

update-commit-count.

  salt.function:

    - name: cmd.run
    - tgt: foo.bar.com

    - kwarg:

      - env:

        - force: yes

    - arg:

      - gitlab-rake gitlab:update_commit_count

The intention of the above is to set the force environment variable to
'yes' prior to running the gitlab-rake command. When that EV is set, the
update_commit_count function will not prompt (!) for confirmation on STDIN.

I thought that by specifying the kwarg option like the above, then when the
rake command is executed on the minion the EV would be set as opposed to
the EV being set somewhere else.

But the above appears to not work that way. And there is no error.

As a work around the below seems to work fine:

update-commit-count:

  salt.function:

    - name: cmd.run

    - tgt: foo.bar.com

    # - kwarg:

    # - env:

    # - force: yes

    - arg:

      - export force=yes && gitlab-rake gitlab:update_commit_count

??

Thanks for any explanations particularly at the concept level.

-sandy

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Colton Myers at Dec 11, 2015 at 9:53 pm
    I think it should work as you expect it to. You may have to set it as a dictionary, rather than a list of dictionaries, however:

      salt.function:

        - name: cmd.run
        - tgt: foo.bar.com

        - kwarg:

          - env:

              force: yes

        - arg:

          - gitlab-rake gitlab:update_commit_count

    Note that I removed the dash before `force: yes` and replaced it with two spaces.

    Give that a try, if it doesn't work we may need to open an issue.

    --
    Colton Myers
    Core Engineer, SaltStack
    @basepi on Twitter/Github/IRC

    Registration for SaltConf 2016 is open! http://saltconf.com/register/
    On Dec 8, 2015, at 8:59 AM, Sandy wrote:

    Hi all,

    I am still trying to get my head around the nuances of state and orchestration modules and appear to have a misunderstanding. Consider the following module:

    update-commit-count.

    salt.function:

    - name: cmd.run
    - tgt: foo.bar.com

    - kwarg:

    - env:

    - force: yes

    - arg:

    - gitlab-rake gitlab:update_commit_count


    The intention of the above is to set the force environment variable to 'yes' prior to running the gitlab-rake command. When that EV is set, the update_commit_count function will not prompt (!) for confirmation on STDIN.

    I thought that by specifying the kwarg option like the above, then when the rake command is executed on the minion the EV would be set as opposed to the EV being set somewhere else.

    But the above appears to not work that way. And there is no error.

    As a work around the below seems to work fine:

    update-commit-count:

    salt.function:

    - name: cmd.run

    - tgt: foo.bar.com

    # - kwarg:

    # - env:

    # - force: yes

    - arg:

    - export force=yes && gitlab-rake gitlab:update_commit_count


    ??

    Thanks for any explanations particularly at the concept level.

    -sandy


    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Sandy at Dec 28, 2015 at 5:45 pm
    I tried a bunch of other variants - cannot get it to work. Upgraded to
    Beryllium and still no go.

    Filed https://github.com/saltstack/salt/issues/30030

    Hope it makes sense.

    Thanks.
    On Tuesday, December 8, 2015 at 10:59:17 AM UTC-5, Sandy wrote:

    Hi all,

    I am still trying to get my head around the nuances of state and
    orchestration modules and appear to have a misunderstanding. Consider the
    following module:

    update-commit-count.

    salt.function:

    - name: cmd.run
    - tgt: foo.bar.com

    - kwarg:

    - env:

    - force: yes

    - arg:

    - gitlab-rake gitlab:update_commit_count

    The intention of the above is to set the force environment variable to
    'yes' prior to running the gitlab-rake command. When that EV is set, the
    update_commit_count function will not prompt (!) for confirmation on STDIN.

    I thought that by specifying the kwarg option like the above, then when
    the rake command is executed on the minion the EV would be set as opposed
    to the EV being set somewhere else.

    But the above appears to not work that way. And there is no error.

    As a work around the below seems to work fine:

    update-commit-count:

    salt.function:

    - name: cmd.run

    - tgt: foo.bar.com

    # - kwarg:

    # - env:

    # - force: yes

    - arg:

    - export force=yes && gitlab-rake gitlab:update_commit_count

    ??

    Thanks for any explanations particularly at the concept level.

    -sandy
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedDec 8, '15 at 3:59p
activeDec 28, '15 at 5:45p
posts3
users2

2 users in discussion

Sandy: 2 posts Colton Myers: 1 post

People

Translate

site design / logo © 2022 Grokbase