Skip to content

Ensure test is added to opts when using states with salt-ssh #61634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 7, 2022

Conversation

Ch3LL
Copy link
Contributor

@Ch3LL Ch3LL commented Feb 11, 2022

What does this PR do?

Ensures test=True is added to __opts__ when states are run with salt-ssh

What issues does this PR fix or reference?

Fixes: #57144

Previous Behavior

{%- set is_test = salt['config.get']('test') %}

config.get check for is_test:
  cmd.run:
    - name: echo '{{ is_test }}'

opts.get check for test:
  cmd.run:
    - name: echo '{{ opts.get('test') }}'
salt-ssh \* state.apply optargs test=True
centos:
----------
          ID: config.get check for is_test
    Function: cmd.run
        Name: echo 'False'
      Result: None
     Comment: Command "echo 'False'" would have been executed
     Started: 21:39:27.915830
    Duration: 1.83 ms
     Changes:   
----------
          ID: opts.get check for test
    Function: cmd.run
        Name: echo 'False'
      Result: None
     Comment: Command "echo 'False'" would have been executed
     Started: 21:39:27.917898
    Duration: 1.971 ms
     Changes:   

Summary for centos
------------
Succeeded: 2 (unchanged=2)
Failed:    0
------------
Total states run:     2
Total run time:   3.801 ms

New Behavior

salt-ssh \* state.apply optargs test=True 
centos:
----------
          ID: config.get check for is_test
    Function: cmd.run
        Name: echo 'True'
      Result: None
     Comment: Command "echo 'True'" would have been executed
     Started: 21:38:25.836527
    Duration: 1.842 ms
     Changes:   
----------
          ID: opts.get check for test
    Function: cmd.run
        Name: echo 'True'
      Result: None
     Comment: Command "echo 'True'" would have been executed
     Started: 21:38:25.838558
    Duration: 1.747 ms
     Changes:   

Summary for centos
------------
Succeeded: 2 (unchanged=2)
Failed:    0
------------
Total states run:     2
Total run time:   3.589 ms

@Ch3LL Ch3LL requested a review from a team as a code owner February 11, 2022 22:08
@Ch3LL Ch3LL requested review from MKLeb and removed request for a team February 11, 2022 22:08
@Ch3LL Ch3LL changed the title [WIP] Ensure test is added to opts when using states with salt-ssh Ensure test is added to opts when using states with salt-ssh Feb 14, 2022
@Ch3LL Ch3LL added the Phosphorus v3005.0 Release code name and version label Mar 9, 2022
@Ch3LL Ch3LL merged commit bf104f8 into saltstack:master Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Phosphorus v3005.0 Release code name and version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] salt-ssh: value of test in config and opts of state or publish.runner is always False
2 participants