Skip to content

Commit

Permalink
fixes regex reading cloud ID depending if JSON output or not
Browse files Browse the repository at this point in the history
  • Loading branch information
luispresuelVenafi committed Jun 6, 2024
1 parent f7e1fd7 commit 2609fc1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ def get_cloud_id_from_output(json = false)
end

Kernel.puts("Checking output:\n"+@previous_command_output)
cloud_id_attr = "cloudId:"
cloud_id_attr = "cloudId"

if json
json_string = extract_json_from_output(@previous_command_output)
JSON.parse(json_string)
cloud_id = unescape_text(normalize_json(json_string, "#{cloud_id_attr}")).tr('"', '')
else
m = @previous_command_output.match /#{cloud_id_attr} (.+)$/
m = @previous_command_output.match /#{cloud_id_attr}: (.+)$/
cloud_id = m[1]
end
cloud_id
Expand Down

0 comments on commit 2609fc1

Please sign in to comment.