The package.pp file looks like this :

# Define a slackware package
define slpackage($package) {
        file {
                "/var/lib/slackware-packages/${package}":
                        ensure  => file,
                        owner   => root,
                        group   => root,
                        mode    => 0644,
                        source  => "puppet://puppet/packages/${package}",
                        require => [File["/var/lib/slackware-packages"], ];
        }

        $foldername = getPackageName($package)

        exec {
                "installpkg /var/lib/slackware-packages/${package}":
                        unless  => "test -f /var/log/packages/${foldername}",
                        require => 
[File["/var/lib/slackware-packages/${package}"], ];
        }
}

It should retrieve a package from the master and move it to /var/lib/
slackware-packages/ then we want to execute the slackware "installpkg"
command to install our package. The getPackageName function only
return the the name of the package without the ".tgz" extension.

Thank you
Dom

On Apr 13, 6:08 pm, Denmat <tu2bg...@gmail.com> wrote:
> Hi,
>
> Not sure what the error message means or why it doesn't like line 28.
>
> > /etc/puppet/manifests/
> > classes/package.pp:28
>
> I do believe your master should be at least the same version as the clients 
> though.
>
> Maybe try them at the same version level? If still complains you should post 
> the package.pp file.
>
> Cheers,
> Den
>
> On 14/04/2011, at 7:12, Dom <dominick.riv...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Puppet v2.6.7
> > Puppet Master v2.6.5
>
> > Hi everyone,
>
> > I wrote my first custom function and I can't get it to work on the
> > client.
> > The error message is :
>
> > --------------------------------------------------------------------------- 
> > -
> > debug: Using cached certificate_revocation_list for ca
> > debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw
> > yaml; using pson
> > err: Could not retrieve catalog from remote server: Error 400 on
> > SERVER: Unknown function getPackageName at /etc/puppet/manifests/
> > classes/package.pp:28 on node mynode
> > info: Not using expired catalog for mynode from cache; expired at Wed
> > Apr 13 10:29:29 -0400 2011
> > notice: Using cached catalog
> > err: Could not retrieve catalog; skipping run
> > debug: Using cached certificate for ca
> > --------------------------------------------------------------------------- 
> > -
>
> > This is where I copy the file on the puppet master:
>
> > /var/lib/puppet/lib/puppet/parser/functions/strSlice.rb
> > # also tried /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/
> > strSlice.rb
>
> > On the puppet master I tried these command :
>
> > ruby -rpuppet strSlice.rb # it return nothing and no error
> > irb
> >> require 'puppet'
> >> require '/var/lib/puppet/lib/puppet/parser/functions/strSlice.rb'
> >> Puppet::Parser::Functions.function(:getPackageName)
> > => "function_getPackageName"
>
> > So it seems to be fine on the puppetmaster, at least it find out my
> > custom function. What did I miss to get it to work on the client?
>
> > Thank you.
> > Dom
>
> > --
> > 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 
> > athttp://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.

Reply via email to