Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Martin Hradil
@himdel
9
Nick LaMuro
@NickLaMuro
damn... multiple makes this harder
ManageIQ::Providers::EmbeddedAutomationManager.first.authentications.all.map(&:manager_ref)
Martin Hradil
@himdel
is ManageIQ::Providers::EmbeddedAutomationManager.first.last_refresh_error relevant? => "uninitialized constant ManageIQ::Providers::EmbeddedAnsible::AutomationManager::RefreshParser"
Nick LaMuro
@NickLaMuro
oh, no, that is not what I was getting
Martin Hradil
@himdel
> ManageIQ::Providers::EmbeddedAutomationManager.first.authentications.all.map(&:manager_ref)
=> ["2", "5", "8", "7", "9", "10", "3", "4", nil]
Nick LaMuro
@NickLaMuro
ManageIQ::Providers::EmbeddedAutomationManager.first.authentications.all.last
the nil manager_ref I "think™" is the problem
Martin Hradil
@himdel
sounds reasonable :)
=> #<ManageIQ::Providers::EmbeddedAnsible::AutomationManager::MachineCredential id: 170, name: "ManageIQ Default Credential", authtype: nil, userid: nil, password: nil, resource_id: 2, resource_type: "ExtManagementSystem", created_on: "2019-06-12 09:25:43", updated_on: "2019-06-12 09:25:43", last_valid_on: nil, last_invalid_on: nil, credentials_changed_on: nil, status: nil, status_details: nil, type: "ManageIQ::Providers::EmbeddedAnsible::AutomationMa...", auth_key: nil, fingerprint: nil, service_account: nil, challenge: nil, login: nil, public_key: nil, htpassd_users: [], ldap_id: [], ldap_email: [], ldap_name: [], ldap_preferred_user_name: [], ldap_bind_dn: nil, ldap_insecure: nil, ldap_url: nil, request_header_challenge_url: nil, request_header_login_url: nil, request_header_headers: [], request_header_preferred_username_headers: [], request_header_name_headers: [], request_header_email_headers: [], open_id_sub_claim: nil, open_id_user_info: nil, open_id_authorization_endpoint: nil, open_id_token_endpoint: nil, open_id_extra_scopes: [], open_id_extra_authorize_parameters: nil, certificate_authority: nil, google_hosted_domain: nil, github_organizations: [], rhsm_sku: nil, rhsm_pool_id: nil, rhsm_server: nil, manager_ref: nil, options: nil, evm_owner_id: nil, miq_group_id: 1, tenant_id: 1, become_username: nil, become_password: nil, auth_key_password: nil>
Jason Frey
@Fryguy
Conversations in Code™
Martin Hradil
@himdel
:)
Jason Frey
@Fryguy
puts "Hi"
Nick LaMuro
@NickLaMuro
okay, then try doing this:
ManageIQ::Providers::EmbeddedAutomationManager.first.authentications.all.last.update_attribute :manager_ref, ManageIQ::Providers::EmbeddedAutomationManager.first.id
I think that should allow you to create a new service template now
because this was the error I got:
{"error":{"kind":"bad_request","message":"Could not create Service Template - cant convert nil into Integer","klass":"Api::BadRequestError"}}
Martin Hradil
@himdel
oh ... which problem are you solving ?
Nick LaMuro
@NickLaMuro

basically, it was two pronged:

In app/models/manageiq/providers/embedded_ansible/seeding.rb when you first enable the role, it will create a default credential, but only assign it the name attribute. This was mostly okay since we were using the relation to fill in the rest.

But with the native_ref call, this would bomb when trying to type cast a nil to an integer. manager_ref was something we got from a refresh when using ansible_tower

Martin Hradil
@himdel
aah, but it still waits for a task
Nick LaMuro
@NickLaMuro
there is a "task" we create for this, but it is mostly ceremony for the UI now, since there is zero refresh is needed
but it was bombing prior to that (at least for me) because of the above
Martin Hradil
@himdel
ok, I'll run simulate_queue_worker and look at the new last one?
Nick LaMuro
@NickLaMuro
the fix (I think) is just to make sure we put in a stub manager_ref for the sake of things that still use it when seeding
that should be right, though I am suprised you don't have to re-run that API call
Martin Hradil
@himdel
Heheh, [----] I, [2019-06-19T18:09:32.654219 #19301:2b2882198e64] INFO -- : Completed 400 Bad Request in 178176ms (Views: 0.1ms | ActiveRecord: 159.6ms)
{"error":{"kind":"bad_request","message":"Could not create Service Template - undefined method '[]' for nil:NilClass","klass":"Api::BadRequestError"}}
Nick LaMuro
@NickLaMuro
this is where I am wondering if you had carried over credentials from a previous database
Martin Hradil
@himdel
[----] I, [2019-06-19T18:09:30.509561 #2152:2b1964ddc5b8]  INFO -- : MIQ(MiqQueue#deliver) Message id: [123135691], Delivering...
[----] I, [2019-06-19T18:09:30.590707 #2152:2b1964ddc5b8]  INFO -- : MIQ(MiqTask#update_status) Task: [366200] [Active] [Ok] [Task starting]
[----] I, [2019-06-19T18:09:32.337412 #2152:2b1964ddc5b8]  INFO -- : MIQ(MiqQueue#delivered) Message id: [123135691], State: [ok], Delivered in [1.827865993] seconds
[----] I, [2019-06-19T18:09:32.338922 #2152:2b1964ddc5b8]  INFO -- : MIQ(MiqQueue#m_callback) Message id: [123135691], Invoking Callback with args: ["Finished", "ok", "Message delivered successfully", "#<ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScript id: 468, manager_id: 2, manager_ref: nil, name: \"miq_ff_provision\", description: \"fff\", variables: {\"project\"=>\"21\", \"inventory\"=>2, \"become_enabled\"=>false, \"verbosity\"=>\"0\", \"ask_variables_on_launch\"=>true, \"ask_limit_on_launch\"=>true, \"ask_inventory_on_launch\"=>true, \"ask_credential_on_launch\"=>true, \"extra_vars\"=>\"{}\", \"credential\"=>2}, created_at: \"2019-06-19 18:09:32\", updated_at: \"2019-06-19 18:09:32\", survey_s..."]
[----] I, [2019-06-19T18:09:32.435265 #2152:2b1964ddc5b8]  INFO -- : MIQ(MiqTask#update_status) Task: [366200] [Finished] [Ok] [Task completed successfully]
Oh that could defiinitely be true, is there a purge button?
oh, right, purge the ones where the provider doesn't exist :)
Nick LaMuro
@NickLaMuro
not that I can tell it seems, or at least we don't have it set up in the relations to do it
Martin Hradil
@himdel
huh, should manager_id and manager_ref match at all?
Nick LaMuro
@NickLaMuro
manager_ref was supposed to be an idea id on the ansible_tower side (referencing a record in the ansible tower database)
now it doesn't make sense for EmbeddedAnsible since we are just using ansible_runner and own everything ourselves in our DB
Martin Hradil
@himdel
> ManageIQ::Providers::EmbeddedAutomationManager.first.authentications.all.map { |a| a.manager_ref }
=> ["2", "5", "8", "7", "9", "10", "3", "4", "2"]
> ManageIQ::Providers::EmbeddedAutomationManager.first.authentications.all.map { |a| a.manager_id }
=> [2, 2, 2, 2, 2, 2, 2, 2, 2]
oh, ok.. in that case, the failure on my side could just be that I'm not running any ansible?
Nick LaMuro
@NickLaMuro
it is more we haven't really written the migrations to migrate the data completely, since it is a work in progress
Martin Hradil
@himdel
(And it still sounds like the API should not be trying to wait..)
aah, makes sense :)
Nick LaMuro
@NickLaMuro

yeah, that one was a bit weird

I think previously it was just waiting for a task to be started, and then it creates the service_template on ansible_tower end in that task

and I think it also had to wait to get a reference ID for that job in tower before it could return sucessfully
Martin Hradil
@himdel
that sounds about right... the UI is hardcoded to flash Add of Repository "%s" was successfully initiated on success, that fits the idea
Martin Hradil
@himdel
wait no... I'm looking at entirely the wrong file
Catalog Item %s was saved
idk
Nick LaMuro
@NickLaMuro
yeah, me too, and I am "working" on this stuff as well :sweat_smile:
Nick LaMuro
@NickLaMuro
okay, I think this will fix the bug for new instance of embedded ansible going forward: ManageIQ/manageiq#18897
Daniel Berger
@djberg96
d-m-u
@d-m-u
yeah, yeah, yeah, i know, it's failing, and it's my fault, i'm working on it