Skip to content
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 two host entries; Entries are getting combined into one line on the first run, then properly inserted in the second run #101

Closed
jberry opened this issue May 14, 2014 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@jberry
Copy link

jberry commented May 14, 2014

See output below. Trying to add two entries. First run of puppet combines the entries into one /etc/hosts line. Second run properly cleans up /etc/hosts and puts them as two lines. Issue also happens even when both host entries are not coming from the same class, or even the same module. (On another setup, I had 3 host entries specified throughout the environment, and all 3 were combined into one line. Took 2 more puppet runs for it to be clean)

####CLASS###
class requiredhostsentries{

  host{"managementhost2.private.com":
    ensure => present,
    ip => "192.168.10.12",
    host_aliases => ["managementhost2"],
    provider => augeas,
  }

  host{"myrepohost1.private.com":
    ensure => present,
    ip => "192.168.10.192",
    host_aliases => ["myrepohost1"],
    provider => augeas,
  }
}
#####END OF CLASS#####
###PUPPET RUNS###

[root@clientbox40 ~]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
<snip misc stuff>
Info: Applying configuration version '1400087970'
Notice: /Stage[main]/Required::Required_fmi/Host[managementhost.private.com]/ensure: created
Notice: /Stage[main]/Required::Required_fmi/Host[myrepohost1.private.com]/ensure: created
Notice: Finished catalog run in 7.00 seconds

[root@clientbox40 ~]# cat /etc/hosts
<snip unrelevant hosts>
192.168.10.192  myrepohost1.private.com managementhost2 myrepohost1
<eof>

######Next Run of Puppet######
[root@clientbox40 ~]# puppet agent --test
<snip misc stuff>
Info: Applying configuration version '1400087970'
Notice: /Stage[main]/Required::Required_fmi/Host[managementhost.private.com]/ensure: created
Notice: /Stage[main]/Required::Required_fmi/Host[myrepohost1.private.com]/host_aliases: host_aliases changed 'managementhost2 myrepohost1' to 'myrepohost1'
Notice: Finished catalog run in 6.77 seconds

[root@clientbox40 ~]# cat /etc/hosts
<snip unrelevant hosts>
192.168.10.192  myrepohost1.private.com myrepohost1
192.168.10.12   managementhost2.private.com managementhost2

 ####Information###

Versions of software/modules:
Puppet 3.5.1-1
Foreman 1.5.0-1
Augeasproviders 1.1.0, pulled from git://github.com/hercules-team/augeasproviders

@jberry jberry changed the title Adding two host entries in one class; Entries are getting combined into one line on the first run, then properly inserted in the second run Adding two host entries; Entries are getting combined into one line on the first run, then properly inserted in the second run May 14, 2014
@domcleal domcleal self-assigned this May 14, 2014
@raphink
Copy link
Member

raphink commented Jun 2, 2014

This bug was introduced by commit 7808760 which shares an Augeas handler for Puppet >= 3.4.

@raphink raphink added the bug label Jun 2, 2014
@raphink raphink assigned raphink and unassigned domcleal Jun 2, 2014
domcleal pushed a commit to domcleal/augeasproviders that referenced this issue Jun 2, 2014
* pg_hba test failures
* mailalias test failures
  (probably shouldn't assume order of resource exec)

Fixes voxpupuli#101
@domcleal
Copy link
Contributor

domcleal commented Jun 2, 2014

@raphink fyi, I have a WIP branch here to fix it, but it's not quite done... https://github.com/domcleal/augeasproviders/tree/101-seq-shared

@raphink
Copy link
Member

raphink commented Jun 2, 2014

Ah great. I hadn't seen how using the 01 trick would be problematic when sharing the handler! We should probably provide a helper in the lib for that, as it may occur in quite a few providers.

@domcleal
Copy link
Contributor

domcleal commented Jun 2, 2014

Yeah, a helper to work out the correct seq number based on the current in-memory tree was the way I was going with the fix.

@raphink
Copy link
Member

raphink commented Jun 2, 2014

This bug is really problematic. We should probably port is to 1.X and release a bug fix.

@raphink
Copy link
Member

raphink commented Jun 3, 2014

PR #107 fixes this issue.

@raphink
Copy link
Member

raphink commented Jun 3, 2014

Fixed in cb07321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants