Issue #14399 has been updated by Jacob  McCann.

So this DOES work with the examples above, the issue I'm encountering occurs 
under a slightly more complicated setup.

After rebuilding my system it worked fine on 2.7.9.  The issue is when I 
include oracle_db outside of the ENC (in site.pp based on a fact) and also 
assign oracle_db::hugepages via ENC that it breaks.  The fact was set before 
system rebuild, and not after system rebuild.

So some more code ... a lot of this is stuff I've meant to cleanup but haven't 
so its ugly and I've simplified it a lot to remove case statements ... but I 
think puppet should still allow what I am trying to do to work:

site.pp
<pre>
node default {
  # Main Apps (can not have multiples, each inherits common themselves)
  if $::hostname == 'hostA' {
    include oracle
  }
  
  class { common: }
}
</pre>

oracle/manifests/init.pp:
<pre>
class oracle {
  include oracle_db
}
</pre>

oracle_db files same as in Bug Description above.

So with this on system hostA with oracle_db::hugepages assigned via ENC (and 
from site.pp will include oracle) it FAILS:
<pre>
notice: kernel.shmall:1
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:1]/message:
 defined 'message' as 'kernel.shmall:1'
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: Finished catalog run in 13.16 seconds
</pre>

And on system hostB with oracle_db::hugepages assigned via ENC it WORKS:
<pre>
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: kernel.shmall:2
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:2]/message:
 defined 'message' as 'kernel.shmall:2'
notice: Finished catalog run in 14.80 seconds
</pre>

And also on system hostB with oracle_db and oracle_db::hugepages assigned via 
ENC it WORKS:
<pre>
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: kernel.shmall:2
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:2]/message:
 defined 'message' as 'kernel.shmall:2'
notice: Finished catalog run in 14.83 seconds
</pre>

And also on system hostB with oracle and oracle_db:hugepages assigned via ENC 
it WORKS:
<pre>
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: kernel.shmall:2
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:2]/message:
 defined 'message' as 'kernel.shmall:2'
notice: Finished catalog run in 15.02 seconds
</pre>

Now if I change site.pp to:
<pre>
node default {
  # Main Apps (can not have multiples, each inherits common themselves)
  if $::hostname == 'hostA' {
    include oracle_db
  }
  
  class { common: }
}
</pre>

Then hostA still FAILS:
<pre>
notice: kernel.shmall:1
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:1]/message:
 defined 'message' as 'kernel.shmall:1'
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: Finished catalog run in 13.16 seconds
</pre>

If I change site.pp to:
<pre>
node default {
  # Main Apps (can not have multiples, each inherits common themselves)
  if $::hostname == 'hostA' {
    notify{'site.pp': }
  }
  
  class { common: }
}
</pre>

Then hostA WORKS:
<pre>
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: kernel.shmall:2
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:2]/message:
 defined 'message' as 'kernel.shmall:2'
notice: site.pp
notice: /Stage[main]//Node[default]/Notify[site.pp]/message: defined 'message' 
as 'site.pp'
notice: Finished catalog run in 12.75 seconds
</pre>

This only affects trying to override a define.  'core' types override fine 
under any situation still for me.

Sorry for all the output.  Trying to narrow this down and show as best as I can 
think of how to.  If more information is needed let me know.

Thanks!
----------------------------------------
Bug #14399: Can not override define parameter
https://projects.puppetlabs.com/issues/14399#change-62492

Author: Jacob  McCann
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.14
Keywords: 
Branch: 


When inheriting another class and trying to override a parameter for a define, 
the new value does not get set.

What I am doing:

oracle_db/manifests/init.pp
<pre>
class oracle_db {
      etc_sysctl_conf { 'kernel.shmall':
        value => '1',
      }
}
</pre>

oracle_db/manifests/etc_sysctl_conf.pp
<pre>
define oracle_db::etc_sysctl_conf ( $attr = $name, $value ) {
  notify{"${attr}:${value}": }
}
</pre>

oracle_db/manifests/hugepages.pp
<pre>
class oracle_db::hugepages inherits oracle_db { 
  Oracle_db::Etc_sysctl_conf['kernel.shmall'] { 
    value => '2', 
  } 
  oracle_db::etc_sysctl_conf { "vm.nr_hugepages": 
    value => '3'; 
  } 
}
</pre>

So I am trying to override oracle_db::etc_sysctl_conf['kernel.shmall'] resource 
in oracle_db::hugepages to change value parameter from 1 (set in oracle_db) to 
2.

