Skip to content
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

salt-ssh state.sls doesn't work #7698

Closed
sebw opened this issue Oct 9, 2013 · 10 comments
Closed

salt-ssh state.sls doesn't work #7698

sebw opened this issue Oct 9, 2013 · 10 comments
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix severity-low 4th level, cosemtic problems, work around exists

Comments

@sebw
Copy link
Contributor

sebw commented Oct 9, 2013

root@salt-master01:~# salt-call --versions-report
           Salt: 0.17.0
         Python: 2.7.3 (default, Jan  2 2013, 13:56:14)
         Jinja2: 2.6
       M2Crypto: 0.21.1
 msgpack-python: 0.1.10
   msgpack-pure: Not Installed
       pycrypto: 2.6
         PyYAML: 3.10
          PyZMQ: 13.1.0
            ZMQ: 3.2.3

[root@slinuxmgmt01 ~]# salt-call --versions-report
           Salt: 0.16.3
         Python: 2.6.8 (unknown, Nov  7 2012, 14:47:45)
         Jinja2: unknown
       M2Crypto: 0.21.1
 msgpack-python: 0.1.12
   msgpack-pure: Not Installed
       pycrypto: 2.3
         PyYAML: 3.08
          PyZMQ: 2.1.9
            ZMQ: 2.2.0


root@salt-master01:/etc/salt# salt 'slinuxmgmt01.intranet.example.org' state.sls sshd common
slinuxmgmt01.intranet.example.org:
----------
    State: - file
    Name:      /etc/ssh/sshd_config
    Function:  managed
        Result:    True
        Comment:   File /etc/ssh/sshd_config updated
        Changes:   diff: ---  
+++  
@@ -1,3 +1,4 @@
+# !!! THIS FILE IS MANAGED BY SALT. DO NOT EDIT MANUALLY !!! 

 # Ecoute IPv4 seulement 
 Port 22

                   mode: 400

----------
    State: - service
    Name:      sshd
    Function:  running
        Result:    True
        Comment:   Service restarted
        Changes:   sshd: True


Summary
------------
Succeeded: 2
Failed:    0
------------
Total:     2



root@salt-master01:/etc/salt# salt-ssh 'slinuxmgmt01.intranet.example.org' state.sls sshd common
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/client/ssh/__init__.py", line 223, in handle_routine
    stdout, stderr = single.run()
  File "/usr/lib/python2.7/dist-packages/salt/client/ssh/__init__.py", line 446, in run
    self.wfuncs = salt.loader.ssh_wrapper(opts, wrapper)
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 239, in ssh_wrapper
    'ssh'))
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 45, in _create_loader
    ext_types = os.path.join(opts['extension_modules'], ext_type)
KeyError: 'extension_modules'
^C
Exiting gracefully on Ctrl-c

Even a simple test.ping won't work.

# salt-ssh 'slinuxmgmt*' test.ping
slinuxmgmt01.intranet.example.org:
    Pseudo-terminal will not be allocated because stdin is not a terminal.

    Traceback (most recent call last):
      File "/tmp/.salt/salt-call", line 7, in ?
        from salt.scripts import salt_call
      File "/tmp/.salt/salt/__init__.py", line 34
        except ImportError as exc:
                            ^
    SyntaxError: invalid syntax
@ajithhub
Copy link
Contributor

ajithhub commented Oct 9, 2013

The second error, the syntax thing, is fixed in the next 0.17 release(2a1c4fc) . The SHIM script was not testing for python2.6 or python2.7, and ended up using python, which must be less than 2.6.

@basepi
Copy link
Contributor

basepi commented Oct 9, 2013

Heh, I spent a few minutes looking for a duplicate issue, then remembered that I was thinking of a different salt-users thread.

Thanks for reporting this, we'll look into it

@cachedout
Copy link
Contributor

Hi @sebw. In the current development branch, state.sls seems to be operational for most people. However, the current parser for command-line arguments is pretty basic and so salt-ssh state.sls mystate should work but salt-ssh state.sls mystate myotherstate is failing with a KeyError.

You should be able to play around with the current dev release of salt-ssh and states and we'll work on improving the cmd-line parser in the meantime. Let me know if you're getting errors while attempting to run a single state and we'll take a look at that, too. Thanks!

@sebw
Copy link
Contributor Author

sebw commented Oct 30, 2013

Hey @cachedout

Just to be sure I understand the doc correctly, shouldn't it be salt-ssh '*' state.sls mystate,myotherstate env ? Because that's what I was actually trying in my example: deploying the sshd state from the environment named common. Or should I run salt-ssh '*' state1 state2 env=common ?

Thanks.

@cachedout
Copy link
Contributor

@sebw Ah, I misunderstood you. We're still sorting out the parsing for salt-ssh as I mentioned so I wasn't totally sure what you were trying to accomplish. Yes, your syntax is correct salt-ssh '*' state1 env1 and works for me as advertised in most recent develop branch.

@cachedout
Copy link
Contributor

Since this seems to be working in develop and I believe all the questions have been answered, I'm going to go ahead and close this. If this needs to be re-opened, please comment on this thread and we'll happily do it. Thanks!

@nmadhok
Copy link
Contributor

nmadhok commented Apr 2, 2014

I'm getting this:

[root@saltmaster ~]# salt-ssh '*' state.highstate test=True
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib64/python2.6/multiprocessing/process.py", line 232, in _bootstrap
    self.run()
  File "/usr/lib64/python2.6/multiprocessing/process.py", line 88, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.6/site-packages/salt/client/ssh/__init__.py", line 260, in handle_routine
    stdout, stderr = single.run()
  File "/usr/lib/python2.6/site-packages/salt/client/ssh/__init__.py", line 498, in run
    stdout, stderr = self.run_wfunc()
  File "/usr/lib/python2.6/site-packages/salt/client/ssh/__init__.py", line 566, in run_wfunc
    self.wfuncs = salt.loader.ssh_wrapper(opts, wrapper)
  File "/usr/lib/python2.6/site-packages/salt/loader.py", line 264, in ssh_wrapper

@basepi
Copy link
Contributor

basepi commented Apr 2, 2014

@nmadhok What version?

@nmadhok
Copy link
Contributor

nmadhok commented Apr 2, 2014

@basepi

[root@saltmaster ~]# salt --version
salt 2014.1.0

@basepi
Copy link
Contributor

basepi commented Apr 2, 2014

Could you potentially test on the develop branch or the 2014.1 branch? It's possible we've already fixed that. If it's still an issue there, you should open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests

5 participants