Re: [Puppet Users] Syntax of a class reference in Hiera

2019-03-13 Thread Stephen Kenny

We're running Puppet 6 (server and agents), so I will file that ticket 
today.
Many thanks for the clarification.

Stephen


On Tuesday, 12 March 2019 18:42:01 UTC, Henrik Lindberg wrote:
>
>
> These two lines are very different: 
>
>before => Class['nfs'] 
>before: 'Class[nfs]' 
>
> The first is a real data type - a reference to a Class with the title 
> (i.e. name of class) 'nfs'. The second is a String that is interpreted / 
> parsed by the processing for the "before" meta parameter. Apparently it 
> does not get it quite right. Please file a ticket in Puppet's JIRA for 
> the PUP project. 
>
 

>
> Before doing this though, if you are on an older version this may have 
> been fixed already as the problem sounds vaguely familiar, so please try 
> on at least a 5.x version of puppet.  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a7aef028-b71e-43a6-a821-dc361e221de2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax of a class reference in Hiera

2019-03-12 Thread Henrik Lindberg

On 2019-03-12 18:09, Stephen Kenny wrote:


I want to create a directory that will contain NFS mount points.  
Therefore, it makes
sense to have it in place before any of the NFS-related Puppet stuff.  I 
can do it

in either of two ways.

1. In a manifest, with a regular file resource, which contains the line

           before => Class['nfs'],

No problem there.

2. If I try to do this via a lookup of equivalent Hiera data, I see
     something unusual - or maybe just something I don't understand 
properly.


If my Hiera data looks like this:

  '/primary':
     ensure: 'directory'
     mode:   '0755'
     owner: 'root'
     group: 'root'
     before: 'Class[nfs]'

  - I get an error when I run the agent on the node: "Server Error: 
Invalid relationship:
File[/primary] { before => Class[nfs] }, because Class[nfs] doesn't seem 
to be in the catalog".


But if I change "nfs" to "Nfs" - i.e .capitalize the first letter of the 
class *name*,

it works.

I get that resource references should always be capitalized
(require => File['/etc/sysctl.d/recommended.conf']  and so on), but what 
is going on with
the necessity for capitalizing the resource _name_ - "Nfs" in my example 
- when

trying to accomplish the job via lookup and Hiera?

Thanks for any enlightenment,


These two lines are very different:

  before => Class['nfs']
  before: 'Class[nfs]'

The first is a real data type - a reference to a Class with the title 
(i.e. name of class) 'nfs'. The second is a String that is interpreted / 
parsed by the processing for the "before" meta parameter. Apparently it 
does not get it quite right. Please file a ticket in Puppet's JIRA for 
the PUP project.


Before doing this though, if you are on an older version this may have 
been fixed already as the problem sounds vaguely familiar, so please try 
on at least a 5.x version of puppet.


best
- henrik



Stephen Kenny
School of Computer Science
Trinity College
Dublin
Ireland

--
You received this message because you are subscribed to the Google 
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to puppet-users+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2f41b686-c41c-470f-a8a4-be07d1f5f854%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/q68uhc%2486aq%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Syntax of a class reference in Hiera

2019-03-12 Thread Stephen Kenny

I want to create a directory that will contain NFS mount points.  
Therefore, it makes
sense to have it in place before any of the NFS-related Puppet stuff.  I 
can do it
in either of two ways.

1. In a manifest, with a regular file resource, which contains the line

  before => Class['nfs'],

No problem there.   

2. If I try to do this via a lookup of equivalent Hiera data, I see
something unusual - or maybe just something I don't understand properly.

If my Hiera data looks like this:

 '/primary':
ensure: 'directory'
mode:   '0755'
owner: 'root'
group: 'root' 
before: 'Class[nfs]'

 - I get an error when I run the agent on the node: "Server Error: Invalid 
relationship: 
File[/primary] { before => Class[nfs] }, because Class[nfs] doesn't seem to 
be in the catalog".

But if I change "nfs" to "Nfs" - i.e .capitalize the first letter of the 
class *name*,
it works.

I get that resource references should always be capitalized
(require => File['/etc/sysctl.d/recommended.conf']  and so on), but what is 
going on with
the necessity for capitalizing the resource _name_ - "Nfs" in my example - 
when
trying to accomplish the job via lookup and Hiera?

Thanks for any enlightenment,

Stephen Kenny
School of Computer Science
Trinity College
Dublin 
Ireland

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2f41b686-c41c-470f-a8a4-be07d1f5f854%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] syntax issue over puppet_4

2017-02-22 Thread Ren
yeah you absolutely right ! thank you.  now it works.  
am still discovering puppet. 

Le mercredi 22 février 2017 15:29:54 UTC+1, Dirk Heinrichs a écrit :
>
> Am 22.02.2017 um 14:28 schrieb Ren:
>
> *Error: Failed to apply catalog: Could not find dependency 
> Package[openssh-server] for File[/etc/ssh/sshd_config] at   
> modules/sshd/manifests/init.pp:14*
>
>
> It's not declared (package {$ssh_pkg: ...}). Wondering why it worked in 
> P3...
>
> Bye...
>
> Dirk
> -- 
> *Dirk Heinrichs*
> Senior Systems Engineer, Delivery Pipeline
> OpenTextTM Discovery | Recommind
> *Email*: dirk.he...@recommind.com 
> *Website*: www.recommind.de
>
> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
>
> Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon 
> Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 
> 10646
>
> This e-mail may contain confidential and/or privileged information. If you 
> are not the intended recipient (or have received this e-mail in error) 
> please notify the sender immediately and destroy this e-mail. Any 
> unauthorized copying, disclosure or distribution of the material in this 
> e-mail is strictly forbidden
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte 
> Weitergabe dieser Mail sind nicht gestattet.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/10e0a47a-62b1-4540-9bbc-76da53d0a17f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] syntax issue over puppet_4

2017-02-22 Thread Dirk Heinrichs
Am 22.02.2017 um 14:28 schrieb Ren:

> *Error: Failed to apply catalog: Could not find dependency
> Package[openssh-server] for File[/etc/ssh/sshd_config] at  
> modules/sshd/manifests/init.pp:14*

It's not declared (package {$ssh_pkg: ...}). Wondering why it worked in
P3...

Bye...

Dirk
-- 
*Dirk Heinrichs*
Senior Systems Engineer, Delivery Pipeline
OpenText^TM Discovery | Recommind
*Email*: dirk.heinri...@recommind.com 
*Website*: www.recommind.de 

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon
Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer
HRB 10646

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/29547df0-51c6-cf64-d01e-d75fd4e68d0a%40opentext.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] syntax issue over puppet_4

2017-02-22 Thread Ren
Hi all, I'm hoping you can point out some detail I'm missing. Puppet agent 
seems to fail with manifest working fine with puppet3 but not for puppet4. 

Thank you . 

*Error: Failed to apply catalog: Could not find dependency 
Package[openssh-server] for File[/etc/ssh/sshd_config] at   
modules/sshd/manifests/init.pp:14*



class sshd {
case $::operatingsystem {
/(CentOS|Scientific|OracleLinux|OpenSuSE)/: {
$ssh_pkg = "openssh"
$ssh_svc = "sshd"
}
/(Debian|Solaris|Ubuntu)/: {
$ssh_pkg = "openssh-server"
$ssh_svc = "ssh"
}
}

# Special sshd_config
file {'/etc/ssh/sshd_config':
ensure => present,
mode => '0600',
require => Package[$ssh_pkg],
source => $application ? {
"jump" => "puppet:///modules/sshd/sshd_config.jump",
"git" => "puppet:///modules/sshd/sshd_config.gitolite",
default => "puppet:///modules/sshd/sshd_config.default"
},
notify => Service[$ssh_svc];
}

service {$ssh_svc:
ensure => running,
require => Package[$ssh_pkg],
enable => true;
}
}


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/76ddfca5-e10b-4e97-8c37-f434a8e91ecd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax problem, if/case in class section for $hostname

