Skip to content

Commit

Permalink
Fix issue when keyids_file is not defined in .ansigenome.conf
Browse files Browse the repository at this point in the history
Thanks for reporting @adriaand007 :)
Fixes: nickjj#33 (comment)
  • Loading branch information
ypid committed May 23, 2017
1 parent ed4de3f commit 39d7b1f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions ansigenome/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,16 @@ def _get_debops_keyring_entities(self, keyids_file):
The file is assumed to be locally available to avoid to contact external servers.
"""

# FIXME
keyids_file = '/home/user/.ansible/ypid-ansible-common/submodules/debops-keyring/keyids'

entities = set()

with open(keyids_file, 'r') as keyids_fd:
for keyid_line in keyids_fd:
_re = re.search(
r'^(?P<keyid>[^ ]+) (?P<name>[^<]+) <(?P<nick>.*)>$',
keyid_line,
)
entities.add(_re.group('nick'))
if keyids_file:
with open(keyids_file, 'r') as keyids_fd:
for keyid_line in keyids_fd:
_re = re.search(
r'^(?P<keyid>[^ ]+) (?P<name>[^<]+) <(?P<nick>.*)>$',
keyid_line,
)
entities.add(_re.group('nick'))

return entities

Expand Down Expand Up @@ -407,7 +405,7 @@ def read_and_validate_meta(self, role):
if os.path.exists(self.paths["ansigenome"]):
self.meta_dict['ansigenome_info'] = utils.yaml_load(self.paths["ansigenome"])['ansigenome_info']
maintainers = self._get_maintainers_from_changelog(self.paths["changelog"])
keyring_entities = self._get_debops_keyring_entities(self.config["keyids_file"])
keyring_entities = self._get_debops_keyring_entities(self.config.get('keyids_file'))
if 'ansigenome_info' in self.meta_dict:
if maintainers:
authors = []
Expand Down

0 comments on commit 39d7b1f

Please sign in to comment.