Skip to content

Commit

Permalink
Merge pull request ManageIQ#86 from putmanoj/use-terraform-runner-liv…
Browse files Browse the repository at this point in the history
…e-api

Use terraform-runner /live api in Terraform::Runner.available? method
  • Loading branch information
agrare committed Nov 15, 2024
2 parents 75c8d44 + d876a44 commit 07ce648
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/terraform/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class << self
def available?
return @available if defined?(@available)

response = terraform_runner_client.get('ping')
@available = response.status == 200
response = terraform_runner_client.get('live')
@available = response.status == 200 && JSON.parse(response.body)['status'] == 'UP'
rescue
@available = false
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/terraform/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

describe "is .available" do
before do
stub_request(:get, "#{terraform_runner_url}/ping")
.to_return(:status => 200, :body => {'count' => 0}.to_json)
stub_request(:get, "#{terraform_runner_url}/live")
.to_return(:status => 200, :body => {:status => "UP", :checks => []}.to_json)
end

it "check if terraform-runner service is available" do
Expand Down

0 comments on commit 07ce648

Please sign in to comment.