Fix clean function for windows

This commit is contained in:
twangboy 2016-05-19 11:13:03 -06:00 committed by Pedro Algarvio
parent fca093580c
commit b60bc974a0
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
2 changed files with 9 additions and 2 deletions

View File

@ -36,6 +36,7 @@ try:
except ImportError: except ImportError:
import socketserver import socketserver
STATE_FUNCTION_RUNNING_RE = re.compile( STATE_FUNCTION_RUNNING_RE = re.compile(
r'''The function (?:"|')(?P<state_func>.*)(?:"|') is running as PID ''' r'''The function (?:"|')(?P<state_func>.*)(?:"|') is running as PID '''
r'(?P<pid>[\d]+) and was started at (?P<date>.*) with jid (?P<jid>[\d]+)' r'(?P<pid>[\d]+) and was started at (?P<date>.*) with jid (?P<jid>[\d]+)'
@ -981,7 +982,7 @@ class TestDaemon(object):
] ]
} }
master_opts['ext_pillar'].append( master_opts['ext_pillar'].append(
{'cmd_yaml': 'cat {0}'.format( {'cmd_yaml': 'type {0}'.format(
os.path.join( os.path.join(
FILES, FILES,
'ext.yaml' 'ext.yaml'
@ -1222,9 +1223,13 @@ class TestDaemon(object):
''' '''
Clean out the tmp files Clean out the tmp files
''' '''
def remove_readonly(func, path, excinfo):
os.chmod(path, stat.S_IWRITE)
func(path)
for dirname in (TMP, TMP_STATE_TREE, TMP_PRODENV_STATE_TREE): for dirname in (TMP, TMP_STATE_TREE, TMP_PRODENV_STATE_TREE):
if os.path.isdir(dirname): if os.path.isdir(dirname):
shutil.rmtree(dirname) shutil.rmtree(dirname, onerror=remove_readonly)
def wait_for_jid(self, targets, jid, timeout=120): def wait_for_jid(self, targets, jid, timeout=120):
time.sleep(1) # Allow some time for minions to accept jobs time.sleep(1) # Allow some time for minions to accept jobs

View File

@ -13,3 +13,5 @@ open_mode: True
order_masters: True order_masters: True
fileserver_list_cache_time: 0 fileserver_list_cache_time: 0
pillar_opts: True pillar_opts: True
tcp_master_publish_pull: 33305
tcp_master_workers: 33306