salt
salt copied to clipboard
module.ilo tempfile creation in __execute_cmd results in TypeError: cannot concatenate 'str' and 'int' objects
[root@dbserver tmp]# salt-call --log-level=debug ilo.create_user test1 secretagent REMOTE_CONS_PRIV RESET_SERVER_PRIV CONFIG_ILO_PRIV
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: dbserver.internal.dc.com
[DEBUG ] Configuration file path: /etc/salt/minion
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Initializing new SAuth for ('/etc/salt/pki/minion', 'dbserver.internal.dc.com', 'tcp://192.168.55.230:4506')
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] LazyLoaded ilo.create_user
Passed invalid arguments: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 138, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/ilo.py", line 381, in create_user
return __execute_cmd('Create_user', _xml)
File "/usr/lib/python2.6/site-packages/salt/modules/ilo.py", line 42, in __execute_cmd
delete=False) as fh:
File "/usr/lib64/python2.6/tempfile.py", line 444, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/lib64/python2.6/tempfile.py", line 226, in _mkstemp_inner
file = _os.path.join(dir, pre + name + suf)
TypeError: cannot concatenate 'str' and 'int' objects
[root@dbserver tmp]#
[root@dbserver tmp]# salt-call --versions
Salt: 2015.5.2
Python: 2.6.6 (r266:84292, Jan 22 2014, 01:49:05)
Jinja2: unknown
M2Crypto: 0.20.2
msgpack-python: 0.1.13
msgpack-pure: Not Installed
pycrypto: 2.0.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.5.0
RAET: Not Installed
ZMQ: 4.0.5
Mako: Not Installed
[root@dbserver tmp]#
[root@dbserver tmp]# diff -u /usr/lib/python2.6/site-packages/salt/modules/ilo.py.orig /usr/lib/python2.6/site-packages/salt/modules/ilo.py
--- /usr/lib/python2.6/site-packages/salt/modules/ilo.py.orig 2015-08-04 01:09:25.515595567 -0700
+++ /usr/lib/python2.6/site-packages/salt/modules/ilo.py 2015-08-04 01:10:34.631932136 -0700
@@ -37,8 +37,8 @@
if not os.path.isdir(tmp_dir):
os.mkdir(tmp_dir)
with tempfile.NamedTemporaryFile(dir=tmp_dir,
- prefix=name,
- suffix=os.getpid(),
+ prefix=name+str(os.getpid()),
+ suffix='.xml',
delete=False) as fh:
tmpfilename = fh.name
fh.write(xml)
[root@dbserver tmp]#
[root@dbserver tmp]# salt-call --log-level=debug ilo.create_user test1 secretagent REMOTE_CONS_PRIV RESET_SERVER_PRIV CONFIG_ILO_PRIV
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: dbserver.internal.dc.com
[DEBUG ] Configuration file path: /etc/salt/minion
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Initializing new SAuth for ('/etc/salt/pki/minion', 'dbserver.internal.dc.com', 'tcp://192.168.55.230:4506')
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] LazyLoaded ilo.create_user
[DEBUG ] LazyLoaded cmd.run_all
[INFO ] Executing command 'hponcfg -f /var/cache/salt/minion/tmp/Create_user53726gDp1Rt.xml' in directory '/root'
[DEBUG ] stdout: HP Lights-Out Online Configuration utility
Version 4.5.0 Date 07/17/2015 (c) Hewlett-Packard Company, 2015
Firmware Revision = 1.22 Device type = iLO 4 Driver name = hpilo
Script succeeded
[DEBUG ] LazyLoaded file.remove
[DEBUG ] LazyLoaded ns_logstash.returner
[DEBUG ] LazyLoaded config.get
[DEBUG ] LazyLoaded pillar.get
[DEBUG ] Re-using SAuth for ('/etc/salt/pki/minion', 'dbserver.internal.dc.com', 'tcp://192.168.55.230:4506')
[DEBUG ] LazyLoaded nested.output
local:
True
[root@dbserver tmp]#
@gmcwhistler, thanks for the report. You are welcome to submit this as a patch against the 2015.5 branch.
created pull request https://github.com/saltstack/salt/pull/26061
Thanks, @gmcwhistler.