Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: PE 2016.1.2
- Ruby: 2.1.8
- Distribution: OL6
- Module version: 0.3.0
How to reproduce (e.g Puppet code you use)
We have an Java RPM which installs oracle java. The RPM comes with an alternatives configuration that creats the following alternative_entry (described in puppet)
alternative_entry { '/usr/lib/jvm/java-1.8.0-oracle.x86_64':
ensure => 'present',
altlink => '/usr/lib/jvm/java-oracle',
altname => 'java_sdk_oracle',
priority => '180092',
}
We also have openjdkl and oracle java-1.9 intalled on the system. What I know want to achive is a new alternatives enty which provides me a master link /usr/lib/jvm/java-1.8.0. So I added the following to my manifest:
alternative_entry { '/usr/lib/jvm/java-1.8.0-oracle.x86_64':
ensure => 'present',
altlink => '/usr/lib/jvm/java-1.8.0',
altname => 'java_1.8.0'
priority => '10',
}
What are you seeing
When I run puppet with the manifest I get:
Notice: /Stage[main]/Main/Alternative_entry[/usr/lib/jvm/java-1.8.0-oracle.x86_64]/altname: altname changed 'java_sdk_1.8.0' to 'java_1.8.0'
Notice: /Stage[main]/Main/Alternative_entry[/usr/lib/jvm/java-1.8.0-oracle.x86_64]/priority: priority changed '180092' to '10'
Notice: Applied catalog in 1.46 seconds
So first of all... pupept thought he changed only some values of an already existing entry.
What I see on the system is the expected behaivour:
Pupept called alternatives --install and created a new config in /var/lib/alternatives with the following content:
cat /var/lib/alternatives/java_1.8.0
auto
/usr/lib/jvm/java-1.8.0
/usr/lib/jvm/java-1.8.0-oracle.x86_64
10
alternatives created the master link I was expecting:
[root@dev-sys0-sis-v01 ~]# ls -lisa /usr/lib/jvm/java-1.8.0
4613 0 lrwxrwxrwx 1 root root 28 Aug 16 18:18 /usr/lib/jvm/java-1.8.0 -> /etc/alternatives/java_1.8.0
[root@dev-sys0-sis-v01 ~]# ls -lisa /etc/alternatives/java_1.8.0
269939 0 lrwxrwxrwx 1 root root 37 Aug 16 18:18 /etc/alternatives/java_1.8.0 -> /usr/lib/jvm/java-1.8.0-oracle.x86_64
But after that, on every subsequent run, I run into idempotency issues:
On every pupept run I get:
puppet apply test.2pp
Notice: Compiled catalog for dev-sys0-sis-v01.sf-rz.de in environment production in 0.08 seconds
Notice: /Stage[main]/Main/Alternative_entry[/usr/lib/jvm/java-1.8.0-oracle.x86_64]/altname: altname changed 'java_sdk_1.8.0' to 'java_1.8.0'
Notice: /Stage[main]/Main/Alternative_entry[/usr/lib/jvm/java-1.8.0-oracle.x86_64]/priority: priority changed '180092' to '10'
Notice: Applied catalog in 1.38 seconds
When I do a püppet resource alternative_enty I see my entry with the curretn value:
alternative_entry { '/usr/lib/jvm/java-1.8.0-oracle.x86_64':
ensure => 'present',
altlink => '/usr/lib/jvm/java-1.8.0',
altname => 'java_1.8.0',
priority => '10',
}
What I don't see anymore is the enty that manages the meta link for 'java_sdk_oracle'.
same goes for other entrys that are provided by the system. If I count the total entrys I get from "puppet resource alternative_enty" and the entrys that are available in /var/lib/alternatives, I can see that puppet is missing a lot of entrys.
What behaviour did you expect instead
I would expect the alternative_enty to be idempotent. And A puppet resource alternative_entry should display all alternative groups that are actually configured and not just one for every Path that is configured inside of the entry.
Output log
Any additional information you'd like to impart
What I've seen and discoverd so far, I think the issues I'm seeing is related to ressource keying. alternative_entry uses the path as key, but a path is not a unique value in the sense of alternatives itself. It should use either altlink or altname as key, or am I missing somithing here?
Regards
Raskil