Skip to content

Commit

Permalink
Merge pull request #271 from puppetlabs/bug-fix_empty_inventory
Browse files Browse the repository at this point in the history
(bug) - Fix empty inventory
  • Loading branch information
david22swan committed Aug 5, 2024
2 parents 5b26d04 + 4a98922 commit 7562eb5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tasks/provision_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,22 @@ def tear_down(node_name, inventory, _vars, retry_attempts)
response.to_json
end

# Runs the provision or tear_down action based on the provided parameters.
# Expects the following parameters in JSON format from stdin:
# - action: The action to perform ('provision' or 'tear_down').
# - node_name: The name of the node to provision or tear down.
# - platform: The platform to provision.
# - vars: Additional variables to assign to nodes.
# - retry_attempts: The number of retry attempts for provisioning or tearing down.
# - inventory_location: The location of the inventory file. If not provided, defaults to './spec/fixtures/litmus_inventory.yaml'.
# The result of the action is printed to stdout in JSON format.
# Exits with status 0 on success, or 1 on failure.
def self.run
params = JSON.parse($stdin.read)
params.transform_keys!(&:to_sym)
action, node_name, platform, vars, retry_attempts, inventory_location = params.values_at(:action, :node_name, :platform, :vars, :retry_attempts, :inventory)

inventory_location ||= File.join(Dir.pwd, '/spec/fixtures/litmus_inventory.yaml')
inventory = InventoryHelper.open(inventory_location)

runner = new
Expand Down

0 comments on commit 7562eb5

Please sign in to comment.