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

Ansible refresh inventory #13807

Merged
merged 2 commits into from
Feb 8, 2017

Conversation

durandom
Copy link
Member

@durandom durandom commented Feb 8, 2017

This is a rewrite of #13774 on top of #13728

Refreshes ConfigurationScriptSource and Playbooks for Ansible Tower

@miq-bot add_label providers/ansible_tower

cc @jameswnl @Ladas @blomquisg

@miq-bot
Copy link
Member

miq-bot commented Feb 8, 2017

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Feb 8, 2017

Some comments on commits durandom/manageiq@abba7cb~...6d28a00

spec/models/manageiq/providers/ansible_tower/automation_manager/refresher_spec.rb

  • 💣 💥 🔥 🚒 - 20 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 22 - Detected cloudforms

@miq-bot
Copy link
Member

miq-bot commented Feb 8, 2017

Checked commits durandom/manageiq@abba7cb~...6d28a00 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
5 files checked, 0 offenses detected
Everything looks good. 🍰

# FIXME: its not really nice how I have to build a manager_ref / uuid here
p = target.playbooks.find_or_build("#{i.id}__#{playbook_name}")
# FIXME: how about just adding `o` - configuration_script_source here?
p[:configuration_script_source] = target.configuration_script_sources.lazy_find(i.id.to_s)
Copy link
Contributor

@Ladas Ladas Feb 8, 2017

Choose a reason for hiding this comment

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

if it's always 'o', you can just put it there :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

oooh

Copy link
Contributor

Choose a reason for hiding this comment

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

hehe' :-)


i.playbooks.each do |playbook_name|
# FIXME: its not really nice how I have to build a manager_ref / uuid here
p = target.playbooks.find_or_build("#{i.id}__#{playbook_name}")
Copy link
Contributor

@Ladas Ladas Feb 8, 2017

Choose a reason for hiding this comment

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

so the manager_ref is "#{i.id}__#{playbook_name}" ?

it might be better not to change manager_ref, since you will need to parse it when talking to provider? E.g. doing some operation with playbook.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, the playbook is just a name. So to make it really uniq, I need to scope it under project_id

GET /api/v1/projects/4/playbooks/
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
X-API-Time: 0.039s

[
    "hello_world.yml"
]

Copy link
Contributor

Choose a reason for hiding this comment

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

right, so it's better to have in unchanged in our db, so e.g. it you want to delete a playbook you know you need playbook.manager_ref and playbook.configuration_script_source.manager_ref

So you don't need to do a playbook.manager_ref.split("__")

I was proposing another key for pure unique check in #13806

Copy link
Member Author

Choose a reason for hiding this comment

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

so it's better to have in unchanged in our db

what should I set it to then? If I do this

target.playbooks.find_or_build(playbook_name)

the tests fail, because there are duplicate playbook names across projects

Copy link
Contributor

Choose a reason for hiding this comment

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

So this case would need find_or_build to take in more than 1 attribute. Are there other use cases that need this too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we need to add the find_or_build_by, as we talked in the other PR

In AWS, I have several entities with unique key.size >= 2

Copy link
Contributor

Choose a reason for hiding this comment

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

great!

@blomquisg
Copy link
Member

Overall looks good to me. @Ladas is also reviewing

@Ladas
Copy link
Contributor

Ladas commented Feb 8, 2017

@blomquisg for me it's just nits, so we can merge and tweak those later. :-) @durandom has nice FIXMEs for those :-)

I think the refresh code looks really nice now. :-) @durandom is the King of the APIs :-)

@blomquisg
Copy link
Member

@durandom is the King of the APIs :-)

@Ladas, should he change his nick to to Tarzan: King of APIs?

@durandom
Copy link
Member Author

durandom commented Feb 8, 2017

@blomquisg if you merge this, you can call me whatever you want :)

I'll fix the FIXMEs in follow ups

@blomquisg blomquisg merged commit 97ac8af into ManageIQ:master Feb 8, 2017
@blomquisg blomquisg added this to the Sprint 54 Ending Feb 13, 2017 milestone Feb 8, 2017
@durandom durandom deleted the ansible_refresh_inventory branch February 8, 2017 16:26
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.

6 participants