2016-02-15 Thread jcbollinger


On Monday, February 15, 2016 at 7:33:47 AM UTC-6, Denny Schierz wrote:
 

> It seems to be impossible to use if/case/whatever as selector for a 
> parameter.
>
>
The 'if' and 'case' statements are *statements*, not expressions.  They do 
not produce a value.  As R.I. observed, if you need a conditional 
*expression* then there are selectors.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4676f131-f8d3-4e20-a343-cdb71a324e95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax problem, if/case in class section for $hostname

2016-02-15 Thread R.I.Pienaar


- Original Message -
> From: "Denny Schierz" <denny.schi...@gmail.com>
> To: "puppet-users" <puppet-users@googlegroups.com>
> Sent: Monday, February 15, 2016 2:33:47 PM
> Subject: Re: [Puppet Users] Syntax problem, if/case in class section for 
> $hostname

> hi,
> 
> in the last 5 min I was able to solve my problem. The problem was that I
> wanted to override a parameterized class .. my solution is is now:
> 
> class users::fbar::params {
> 
> if ($::hostname =~ /^devpc21+(\d+)./) {
>  $groups  = [ 'admin' ] }
> else {
> 
>  $groups  = [ 'devel' ] }
> }
> 
> class users::fbar (
>  $ensure  = present,
>  $groups  = $users::fbar::params::groups
> )
>  inherits  users::fbar::params
> 
> {
>   case $ensure {
> 
>  present: {
> users::add_user { fbar:
>comment=> 'Foo Bar',
>uid => 1024,
>groups  => $groups,
>shell   => '/bin/bash',
>yubikeyid   => 'cxx',
>require => Group[ $groups ],
> }
>  }
>  absent: {
> users::del_user { ['fbar' ]:
>managehome  => true,
> }
> 
>  }
>   }
> }
> 
> It seems to be impossible to use if/case/whatever as selector for a
> parameter.

Puppet has selectors for this purpose.

https://docs.puppetlabs.com/puppet/latest/reference/lang_conditional.html#selectors

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/871116132.285727.1455543495753.JavaMail.zimbra%40devco.net.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax problem, if/case in class section for $hostname

2016-02-15 Thread Denny Schierz
hi,

in the last 5 min I was able to solve my problem. The problem was that I 
wanted to override a parameterized class .. my solution is is now:

class users::fbar::params {

if ($::hostname =~ /^devpc21+(\d+)./) {
  $groups  = [ 'admin' ] }
else {

  $groups  = [ 'devel' ] }
}

class users::fbar (
  $ensure  = present,
  $groups  = $users::fbar::params::groups
)
  inherits  users::fbar::params

 {
   case $ensure {

  present: {
 users::add_user { fbar:
comment=> 'Foo Bar',
uid => 1024,
groups  => $groups,
shell   => '/bin/bash',
yubikeyid   => 'cxx',
require => Group[ $groups ],
 }
  }
  absent: {
 users::del_user { ['fbar' ]:
managehome  => true,
 }

  }
   }
}

It seems to be impossible to use if/case/whatever as selector for a 
parameter.

cu denny

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b9dbdb86-4f26-4a61-b23a-f64e797919bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax problem, if/case in class section for $hostname

2016-02-15 Thread Henrik Lindberg

On 2016-15-02 8:37, Denny Schierz wrote:

hi,

I try to get an if/case thing working, but I always get a syntax error.

We have something  like that for an user:

modules/users/manifests/fbar.pp


class users::fbar (
   $ensure  = present,
   $groups  = [ 'develop' ]
) {
case $ensure {

   present: {
  users::add_user { foobar:
 comment=> 'Foo bar',
 uid => 1024,
 groups  => $groups,
 shell   => '/bin/bash',
 require => Group[$groups],
  }
   }
   absent: {
  users::del_user { ['fbar' ]:
 managehome  => true,
  }

   }
}
}

which is included on a node ...

environments/dev/manifests/developpc.pp

[...]

# distribute users
class { 'users::fbar':
  ensure   => present,
}


The only thing I want, is to change the group on a special node with
$hostname =~ /regex$/

I tried a lot to change from
$groups  = [ 'develop' ]
to
$groups  = [ 'admins' ]

with if/else and with case but ended up with syntax error on '}' ...
expected ... (if i remember right).

So, what I have done wrong ?



Impossible to guess when not seeing the entire failing example.
- henrik


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/n9sje8%241up%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Syntax problem, if/case in class section for $hostname

2016-02-14 Thread Denny Schierz
hi,

I try to get an if/case thing working, but I always get a syntax error.

We have something  like that for an user:

modules/users/manifests/fbar.pp


class users::fbar (
  $ensure  = present,
  $groups  = [ 'develop' ]
) {
   case $ensure {

  present: {
 users::add_user { foobar:
comment=> 'Foo bar',
uid => 1024,
groups  => $groups,
shell   => '/bin/bash',
require => Group[$groups],
 }
  }
  absent: {
 users::del_user { ['fbar' ]:
managehome  => true,
 }

  }
   }
}

which is included on a node ...

environments/dev/manifests/developpc.pp

[...]

   # distribute users
   class { 'users::fbar':
 ensure   => present,
   }


The only thing I want, is to change the group on a special node with 
$hostname =~ /regex$/

I tried a lot to change from   
$groups  = [ 'develop' ] 
to 
$groups  = [ 'admins' ]

with if/else and with case but ended up with syntax error on '}' ... 
expected ... (if i remember right).

So, what I have done wrong ?

cu denny

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/daff705a-73b1-42ce-b084-718a4b9bfb7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Syntax Error in Puppet Learning VM

2015-01-26 Thread John Julien
Hi,
Is this the right place to report errors in the Puppet Learning Guide?  I 
have found a syntax error on page 57 while executing Task 2 of the 
Variables and Class Parameters quest.

file { ${doc_root}/bonjour.html}
   ensure = 'present',
   content = em${french}/em,
}

Where is should be

file { ${doc_root}/bonjour.html:
  ensure = 'present',
  content = em${french}/em,
}

John

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f312b48a-ad1d-427c-9da7-43719e2ae029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax Error in Puppet Learning VM

2015-01-26 Thread Henrik Lindberg

On 2015-26-01 21:15, John Julien wrote:

Hi,
Is this the right place to report errors in the Puppet Learning Guide?
I have found a syntax error on page 57 while executing Task 2 of the
Variables and Class Parameters quest.

|
file {${doc_root}/bonjour.html}
ensure='present',
content =em${french}/em,
}
|

Where is should be
|

file {${doc_root}/bonjour.html:
ensure='present',
   content =em${french}/em,
}
|


Please file a ticket here: https://tickets.puppetlabs.com/browse/LEARNVM/

regards
- henrik


John

--
You received this message because you are subscribed to the Google
Groups Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com
mailto:puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/f312b48a-ad1d-427c-9da7-43719e2ae029%40googlegroups.com
https://groups.google.com/d/msgid/puppet-users/f312b48a-ad1d-427c-9da7-43719e2ae029%40googlegroups..com?utm_medium=emailutm_source=footer.
For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog Puppet on the Edge
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ma6mk8%24ovn%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Syntax error

2014-09-22 Thread David Logan
Hi Folks,

I've tried this snippet several ways, both using case and selector 
statements. I keep getting an error

root@ubuntu64:/etc/puppet/manifests# puppet parser validate 
/etc/puppet/modules/timezone/manifests/params.pp
Error: Could not parse for environment production: Syntax error at '='; 
expected '}' at /etc/puppet/modules/timezone/manifests/params.pp:25
root@ubuntu64:/etc/puppet/manifests#


comments above have been taken out

 15 class timezone::params {
 16 
 17   $timezone = 'Australia/Darwin'
 18   $hw_utc = true
 19 
 20 # This is calculated in timezone class
 21   $set_timezone_command = ''
 22 
 23   case $::operatingsystem {
 24 /^(?i:Debian|Ubuntu)$/: {
 25   $config_file = '/etc/timezone'
 26 }
 27 /^(?i:RedHat|CentOS)$/: {
 28   case $::operatingsystemmajrelease {
 29 '7': $config_file = '/etc/localtime'
 30 default: $config_file = '/etc/sysconfig/clock'
 31   }
 32 }
 33 default: { $config_file = '/etc/sysconfig/clock' }
 34   }
 35 
 36   $config_file_mode = $::operatingsystem ? {
 37 default = '0644',
 38   }
 39 
 40   $config_file_owner = $::operatingsystem ? {
 41 default = 'root',
 42   }
 43 
 44   $config_file_group = $::operatingsystem ? {
 45 'FreeBSD' = 'wheel',
 46 default   = 'root',
 47   }
 48 
 49   $source = ''
 50   $template = timezone/timezone-${::operatingsystem}
 51   $options = ''
 52   $audit_only = false
 53   $noops = false
 54 
 55 }

If somebody wouldn't mind pointing out the error my ways, that would be 
most appreciated.

Thanks
David

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d580879f-1db3-478a-beee-73a81657cb14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Syntax error

2014-09-22 Thread Denmat
Hi,

Try $config_file = 'value'.

You need to assign the value. 

https://docs.puppetlabs.com/puppet/latest/reference/lang_conditional.html#case-statements

Cheers
Den
 On 22 Sep 2014, at 11:53, David Logan skrat...@gmail.com wrote:
 
 Syntax error at '='; expected '}' at /etc/puppet/modules/time

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20C73C84-E00A-4B36-BF86-2A83A4E4A14D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Syntax for echoing Fqdn name inside a hash value (please help)

2014-03-04 Thread Virtual_user

Hi 
i am using puppet 2.7

i want to echo  the Fqdn name in a template by using looping through the 
hash, 

Example, in site.pp i have

$acc_sudo = $mc_servertype ? {
'system' = [ '%APP *%= fqdn %* =/etc/init.d/httpd start, 
/etc/init.d/httpd stop,/etc/init.d/httpd restart, /sbin/services httpd 
restart' ],
'db' = [ '%DB %= fqdn % =/etc/init.d/oracle start'],
'app' = ['%APP %= fqdn % =/etc/init.d/httpd start, 
/etc/init.d/httpd stop,/etc/init.d/httpd restart, /sbin/services httpd 
restart' ],

}



and sudo.erb file i have 

% if mc_servertype == system %

% acc_sudo.each do |sudo| %%= sudo %% end %

% end %

problem is, when its generating the sudo file, its  writing like this 

%APP*%= fqdn %*=/etc/init.d/httpd start, /etc/init.d/httpd 
stop,/etc/init.d/httpd restart, /sbin/services httpd restart


but i want to make it like this

%APPserver1.test.co=/etc/init.d/httpd start, /etc/init.d/httpd 
stop,/etc/init.d/httpd restart, /sbin/services httpd restart


what will be the right syntax for it in site.pp ??

please help with this.




-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3f966768-7c1f-4c24-975f-97d0fdc6a8cb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] syntax problems trying to use Keith Burdis's erwbgy/system module without Hiera

2013-03-21 Thread John Smith
I'm trying to use Keith Burdis's excellent erwbgy/system module without 
Hiera, at least initially.

http://forge.puppetlabs.com/erwbgy/system

I cannot determine how call the modules.  From what I can tell the 
documentation isn't quite correct (or I am reading it wrong).  I'm trying 
to start with ntp because that's an easy to understand example.

https://github.com/erwbgy/puppet-ntp

The ntp documentation says 

snip
Specify a list of time servers to use:

class { 'ntp':
  servers = [ 'ntp1.domain.com', 'ntp2.domain.com' ],
}
endsnip

If I enter it like this in my manifest, I get errors. I assume the correct 
syntax is something more like this 

snip
system::ntp { 'name': 
  servers = [ 'ntp1.domain.com', 'ntp2.domain.com' ],
}
endsnip

but that syntax gets me this error
 Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid 
resource type system::ntp at /etc/puppet/manifests/site.pp:36 on node

Any help with this would be appreciated..
thanks!

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




[Puppet Users] syntax checking nodes, don't allow global scope

2013-03-12 Thread Rudy Gevaert


Hi,

We have been bitten twice by the following.  We group the configuration 
or our nodes in several files.

nodes.d/group1.pp
nodes.d/group2.pp
...

Now twice people have accidently added some statements that are put in 
the global scope... which are then applied to all nodes:

The example is simplified:

---nodes.d/group1.pp-
node mynode {
   ...
}
include thisorthat



Ofcourse this doesn't trigger a syntax error (that we run before a push 
to the git repo can be done).

Are there any other ways to catch this?  Except code revision 

Thanks,

Rudy



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




Re: [Puppet Users] syntax checking nodes, don't allow global scope

2013-03-12 Thread Denmat
Hi,

None that I know of - its the same as putting includes in site.pp. Education 
and review are your best bet.

Den

(That said, very verbose rspec tests may pick it up for very specific cases - 
but it would be a bit of work.)


On 12/03/2013, at 23:31, Rudy Gevaert rudy.geva...@gmail.com wrote:

 Hi,
 
 We have been bitten twice by the following.  We group the configuration 
 or our nodes in several files.
 
 nodes.d/group1.pp
 nodes.d/group2.pp
 ...
 
 Now twice people have accidently added some statements that are put in 
 the global scope... which are then applied to all nodes:
 
 The example is simplified:
 
 ---nodes.d/group1.pp-
 node mynode {
...
 }
 include thisorthat
 
 
 
 Ofcourse this doesn't trigger a syntax error (that we run before a push 
 to the git repo can be done).
 
 Are there any other ways to catch this?  Except code revision 
 
 Thanks,
 
 Rudy
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users+unsubscr...@googlegroups.com.
 To post to this group, send email to puppet-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/puppet-users?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

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




[Puppet Users] Syntax error in 2.6.8 but not in 2.7.19

2012-10-25 Thread Abhijeet R

Hi,

I have a simple .pp file like

class ucarp2::host
{
  define config( $node_id, $password=, $interface_primary, 
$interface_vip, $vip_addr, $vip_addr_netmask, $vip_addr_gw, 
$other_options = , $ensure=present ) {

#Creating vip up/down scripts
ensure_resource('file', 'vip-up', {ensure = $present, path = 
'/etc/sysconfig/carp/vip-up', content = template(ucarp2/vip-up.erb), 
require = Package['ucarp']})

  }
}

On puppet 2.7.19, no issues but on 2.6.8, it gives

err: Could not parse for environment production: Syntax error at '{'; 
expected '}' at /tmp/ucarp/manifests/host.pp:6


The function ensure_resource() actually comes from 
https://github.com/bodepd/puppet-ensure_resource


Is this a bug in 2.6.8? It's a production (so can't upgrade as of now) 
environment and I had set a update hook to avoid any syntax errors and 
this is blocking me. What is going wrong here?


--
Cheers,
Abhijeet R
http://blog.abhijeetr.com

--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To post to this group, send email to puppet-users@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] syntax change or regression?

2012-08-12 Thread Samuel José Martín

Hi,

I am using puppet to generate ipsec tunnels configuration on OpenBSDs 
gateways.
Having a bunch of offices, I did something like this:

$enc = $office ?
{
paris =
{
london = aes,
kiev = 3des
},
london =
{
paris = aes,
kiev = 3des
},
kiev =
{
paris = 3des,
london = 3des
}
}

This may not be the cleaner way, since I have to specify each variable two 
times - the enc for tunnel from paris to london is obviously the same as 
the one from london to paris.
However, this works, under OpenBSD 4.9 and our production puppetmaster 
(2.6).

Now, we want to upgrade our firewalls to OpenBSD 5.0.
Their puppet client version (2.7.1) is forcing us to upgrade our 
puppetmaster too.

My test puppetmaster is running debian wheezy, with puppet* 2.7.14-1.
While executing puppetd -vt on the client, it fails compiling catalog, with 
some syntax error at '{'; expected '}'.
I've just updated my puppetmaster to 2.7.18-1, no changes since my last 
check.
The faulty { is the second one (in my sample, the one just after paris).

Is this some regression, in ruby or puppetmaster?
Or is this kind of syntax deprecated in any way?
Is there any replacement?
What could I do to patch my repository, before upgrading our production 
puppetmaster?


Thanks for your help,

Regards.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/dJiuo5sjBYwJ.
To post to this group, send email to puppet-users@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] syntax change or regression?

2012-08-12 Thread Justin Stoller
On Sun, Aug 12, 2012 at 1:35 AM, Samuel José Martín faus...@gmail.com wrote:

 Hi,

 I am using puppet to generate ipsec tunnels configuration on OpenBSDs
 gateways.
 Having a bunch of offices, I did something like this:

 $enc = $office ?
 {
 paris =
 {
 london = aes,
 kiev = 3des
 },
 london =
 {
 paris = aes,
 kiev = 3des
 },
 kiev =
 {
 paris = 3des,
 london = 3des
 }
 }

 This may not be the cleaner way, since I have to specify each variable two
 times - the enc for tunnel from paris to london is obviously the same as the
 one from london to paris.
 However, this works, under OpenBSD 4.9 and our production puppetmaster
 (2.6).

 Now, we want to upgrade our firewalls to OpenBSD 5.0.
 Their puppet client version (2.7.1) is forcing us to upgrade our
 puppetmaster too.

 My test puppetmaster is running debian wheezy, with puppet* 2.7.14-1.
 While executing puppetd -vt on the client, it fails compiling catalog, with
 some syntax error at '{'; expected '}'.
 I've just updated my puppetmaster to 2.7.18-1, no changes since my last
 check.
 The faulty { is the second one (in my sample, the one just after paris).

 Is this some regression, in ruby or puppetmaster?
 Or is this kind of syntax deprecated in any way?
 Is there any replacement?

I think you've found this:
https://projects.puppetlabs.com/issues/14301   --   Hashes can not be
used in selectors

I don't know how it sits in the deprecated/regression realm.
I think updating your thoughts in the ticket would help move it
forward in development though.

 What could I do to patch my repository, before upgrading our production
 puppetmaster?

For the time being (if you don't want to refactor your module in
otherways) you can always assign the hash outside of the selector
(my_test.pp)

$office = 'paris'

$paris  = { london = aes,  kiev =   3des }
$london = { paris  = aes,  kiev =   3des }
$kiev   = { paris  = 3des, london = 3des }

$enc = $office ?  {
  paris = $paris,
  london = $london,
  kiev = $kiev
}

notify { $enc['london']: }




 - Justin



 Thanks for your help,

 Regards.

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/puppet-users/-/dJiuo5sjBYwJ.
 To post to this group, send email to puppet-users@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.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] syntax change or regression?

2012-08-12 Thread Trevor Vaughan
Though not elegant, you could also run it through an inline template.

Alternatively, you could write a puppet function that manipulates your
data structure appropriately and returns an appropriate answer for you
to use in your selector.

Trevor

On Sun, Aug 12, 2012 at 1:11 PM, Justin Stoller jus...@puppetlabs.com wrote:
 On Sun, Aug 12, 2012 at 1:35 AM, Samuel José Martín faus...@gmail.com wrote:

 Hi,

 I am using puppet to generate ipsec tunnels configuration on OpenBSDs
 gateways.
 Having a bunch of offices, I did something like this:

 $enc = $office ?
 {
 paris =
 {
 london = aes,
 kiev = 3des
 },
 london =
 {
 paris = aes,
 kiev = 3des
 },
 kiev =
 {
 paris = 3des,
 london = 3des
 }
 }

 This may not be the cleaner way, since I have to specify each variable two
 times - the enc for tunnel from paris to london is obviously the same as the
 one from london to paris.
 However, this works, under OpenBSD 4.9 and our production puppetmaster
 (2.6).

 Now, we want to upgrade our firewalls to OpenBSD 5.0.
 Their puppet client version (2.7.1) is forcing us to upgrade our
 puppetmaster too.

 My test puppetmaster is running debian wheezy, with puppet* 2.7.14-1.
 While executing puppetd -vt on the client, it fails compiling catalog, with
 some syntax error at '{'; expected '}'.
 I've just updated my puppetmaster to 2.7.18-1, no changes since my last
 check.
 The faulty { is the second one (in my sample, the one just after paris).

 Is this some regression, in ruby or puppetmaster?
 Or is this kind of syntax deprecated in any way?
 Is there any replacement?

 I think you've found this:
 https://projects.puppetlabs.com/issues/14301   --   Hashes can not be
 used in selectors

 I don't know how it sits in the deprecated/regression realm.
 I think updating your thoughts in the ticket would help move it
 forward in development though.

 What could I do to patch my repository, before upgrading our production
 puppetmaster?

 For the time being (if you don't want to refactor your module in
 otherways) you can always assign the hash outside of the selector
 (my_test.pp)

 $office = 'paris'

 $paris  = { london = aes,  kiev =   3des }
 $london = { paris  = aes,  kiev =   3des }
 $kiev   = { paris  = 3des, london = 3des }

 $enc = $office ?  {
   paris = $paris,
   london = $london,
   kiev = $kiev
 }

 notify { $enc['london']: }




  - Justin



 Thanks for your help,

 Regards.

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/puppet-users/-/dJiuo5sjBYwJ.
 To post to this group, send email to puppet-users@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.

 --
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To post to this group, send email to puppet-users@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.




-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaug...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] syntax highlighting on emacs

2011-06-29 Thread Tony G.
On Tue, Jun 28, 2011 at 2:00 PM, Sylvain sylv...@kalache.fr wrote:

 Hi guys,

 I'm trying to install the syntax highlighting on emacs for Puppet.
 I'm using the configuration files provide on
 http://projects.reductivelabs.com/repositories/browse/puppet/ext/emacs

 When I open a .pp file I got this error:
 File mode specification error: (void-function puppet-mode)

Hi

The .el files must be in the library path or you can do something like this
in your ~.emacs file

;; Local Library Path
(add-to-list 'load-path ~/path/to/your/el/files)

then I autoload it with in my ~.emacs, that is almost the same as the
puppet-mode-init.el

;; Puppet mode
(autoload 'puppet-mode puppet-mode Puppet Mode. t)
(add-to-list 'auto-mode-alist '(\\.pp\\' . puppet-mode))
(add-to-list 'interpreter-mode-alist '(puppet . puppet-mode))

Hope that helps.


 Thanks

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To post to this group, send email to puppet-users@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.




-- 
Tony
http://blog.tonyskapunk.net

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] syntax highlighting on emacs

2011-06-28 Thread Sylvain
Hi guys,

I'm trying to install the syntax highlighting on emacs for Puppet.
I'm using the configuration files provide on
http://projects.reductivelabs.com/repositories/browse/puppet/ext/emacs

When I open a .pp file I got this error:
File mode specification error: (void-function puppet-mode)

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] syntax error with case statment; in file type.

2011-03-30 Thread trey85stang
I am getting a syntax error in a module and I'm not sure why...

Anyone care to take a look?

class audit {
  file { /etc/audit.rules:
owner = root,
group = root,
mode  = 640,
case $operatingsystemrelease {
  10.2: { path   = /etc/audit.rules,
source = puppet:///modules/audit/audit.rules.sles10,
require = Package[audit-libs,audit]
  }
  11.1: { path   = /etc/audit/audit.rules,
source = puppet:///modules/audit/audit.rules.sles11,
require = Package[audit-libs,audit,audit-audispd-
plugins]
  }
}
  }
}

error on client is:
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Syntax error at 'case'; expected '}' at /etc/puppet/shared/
modules/audit/manifests/init.pp:6 on node node.example.com

Also,  is it possible to do regex's in the case statement?

i.e
  /^10\.[0-3]*/: { stuff here }
  /^11\.[0-3]*/: { other stuff }

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] syntax error with case statment; in file type.

2011-03-30 Thread Martin Alfke

On Mar 30, 2011, at 4:03 PM, trey85stang wrote:

 I am getting a syntax error in a module and I'm not sure why...
 
 Anyone care to take a look?
 
 class audit {
  file { /etc/audit.rules:
owner = root,
group = root,
mode  = 640,
case $operatingsystemrelease {
  10.2: { path   = /etc/audit.rules,
source = puppet:///modules/audit/audit.rules.sles10,
require = Package[audit-libs,audit]
  }
  11.1: { path   = /etc/audit/audit.rules,
source = puppet:///modules/audit/audit.rules.sles11,
require = Package[audit-libs,audit,audit-audispd-
 plugins]
  }
}
  }
 }

You need to use a selector for each resource item:
path = $operatingsystemrelease ?  {
  10.2 = /etc/audit.rules,
  11.1 = /etc/audit/audit.rules,
  default = undef,
},
source = $operatingsystemrelease ? {
  10.2 = puppet...,
  11.1 = puppet...,
  default = ...,
},

another option would be to separate this to multiple manifests (one for each 
os-release) and include based upon os-release number.



 
 error on client is:
 err: Could not retrieve catalog from remote server: Error 400 on
 SERVER: Syntax error at 'case'; expected '}' at /etc/puppet/shared/
 modules/audit/manifests/init.pp:6 on node node.example.com
 
 Also,  is it possible to do regex's in the case statement?
 
 i.e
  /^10\.[0-3]*/: { stuff here }
  /^11\.[0-3]*/: { other stuff }

Regexp are possible, But you have to take care of upper/lower letters yourself.


 
 Thanks
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To post to this group, send email to puppet-users@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.
 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] Syntax error at 'enable'; expected '}'

2011-02-09 Thread Tim Dunphy
Hello puppet list!!



 I keep getting the same error and I can't for the life of me see
where this problem is...


[root@VIRTCENT03:~] #puppetd --test
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not parse for environment production: Syntax error at
'enable'; expected '}' at /etc/puppet/manifests/classes/baseapps.pp:23
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run



Here is the manifest it is erroring out on:


class baseapps {

 $packagelist = [ nmap,php-common,php-cli,perl,keychain,screen ]

 package { $packagelist:
   ensure = installed }


class sshd {
  case $operatingsystem {
   centos: { $ssh_packages = [
openssh,openssh-server,openssh-clients] }
   default: { $ssh_packages = [ openssh, openssh-server ] }
  }

  package { $ssh_packages: ensure = installed }

  service { sshd:
   name = $operatingsystem ? {
centos = sshd,
default = sshd,
   }

  enable = true,
  ensure = running

 }


}


Could someone please lend an eye?

Thanks!!

-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] Syntax error at 'enable'; expected '}'

2011-02-09 Thread Patrick

On Feb 9, 2011, at 12:28 PM, Tim Dunphy wrote:

 Hello puppet list!!
 
 
 
 I keep getting the same error and I can't for the life of me see
 where this problem is...
 
 
 [root@VIRTCENT03:~] #puppetd --test
 err: Could not retrieve catalog from remote server: Error 400 on
 SERVER: Could not parse for environment production: Syntax error at
 'enable'; expected '}' at /etc/puppet/manifests/classes/baseapps.pp:23
 warning: Not using cache on failed catalog
 err: Could not retrieve catalog; skipping run
 

Well, the problem seems to be in the service line so you can cut your manifest 
down to this and try it without the master after replacing the variable:

test.pp:
include testClass
class testClass
{
#Pretends we have factor
$operatingsystem = centos
service { sshd:
name = $operatingsystem ? {
centos = sshd,
default = sshd,
}
enable = true,
ensure = running
}
}


Then run it again and see if you get the same error without the master.

puppet --verbose test.pp

 Could not parse for environment production: Syntax error at 'enable'; 
 expected '}' at /removed_path/test2.pp:10 on node localhost

Yep.  Still have the error.  Now you can test it much easier.

Now, in this case, your problem is because you missed a comma after closing the 
operating system selector.  Still, if you can shrink your manifest and remove 
the puppetmaster, it will help us in the future.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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] syntax for class names

2010-11-11 Thread Eric Snow
How do you dynamically create classes?

For instance, I have a bunch of users to make.  I have all their
usernames.  Each is the same as the others except for the username and
one other value.  I don't want to have to spell out a User for each,
but would rather set up them up dynamically, in a much cleaner way
(and more maintainable).

It looks like parameterized classes would mostly do it, but is the
syntax for including a parameterized class the same everywhere?  Can a
parameterized class be virtual?

As well, I was hoping to set up some defines in the dynamically
created user so that they could be used from the class's namespace.
The alternative is to do them separately and pass in the same
information that I already passed in to the class, which seems messier
than just providing them from the class's namespace.

Thanks.

-eric

-- 
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] syntax for class names

2010-11-11 Thread Bruce Richardson
On Thu, Nov 11, 2010 at 12:50:02PM -0800, Eric Snow wrote:
 How do you dynamically create classes?

You don't.  2.6 has parameterized classes but that's not quite what you
mean.

 
 For instance, I have a bunch of users to make.  I have all their
 usernames.  Each is the same as the others except for the username and
 one other value.  I don't want to have to spell out a User for each,
 but would rather set up them up dynamically, in a much cleaner way
 (and more maintainable).

You can use resource defaults to take out most of the drudgery

  User {
managed = true,
shell = '/bin/bash'
  }

Then you only need type out the varying properties of each user.

 
 It looks like parameterized classes would mostly do it, but is the
 syntax for including a parameterized class the same everywhere?  Can a
 parameterized class be virtual?

No.  Resources can be virtual but not classes.

If you were hoping to be able to create all of these users by iterating
through a hash, or something similar, then Puppet really doesn't support
that.  Puppet's DSL is declaritive and can't be treated like some OO
language (I wish Luke had chosen a name other than class for Puppet's
classes; it only confuses people).

Have you noticed that Puppet has arrays and hashes but doesn't have a
keys() function?  You *could* have a hash of users and their properties

  $users = { john = { shell = '/bin/bash', uid = '501' }, david = {
shell = '/bin/tcsh', uid = '501' }

and have a define which consulted that hash, as in

  define hash_user ( $user_hash ) {
user { $name:
ensure = 'present',
managed = true,
shell = $users[$name][shell],
uid = $user_hash[$name][uid]
}
  }

But since there is no keys function, you can't do

  hash_user { [ keys($users) ]: user_hash = $users }

You have to do

  hash_user { [ 'john', 'david' ]: user_hash = $users }

which isn't really saving you a lot.

Bluntly, Puppet wants you to declare your resources explicitly.

 As well, I was hoping to set up some defines in the dynamically
 created user so that they could be used from the class's namespace.
 The alternative is to do them separately and pass in the same
 information that I already passed in to the class, which seems messier
 than just providing them from the class's namespace.

I think there may be a misplaced word in there; it doesn't seem to make
entire sense.

-- 
Bruce

Get thee behind me, Stan: for it is written, thou hast gotten me into
another fine mess.  -- Oliver 4:8

-- 
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] syntax for class names

2010-11-11 Thread Daniel Pittman
Eric Snow es...@verio.net writes:

 How do you dynamically create classes?

You pretty much can't: puppet is aimed at being a deterministic system, and so
it wants to have a non-programmatic state to achieve.[1]

 For instance, I have a bunch of users to make.  I have all their
 usernames.  Each is the same as the others except for the username and
 one other value.  I don't want to have to spell out a User for each,
 but would rather set up them up dynamically, in a much cleaner way
 (and more maintainable).

The conventional way would be this:

  define my::user () {
user { $name: whatever = 'foo' }
  }
  my::user { [one, two, red, blue]: }

Puppet will create all those resources nicely.

[...]

 As well, I was hoping to set up some defines in the dynamically created user
 so that they could be used from the class's namespace.  The alternative is
 to do them separately and pass in the same information that I already passed
 in to the class, which seems messier than just providing them from the
 class's namespace.

I strongly suspect that a worked example of what you want to do, but that is
failing, would help make the whole thing a lot clearer...

Anyhow, my final bit of (now unsolicited) advice here:

Don't do that anyhow.  Use LDAP, or some other network directory service, to
manage your user accounts.  It hurts way less than trying to do this at scale,
once you start to discover needs for things like consistent UIDs, etc.

Regards,
Daniel

Footnotes: 
[1]  Like the English language, puppet isn't that pure, and you can work
 around this in a whole bunch of ways.  Pure-ruby manifests in 2.6 might
 be a way to do that, for example.

-- 
✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 707
   ♽ made with 100 percent post-consumer electrons

-- 
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] syntax for class names

2010-11-11 Thread Bruce Richardson
On Fri, Nov 12, 2010 at 09:32:16AM +1100, Daniel Pittman wrote:
 Footnotes: 
 [1]  Like the English language, puppet isn't that pure, and you can work
  around this in a whole bunch of ways.  Pure-ruby manifests in 2.6 might
  be a way to do that, for example.

Oh, I knew somebody was going to say that.  I don't much like the idea
of ruby manifests; it seems to turn Puppet's design upside down.  I try
to reduce the direct use of Ruby in my puppet configurations to an
absolute minimum.

-- 
Bruce

It is impolite to tell a man who is carrying you on his shoulders that
his head smells.

-- 
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] syntax for class names

2010-11-11 Thread Daniel Pittman
Bruce Richardson itsbr...@workshy.org writes:
 On Thu, Nov 11, 2010 at 12:50:02PM -0800, Eric Snow wrote:

[...]

 If you were hoping to be able to create all of these users by iterating
 through a hash, or something similar, then Puppet really doesn't support
 that.  Puppet's DSL is declaritive and can't be treated like some OO
 language (I wish Luke had chosen a name other than class for Puppet's
 classes; it only confuses people).

 Have you noticed that Puppet has arrays and hashes but doesn't have a
 keys() function?  You *could* have a hash of users and their properties

It really wouldn't be a terribly hard extension to write one, however. :)

Daniel

-- 
✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 707
   ♽ made with 100 percent post-consumer electrons

-- 
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] syntax

2010-03-06 Thread Nigel Kersten
On Fri, Mar 5, 2010 at 10:31 PM, Dick Davies
rasput...@hellooperator.net wrote:
 On Thu, Mar 4, 2010 at 5:43 PM, Peter Meier peter.me...@immerda.ch wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Well, it workes in erb test, but not when puppet runs:

 undefined method `start_with?' for  via puppet

 erb -x -T '-' test.erb | ruby -c  says Syntax OK

 I thought 'start_with was a ruby 1.9 thing only? And starts_with is
 a Rails-ism ?

 exactly.

 No, don't think so:

 ~ $ irb
 RUBY_VERSION
 = 1.8.7
 foo.start_with?(fo)
 = true
 ^D~ $

Interesting. Looks like it appeared in 1.8.7 as well.

$ irb
 RUBY_VERSION
= 1.8.6
 foo.start_with?(fo)
NoMethodError: undefined method `start_with?' for foo:String



 [ this is on Snow Leopard, mind, ] I'm not sure how much of Ruby you can
 use in ERB templates, but I'd have thought if a language feature works
 on irb, it'll work in templates run on that machine.

 Templates are expanded on the puppetmaster, right?

yes.


 --
 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.





-- 
nigel

-- 
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] syntax

2010-03-05 Thread Len Rugen
But they don't seem to work IN A TEMPLATE

On Fri, Mar 5, 2010 at 1:16 AM, Peter Meier peter.me...@immerda.ch wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

  So can someone point to working regex template example?

 First answer of Ohad to your question:

  you might want to try regexp, e.g.
 
  % if fqdn =~ /^something/ -%


 irb(main):001:0  =~ /^aa/
 = 0
 irb(main):002:0  =~ /^ab/
 = nil

 =~ returns the first location of the occurence of the pattern or nil if
 none is found. if nil in ruby will never be evaluated.

 cheers pete
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkuQr9sACgkQbwltcAfKi39wRgCeJtTVbOFcRC4I3TWQFm2YTWOk
 mskAni20CwM2zvqarbhyKcQNC9cznNAL
 =mAAm
  -END PGP SIGNATURE-

 --
 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.compuppet-users%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.



-- 
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] syntax

2010-03-05 Thread Len Rugen
Maybe the dash in -% is the problem, I was tunnel visioned on the regex
part.

On Fri, Mar 5, 2010 at 6:58 AM, Len Rugen lenru...@gmail.com wrote:

 But they don't seem to work IN A TEMPLATE

 On Fri, Mar 5, 2010 at 1:16 AM, Peter Meier peter.me...@immerda.chwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

  So can someone point to working regex template example?

 First answer of Ohad to your question:

  you might want to try regexp, e.g.
 
  % if fqdn =~ /^something/ -%


 irb(main):001:0  =~ /^aa/
 = 0
 irb(main):002:0  =~ /^ab/
 = nil

 =~ returns the first location of the occurence of the pattern or nil if
 none is found. if nil in ruby will never be evaluated.

 cheers pete
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkuQr9sACgkQbwltcAfKi39wRgCeJtTVbOFcRC4I3TWQFm2YTWOk
 mskAni20CwM2zvqarbhyKcQNC9cznNAL
 =mAAm
  -END PGP SIGNATURE-

 --
 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.compuppet-users%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.




-- 
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] syntax