I then have oracle_db and oracle_db::hugepages assigned to the system via an 
ENC.  I've also tested with just having oracle_db::hugepages assigned via ENC.

The results I get are:
<pre>
notice: kernel.shmall:1
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:1]/message:
 defined 'message' as 'kernel.shmall:1'
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
</pre>

And what I would expect is for kernel.shmall to have a value of 2 instead (the 
following is hand-edited to show what I would expect):
<pre>
notice: kernel.shmall:2
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:2]/message:
 defined 'message' as 'kernel.shmall:2'
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
</pre>

Complete output from a run:
<pre>
hostA:~ # puppet agent --test 
info: Retrieving plugin
info: Loading facts in usps_bu_eth
info: Loading facts in usps_puppet_db_server
info: Loading facts in usps_syslog_client_ip
info: Loading facts in usps_puppet_master_host
info: Loading facts in hcs_service
info: Loading facts in packages
info: Loading facts in usps_patch_bundle
info: Loading facts in usps_bu_net_zone
info: Loading facts in memorysize
info: Loading facts in usps_puppet_basedir
info: Loading facts in usps_os_dist
info: Loading facts in usps_is_dmz
info: Loading facts in network
info: Loading facts in usps_os_version
info: Loading facts in jumpver_facts
info: Loading facts in usps_bu_macaddress
info: Loading facts in usps_patch_repo
info: Loading facts in usps_public_int
info: Loading facts in usps_patch_status
info: Loading facts in concat_basedir
info: Loading facts in usps_bu_int
info: Loading facts in usps_is_ctm_server
info: Loading facts in usps_is_puppet_master
info: Loading facts in usps_puppet_env
info: Loading facts in usps_puppet_ca_server
info: Loading facts in usps_puppet_report_server
info: Loading facts in usps_bu_net
info: Loading facts in usps_puppet_is_ca
info: Loading facts in usps_bu_ip
info: Loading facts in usps_patch_env
info: Loading facts in usps_bootloader
info: Loading facts in usps_patch_date
info: Loading facts in usps_bu_eth
info: Loading facts in usps_puppet_db_server
info: Loading facts in usps_syslog_client_ip
info: Loading facts in usps_puppet_master_host
info: Loading facts in hcs_service
info: Loading facts in packages
info: Loading facts in usps_patch_bundle
info: Loading facts in usps_bu_net_zone
info: Loading facts in memorysize
info: Loading facts in usps_puppet_basedir
info: Loading facts in usps_os_dist
info: Loading facts in usps_is_dmz
info: Loading facts in network
info: Loading facts in usps_os_version
info: Loading facts in jumpver_facts
info: Loading facts in usps_bu_macaddress
info: Loading facts in usps_patch_repo
info: Loading facts in usps_public_int
info: Loading facts in usps_patch_status
info: Loading facts in concat_basedir
info: Loading facts in usps_bu_int
info: Loading facts in usps_is_ctm_server
info: Loading facts in usps_is_puppet_master
info: Loading facts in usps_puppet_env
info: Loading facts in usps_puppet_ca_server
info: Loading facts in usps_puppet_report_server
info: Loading facts in usps_bu_net
info: Loading facts in usps_puppet_is_ca
info: Loading facts in usps_bu_ip
info: Loading facts in usps_patch_env
info: Loading facts in usps_bootloader
info: Loading facts in usps_patch_date
Could not retrieve macaddress_eth2: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth3: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth8: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth9: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth12: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth13: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth14: undefined method `[]' for nil:NilClass
Could not retrieve macaddress_eth15: undefined method `[]' for nil:NilClass
info: Caching catalog for hostA
info: Applying configuration version '1336591539'
notice: kernel.shmall:1
notice: 
/Stage[main]/Oracle_db/Oracle_db::Etc_sysctl_conf[kernel.shmall]/Notify[kernel.shmall:1]/message:
 defined 'message' as 'kernel.shmall:1'
notice: vm.nr_hugepages:3
notice: 
/Stage[main]/Oracle_db::Hugepages/Oracle_db::Etc_sysctl_conf[vm.nr_hugepages]/Notify[vm.nr_hugepages:3]/message:
 defined 'message' as 'vm.nr_hugepages:3'
notice: Finished catalog run in 17.88 seconds
</pre>

This has been tested using 2.7.9 and 2.7.14.

Some discussion on this in @ <a 
href='https://groups.google.com/forum/?fromgroups#!topic/puppet-users/buQxiN6Hlj4'>https://groups.google.com/forum/?fromgroups#!topic/puppet-users/buQxiN6Hlj4</a>


-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to