Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Tower 3.3 removed result_stdout field from project_update #122

Merged
merged 1 commit into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions lib/ansible_tower_client/base_models/project_update.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module AnsibleTowerClient
class ProjectUpdate < BaseModel
def stdout(format = 'txt')
api.get("#{related['stdout']}?format=#{format}").body
end
alias result_stdout stdout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be a version dependent patch? Will this break older versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. I checked and this is available since 3.1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still support versions older than 3.1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure.
At least 3.0 reached End of Maintenance Support 2 (EOL) on 2/28/18 according to
https://access.redhat.com/support/policy/updates/ansible-tower

We started supporting Embedded Tower since 3.1. I am not sure about the external integration. Do you remember what version of Tower is the first integrated by MIQ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this change is intended to fix master and hammer branches I think we should be ok here based on the Tower EOL for 3.0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add the alias?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the miq tower gem is depending on this alias

end
end
16 changes: 16 additions & 0 deletions spec/project_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,20 @@
expect(obj.id).to be_a Integer
expect(obj.name).to be_a String
end

context '#stdout' do
describe "exists" do
let(:stdout) { "Ansible Tower Project Update output" }

it "returns stdout default to plain text" do
expect(api).to receive(:get).with(/format=txt/).and_return(instance_double("Faraday::Result", :body => stdout))
expect(described_class.new(api, raw_instance).stdout).to eq(stdout)
end

it "returns formatted text per request" do
expect(api).to receive(:get).with(/format=html/).and_return(instance_double("Faraday::Result", :body => stdout))
expect(described_class.new(api, raw_instance).stdout('html')).to eq(stdout)
end
end
end
end