Skip to content

Make inventory_path and playbook_path mandatory when enabled is true#3

Merged
alvagante merged 2 commits intotestfrom
copilot/sub-pr-1-again
Feb 23, 2026
Merged

Make inventory_path and playbook_path mandatory when enabled is true#3
alvagante merged 2 commits intotestfrom
copilot/sub-pr-1-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

When enabled = true, the Ansible integration silently accepted undef for inventory_path and playbook_path, writing empty values to .env and skipping cloning without any error.

Changes

  • manifests/integrations/ansible.pp: Added a conditional validation block — when $enabled is true, both $inventory_path and $playbook_path must be set; fails fast with a clear message if either is missing. When $enabled is false, no paths are required.
if $enabled {
  unless $inventory_path {
    fail('pabawi::integrations::ansible: inventory_path is required when enabled is true')
  }
  unless $playbook_path {
    fail('pabawi::integrations::ansible: playbook_path is required when enabled is true')
  }
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…abled is true

Co-authored-by: alvagante <283804+alvagante@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on mandatory playbook and inventory paths Make inventory_path and playbook_path mandatory when enabled is true Feb 23, 2026
Copilot AI requested a review from alvagante February 23, 2026 07:42
@alvagante alvagante marked this pull request as ready for review February 23, 2026 07:55
Copilot AI review requested due to automatic review settings February 23, 2026 07:55
@alvagante alvagante merged commit 5b8b1e7 into test Feb 23, 2026
3 of 4 checks passed
@alvagante alvagante deleted the copilot/sub-pr-1-again branch February 23, 2026 07:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modifies the Ansible integration validation logic to make inventory_path and playbook_path parameters mandatory only when the integration is enabled (enabled = true). Previously, these parameters were always required regardless of the enabled state, which caused unnecessary failures when the integration was disabled.

Changes:

  • Modified parameter validation in manifests/integrations/ansible.pp to conditionally require inventory_path and playbook_path only when $enabled is true
  • Updated error messages to clarify that paths are required specifically when enabled is true

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to 68
# Validate required parameters when integration is enabled
if $enabled {
unless $inventory_path {
fail('pabawi::integrations::ansible: inventory_path is required when enabled is true')
}
unless $playbook_path {
fail('pabawi::integrations::ansible: playbook_path is required when enabled is true')
}
}
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic is correct for when enabled is true, but there's a related issue elsewhere in the file: when enabled is false and inventory_path is undef, the code at line 78-80 will fail if inventory_source is provided (dirname will be called on undef), and line 119 will write an empty ANSIBLE_INVENTORY_PATH to .env. Consider either: (1) also validating inventory_path and playbook_path are not set when enabled is false if inventory_source or playbook_source are provided, or (2) wrapping the git clone blocks (lines 78-93 and 96-111) with an additional enabled check to prevent cloning when the integration is disabled.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants