On Wednesday, November 21, 2012 7:56:45 AM UTC-6, llowder wrote:
>
>
>
> On Tuesday, November 20, 2012 4:45:59 PM UTC-6, Andy Parker wrote:
>>
>> On Tue, Nov 20, 2012 at 2:31 PM, llowder <[email protected]> wrote:
>>
>>> I'm currently working on trying to track down #1372 [1]. Somewhat new to 
>>> this process as well.
>>>
>>>
>> Oh, I just remember this: update the bug to "Investigating" and assign it 
>> to yourself.
>>
>
> I'm able to assign it to myself, but I am listed as a "reporter" on the 
> project page, and "Investigating" does not show up in the list of statuses 
> I am able to set.
>  
>
>>  
>>
>>> I currently have a series of tests that show and explain the current 
>>> behavior, to define the edges of this bug.[2]
>>> The tests are mostly done, though I am adding an additional set to show 
>>> what happens when an ENC is used.
>>>
>>> Once these are done, I am not entirely sure what my next step is, though 
>>> I would guess it has to do with using irb or pry to trace the code and see 
>>> what happens.
>>>
>>>
>> Yeah, this is where things can start getting a little more difficult :) I 
>> would suggest using pry or ruby-debug or even just puts statements and 
>> running a failing test case. Starting in the include function would 
>> probably be a good place. Figure out what include is doing that doesn't 
>> look right.
>>
>> You can also do some inspection by comparing what happens with "class { 
>> foo: }" vs. "include foo". Why are those two different? That might point to 
>> the problem as well.
>>
>> Once you figure that out, then try to figure out a fix to the design so 
>> that this kind of problem is unlikely to occur again. In this case I 
>> suspect it will be getting rid of some duplication.
>>
>

I added some puts as suggested, and I think I know why it works in some 
cases but not others.  But I don't know how to fix and I think any changes 
would likely be far reaching.

"include" is designed to be safe to use multiple times. You can put 
"include foo" as many times as you want in a manifest or node scope, and it 
will only ever get included once.

The parametrized class  syntax can be used once and only once per node 
scope.

In IRC the other day someone made the comment about nodes getting loaded as 
classes. That came to mind this morning so I added some puts to the 
compiler to supplement what I had in the include function.

in the "add_class" method of the compiler I added:

  puts "Added class '#{name}' to the catalog"

Using a simple manifest,

node ubuntu {
  $var = 'This is the node var'
  notify { 'nodenotify': message => $var, }
  notice( "(node) var is '${::ubuntu::var}'" )
}

I noticed the following outputs:

Added class 'settings' to the catalog
Added class '' to the catalog
Added class 'ubuntu' to the catalog
notice: Scope(Node[ubuntu]): (node) var is 'This is the node var'
info: Applying configuration version '1353510049'
notice: This is the node var
notice: /Stage[main]//Node[ubuntu]/Notify[nodenotify]/message: defined 
'message' as 'This is the node var'
notice: Finished catalog run in 0.02 seconds

When I add in a class named 'ubuntu' using param syntax the line "Added 
class 'ubuntu' to the catalog" appears twice.

bugtest.pp contents:

node ubuntu {
  class { 'ubuntu': }
#  include ubuntu
  $var = 'This is the node var'
  notify { 'nodenotify': message => $var, }
  notice( "(node) var is '${::ubuntu::var}'" )
}

class ubuntu {
  $var = 'This is the class var'
  notify { 'classnotify': message => $var, }
  notice( "(class) ubuntu::var is '${::ubuntu::var}'" )
}
puppet apply --verbose bugtest.pp :

Could not retrieve arp_lo: undefined method `get_arp_value' for 
Facter::Util::IP:Module
Could not retrieve arp_eth0: undefined method `get_arp_value' for 
Facter::Util::IP:Module
Added class 'settings' to the catalog
Added class '' to the catalog
Added class 'ubuntu' to the catalog
notice: Scope(Node[ubuntu]): (node) var is 'This is the node var'
Added class 'ubuntu' to the catalog
notice: Scope(Class[Ubuntu]): (class) ubuntu::var is 'This is the class var'
info: Applying configuration version '1353510226'
notice: This is the node var
notice: /Stage[main]//Node[ubuntu]/Notify[nodenotify]/message: defined 
'message' as 'This is the node var'
notice: This is the class var
notice: /Stage[main]/Ubuntu/Notify[classnotify]/message: defined 'message' 
as 'This is the class var'
notice: Finished catalog run in 0.02 seconds

So this tells me that when used with "node ubuntu" or "node /ubuntu/" 
"include" is seeing that there is already a Class['ubuntu'] loaded and then 
not loading the actual class.

I'm unsure how to fix this - but I do know there needs to be some serious 
thought given to how to approach this.

Should nodes be treated as classes?
Should it be allowed to have classes and nodes share a name? (From a user 
standpoint, these appear to be separate resource types so it logically it 
should be allowed)

Comments / thoughts very welcome.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-dev/-/ETv7q2rmGn4J.
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-dev?hl=en.

Reply via email to