Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bug) - Fix empty inventory #271

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading