-
Notifications
You must be signed in to change notification settings - Fork 897
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
Adding many models for EmbeddedAnsible provider #13879
Adding many models for EmbeddedAnsible provider #13879
Conversation
find_by(:manager_id => manager.id, :manager_ref => job_template.id) | ||
end | ||
|
||
def create_in_provider_queue(manager_id, params) | ||
manager = ExtManagementSystem.find(manager_id) | ||
|
||
manager = ExtManagementSystem.find(manager_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do it twice because of the non-deterministic nature of computers. LOL
@@ -0,0 +1,90 @@ | |||
require 'ansible_tower_client' | |||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::Job | |||
include Status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to use include_concern here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I could not figure that out last night! Thanks, I'll give this a try.
:ext_management_system => template.manager, | ||
:job_template => template) | ||
stack.send(:update_with_provider_object, raw_create_stack(template, options)) | ||
stack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure this copy paste, but a preferred pattern than
x = blah
x.foo = bar
return x
is
blah.tap do |x|
x.foo = bar
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, 100% copy/paste. I can update this as part of the PR, though.
@@ -0,0 +1,3 @@ | |||
# This corresponds to Ansible Tower's Azure Resource Manager (azure_rm) type credential. We are not modeling the deprecated Azzure classic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo Azzure
-> Azure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, also copy/paste. I'll add it to the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe, my fault
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I azzure you, it's ok 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fryguy 😑
@blomquisg LGTM, with a few minor comments There are also a few minor rubocop issues, but if they were there previously, then no need to do them in this PR. |
38520bf
to
c90a59f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blomquisg looks like specs failed because you missed a few automate service models. See this for an example
Thanks @bdunne .... on it |
c90a59f
to
640f9d3
Compare
OMG it's 🍏 💚 📗 🐸 🐍 🐢 🍀 🌵 🎾 ✳️ ❇️ ✅ Though, any chance we can get #13776 reviewed and merged first? Then, I'll rebase mine on top of that and incorporate the new models introduced there. |
This pull request is not mergeable. Please rebase and repush. |
@blomquisg #13776 is merged. I think we can merge after rebase. |
640f9d3
to
51d607a
Compare
... Those tests pass locally for me, so it must be something very recently added since my last rebase. |
It's broken in master |
This pull request is not mergeable. Please rebase and repush. |
51d607a
to
57a1399
Compare
it's the classic |
This pull request is not mergeable. Please rebase and repush. |
WOW! So many changes here. This is the first attempt to create a way to differentiate the AnsibleTower models from the EmbeddedAnsible models. The point behind this differentiation is to allow querying done via the MIQ API and UI to filter based on the Embedded vs. External nature of each. Specifically, one should be able to ask for `ManageIQ::Providers::EmbeddedAutomationManager::ConfigurationScript.all` and not get any configuration script from any `AnsibleTower` providers, because `AnsibleTower` providers should be strictly `ExternalAutomationManagers`. This definitely feels like a lot of convoluted hierarchical organization that's going to hurt in the future. TODO: OMG, draw a picture of this!
57a1399
to
f72a278
Compare
Checked commits blomquisg/manageiq@be9b4d0~...f72a278 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/models/manageiq/providers/ansible_tower/shared/automation_manager/configuration_script.rb
app/models/manageiq/providers/ansible_tower/shared/automation_manager/job.rb
spec/models/manageiq/providers/ansible_tower/automation_manager/configuration_script_spec.rb
|
@@ -8,22 +11,19 @@ def create_in_provider(manager_id, params) | |||
|
|||
# Get the record in our database | |||
# TODO: This needs to be targeted refresh so it doesn't take too long | |||
EmsRefresh.queue_refresh(manager, nil, true) if manager.authentication_status_ok? | |||
|
|||
EmsRefresh.queue_refresh(manager, nil, true) if !manager.missing_credentials? && manager.authentication_status_ok? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blomquisg This changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did ... or, it did when I first copied all this stuff around
|
||
def provider_object(connection = nil) | ||
(connection || connection_source.connect).api.job_templates.find(manager_ref) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also why was this added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not added:
manageiq/app/models/manageiq/providers/ansible_tower/automation_manager/configuration_script.rb
Line 16 in 8773af5
def provider_object(connection = nil) |
Adding a comment regarding filtering by models. This has come up a few times, and I wanna make sure it's captured somewhere. PrefaceThere are two different However, propagating specific provider names back into the UI breaks future-looking pluggability of trying to keep specific provider names out of the UI. So, an intermediate layer has been added to allow model-level filtering between "Embedded" and "External" types of
FilteringTo see all of the ManageIQ::Providers::EmbeddedAutomationManager.ConfigurationScriptSource.all To see all of the ManageIQ::Providers::ExternalAutomationManager.ConfigurationScript.all |
WOW! So many changes here.
This is the first attempt to create a way to differentiate the
AnsibleTower
models from theEmbeddedAnsible
models.The point behind this differentiation is to allow querying done via the MIQ API and UI to filter based on the Embedded vs. External nature of each.
Specifically, one should be able to ask for
ManageIQ::Providers::EmbeddedAutomationManager::ConfigurationScript.all
and not get any configuration script from any
AnsibleTower
providers, becauseAnsibleTower
providers should be strictlyExternalAutomationManagers
.How was this accomplished?
AnsibleTower
models has been extracted and moved to a newManageIQ::Providers::AnsibleTower::Shared
namespaceAnsibleTower
andEmbeddedAnsible
now pull all logic from models inManageIQ::Providers::AnsibleTower::Shared
models.a. Note that only a few models are actually in
Shared
. This is because only a few actually had any implementation.EmbeddedAutomationManager
andExternalAutomationManager
have been built out more. Maybe not completely. This PR might have missed some gaps.AutomationManager
has more models for completeness. We can decide whether this is really necessary, but it felt better to do it this way.ConfigurationScript
modeling for Ansible Tower and Embedded Ansible