Skip to content

Commit

Permalink
Handle plays without hosts
Browse files Browse the repository at this point in the history
Not all plays have hosts. Most notable is import. While it would be
better to actually parse the imported play, this at least prevents a
crash.
  • Loading branch information
ekohl authored and evgeni committed Dec 18, 2020
1 parent c2fc961 commit c0bf149
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion obsah/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def takes_target_parameter(self):
with open(self.path) as playbook_file:
plays = yaml.safe_load(playbook_file.read())

return any(self.application_config.target_name() in play['hosts'] for play in plays)
return any(self.application_config.target_name() in play.get('hosts', []) for play in plays)

@property
def playbook_variables(self):
Expand Down

0 comments on commit c0bf149

Please sign in to comment.