Hi all, I''m using the puppetlabs/ntp module and would like to define the ntp servers based on the fact timezone: #ntp class { ''::ntp'': case $timezone { PDT: { servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', ''2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], } default: { fail("Unrecognized timezone $timezone") } } } The above gives me "Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at ''timezone''; expected ''}'' at /etc/puppet/modules/linux/manifests/init.pp:56 on node" but It''s unclear to me what I''ve done wrong. Any suggestions? Thank you in advance! Greg -- 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
Hi, To me, this would look like this. You''re assigning the ''server'' variable using =>, rather than =: class { ''::ntp'': case $timezone { ''PDT'': { servers = [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''] } default: { fail("Unrecognized timezone $timezone") } # rest of the class. .... } I hope this helps. -frederiko On Thu, Sep 5, 2013 at 9:25 AM, Greg Coit <gregcoit@gmail.com> wrote:> Hi all, > > I''m using the puppetlabs/ntp module and would like to define the ntp > servers based on the fact timezone: > > #ntp > class { ''::ntp'': > case $timezone { > PDT: { servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' > 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], } > default: { fail("Unrecognized timezone $timezone") } > } > } > > The above gives me "Error: Could not retrieve catalog from remote server: > Error 400 on SERVER: Syntax error at ''timezone''; expected ''}'' at > /etc/puppet/modules/linux/manifests/init.pp:56 on node" but It''s unclear to > me what I''ve done wrong. Any suggestions? > > Thank you in advance! > > Greg > > -- > 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+unsubscribe@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. > 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
Thank you for the reply Frederiko. Unfortunately, that doesn''t seem to be the issue. The following is from the pupetlabs/ntep docs and works: class { ''::ntp'': servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', ''2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], } Greg On Thursday, September 5, 2013 10:41:25 AM UTC-7, Frederiko Costa wrote:> > Hi, > > To me, this would look like this. You''re assigning the ''server'' variable > using =>, rather than =: > > class { ''::ntp'': > case $timezone { > ''PDT'': { > servers = [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' > 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''] } > default: { > fail("Unrecognized timezone $timezone") > } > > # rest of the class. > .... > } > > I hope this helps. > > -frederiko > > > > On Thu, Sep 5, 2013 at 9:25 AM, Greg Coit <greg...@gmail.com <javascript:> > > wrote: > >> Hi all, >> >> I''m using the puppetlabs/ntp module and would like to define the ntp >> servers based on the fact timezone: >> >> #ntp >> class { ''::ntp'': >> case $timezone { >> PDT: { servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' >> 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], } >> default: { fail("Unrecognized timezone $timezone") } >> } >> } >> >> The above gives me "Error: Could not retrieve catalog from remote server: >> Error 400 on SERVER: Syntax error at ''timezone''; expected ''}'' at >> /etc/puppet/modules/linux/manifests/init.pp:56 on node" but It''s unclear to >> me what I''ve done wrong. Any suggestions? >> >> Thank you in advance! >> >> Greg >> >> -- >> 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...@googlegroups.com <javascript:>. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> Visit this group at http://groups.google.com/group/puppet-users. >> 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
Ohh.. my bad. You''re actually instantiating the parametized class ntp. I accidentally thought you were writing your module. In that case, you might want to try using selectors. But I don''t remember from the top of my head if the fail() function would work. Let''s stick with the ''case'' anyway ... Try this, assuming you have a node declaration ... node ''a.b.c.d'' { case $timezone { ''PDT'': { $my_ntp_servers = [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', ''2.us.pool.ntp.org'', ''3.us.pool.ntp.org''] } default: { fail("Unrecognized timezone $timezone") } class { ''ntp'': server => $my_ntp_servers, } } If I were you, I would put the timezone logic outside. Hope this time I''m correct. :-) -frederiko On Thu, Sep 5, 2013 at 11:15 AM, Greg Coit <gregcoit@gmail.com> wrote:> Thank you for the reply Frederiko. Unfortunately, that doesn''t seem to be > the issue. The following is from the pupetlabs/ntep docs and works: > > class { ''::ntp'': > servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' > 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], > } > > Greg > > > On Thursday, September 5, 2013 10:41:25 AM UTC-7, Frederiko Costa wrote: > >> Hi, >> >> To me, this would look like this. You''re assigning the ''server'' variable >> using =>, rather than =: >> >> class { ''::ntp'': >> case $timezone { >> ''PDT'': { >> servers = [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' >> 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''] } >> default: { >> fail("Unrecognized timezone $timezone") >> } >> >> # rest of the class. >> .... >> } >> >> I hope this helps. >> >> -frederiko >> >> >> >> On Thu, Sep 5, 2013 at 9:25 AM, Greg Coit <greg...@gmail.com> wrote: >> >>> Hi all, >>> >>> I''m using the puppetlabs/ntp module and would like to define the ntp >>> servers based on the fact timezone: >>> >>> #ntp >>> class { ''::ntp'': >>> case $timezone { >>> PDT: { servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' >>> 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], } >>> default: { fail("Unrecognized timezone $timezone") } >>> } >>> } >>> >>> The above gives me "Error: Could not retrieve catalog from remote >>> server: Error 400 on SERVER: Syntax error at ''timezone''; expected ''}'' at >>> /etc/puppet/modules/linux/**manifests/init.pp:56 on node" but It''s >>> unclear to me what I''ve done wrong. Any suggestions? >>> >>> Thank you in advance! >>> >>> Greg >>> >>> -- >>> 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...@**googlegroups.com. >>> To post to this group, send email to puppet...@googlegroups.com. >>> >>> Visit this group at http://groups.google.com/**group/puppet-users<http://groups.google.com/group/puppet-users> >>> . >>> For more options, visit https://groups.google.com/**groups/opt_out<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+unsubscribe@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. > 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
Frederiko, That worked perfectly! I was trying to be too fancy I guess. Thank you for the help!!!! Greg On Thursday, September 5, 2013 11:27:02 AM UTC-7, Frederiko Costa wrote:> > Ohh.. my bad. You''re actually instantiating the parametized class ntp. I > accidentally thought you were writing your module. > > In that case, you might want to try using selectors. But I don''t remember > from the top of my head if the fail() function would work. Let''s stick with > the ''case'' anyway ... > > Try this, assuming you have a node declaration ... > > node ''a.b.c.d'' { > case $timezone { > ''PDT'': { > $my_ntp_servers = [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', > ''2.us.pool.ntp.org'', ''3.us.pool.ntp.org''] } > default: { > fail("Unrecognized timezone $timezone") > } > > class { ''ntp'': > server => $my_ntp_servers, > } > } > > If I were you, I would put the timezone logic outside. > > Hope this time I''m correct. :-) > > -frederiko > > > > On Thu, Sep 5, 2013 at 11:15 AM, Greg Coit <greg...@gmail.com<javascript:> > > wrote: > >> Thank you for the reply Frederiko. Unfortunately, that doesn''t seem to >> be the issue. The following is from the pupetlabs/ntep docs and works: >> >> class { ''::ntp'': >> servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' >> 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], >> } >> >> Greg >> >> >> On Thursday, September 5, 2013 10:41:25 AM UTC-7, Frederiko Costa wrote: >> >>> Hi, >>> >>> To me, this would look like this. You''re assigning the ''server'' variable >>> using =>, rather than =: >>> >>> class { ''::ntp'': >>> case $timezone { >>> ''PDT'': { >>> servers = [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' >>> 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''] } >>> default: { >>> fail("Unrecognized timezone $timezone") >>> } >>> >>> # rest of the class. >>> .... >>> } >>> >>> I hope this helps. >>> >>> -frederiko >>> >>> >>> >>> On Thu, Sep 5, 2013 at 9:25 AM, Greg Coit <greg...@gmail.com> wrote: >>> >>>> Hi all, >>>> >>>> I''m using the puppetlabs/ntp module and would like to define the ntp >>>> servers based on the fact timezone: >>>> >>>> #ntp >>>> class { ''::ntp'': >>>> case $timezone { >>>> PDT: { servers => [ ''0.us.pool.ntp.org'', ''1.us.pool.ntp.org'', '' >>>> 2.us.pool.ntp.org'', ''3.us.pool.ntp.org''], } >>>> default: { fail("Unrecognized timezone $timezone") } >>>> } >>>> } >>>> >>>> The above gives me "Error: Could not retrieve catalog from remote >>>> server: Error 400 on SERVER: Syntax error at ''timezone''; expected ''}'' at >>>> /etc/puppet/modules/linux/**manifests/init.pp:56 on node" but It''s >>>> unclear to me what I''ve done wrong. Any suggestions? >>>> >>>> Thank you in advance! >>>> >>>> Greg >>>> >>>> -- >>>> 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...@**googlegroups.com. >>>> To post to this group, send email to puppet...@googlegroups.com. >>>> >>>> Visit this group at http://groups.google.com/**group/puppet-users<http://groups.google.com/group/puppet-users> >>>> . >>>> For more options, visit https://groups.google.com/**groups/opt_out<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...@googlegroups.com <javascript:>. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> Visit this group at http://groups.google.com/group/puppet-users. >> 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.