Bug 1465628 - A remote job runs multiple times on a single server that belongs to multiple Host Collections
A remote job runs multiple times on a single server that belongs to multiple ...
Status: VERIFIED
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Remote Execution (Show other bugs)
6.2.10
Unspecified Unspecified
high Severity high (vote)
: 6.2.12
: --
Assigned To: aruzicka
jcallaha
: FieldEngineering, PrioBumpField
: 1465621 1479091 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-27 15:26 EDT by Brian Coca
Modified: 2017-09-19 12:49 EDT (History)
15 users (show)

See Also:
Fixed In Version: tfm-rubygem-foreman_remote_execution-1.3.3,rubygem-foreman_remote_execution-0.3.0.19-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1480352 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
verification screenshot (82.26 KB, image/png)
2017-08-28 15:52 EDT, jcallaha
no flags Details
rhel7_hotfix (416.96 KB, application/x-rpm)
2017-09-11 11:38 EDT, Adam Price
no flags Details
rhel6_hotfix (460.36 KB, application/x-rpm)
2017-09-11 11:38 EDT, Adam Price
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 20260 None None None 2017-07-10 08:51 EDT

  None (edit)
Description Brian Coca 2017-06-27 15:26:13 EDT
Description of problem:

When you run a remote job on a single host collection and it contains a system that belongs to multiple host collections, the job will run multiple times on that system.


How reproducible:

100%

Steps to Reproduce:

[root@sat62 ~]# hammer job-invocation create --job-template "Run Command - SSH Default" --inputs command='date +"%H:%M:%S.%N" >> /tmp/lala.txt' --search-query "host_collection = hostcol01"  
Job invocation 13 created
[........................................................................................................................................] [100%]
8 task(s), 6 success, 2 fail


^^Note: 8 tasks created.



[root@sat62 ~]# hammer host-collection info --id 3
ID:          3
Name:        hostcol01
Limit:       None
Description: 
Total Hosts: 4

^^ Note: hostcol01 has 4 hosts only.


[root@member-of-hostcol01 ~]# cat /tmp/lala.txt
18:26:55.103882174
18:26:55.104630745
18:26:55.273895571


^^ This specific member of hostcol01 belongs to 3 host collections. It ran this job 3 times.


[root@member-of-hostcol01 ~]# journalctl -u sshd --since 18:20:55
-- Logs begin at Dom 2017-06-25 04:35:12 UTC, end at Ter 2017-06-27 18:45:30 UTC. --
Jun 27 18:26:54 member-of-hostcol01.example.com sshd[2269]: Accepted publickey for root from 172.18.0.1 port 45202 ssh2: RSA ee:a4:a8:67:65:b9:a3:
Jun 27 18:26:54 member-of-hostcol01.example.com sshd[2271]: Accepted publickey for root from 172.18.0.1 port 45204 ssh2: RSA ee:a4:a8:67:65:b9:a3:
Jun 27 18:26:54 member-of-hostcol01.example.com sshd[2270]: Accepted publickey for root from 172.18.0.1 port 45203 ssh2: RSA ee:a4:a8:67:65:b9:a3:


^^ All 3 visits to this host on the same second.



[root@other-member-of-hostcol01 ~]# cat /tmp/lala.txt
18:26:54.671381525

^^ Note, this host belongs to a single Host Collection. It ran the remote job only once.


Actual results:

It created 8 tasks

Expected results:

4 tasks and the job to run only once.
Comment 1 Brian Coca 2017-06-27 15:27:34 EDT
*** Bug 1465621 has been marked as a duplicate of this bug. ***
Comment 2 aruzicka 2017-07-10 08:51:20 EDT
Created redmine issue http://projects.theforeman.org/issues/20260 from this bug
Comment 7 pm-sat@redhat.com 2017-07-11 04:12:35 EDT
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20260 has been resolved.
Comment 11 pm-sat@redhat.com 2017-08-03 18:15:23 EDT
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20260 has been resolved.
Comment 12 Ivan Necas 2017-08-08 03:05:27 EDT
*** Bug 1479091 has been marked as a duplicate of this bug. ***
Comment 13 jcallaha 2017-08-10 14:20:10 EDT
Verified in Satellite 6.3 Snap 10.

Added an RE-enabled host to 3 host collections, then executed the following command.

-bash-4.2# hammer job-invocation create --job-template "Run Command - SSH Default" --inputs command='date +"%H:%M:%S.%N" >> /root/test.txt' --search-query "host_collection = collection2"
Job invocation 3 created
[......................................] [100%]
1 task(s), 1 success, 0 fail


--- on the host ---
-bash-4.2# cat test.txt 
20:09:45.333383189
Comment 16 jcallaha 2017-08-28 15:52:03 EDT
Verified in Satellite 6.2.12 Snap 1.

Added a single host to two host collections then ran the below command.

-bash-4.1# hammer job-invocation create --job-template "Run Command - SSH Default" --inputs command='date +"%H:%M:%S.%N" >> /root/test.txt' --search-query "host_collection = coll2"
[Foreman] Password for admin: 
Job invocation 1 created
[..............................................................] [100%]
1 task(s), 1 success, 0 fail

on the target host, it is clear that it only ran once.

[root@ibm-x3250m4-06 ~]# cat test.txt 
15:46:30.231378802

Finally, see attached screenshot for job page.
Comment 17 jcallaha 2017-08-28 15:52 EDT
Created attachment 1319206 [details]
verification screenshot
Comment 25 Adam Price 2017-09-11 11:38 EDT
Created attachment 1324496 [details]
rhel7_hotfix
Comment 26 Adam Price 2017-09-11 11:38 EDT
Created attachment 1324497 [details]
rhel6_hotfix
Comment 27 Adam Price 2017-09-11 11:42:45 EDT
=== HOTFIX INSTRUCTIONS FOR SATELLITE 6.2.11 ONLY ===

1. Download attached hotfix RPM depending on your Satellite host OS version
2. Stop Satellite
  katello-service stop
3. Extract the tarball and install the package
4. Start Satellite
  katello-service start
Comment 28 Adam Price 2017-09-11 11:45:40 EDT
Amendment to 6.2.11 hotfix instructions:

The hotfix RPMs are not archived, so there isn't a tarball to extract in step 3.

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