Skip to content

Instantly share code, notes, and snippets.

@Karunamon
Created March 16, 2017 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Karunamon/2d02fe7c1c0596c5e400d12af64403e4 to your computer and use it in GitHub Desktop.
Save Karunamon/2d02fe7c1c0596c5e400d12af64403e4 to your computer and use it in GitHub Desktop.
start_random_vm:
module.run:
- name: cloud.action
- kwargs:
action: 'stop'
instance: 'somevm'
@whiteinge
Copy link

Close! The **kwargs in that function signature want the keyword args to be top-level. The docs should really show an example. Try this:

start_random_vm:
  module.run:
    - name: cloud.action
    - action: 'stop'
    - instance: 'somevm'

@Karunamon
Copy link
Author

Karunamon commented Mar 16, 2017

That blows up too - it doesn't appear to recognize the action as an action.

local:
----------
          ID: start_random_vm
    Function: module.run
        Name: cloud.action
      Result: True
     Comment: Module function cloud.action executed
     Started: 11:19:37.622324
    Duration: 33991.754 ms
     Changes:
              ----------
              ret:
                  ----------
                  Invalid Actions:
                      ----------
                      vmware.None:
                          - somevm
                  Not Actioned/Not Running:
                      - somevm
                  Not Found:
                      - somevm

@whytewolf
Copy link

for cloud.action the function is fun: not action:

@whiteinge
Copy link

Sorry, I didn't look closely enough at the cloud.action signature. Looks like it wants fun instead of action.

@Karunamon
Copy link
Author

Karunamon commented Mar 16, 2017

I was looking at the runner doc rather than the module doc - however, identical error for fun:

start_random_vm:
  module.run:
    - name: cloud.action
    - fun: 'start'
    - instance: 'somevm'

The signature is:

salt.modules.cloud.action(fun=None, cloudmap=None, names=None, provider=None, instance=None, **kwargs)

Using the runner module from the CLI works as expected: salt-run cloud.action stop instance=somevm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment