Issue #21186 has been updated by Charlie Sharpsteen.

Description updated
Status changed from Unreviewed to Needs More Information
Assignee set to Ti Leggett

> No matter what it thinks it should install the JDK package even though the 
> parameter is set to false.

Hi Ti,

I see from the linked discussion on Google Groups that your `params.pp` file 
looks like this:

<pre>
class java::params ( 
    $parameters = hiera_hash('java', []), 
) { 
    case $::osfamily { 
        'Debian': { 
            $openjdk_6_jdk = ['openjdk-6-jdk'] 
            $openjdk_6_jre = ['openjdk-6-jre'] 
            $openjdk_7_jdk = ['openjdk-7-jdk'] 
            $openjdk_7_jre = ['openjdk-7-jre'] 
            $sum_6_jdk = ['sun-java6-jdk'] 
            $sun_6_jre = ['sun-java6-jre'] 
        } 
        'RedHat': { 
            $openjdk_6_jdk = ['java-1.6.0-openjdk'] 
            $openjdk_6_jre = ['java-1.6.0-openjdk-devel'] 
            $openjdk_7_jdk = ['java-1.7.0-openjdk'] 
            $openjdk_7_jre = ['java-1.7.0-openjdk-devel'] 
        } 
        default: { 
            fail("Unsupported platform: $osfamily") 
        } 
    } 
} 
</pre>

I also see the following output from what appears to be a `--noop` run:

<pre>
Info: Applying configuration version '1370635086' 
Notice: /Stage[main]/Java::Install/Notify[enable_v7]/message: current_value 
absent, should be Key (noop) 
Notice: /Stage[main]/Java::Install/Notify[enable_v6]/message: current_value 
absent, should be Key (noop) 
Notice: /Stage[main]/Java::Install/Notify[sun]/message: current_value absent, 
should be Key (noop) 
Notice: /Stage[main]/Java::Install/Notify[openjdk]/message: current_value 
absent, should be Key (noop) 
Notice: /Stage[main]/Java::Install/Package[java-1.6.0-openjdk-devel]/ensure: 
current_value absent, should be latest (noop) 
Notice: /Stage[main]/Java::Install/Notify[It is a hash]/message: current_value 
absent, should be It is a hash (noop) 
Notice: /Stage[main]/Java::Install/Notify[enable_jdk]/message: current_value 
absent, should be Key (noop) 
Notice: Class[Java::Install]: Would have triggered 'refresh' from 7 events 
Notice: Finished catalog run in 27.52 seconds 
</pre>

It looks like the run would have installed a package named 
`java-1.6.0-openjdk-devel`, which leads me to believe you are running this 
agent on a RedHat sysystem. Looking back at the params file, 
`java-1.6.0-openjdk-devel` is assigned to the value of 
`$java::params::openjdk_6_jre` --- which is not the variable guarded by the `if 
$parameters['enable_jdk']` statement.

At first glance, this code appears to be functioning as intended---nothing 
inside the JDK branch is being executed. What output were you expecting?

----------------------------------------
Bug #21186: Hiera YAML False Bug
https://projects.puppetlabs.com/issues/21186#change-92733

* Author: Ti Leggett
* Status: Needs More Information
* Priority: Normal
* Assignee: Ti Leggett
* Category: 
* Target version: 
* Affected Puppet version: 3.2.1
* Keywords: Hiera YAML boolean
* Branch: 
----------------------------------------
It seems puppet thinks that variables evaluate to true even when they are 
explicitly set to false in hiera YAML.

In my searching it seems like this should be fixed but with hiera 1.2.1 and 
puppet 3.2.1 I'm still seeing this.

In my YAML I have:

<pre>
# Java directives
java :
   enable_jdk : false # Install the JDK as well as the JRE
   enable_v6  : true  # Install Java 6
   enable_v7  : false # Install Java 7
   openjdk    : true  # Install OpenJDK
   sun        : false # Install Sun
</pre>

And in one of my manifests I do something like:

<pre>
class java::install (
   $parameters = hiera('java', []),
) { 
   if $parameters['openjdk'] == true {
       if $parameters['enable_v6'] == true and $java::params::openjdk_6_jre {
           package { $java::params::openjdk_6_jre:
               ensure => latest,
           }
           if $parameters['enable_jdk'] == true and 
$java::params::openjdk_6_jdk {
               package { $java::params::openjdk_6_jdk:
                   ensure => latest,
               }
           }
       }
…
</pre>

No matter what it thinks it should install the JDK package even though the 
parameter is set to false. I've tried setting it 0, False, n, and N and it 
always evaluates to true. Is this a known bug and if so is there a workaround?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to