2010-03-05 Thread Dick Davies
On Thu, Mar 4, 2010 at 5:43 PM, Peter Meier peter.me...@immerda.ch wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Well, it workes in erb test, but not when puppet runs:

 undefined method `start_with?' for  via puppet

 erb -x -T '-' test.erb | ruby -c  says Syntax OK

 I thought 'start_with was a ruby 1.9 thing only? And starts_with is
 a Rails-ism ?

 exactly.

No, don't think so:

~ $ irb
 RUBY_VERSION
= 1.8.7
 foo.start_with?(fo)
= true
 ^D~ $

[ this is on Snow Leopard, mind, ] I'm not sure how much of Ruby you can
use in ERB templates, but I'd have thought if a language feature works
on irb, it'll work in templates run on that machine.

Templates are expanded on the puppetmaster, right?

-- 
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] syntax

2010-03-04 Thread Len Rugen
Will something like this work in a template?

% if fqdn.starts_with?'something' then %

My test isn't working, I don't know if it's some minor syntax issue or if
I'm completely out of bounds.

-- 
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] syntax

2010-03-04 Thread Dick Davies
On Thu, Mar 4, 2010 at 2:01 PM, Len Rugen lenru...@gmail.com wrote:
 Will something like this work in a template?

 % if fqdn.starts_with?'something' then %

Try 'start_with?'  instead of 'starts_with?'

-- 
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] syntax

2010-03-04 Thread Len Rugen
Thanks!  That one works with only a warning:
warning: parenthesize argument(s) for future version

but I can't figure out where it would like parens.

This is the problem with web/wiki doc, you never know if it's REALLY right.
I couldn't get any regex option working in a template either, but then, I
don't know regex.

It seems I'm presented with 2-3 new things a week that I'm supposed to fully
understand and know the syntax in full detail.  It's not going to
happen

Now back to something called maven..

-- 
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] syntax

2010-03-04 Thread Joe McDonagh

Len Rugen wrote:

Thanks!  That one works with only a warning:
warning: parenthesize argument(s) for future version
 
but I can't figure out where it would like parens.
 
This is the problem with web/wiki doc, you never know if it's REALLY 
right.  I couldn't get any regex option working in a template either, 
but then, I don't know regex.
That (regex in a template) is a function of ruby, and probably a slight 
syntactic issue, like putting the tilde on the wrong side of the equals 
sign, forgetting to encapsulate your regex in //, etc.
 
It seems I'm presented with 2-3 new things a week that I'm supposed to 
fully understand and know the syntax in full detail.  It's not going 
to happen
If you're in the infrastructure business, sounds like par for the 
course. This is why we make the big bucks. As far as the docs go, you 
may just be on an older version of puppet. Running 'puppetdoc' with no 
arguments will spit out docs for the running version on your system.
 
Now back to something called maven..


--
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.



--
Joe McDonagh
AIM: YoosingYoonickz
IRC: joe-mac on freenode
L'ennui est contre-révolutionnaire

--
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] syntax

2010-03-04 Thread Len Rugen
Well, it workes in erb test, but not when puppet runs:

undefined method `start_with?' for  via puppet

erb -x -T '-' test.erb | ruby -c  says Syntax OK




On Thu, Mar 4, 2010 at 10:40 AM, Len Rugen lenru...@gmail.com wrote:

 Thanks!  That one works with only a warning:
 warning: parenthesize argument(s) for future version

 but I can't figure out where it would like parens.

 This is the problem with web/wiki doc, you never know if it's REALLY
 right.  I couldn't get any regex option working in a template either, but
 then, I don't know regex.

 It seems I'm presented with 2-3 new things a week that I'm supposed to
 fully understand and know the syntax in full detail.  It's not going to
 happen

 Now back to something called maven..



-- 
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] syntax

2010-03-04 Thread Nigel Kersten
On Thu, Mar 4, 2010 at 9:01 AM, Len Rugen lenru...@gmail.com wrote:
 Well, it workes in erb test, but not when puppet runs:

 undefined method `start_with?' for  via puppet

 erb -x -T '-' test.erb | ruby -c  says Syntax OK

I thought 'start_with was a ruby 1.9 thing only? And starts_with is
a Rails-ism ?






 On Thu, Mar 4, 2010 at 10:40 AM, Len Rugen lenru...@gmail.com wrote:

 Thanks!  That one works with only a warning:
 warning: parenthesize argument(s) for future version

 but I can't figure out where it would like parens.

 This is the problem with web/wiki doc, you never know if it's REALLY
 right.  I couldn't get any regex option working in a template either, but
 then, I don't know regex.

 It seems I'm presented with 2-3 new things a week that I'm supposed to
 fully understand and know the syntax in full detail.  It's not going to
 happen

 Now back to something called maven..


 --
 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.




-- 
nigel

-- 
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] syntax

2010-03-04 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 Well, it workes in erb test, but not when puppet runs:

 undefined method `start_with?' for  via puppet

 erb -x -T '-' test.erb | ruby -c  says Syntax OK
 
 I thought 'start_with was a ruby 1.9 thing only? And starts_with is
 a Rails-ism ?

exactly.

cheers pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuP8TwACgkQbwltcAfKi3+ghwCfTT1ThE2ar9tHrKPH5repB1kl
giIAn2cTfuBUukTtOhTGRxyruif1Vf7y
=YkSL
-END PGP SIGNATURE-

-- 
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] syntax

2010-03-04 Thread Len Rugen
We're running ruby 1.8.5, which is current on the RHEL channel.  Are others
running puppet at 1.9?

-- 
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] syntax

2010-03-04 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 We're running ruby 1.8.5, which is current on the RHEL channel.  Are others
 running puppet at 1.9?

I don't think that puppet is yet fully supported on 1.9, so I don't
assume it. Hence you should go with the RegExp.

cheers pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuQDA0ACgkQbwltcAfKi3+OnQCgtjYJ73n/QOonSrfNf6i48WHJ
TRIAnA4tN1BMJFqiNqEmyMn+KY2zSTjk
=5Htb
-END PGP SIGNATURE-

-- 
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] syntax

2010-03-04 Thread Len Rugen
So can someone point to working regex template example?

Thanks

On Thu, Mar 4, 2010 at 1:37 PM, Peter Meier peter.me...@immerda.ch wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

  We're running ruby 1.8.5, which is current on the RHEL channel.  Are
 others
  running puppet at 1.9?

 I don't think that puppet is yet fully supported on 1.9, so I don't
 assume it. Hence you should go with the RegExp.

 cheers pete
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkuQDA0ACgkQbwltcAfKi3+OnQCgtjYJ73n/QOonSrfNf6i48WHJ
 TRIAnA4tN1BMJFqiNqEmyMn+KY2zSTjk
 =5Htb
 -END PGP SIGNATURE-

 --
 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.compuppet-users%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.



-- 
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] syntax

2010-03-04 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 So can someone point to working regex template example?

First answer of Ohad to your question:

 you might want to try regexp, e.g.

 % if fqdn =~ /^something/ -%


irb(main):001:0  =~ /^aa/
= 0
irb(main):002:0  =~ /^ab/
= nil

=~ returns the first location of the occurence of the pattern or nil if
none is found. if nil in ruby will never be evaluated.

cheers pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuQr9sACgkQbwltcAfKi39wRgCeJtTVbOFcRC4I3TWQFm2YTWOk
mskAni20CwM2zvqarbhyKcQNC9cznNAL
=mAAm
-END PGP SIGNATURE-

-- 
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] Syntax error in ssh::auth module?

2010-02-18 Thread Michael Gliwinski
Hello Andrew,

