# Timing issue, installing a package and then modifying one of it's files...

**URL:** <https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699>\
**Category:** Ansible Project\
**Created:** [March 4, 2014, 6:54pm UTC](https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699 "2014-03-04T18:54:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [March 4, 2014, 6:54pm UTC](https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699/1 "2014-03-04T18:54:27Z")

</div>

I have come across an unusual timing issue… I’m not sure what is causing it but it is repeatable…

Here is a single task file from part of my initial set up… (I’ve removed the AIX and 32 bit variants but they are interspersed with the 64 bit RedHat version.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 4, 2014, 7:04pm UTC](https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699/2 "2014-03-04T19:04:43Z")

</div>

Do you think there’s a background process spawned by sysstat that is modifying it’s own cron job?

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [March 4, 2014, 9:13pm UTC](https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699/3 "2014-03-04T21:13:46Z")

</div>

If there is it’s fast enough that yum install sysstat && cat /etc/cron.d/sysstat gives me the results that I expect. It looks like the sysstat package includes a default /etc/cron.d/sysstat file that doesn’t appear to change at any point.

I’m rather confused by this, unless the install task is returning before it’s finished and I don’t know why that would happen.

Adam

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [March 4, 2014, 9:35pm UTC](https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699/4 "2014-03-04T21:35:20Z")

</div>

Running yum manually with rpmverbosity set to debug I can see that the /etc/cron.d/sysstat file is the first one that is deployed from the RPM and the only script appears to be a postinstall script that runs chkconfig.

I’m trying a run with -vvv and dumping it to a file to see if I can see exactly where the issue lies.

Adam

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [March 10, 2014, 10:21pm UTC](https://forum.ansible.com/t/timing-issue-installing-a-package-and-then-modifying-one-of-its-files/14699/5 "2014-03-10T22:21:40Z")

</div>

My stupidity was at fault…

There is originally a commented out line in the file that ALSO matches the regexp I was using. So, my change was made to the second of two matching lines and not the first… Kind of confusing when using insertbefore…

So I have…

example line 1

# line 2 example

and using line in file I insert “#ansible test” before “line” and it gets put in between lines 1 and 2. i.e. after line 1 and before line 2.

thus I end up with

example line 1  
#ansible test

# line 2 example

and not

#ansible test  
example line 1

# line 2 example

as I was expecting… that behaviour is clearly documented for regexp but it might be worth adding a note to “insertbefore” that it will insert before the LAST line that matches the regexp.

Adam
