Skip to content
Permalink
Browse files Browse the repository at this point in the history
Create randomized logfile name in windows for chef.py
  • Loading branch information
basepi committed Mar 25, 2015
1 parent 5fd1705 commit b49d0d4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions salt/modules/chef.py
Expand Up @@ -6,6 +6,7 @@
# Import Python libs
import logging
import os
import tempfile

# Import Salt libs
import salt.utils
Expand All @@ -24,12 +25,16 @@ def __virtual__():


def _default_logfile(exe_name):

'''
Retrieve the logfile name
'''
if salt.utils.is_windows():
logfile = salt.utils.path_join(
os.environ['TMP'],
'{0}.log'.format(exe_name)
)
logfile_tmp = tempfile.NamedTemporaryFile(dir=os.environ['TMP'],
prefix=exe_name,
suffix='.log',
delete=False)
logfile = logfile_tmp.name
logfile_tmp.close()
else:
logfile = salt.utils.path_join(
'/var/log',
Expand Down

0 comments on commit b49d0d4

Please sign in to comment.