Bug 1474748 - incorrect value used in stock automation wait_for_completion
Summary: incorrect value used in stock automation wait_for_completion
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.7.0
Hardware: All
OS: All
unspecified
medium
Target Milestone: GA
: 5.9.0
Assignee: William Fitzgerald
QA Contact: Pavol Kotvan
URL:
Whiteboard:
Depends On:
Blocks: 1479409 1479410
TreeView+ depends on / blocked
 
Reported: 2017-07-25 10:24 UTC by Felix Dewaleyne
Modified: 2020-12-14 09:14 UTC (History)
10 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1479409 1479410 (view as bug list)
Environment:
Last Closed: 2018-03-06 14:42:04 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Felix Dewaleyne 2017-07-25 10:24:34 UTC
Description of problem:
From bundled automation domain (ManageIQ) the wait_for_completion.rb and wait_for_ip.rb methods are used wrong state variable ae_retry_limit instead of ae_retry_interval

Version-Release number of selected component (if applicable):
cfme-5.7.3.2-1.el7cf.x86_64




Additional info:
The methods that related to Ansible Tower Job launch:

/ ManageIQ / ConfigurationManagement / AnsibleTower / Operations / StateMachines / Job / wait_for_completion

and

/ ManageIQ / ConfigurationManagement / AnsibleTower / Operations / StateMachines / Job / wait_for_ip

used wrong state variable ae_retry_limit instead of ae_retry_interval

[1] https://github.com/ManageIQ/manageiq/blob/euwe/db/fixtures/ae_datastore/ManageIQ/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__/wait_for_completion.rb#L21
[2] https://github.com/ManageIQ/manageiq/blob/euwe/db/fixtures/ae_datastore/ManageIQ/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__/wait_for_ip.rb#L25


https://github.com/ManageIQ/manageiq-content/blob/master/content/automate/ManageIQ/AutomationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__/wait_for_completion.rb#L29

Comment 4 CFME Bot 2017-07-25 21:28:25 UTC
New commit detected on ManageIQ/manageiq-content/master:
https://github.com/ManageIQ/manageiq-content/commit/2cabbfb461af2e9f142d6938c5513c44d11e9222

commit 2cabbfb461af2e9f142d6938c5513c44d11e9222
Author:     william fitzgerald <wfitzger>
AuthorDate: Tue Jul 25 15:36:10 2017 -0400
Commit:     william fitzgerald <wfitzger>
CommitDate: Tue Jul 25 15:36:10 2017 -0400

    Changed ae_retry_limit = 1.minute to ae_retry_interval = 1.minute in 2 methods.
    
    Changes made in Wait_for_ip and Wait_for_completion methods in
    ConfigurationManagement namespace.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1474748
    
    @miq-bot add_label bug, fine/yes, euwe/yes
    @miq-bot assign @gmcculloug

 .../StateMachines/Job.class/__methods__/wait_for_completion.rb          | 2 +-
 .../Operations/StateMachines/Job.class/__methods__/wait_for_ip.rb       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comment 5 CFME Bot 2017-07-25 21:28:30 UTC
New commit detected on ManageIQ/manageiq-content/master:
https://github.com/ManageIQ/manageiq-content/commit/2453106b5b3f0a5bc7373b8220c082db697540e9

commit 2453106b5b3f0a5bc7373b8220c082db697540e9
Author:     william fitzgerald <wfitzger>
AuthorDate: Tue Jul 25 16:11:08 2017 -0400
Commit:     william fitzgerald <wfitzger>
CommitDate: Tue Jul 25 16:11:08 2017 -0400

    Changes made in Wait_for_ip and Wait_for_completion methods in
    AutomationManagement namespace.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1474748
    
    @miq-bot add_label bug, fine/yes
    @miq-bot assign @gmcculloug

 .../StateMachines/Job.class/__methods__/wait_for_completion.rb          | 2 +-
 .../Operations/StateMachines/Job.class/__methods__/wait_for_ip.rb       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comment 9 William Fitzgerald 2018-01-02 16:24:29 UTC
Clear needinfo

Comment 11 William Fitzgerald 2018-01-15 14:47:06 UTC
Pavol,

Setup an appliance with Ansible and run a playbook.  Check the automation.log for retry.  The wait_for_ip and wait_for_completion methods should wait at least 1 minute before trying again after a retry. The log lines below show a retry for WaitForIp and then it waits longer than a minute before trying again.  You could grep the automation.log for WaitForIp. 


[----] I, [2018-01-15T09:34:23.434053 #56509:b9d138]  INFO -- : Q-task_id([miq_provision_23]) Processed  State=[WaitForIp] with Result=[retry]

[----] I, [2018-01-15T09:35:31.460698 #28556:b9d138]  INFO -- : Q-task_id([miq_provision_23]) In State=[WaitForIp], invoking [on_entry] method=[update_provision_status(status => 'Wait_for_ip')]

Let me know if you have any questions.

Thanks

Billy

Comment 13 William Fitzgerald 2018-01-19 15:31:32 UTC
Pavol,

This talk topic should explain how to test this. 

http://talk.manageiq.org/t/launching-ansible-tower-job-templates-from-manageiq/1394

Billy

Comment 15 William Fitzgerald 2018-02-19 17:36:00 UTC
Pavol,

 I used your appliance and was able to run your custom button (play1raw).  I picked an appliance (cu-24x7) that was powered on and has an ip address.  The process failed but it did run WaitForCompletion with a retry.  The retry did wait a minute before it retried again. 

I don't think you need the user domain unless maybe you want to copy the old stuff and see that it doesn't wait a minute before the retry.

Below are some automation log lines from my test.  After the retry, it waited a minute. 

[----] I, [2018-02-19T12:16:17.179862 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Method exited with rc=MIQ_OK
[----] I, [2018-02-19T12:16:17.180173 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Processed  State=[WaitForCompletion] with Result=[retry]
[----] I, [2018-02-19T12:16:17.180561 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Followed  Relationship [miqaedb:/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/default#create]
[----] I, [2018-02-19T12:16:17.181128 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Followed  Relationship [miqaedb:/System/Request/Ansible_Tower_Job#create]
[----] D, [2018-02-19T12:16:17.186759 #16799:ff512c] DEBUG -- : Q-task_id([resource_action_24]) <MiqAeWorkspace>
[----] I, [2018-02-19T12:17:19.090290 #28128:ff512c]  INFO -- : Q-task_id([resource_action_24]) User [admin] with current group ID [2] name [EvmGroup-super_administrator]
[----] I, [2018-02-19T12:17:19.125016 #28128:ff512c]  INFO -- : Q-task_id([resource_action_24]) Instantiating [/SYSTEM/PROCESS/Request?MiqServer%3A%3Amiq_server=1&User%3A%3Auser=1&VmOrTemplate%3A%3Avm=10&ae_state=WaitForCompletion&ae_state_data=---%20%21ruby%2Fhash%3AActiveSupport%3A%3AHashWithIndifferentAccess%0Aansible_job_id%3A%2018%0A&ae_state_previous=---%0A%22%2FManageIQ%2FConfigurationManagement%2FAnsibleTower%2FOperations%2FStateMachines%2FJob%2Fdefault%22%3A%0A%20%20ae_state%3A%20WaitForCompletion%0A%20%20ae_state_retries%3A%201%0A%20%20ae_state_started%3A%202018-02-19%2017%3A16%3A15%20UTC%0A%20%20ae_state_max_retries%3A%20100%0A&ae_state_retries=1&ae_state_started=2018-02-19%2017%3A16%3A15%20UTC&dialog_limit=localhost&dialog_param_abc=1&job_template_name=raw_command&object_name=Request&request=Ansible_Tower_Job&vmdb_object_type=vm]

Thanks

Billy

Comment 16 William Fitzgerald 2018-02-19 18:04:29 UTC
Pavol,

 When I use appliance (nachandr-test) with your custom button, the wait_for_ip goes into retry.  Since this Instance doesn't have an ip address, It should retry every minute for 100 times. 

The retry did wait a minute before it retried again. 

[----] I, [2018-02-19T12:53:53.153632 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Processed  State=[WaitForIP] with Result=[retry]
[----] I, [2018-02-19T12:54:58.789303 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Processed  State=[WaitForIP] with Result=[retry]
[----] I, [2018-02-19T12:56:04.399287 #28128:ff512c]  INFO -- : Q-task_id([resource_action_24]) Processed  State=[WaitForIP] with Result=[retry]
[----] I, [2018-02-19T12:57:08.312324 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Processed  State=[WaitForIP] with Result=[retry]
[----] I, [2018-02-19T12:58:14.481868 #16799:ff512c]  INFO -- : Q-task_id([resource_action_24]) Processed  State=[WaitForIP] with Result=[retry]


Thanks

Billy


Note You need to log in before you can comment on or make changes to this bug.