diff --git a/cli_setup.py b/cli_setup.py index b68af15..076663c 100755 --- a/cli_setup.py +++ b/cli_setup.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python +# # Copyright 2018 OpenStack Foundation # All Rights Reserved. # @@ -44,8 +46,8 @@ def setup_ansible_etc(): # copy over all kolla ansible etc files kolla_ansible_etc_source = os.path.join(kolla_ansible_source_base, 'etc', kolla) - copy_kolla_etc_files_cmd = ('cp -a %s %s' % (kolla_ansible_etc_source, - kolla_ansible_etc_target)) + copy_kolla_etc_files_cmd = ('cp -a %s/* %s' % (kolla_ansible_etc_source, + kolla_ansible_etc_target)) _command_exec(copy_kolla_etc_files_cmd) diff --git a/kolla_cli/common/utils.py b/kolla_cli/common/utils.py index 83fe0a0..603049e 100644 --- a/kolla_cli/common/utils.py +++ b/kolla_cli/common/utils.py @@ -541,15 +541,16 @@ class Lock(object): return self._acquire_flock() else: return self._acquire_pidfile() - except Exception as e: - if not os.path.exists(self.lockpath): - raise Exception('Lock file (%s) is missing' - % self.lockpath) - - # it is ok to fail to acquire, we just return that we failed - LOG.debug('Exception in acquire lock. ' + except IOError as e: + # IOError is the error you get when the file is + # already locked. (No such file returns an OSError.) + # This may be OK and is handled by the caller. + LOG.debug('Exception in acquiring lock. ' 'path: %s pid: %s owner: %s error: %s' % (self.lockpath, self.pid, self.owner, str(e))) + return False + except Exception as e: + raise e def _acquire_pidfile(self): if not self.is_owned_by_me():