salt cmd bug

41 views
Skip to first unread message

linux8080

unread,
Aug 27, 2015, 9:36:12 PM8/27/15
to Salt-users
[root@ ~]# salt-master --version
salt-master 2014.7.0 (Helium)
[root@ ~]# salt-minion --version
salt-minion 2014.7.0 (Helium)

[root@ ~]# cat test.py 
def test():
   import salt.client
   local = salt.client.LocalClient()
   print local.cmd('*','cmd.run',['df -h'])
test()

[root@ ~]# /usr/local/saltstack/bin/python test.py  
{'172.16.50.137': 'Filesystem            Size  Used Avail Use% Mounted on\n/dev/sda2             6.0G  3.4G  2.3G  60% /\ntmpfs                 495M     0  495M   0% /dev/shm\n/dev/sda1             124M   28M   91M  24% /boot\n/dev/sda5              13G  1.3G   11G  11% /data'}
Exception TypeError: 'an integer is required' in <bound method MasterEvent.__del__ of <salt.utils.event.MasterEvent object at 0x2a5ced0>> ignored

[root@ ~]# cat test1.py 
import salt.client
def test():
   local = salt.client.LocalClient()
   print local.cmd('*','cmd.run',['df -h'])
test()

[root@ ~]# /usr/local/saltstack/bin/python test1.py 
{'172.16.50.137': 'Filesystem            Size  Used Avail Use% Mounted on\n/dev/sda2             6.0G  3.4G  2.3G  60% /\ntmpfs                 495M     0  495M   0% /dev/shm\n/dev/sda1             124M   28M   91M  24% /boot\n/dev/sda5              13G  1.3G   11G  11% /data'}

this script run no error,why?

Sharikov Makar

unread,
Aug 29, 2015, 1:08:25 PM8/29/15
to salt-...@googlegroups.com

Module name "test" cannot be used in python.
28.08.2015 4:36 пользователь "linux8080" <jiahua...@gmail.com> написал:

> --
> 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.

Message has been deleted

linux8080

unread,
Aug 31, 2015, 3:38:16 AM8/31/15
to Salt-users


在 2015年8月30日星期日 UTC+8上午1:08:25,maratsh写道:
when I used other function name,the same error,like

def aaa(id):
    import salt.client
    local = salt.client.LocalClient()
    for result in local.cmd_cli('x.x.x.x','cmd.run',['df -h'],timeout=20):
        print result

aaa(2) 

Exception TypeError: 'an integer is required' in <bound method MasterEvent.__del__ of <salt.utils.event.MasterEvent object at 0x1ff4ad0>> ignored

Sharikov Makar

unread,
Sep 1, 2015, 10:04:15 AM9/1/15
to salt-...@googlegroups.com
You should use another name of  module (*.py file).
Reply all
Reply to author
Forward
0 new messages