I'm getting a syntax error when trying to use the ssh::auth module (Syntax 
error at '{'; expected '}' at .../auth.pp:111).  It looks like it's something 
to do with parameters after a collection, i.e. line 111 is:

if $ensure { Ssh_auth_key_client | title == $title | { ensure = $ensure } }

I've had a quick look in puppet documentation and can't find reference (e.g. in 
language tutorial, etc.) to that syntax.  I also searched the mailing lists 
and found something in unrelated discussion on dev list from which I gathered 
that it is a valid syntax.  Is it something new (i.e. newer than 0.24.8)?

Should ssh::auth work on 0.24.8?

BTW, I gather the above should be equivalent to:

if $ensure { Ssh_auth_key_client[$title] { ensure = $ensure } }

yes?

Thanks,

Michael


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**
The information in this email is confidential and may be legally privileged.  
It is intended solely for the addressee and access to the email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail 
are subject to the terms and conditions expressed  in the governing client 
engagement leter or contract.
If you have received this email in error please notify 
supp...@henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, 
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*

-- 
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] Syntax error in ssh::auth module?

2010-02-18 Thread Andrew Schulman
 Hello Andrew,
 
 I'm getting a syntax error when trying to use the ssh::auth module (Syntax 
 error at '{'; expected '}' at .../auth.pp:111).  It looks like it's 
 something 
 to do with parameters after a collection, i.e. line 111 is:
 
 if $ensure { Ssh_auth_key_client | title == $title | { ensure = $ensure } }
 
 I've had a quick look in puppet documentation and can't find reference (e.g. 
 in 
 language tutorial, etc.) to that syntax.  I also searched the mailing lists 
 and found something in unrelated discussion on dev list from which I gathered 
 that it is a valid syntax.  Is it something new (i.e. newer than 0.24.8)?
 
 Should ssh::auth work on 0.24.8?

Hi Michael.  The reference for this syntax is at
http://reductivelabs.com/trac/puppet/wiki/VirtualResources (linked from
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#virtual-resources).
The docs say that virtual resources are supported since 0.20.0, but they
don't say whether the collection syntax ( |...| ) is supported since
then-- maybe it's more recent.  I'm running 0.25.4, so it's possible that
you need a more recent version of Puppet than 0.24.8 to use ssh::auth.

If someone can clarify what Puppet version is required for the collection
syntax, I'll add it to the list of requirements of ssh::auth.

 BTW, I gather the above should be equivalent to:
 
 if $ensure { Ssh_auth_key_client[$title] { ensure = $ensure } }
 
 yes?

No, that's not correct.  To realize a virtual resource, you have to use
either the collection syntax, as in ssh::auth; or the realize function:

  realize Ssh_auth_key_client[$title]

which, according to the docs, doesn't seem to support adding parameters,
e.g.

  realize Ssh_auth_key_client[$title]{ ensure = $ensure }

However, in my testing I found that the above does in fact work, but only
if the parameters inside the brackets haven't been set yet.  That makes it
not useful for ssh::auth, where the purpose is to override defaults.  It's
also undocumented.

If the collection syntax makes ssh::auth unusable in Puppet 0.24, I'd
gladly change it to something more compatible.  But because of the
limitation of the realize function, I can't see a way to do that right now.

Andrew.

-- 
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] Syntax error in ssh::auth module?

2010-02-18 Thread Michael Gliwinski
On Thursday 18 Feb 2010 16:51:38 Andrew Schulman wrote:
  Hello Andrew,
 
  I'm getting a syntax error when trying to use the ssh::auth module
  (Syntax error at '{'; expected '}' at .../auth.pp:111).  It looks like
  it's something to do with parameters after a collection, i.e. line 111
  is:
 
  if $ensure { Ssh_auth_key_client | title == $title | { ensure =
  $ensure } }
 
  I've had a quick look in puppet documentation and can't find reference
  (e.g. in language tutorial, etc.) to that syntax.  I also searched the
  mailing lists and found something in unrelated discussion on dev list
  from which I gathered that it is a valid syntax.  Is it something new
  (i.e. newer than 0.24.8)?
 
  Should ssh::auth work on 0.24.8?
 
 Hi Michael.  The reference for this syntax is at
 http://reductivelabs.com/trac/puppet/wiki/VirtualResources (linked from
 http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#virtual-resource
 s). The docs say that virtual resources are supported since 0.20.0, but
  they don't say whether the collection syntax ( |...| ) is supported
  since then-- maybe it's more recent.  I'm running 0.25.4, so it's possible
  that you need a more recent version of Puppet than 0.24.8 to use
  ssh::auth.

OK

 
 If someone can clarify what Puppet version is required for the collection
 syntax, I'll add it to the list of requirements of ssh::auth.
 
  BTW, I gather the above should be equivalent to:
 
  if $ensure { Ssh_auth_key_client[$title] { ensure = $ensure } }
 
  yes?
 
 No, that's not correct.  To realize a virtual resource, you have to use
 either the collection syntax, as in ssh::auth; or the realize function:
 
   realize Ssh_auth_key_client[$title]
 
 which, according to the docs, doesn't seem to support adding parameters,
 e.g.
 
   realize Ssh_auth_key_client[$title]{ ensure = $ensure }
 
 However, in my testing I found that the above does in fact work, but only
 if the parameters inside the brackets haven't been set yet.  That makes it
 not useful for ssh::auth, where the purpose is to override defaults.  It's
 also undocumented.

Even if collection syntax with parameter override also realizes the resource I 
don't think it matters because in e.g. ssh::auth::client you have:

if $ensure { Ssh_auth_key_client | title = $title | { ensure = $ensure } }
...
realize Ssh_auth_key_client[$title]

So even if parameters are overridden first and the resource is realized 
separately it still works.

 
 If the collection syntax makes ssh::auth unusable in Puppet 0.24, I'd
 gladly change it to something more compatible.  But because of the
 limitation of the realize function, I can't see a way to do that right now.

I did manage to make necessary adjustments to make it work in 0.24.8 but the 
syntax above turned out to be a smaller issue :)  replacing it with the one I 
suggested above worked.

The bigger issue was the =~ operator introduced in 0.25.  I did manage to 
replace it with regsubst but it's ugly (usually one line in 0.25 translates to 
~4 in 0.24.8 using regsubst).  I can attach the file with my changes if you 
want to have a look at it, but it's your call if you want to keep 
compatibility at a price of ... well a bit more convoluted code ;)

Did 0.25 ever land in EPEL?  I really need to have a look at upgrading 
sometime.

 
 Andrew.
 

-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**
The information in this email is confidential and may be legally privileged.  
It is intended solely for the addressee and access to the email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail 
are subject to the terms and conditions expressed  in the governing client 
engagement leter or contract.
If you have received this email in error please notify 
supp...@henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, 
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*

-- 
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] Syntax checking hook when using git?

2009-04-22 Thread Mark Plaksin

Hi:

We want to switch our Puppet config repository from SVN to Git.  Our SVN
repository has a pre-commit hook that does a syntax check.  If the check
fails, the commit fails.  With SVN that hook runs on the server so it's
easy to have (the correct version of) the puppet binary there for the
hook to use.

With Git it looks like the pre-commit hook has to run wherever a person
happens to have checked out the Git repository.  That could be a
desktop, laptop...just about anywhere.  It's harder to make sure the
correct version of Puppet is in all of those places.

Is there a pretty way to solve this problem?  How do you do it?

Is there, perhaps, a way to create a standalone syntax checker that
doesn't require the rest of Puppet?

Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@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
-~--~~~~--~~--~--~---