Re: [Puppet Users] variables with no value

2010-12-19 Thread Stefan Schulte
On Fri, Dec 10, 2010 at 11:31:18AM +0100, Arnau Bria wrote:
 Hi all,
 
 We'd like to share a class, and do something like:
 
 class common_defaults {
 [...]
  user { 'root':
ensure  = present,
password= $root_password ? {
   'serviceA'= 'passwdA',
   default   = 'passwdB',
  },
 [...]
 }
 
 $root_passwd  only has value if someone has defined it. So, i.e:
 
 nodes.pp 
 nodea {
   $root_passwd=serviceA
   include common_defaults
 }
 
 nodeb {
   include common_defaults
 }
 

Maybe its just a typo in your mail, but you set $root_passwd and test
$root_password.

 When I run the client in nodeb, and add a notify of root_password, I see
 that nodeb's root_password has a value and it's serviceA!?!?

This can happen when you have set the var in top scope (nodes.pp
directly or in site.pp) or you have some missing bracket somewhere and
your nodedefinition still works magically while scope is totally mixed up
(happened to me a few times)

-Stefan


pgpO3eYLkW4Qd.pgp
Description: PGP signature


Re: [Puppet Users] variables with no value

2010-12-19 Thread Arnau Bria
On Sun, 19 Dec 2010 16:57:06 +0100
Stefan Schulte wrote:

 On Fri, Dec 10, 2010 at 11:31:18AM +0100, Arnau Bria wrote:
  Hi all,
Hi,

  When I run the client in nodeb, and add a notify of root_password,
  I see that nodeb's root_password has a value and it's serviceA!?!?
 
 This can happen when you have set the var in top scope (nodes.pp
 directly or in site.pp) or you have some missing bracket somewhere and
 your nodedefinition still works magically while scope is totally
 mixed up (happened to me a few times)
that was what happened. Someone defined it at node's top, and it
became a global defined var.
 
 -Stefan
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] variables with no value

2010-12-10 Thread Arnau Bria
Hi all,

We'd like to share a class, and do something like:

class common_defaults {
[...]
 user { 'root':
   ensure  = present,
   password= $root_password ? {
  'serviceA'= 'passwdA',
  default   = 'passwdB',
 },
[...]
}

$root_passwd  only has value if someone has defined it. So, i.e:

nodes.pp 
nodea {
$root_passwd=serviceA
include common_defaults
}

nodeb {
include common_defaults
}


so, we'd like nodea to has passwdA and nodeb to have the default value
passwdB. I've tried with default and '' empty var, but I does not works
neither.

When I run the client in nodeb, and add a notify of root_password, I see
that nodeb's root_password has a value and it's serviceA!?!?

I'm quite lost here, I've been reading variable scope section in
puppet's doc, but it talks about class inheritance, not class
including. I don't understand why the var has a value, I've not found
any ref about value of not defined varibales.

Could anyone give a hand on this?

TIA,
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] variables with no value

2010-12-10 Thread Felix Frank
 nodes.pp 
 nodea {
   $root_passwd=serviceA
   include common_defaults
 }
 
 nodeb {
   include common_defaults
 }

Hi,

could you be a little less cryptic about the node definitions? (I
understand there may be privacy issues, but the above is censored too
drastically.)

Is it possible they overlap in some way?

Cheers,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] variables with no value

2010-12-10 Thread Arnau Bria
On Fri, 10 Dec 2010 11:43:59 +0100
Felix Frank wrote:

  nodes.pp 
  nodea {
  $root_passwd=serviceA
  include common_defaults
  }
  
  nodeb {
  include common_defaults
  }
 
 Hi,
Hi,
 
 could you be a little less cryptic about the node definitions? (I
 understand there may be privacy issues, but the above is censored too
 drastically.) 
 Is it possible they overlap in some way?

Each node has its own classes, and they share 3, but only one
(that one) has a variable. So, each node have other includes,
but they don't overlap, diff services, diff classes.

We could simply as my previously example.
is the selctor correct?

   password= $root_password ? {
  'serviceA'= 'passwdA',
  default   = 'passwdB',
 },

I mean, the default has any sense? if not default but ''? 
because if that selcetor should work, the problem is somewhere else and
we must carefully check our includes.

 Cheers,
 Felix
Cheers,
Arnau 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] variables with no value

2010-12-10 Thread Felix Frank

 We could simply as my previously example.
 is the selctor correct?
 
password= $root_password ? {
   'serviceA'= 'passwdA',
   default   = 'passwdB',
  },
 
 I mean, the default has any sense? if not default but ''? 
 because if that selcetor should work, the problem is somewhere else and
 we must carefully check our includes.

The selector looks fine. You stated that your notify showed that nodeB
uses a variable value it should not use.

Break the manifests down to the most simple subset that shows this
misbehaviour, then post that. (But you will probably stumble upon an
error in the process, anyway.)

Cheers,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] variables with no value

2010-12-10 Thread Arnau Bria
On Fri, 10 Dec 2010 12:33:39 +0100
Felix Frank wrote:

 
  We could simply as my previously example.
  is the selctor correct?
  
 password= $root_password ? {
'serviceA'= 'passwdA',
default   = 'passwdB',
   },
  
  I mean, the default has any sense? if not default but ''? 
  because if that selcetor should work, the problem is somewhere else
  and we must carefully check our includes.
 
 The selector looks fine. 
Ok.

 You stated that your notify showed that nodeB
 uses a variable value it should not use.

Yep. But I thought that it could be caused by the selector, cause it's
my first one where default covers non-defined var case.
 
 Break the manifests down to the most simple subset that shows this
 misbehaviour, then post that. (But you will probably stumble upon an
 error in the process, anyway.)

Yep, I'll try the simplest example in my test server and come back.

 Cheers,
 Felix
Many thanks for your reply.
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.