Issue #12567 has been updated by Chris Price. Assignee deleted (Chris Price)
---------------------------------------- Bug #12567: Class parameter default values are evaluated in a seemingly random order https://projects.puppetlabs.com/issues/12567#change-65079 Author: Ben Marcotte Status: Accepted Priority: High Assignee: Category: parameterized classes Target version: 3.x Affected Puppet version: 2.7.9 Keywords: Branch: Current puppet syntax allows the default value of one class parameter to be set using the value of another class parameter. However, the order in which the parameters are evaluated appears to be somewhat random. Given the following class: class foo( $foo_root = '/var/foo', $a_path = "${foo_root}/a", $b_path = "${foo_root}/b", $c_path = "${foo_root}/c", $d_path = "${foo_root}/d", $e_path = "${foo_root}/e", $f_path = "${foo_root}/f", $g_path = "${foo_root}/g", $h_path = "${foo_root}/h", $i_path = "${foo_root}/i", $j_path = "${foo_root}/j", $k_path = "${foo_root}/k", $l_path = "${foo_root}/l", $m_path = "${foo_root}/m", $n_path = "${foo_root}/n", $o_path = "${foo_root}/o", $p_path = "${foo_root}/p", $q_path = "${foo_root}/q", $r_path = "${foo_root}/r", $s_path = "${foo_root}/s", $t_path = "${foo_root}/t", $u_path = "${foo_root}/u", $v_path = "${foo_root}/v", $w_path = "${foo_root}/w", $x_path = "${foo_root}/x", $y_path = "${foo_root}/y", $z_path = "${foo_root}/z", ) { notify{ "foo_root = '${foo_root}'": } notify{ "a_path = '${a_path}'": } notify{ "b_path = '${b_path}'": } notify{ "c_path = '${c_path}'": } notify{ "d_path = '${d_path}'": } notify{ "e_path = '${e_path}'": } notify{ "f_path = '${f_path}'": } notify{ "g_path = '${g_path}'": } notify{ "h_path = '${h_path}'": } notify{ "i_path = '${i_path}'": } notify{ "j_path = '${j_path}'": } notify{ "k_path = '${k_path}'": } notify{ "l_path = '${l_path}'": } notify{ "m_path = '${m_path}'": } notify{ "n_path = '${n_path}'": } notify{ "o_path = '${o_path}'": } notify{ "p_path = '${p_path}'": } notify{ "q_path = '${q_path}'": } notify{ "r_path = '${r_path}'": } notify{ "s_path = '${s_path}'": } notify{ "t_path = '${t_path}'": } notify{ "u_path = '${u_path}'": } notify{ "v_path = '${v_path}'": } notify{ "w_path = '${w_path}'": } notify{ "x_path = '${x_path}'": } notify{ "y_path = '${y_path}'": } notify{ "z_path = '${z_path}'": } } I get the following output in a test run: info: Applying configuration version '1328902697' notice: /Stage[main]/Foo/Notify[s_path = '/var/foo/s']/message: current_value absent, should be s_path = '/var/foo/s' (noop) notice: /Stage[main]/Foo/Notify[foo_root = '/var/foo']/message: current_value absent, should be foo_root = '/var/foo' (noop) notice: /Stage[main]/Foo/Notify[l_path = '/l']/message: current_value absent, should be l_path = '/l' (noop) notice: /Stage[main]/Foo/Notify[d_path = '/d']/message: current_value absent, should be d_path = '/d' (noop) notice: /Stage[main]/Foo/Notify[n_path = '/n']/message: current_value absent, should be n_path = '/n' (noop) notice: /Stage[main]/Foo/Notify[q_path = '/q']/message: current_value absent, should be q_path = '/q' (noop) notice: /Stage[main]/Foo/Notify[y_path = '/y']/message: current_value absent, should be y_path = '/y' (noop) notice: /Stage[main]/Foo/Notify[o_path = '/var/foo/o']/message: current_value absent, should be o_path = '/var/foo/o' (noop) notice: /Stage[main]/Foo/Notify[a_path = '/a']/message: current_value absent, should be a_path = '/a' (noop) notice: /Stage[main]/Foo/Notify[e_path = '/e']/message: current_value absent, should be e_path = '/e' (noop) notice: /Stage[main]/Foo/Notify[t_path = '/t']/message: current_value absent, should be t_path = '/t' (noop) notice: /Stage[main]/Foo/Notify[f_path = '/f']/message: current_value absent, should be f_path = '/f' (noop) notice: /Stage[main]/Foo/Notify[j_path = '/j']/message: current_value absent, should be j_path = '/j' (noop) notice: /Stage[main]/Foo/Notify[m_path = '/m']/message: current_value absent, should be m_path = '/m' (noop) notice: /Stage[main]/Foo/Notify[z_path = '/var/foo/z']/message: current_value absent, should be z_path = '/var/foo/z' (noop) notice: /Stage[main]/Foo/Notify[r_path = '/r']/message: current_value absent, should be r_path = '/r' (noop) notice: /Stage[main]/Foo/Notify[c_path = '/c']/message: current_value absent, should be c_path = '/c' (noop) notice: /Stage[main]/Foo/Notify[w_path = '/w']/message: current_value absent, should be w_path = '/w' (noop) notice: /Stage[main]/Foo/Notify[h_path = '/var/foo/h']/message: current_value absent, should be h_path = '/var/foo/h' (noop) notice: /Stage[main]/Foo/Notify[u_path = '/u']/message: current_value absent, should be u_path = '/u' (noop) notice: /Stage[main]/Foo/Notify[i_path = '/i']/message: current_value absent, should be i_path = '/i' (noop) notice: /Stage[main]/Foo/Notify[v_path = '/v']/message: current_value absent, should be v_path = '/v' (noop) notice: /Stage[main]/Foo/Notify[k_path = '/k']/message: current_value absent, should be k_path = '/k' (noop) notice: /Stage[main]/Foo/Notify[g_path = '/g']/message: current_value absent, should be g_path = '/g' (noop) notice: /Stage[main]/Foo/Notify[p_path = '/p']/message: current_value absent, should be p_path = '/p' (noop) notice: /Stage[main]/Foo/Notify[x_path = '/x']/message: current_value absent, should be x_path = '/x' (noop) notice: /Stage[main]/Foo/Notify[b_path = '/b']/message: current_value absent, should be b_path = '/b' (noop) notice: Class[Foo]: Would have triggered 'refresh' from 27 events notice: Stage[main]: Would have triggered 'refresh' from 1 events notice: Finished catalog run in 0.16 seconds So, even though all of the parameters that depend of $foo_root are listed after its default has been set, only 4 out of 26 of the latter variables get a value based on $foo_root's default. I expected that parameter values would be evaluated in the order in which they appear in the class declaration. This issue came up while trying to convert a number of modules away from using global variables to override defaults in advance of globals being deprecated in 2.8. Not being able to write parameterized classes of the style above will hinder that conversion process and our ability to be ready for that deprecation. -- 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.
