Skip to content

Commit

Permalink
handle relativ inventory path in request
Browse files Browse the repository at this point in the history
  • Loading branch information
lfkdev committed Jun 29, 2024
1 parent 2ac25fd commit 8d4e286
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/ansible_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ def validate_playbook_request(data, config):

if 'inventory' in data:
inventory_path = Path(data['inventory'])
if not inventory_path.is_file():
errors.append(f"Inventory file not found: {inventory_path}")
if not inventory_path.is_absolute():
inventory_path = Path(config['playbook_dir']) / inventory_path
else:
inventory_path = Path(config['inventory_file'])
if not inventory_path.is_file():
errors.append(f"Default inventory file not found: {inventory_path}")

if not inventory_path.is_file():
errors.append(f"Inventory file not found: {inventory_path}")
data['inventory_path'] = str(inventory_path)

if 'vars' in data and not isinstance(data['vars'], dict):
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "2.0.0"
VERSION = "2.0.2"

def get_version():
return VERSION

0 comments on commit 8d4e286

Please sign in to comment.