diff --git a/kolla_cli/common/service.py b/kolla_cli/common/service.py index 58c0174..0d9097e 100644 --- a/kolla_cli/common/service.py +++ b/kolla_cli/common/service.py @@ -50,7 +50,7 @@ class Service(object): self._groupnames.remove(groupname) def set_groupnames(self, groupnames): - self._groupnames = groupnames + self._groupnames = groupnames def get_groupnames(self): return copy(self._groupnames) diff --git a/kolla_cli/common/utils.py b/kolla_cli/common/utils.py index 6c8ab63..a81bb40 100644 --- a/kolla_cli/common/utils.py +++ b/kolla_cli/common/utils.py @@ -554,21 +554,21 @@ class Lock(object): return os.path.join(get_kolla_cli_home(), 'ansible.lock') def acquire(self): - try: - if self.use_flock: - return self._acquire_flock() - else: - return self._acquire_pidfile() - 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 + try: + if self.use_flock: + return self._acquire_flock() + else: + return self._acquire_pidfile() + 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(): diff --git a/tools/kolla_actions.py b/tools/kolla_actions.py index 76ddeea..adc9795 100755 --- a/tools/kolla_actions.py +++ b/tools/kolla_actions.py @@ -237,5 +237,6 @@ def main(): else: raise Exception('Invalid command %s' % command) + if __name__ == '__main__': main() diff --git a/tools/log_collector.py b/tools/log_collector.py index 508c218..d9833c2 100755 --- a/tools/log_collector.py +++ b/tools/log_collector.py @@ -112,5 +112,6 @@ def main(): print('Log collection complete. Logs are at %s' % tar_path) + if __name__ == '__main__': main()