Skip to content

Commit 7562eb5

Browse files
authored
Merge pull request #271 from puppetlabs/bug-fix_empty_inventory
(bug) - Fix empty inventory
2 parents 5b26d04 + 4a98922 commit 7562eb5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tasks/provision_service.rb

+12
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,22 @@ def tear_down(node_name, inventory, _vars, retry_attempts)
145145
response.to_json
146146
end
147147

148+
# Runs the provision or tear_down action based on the provided parameters.
149+
# Expects the following parameters in JSON format from stdin:
150+
# - action: The action to perform ('provision' or 'tear_down').
151+
# - node_name: The name of the node to provision or tear down.
152+
# - platform: The platform to provision.
153+
# - vars: Additional variables to assign to nodes.
154+
# - retry_attempts: The number of retry attempts for provisioning or tearing down.
155+
# - inventory_location: The location of the inventory file. If not provided, defaults to './spec/fixtures/litmus_inventory.yaml'.
156+
# The result of the action is printed to stdout in JSON format.
157+
# Exits with status 0 on success, or 1 on failure.
148158
def self.run
149159
params = JSON.parse($stdin.read)
150160
params.transform_keys!(&:to_sym)
151161
action, node_name, platform, vars, retry_attempts, inventory_location = params.values_at(:action, :node_name, :platform, :vars, :retry_attempts, :inventory)
162+
163+
inventory_location ||= File.join(Dir.pwd, '/spec/fixtures/litmus_inventory.yaml')
152164
inventory = InventoryHelper.open(inventory_location)
153165

154166
runner = new

0 commit comments

Comments
 (0)