forked from ungleich-public/cdist
Additionaly improve hostdir fix.
This commit is contained in:
parent
92278ef5b0
commit
3b91ace4ea
2 changed files with 9 additions and 5 deletions
|
@ -65,6 +65,8 @@ class Local(object):
|
|||
# import atexit
|
||||
# atexit.register(lambda: shutil.rmtree(base_path_parent))
|
||||
self.hostdir = self._hostdir()
|
||||
self.log.debug("Calculated temp dir for target \"{}\" is "
|
||||
"\"{}\"".format(self.target_host, self.hostdir))
|
||||
self.base_path = os.path.join(base_path_parent, self.hostdir)
|
||||
|
||||
self._init_log()
|
||||
|
@ -97,8 +99,9 @@ class Local(object):
|
|||
return None
|
||||
|
||||
def _hostdir(self):
|
||||
# Do not assume target_host is anything that can be used as a directory name.
|
||||
# Instead use a hash, which is know to work as directory name.
|
||||
# Do not assume target_host is anything that can be used as a
|
||||
# directory name.
|
||||
# Instead use a hash, which is known to work as directory name.
|
||||
return hashlib.md5(self.target_host.encode('utf-8')).hexdigest()
|
||||
|
||||
def _init_log(self):
|
||||
|
@ -239,7 +242,7 @@ class Local(object):
|
|||
message_prefix=message_prefix)
|
||||
|
||||
def save_cache(self):
|
||||
destination = os.path.join(self.cache_path, self.target_host)
|
||||
destination = os.path.join(self.cache_path, self.hostdir)
|
||||
self.log.debug("Saving " + self.base_path + " to " + destination)
|
||||
|
||||
try:
|
||||
|
|
|
@ -2,6 +2,7 @@ Changelog
|
|||
---------
|
||||
|
||||
next:
|
||||
* Core: Fix hostdir: use hash instead of target host (Steven Armstrong)
|
||||
* Core: pep8 (Darko Poljak)
|
||||
* Documentation: Restructure and fix and improve docs and manpages (Darko Poljak)
|
||||
* Core: Add files directory for static files (Darko Poljak)
|
||||
|
|
Loading…
Reference in a new issue