Hi, I am running into this error: Running Puppet agent on demand ... Info: Retrieving plugin Info: Caching catalog for test-pc Error: Failed to apply catalog: Parameter source failed on File[c:/locale.reg]: Cannot use relative URLs ''/etc/puppet/modules/a_locale'' Why the source is not working as should ? $ ls -l /etc/puppet/modules/ -rw-r--r-- 1 root root 1898 Mar 20 15:44 a_locale site.pp case $operatingsystem { windows: { $fileName="c:/locale.reg"} default: { fail("[puppet]" os not supported) } } file { $fileName: ensure => present, source => "/etc/puppet/modules/a_locale", } -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
The source parameter takes URIs. You can''t just give it a system path. Make sure the file lives in a "files" directory in a module and is properly readable by puppet and use puppet://modules/(modulename)/(filename) in source. On Thursday, March 21, 2013 12:38:32 AM UTC-7, Dragos R wrote:> > Hi, > > I am running into this error: > > Running Puppet agent on demand ... > > Info: Retrieving plugin > > Info: Caching catalog for test-pc > > Error: Failed to apply catalog: Parameter source failed on > File[c:/locale.reg]: Cannot use relative URLs > ''/etc/puppet/modules/a_locale'' > > Why the source is not working as should ? > $ ls -l /etc/puppet/modules/ > -rw-r--r-- 1 root root 1898 Mar 20 15:44 a_locale > > > site.pp > > case $operatingsystem { > windows: { $fileName="c:/locale.reg"} > default: { fail("[puppet]" os not supported) } > } > > file { $fileName: > ensure => present, > source => "/etc/puppet/modules/a_locale", > } > > >-- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Thanks, It worked. Though it would of been great to make source work without creating all that structure. If you don''t mind can you please tell me where I can put my logic now if I want to deploy certain files depending on the OS: in the init.pp or the site.pp ? tree -a --charset=ASCII /etc/puppet/modules/ /etc/puppet/modules/ `-- aex |-- files | `-- aexlocale `-- manifests `-- init.pp 3 directories, 2 files site.pp import ''aex'' include aex case $operatingsystem { centos: { include abc ? } windows: { include aex } default: { fail("[puppet] OS not supported") } } ? Regards On Thursday, March 21, 2013 10:56:16 AM UTC+2, Ellison Marks wrote:> > The source parameter takes URIs. You can''t just give it a system path. > Make sure the file lives in a "files" directory in a module and is properly > readable by puppet and use puppet://modules/(modulename)/(filename) in > source. > > On Thursday, March 21, 2013 12:38:32 AM UTC-7, Dragos R wrote: >> >> Hi, >> >> I am running into this error: >> >> Running Puppet agent on demand ... >> >> Info: Retrieving plugin >> >> Info: Caching catalog for test-pc >> >> Error: Failed to apply catalog: Parameter source failed on >> File[c:/locale.reg]: Cannot use relative URLs >> ''/etc/puppet/modules/a_locale'' >> >> Why the source is not working as should ? >> $ ls -l /etc/puppet/modules/ >> -rw-r--r-- 1 root root 1898 Mar 20 15:44 a_locale >> >> >> site.pp >> >> case $operatingsystem { >> windows: { $fileName="c:/locale.reg"} >> default: { fail("[puppet]" os not supported) } >> } >> >> file { $fileName: >> ensure => present, >> source => "/etc/puppet/modules/a_locale", >> } >> >> >> >-- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, March 21, 2013 6:19:39 AM UTC-5, Dragos R wrote:> > Thanks, > > It worked. Though it would of been great to make source work without > creating all that structure. > >If you had already been putting your code in modules, which I would recommend to everyone, then it would not have been "all that [new] structure" -- just one subdirectory of your existing module''s main directory. If I interpret you correctly then you have now created a module for your class, so good show! Do note that you do not necessarily need a separate module for each class. Part of the idea is that you can, and often should, group related classes together in the same module. Note also that one of the advantages of modules is enabling the autoloader. You do not need to ''import'' the manifests of classes that are properly laid out in modules, and indeed, you should not do so, so scratch the "import ''aex''" from your site.pp. As for where you put your logic: a module''s init.pp should not contain any top-level declarations other than the definition of a class with the same name as the module in which it appears -- ''aex'' in your case. If the logic you are talking about belongs inside class aex then put it there; otherwise not. Probably, however, it does not belong in site.pp or anywhere else at top level. Generally speaking, logic belongs in classes, and classes should be in modules. Very little should appear at top level in your site.pp and any manifests it imports, other than node definitions and possibly global resource defaults. Only a single class or definition should appear at top level in other manifests (which should all belong to modules). 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+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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.