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

Add my_zone to ansible tower service template. #15233

Merged
merged 1 commit into from
May 31, 2017

Conversation

tinaafitz
Copy link
Member

Adding my_zone to service_template_ansible_tower enables Ansible Tower Service provisioning to queue work in the provider zone.

https://bugzilla.redhat.com/show_bug.cgi?id=1451473

@tinaafitz
Copy link
Member Author

@miq-bot assign @gmcculloug
@miq-bot add_label bug, providers/ansible_tower, services, fine/yes

@@ -52,6 +52,10 @@ def self.validate_config_info(options)
config_info
end

def my_zone
job_template.manager.try(:my_zone) || MiqServer.my_zone
Copy link
Member

Choose a reason for hiding this comment

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

I understand the job_template.manager.try(:my_zone) part. Why default to MiqServer.my_zone? What happens if my_zone just returns nil instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gmcculloug If we return nil instead of defaulting to MiqServer.my_zone, the work is put on the queue with a nil zone. I initially thought the service_template_provision_task deliver_to_automate method would catch it, but it only defaults it if the source doesn't respond to my_zone.

determine_queue_zone will leave it as nil because the options key zone exists:
if options.key?(:zone) options[:zone] # return specified zone including nil (aka ANY zone)

Copy link
Member

Choose a reason for hiding this comment

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

You are referring to service_template_provision_task.rb#L146.

I guess my follow-up question would be: Is the service_template valid if there is no manager or if the manager has a nil zone? I do not think it is, therefore I still see value in simplifying this method to job_template.manager.try(:my_zone).

Copy link
Member Author

Choose a reason for hiding this comment

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

@gmcculloug Good point. Changes made.

end

context 'without job template manager' do
it "takes the zone from MiqServer" do
Copy link
Member

Choose a reason for hiding this comment

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

This description needs to be updated to match the new functionality.

Copy link
Member Author

Choose a reason for hiding this comment

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

@gmcculloug Changed description.

@miq-bot
Copy link
Member

miq-bot commented May 31, 2017

Checked commit tinaafitz@1d0bb97 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@gmcculloug gmcculloug merged commit e871897 into ManageIQ:master May 31, 2017
@gmcculloug gmcculloug added this to the Sprint 62 Ending Jun 5, 2017 milestone Jun 6, 2017
simaishi pushed a commit that referenced this pull request Jun 9, 2017
@simaishi
Copy link
Contributor

simaishi commented Jun 9, 2017

Fine backport details:

$ git log -1
commit 456b5ac7d409abd5a1010734bb7e161148da821b
Author: Greg McCullough <[email protected]>
Date:   Wed May 31 15:46:47 2017 -0400

    Merge pull request #15233 from tinaafitz/ansible_tower_my_zone
    
    Add my_zone to ansible tower service template.
    (cherry picked from commit e871897e55349892d83a4f52bc8b21d499e3dac6)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1460356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants