On Wed, Mar 24, 2010 at 8:28 AM, Peter Meier <[email protected]> wrote:

> Could not autoload "/var/puppet/lib/puppet/provider/package/flatpkg.rb":
>> wrong number of arguments (2 for 1)
>> Could not autoload "/var/puppet/lib/puppet/provider/package/flatpkg.rb":
>> wrong number of arguments (2 for 1)
>>
>
> it is still called with the wrong number of arguments. do you have it
> somewhere available? I assume that its method signature looks different to
> existing providers in a critical part.
>
> and could you run it with --trace so we can get a stacktrace?
>
> cheers pete
>
>
Hello Pete,

mac-mini:~ rsn$ sudo puppetd -o --no-daemonize -v --debug +ignorecache
--trace
Password:
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Puppet::Type::User::ProviderUseradd: file userdel does not exist
debug: Puppet::Type::User::ProviderUser_role_add: file rolemod does not exist
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderDirectoryservice: Executing
'/usr/bin/dscl -plist . -list /Users'
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/etc/puppet/ssl/certs]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/puppet/facts]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/clientbucket]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/state/classes.txt]: Autorequiring
File[/var/puppet/state]
debug: /File[/etc/puppet/ssl/private_keys]: Autorequiring
File[/etc/puppet/ssl]
debug: /File[/etc/puppet/ssl/certs/ca.pem]: Autorequiring
File[/etc/puppet/ssl/certs]
debug: /File[/etc/puppet/ssl/certificate_requests]: Autorequiring
File[/etc/puppet/ssl]
debug: /File[/etc/puppet/ssl/crl.pem]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/puppet/lib]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/ssl/public_keys]: Autorequiring
File[/etc/puppet/ssl]
debug: /File[/var/puppet/state/state.yaml]: Autorequiring
File[/var/puppet/state]
debug: /File[/var/puppet/state/graphs]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/log]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/etc/puppet/ssl/private_keys/mac-mini.lanl.gov.pem]:
Autorequiring File[/etc/puppet/ssl/private_keys]
debug: /File[/etc/puppet/ssl/certs/mac-mini.lanl.gov.pem]: Autorequiring
File[/etc/puppet/ssl/certs]
debug: /File[/var/puppet/client_yaml]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/ssl]: Autorequiring File[/etc/puppet]
debug: /File[/var/puppet/state]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/ssl/public_keys/mac-mini.lanl.gov.pem]:
Autorequiring File[/etc/puppet/ssl/public_keys]
debug: /File[/var/puppet/run]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/ssl/private]: Autorequiring File[/etc/puppet/ssl]
debug: Finishing transaction 18965070 with 0 changes
debug: Using cached certificate for ca
debug: Using cached certificate for mac-mini.lanl.gov
debug: Loaded state in 0.01 seconds
info: Retrieving plugin
debug: Using cached certificate for ca
debug: Using cached certificate for mac-mini.lanl.gov
debug: Using cached certificate_revocation_list for ca
debug: Format pson not supported for Puppet::FileServing::Metadata; has
not implemented method 'from_pson'
debug: Format s not supported for Puppet::FileServing::Metadata; has not
implemented method 'from_s'
debug: Finishing transaction 18619310 with 0 changes
info: Loading facts in lanl_filesystem_type
info: Loading facts in lanl_firefox_version
info: Loading facts in lanl_little_snitch_version
info: Loading facts in lanl_partition_type
info: Loading facts in lanl_property_number
info: Loading facts in lanl_sav_autoprotect
info: Loading facts in lanl_sav_defDate
info: Loading facts in lanl_sav_sym_schedule_version
info: Loading facts in lanl_sav_version
info: Loading facts in lanl_smart_status
info: Loading facts in lanl_sto_exit_code
info: Loading facts in lanl_sto_installed
info: Loading facts in lanl_sto_version
info: Loading facts in lanl_sys_admin
info: Loading facts in lanl_filesystem_type
info: Loading facts in lanl_firefox_version
info: Loading facts in lanl_little_snitch_version
info: Loading facts in lanl_partition_type
info: Loading facts in lanl_property_number
info: Loading facts in lanl_sav_autoprotect
info: Loading facts in lanl_sav_defDate
info: Loading facts in lanl_sav_sym_schedule_version
info: Loading facts in lanl_sav_version
info: Loading facts in lanl_smart_status
info: Loading facts in lanl_sto_exit_code
info: Loading facts in lanl_sto_installed
info: Loading facts in lanl_sto_version
info: Loading facts in lanl_sys_admin
debug: Format s not supported for Puppet::Resource::Catalog; has not
implemented method 'from_s'
info: Caching catalog for mac-mini.lanl.gov
/var/puppet/lib/puppet/provider/package/flatpkg.rb:25:in `provider'
/var/puppet/lib/puppet/provider/package/flatpkg.rb:25
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:124:in `require'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:124:in `loadall'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:120:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:120:in `loadall'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:119:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:119:in `loadall'
/Library/Ruby/Site/1.8/puppet/metatype/manager.rb:93:in `newtype'
/Library/Ruby/Site/1.8/puppet.rb:157:in `newtype'
/Library/Ruby/Site/1.8/puppet/type/package.rb:7
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:85:in `load'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:85:in `load'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:81:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:81:in `load'
/Library/Ruby/Site/1.8/puppet/metatype/manager.rb:119:in `type'
/Library/Ruby/Site/1.8/puppet/resource.rb:171:in `to_ral'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `send'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `each'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:474:in `to_ral'
/Library/Ruby/Site/1.8/puppet/configurer.rb:125:in `convert_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:120:in `retrieve_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:145:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent/locker.rb:21:in `lock'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/sync.rb:229:in
`synchronize'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:130:in `with_client'
/Library/Ruby/Site/1.8/puppet/agent.rb:51:in `run'
/Library/Ruby/Site/1.8/puppet/application/puppetd.rb:103:in `onetime'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `send'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `run_command'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/Library/Ruby/Site/1.8/puppet/application.rb:306:in `exit_on_fail'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
Could not autoload "/var/puppet/lib/puppet/provider/package/flatpkg.rb":
wrong number of arguments (2 for 1)
/var/puppet/lib/puppet/provider/package/flatpkg.rb:25:in `provider'
/var/puppet/lib/puppet/provider/package/flatpkg.rb:25
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:124:in `require'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:124:in `loadall'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:120:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:120:in `loadall'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:119:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:119:in `loadall'
/Library/Ruby/Site/1.8/puppet/metatype/manager.rb:93:in `newtype'
/Library/Ruby/Site/1.8/puppet.rb:157:in `newtype'
/Library/Ruby/Site/1.8/puppet/type/package.rb:7
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:85:in `load'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:85:in `load'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:81:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:81:in `load'
/Library/Ruby/Site/1.8/puppet/metatype/manager.rb:119:in `type'
/Library/Ruby/Site/1.8/puppet/resource.rb:171:in `to_ral'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `send'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `each'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:474:in `to_ral'
/Library/Ruby/Site/1.8/puppet/configurer.rb:125:in `convert_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:120:in `retrieve_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:145:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent/locker.rb:21:in `lock'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/sync.rb:229:in
`synchronize'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:130:in `with_client'
/Library/Ruby/Site/1.8/puppet/agent.rb:51:in `run'
/Library/Ruby/Site/1.8/puppet/application/puppetd.rb:103:in `onetime'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `send'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `run_command'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/Library/Ruby/Site/1.8/puppet/application.rb:306:in `exit_on_fail'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
Could not autoload "/var/puppet/lib/puppet/provider/package/flatpkg.rb":
wrong number of arguments (2 for 1)
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_delete
does not exist
debug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderPorts: file
/usr/local/sbin/portupgrade does not exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgrm does not
exist
debug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not
exist
debug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not
exist
debug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude
does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_delete does not exist
debug: Puppet::Type::Package::ProviderDarwinport: file /opt/local/bin/port
does not exist
debug: Puppet::Type::Package::ProviderYum: file rpm does not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix does not
exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmq does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox
does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall does
not exist
debug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist
Could not autoload flatpkg: wrong number of arguments (2 for 1)
/var/puppet/lib/puppet/provider/package/flatpkg.rb:25:in `provider'
/var/puppet/lib/puppet/provider/package/flatpkg.rb:25
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:85:in `load'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:85:in `load'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:81:in `each'
/Library/Ruby/Site/1.8/puppet/util/autoload.rb:81:in `load'
/Library/Ruby/Site/1.8/puppet/type.rb:1512:in `provider'
/Library/Ruby/Site/1.8/puppet/type.rb:1607:in `unsafe_validate'
/Library/Ruby/Site/1.8/puppet/parameter.rb:489:in `validate'
/Library/Ruby/Site/1.8/puppet/parameter.rb:511:in `value='
/Library/Ruby/Site/1.8/puppet/type.rb:452:in `[]='
/Library/Ruby/Site/1.8/puppet/type.rb:1935:in `set_parameters'
/Library/Ruby/Site/1.8/puppet/type.rb:1929:in `each'
/Library/Ruby/Site/1.8/puppet/type.rb:1929:in `set_parameters'
/Library/Ruby/Site/1.8/puppet/type.rb:1909:in `initialize'
/Library/Ruby/Site/1.8/puppet/resource.rb:172:in `new'
/Library/Ruby/Site/1.8/puppet/resource.rb:172:in `to_ral'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `send'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `each'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:474:in `to_ral'
/Library/Ruby/Site/1.8/puppet/configurer.rb:125:in `convert_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:120:in `retrieve_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:145:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent/locker.rb:21:in `lock'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/sync.rb:229:in
`synchronize'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:130:in `with_client'
/Library/Ruby/Site/1.8/puppet/agent.rb:51:in `run'
/Library/Ruby/Site/1.8/puppet/application/puppetd.rb:103:in `onetime'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `send'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `run_command'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/Library/Ruby/Site/1.8/puppet/application.rb:306:in `exit_on_fail'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
/Library/Ruby/Site/1.8/puppet/parameter.rb:394:in `fail'
/Library/Ruby/Site/1.8/puppet/parameter.rb:491:in `validate'
/Library/Ruby/Site/1.8/puppet/parameter.rb:511:in `value='
/Library/Ruby/Site/1.8/puppet/type.rb:452:in `[]='
/Library/Ruby/Site/1.8/puppet/type.rb:1935:in `set_parameters'
/Library/Ruby/Site/1.8/puppet/type.rb:1929:in `each'
/Library/Ruby/Site/1.8/puppet/type.rb:1929:in `set_parameters'
/Library/Ruby/Site/1.8/puppet/type.rb:1909:in `initialize'
/Library/Ruby/Site/1.8/puppet/resource.rb:172:in `new'
/Library/Ruby/Site/1.8/puppet/resource.rb:172:in `to_ral'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `send'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:576:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `each'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:554:in `to_catalog'
/Library/Ruby/Site/1.8/puppet/resource/catalog.rb:474:in `to_ral'
/Library/Ruby/Site/1.8/puppet/configurer.rb:125:in `convert_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:120:in `retrieve_catalog'
/Library/Ruby/Site/1.8/puppet/configurer.rb:145:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent/locker.rb:21:in `lock'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/sync.rb:229:in
`synchronize'
/Library/Ruby/Site/1.8/puppet/agent.rb:53:in `run'
/Library/Ruby/Site/1.8/puppet/agent.rb:130:in `with_client'
/Library/Ruby/Site/1.8/puppet/agent.rb:51:in `run'
/Library/Ruby/Site/1.8/puppet/application/puppetd.rb:103:in `onetime'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `send'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `run_command'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/Library/Ruby/Site/1.8/puppet/application.rb:306:in `exit_on_fail'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
err: Could not run Puppet configuration client: Invalid package provider
'flatpkg' at
/Groups/roytest/modules/flattest/manifests/definitions/fpkg.pp:31
mac-mini:~ rsn$


and here's the provider (that works when put in the right place in the ruby
path on the server and client)

#
# flatpkg.rb
#
# Install Installer.app packages wrapped up inside a DMG image file.
#
# Copyright (C) 2007 Jeff McCune Jeff McCune <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation (version 2 of the License)
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA  02110-1301 USA
#
# Note: the 'flatpkg' Provider checks for installed .pkg file names
# in /var/db/.puppet_flat_pkg_installed_<name>

require 'puppet/provider/package'
require 'facter/util/plist'

Puppet::Type.type(:package).provider(:flatpkg, :parent =>
Puppet::Provider::Package) do
    desc "Package management based on Apple's Installer.app.  This package
works by
    installing a flat .pkg or .mpkg file."

    confine :operatingsystem => :darwin
    defaultfor :operatingsystem => :darwin
    commands :installer => "/usr/sbin/installer"
    commands :curl => "/usr/bin/curl"

    # JJM We store a cookie for each installed .pkg in /var/db
    def self.instance_by_name
        Dir.entries("/var/db").find_all { |f|
            f =~ /^\.puppet_flat_pkg_installed_/
        }.collect do |f|
            name = f.sub(/^\.puppet_flat_pkg_installed_/, '')
            yield name if block_given?
            name
        end
    end

    def self.instances
        instance_by_name.collect do |name|
            new(
                :name => name,
                :provider => :flatpkg,
                :ensure => :installed
            )
        end
    end

    def self.installpkg(source, name, orig_source)
      installer "-pkg", source, "-target", "/"
      # Non-zero exit status will throw an exception.
      File.open("/var/db/.puppet_flat_pkg_installed_#{name}", "w") do |t|
          t.print "name: '#{name}'\n"
          t.print "source: '#{orig_source}'\n"
      end
    end

    def self.installflatpkg(source, name)
        unless source =~ /\.pkg$/i
            raise Puppet::Error.new("Mac OS X Flat PKG's must specificy a
source string ending in .pkg")
        end

        # curl down the flat package
        require 'open-uri'
        cached_source = source
        if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
            cached_source = "/tmp/#{name}"
            begin
                curl "-o", cached_source, "-C", "-", "-k", "-s", "--url",
source
                Puppet.debug "Success: curl transfered [#{name}]"
            rescue Puppet::ExecutionFailure
                Puppet.debug "curl did not transfer [#{name}].  Falling back
to slower open-uri transfer methods."
                cached_source = source
            end
        begin
        # install the flat package
        installpkg(cached_source, name, source)
        ensure
        # JJM Remove the file if open-uri didn't already do so.
        File.unlink(cached_source) if File.exist?(cached_source)
            end
    end
    end

    def query
        if
FileTest.exists?("/var/db/.puppet_flat_pkg_installed...@resource[:name]}")
            return {:name => @resource[:name], :ensure => :present}
        else
            return nil
        end
    end

    def install
        source = nil
        unless source = @resource[:source]
            raise Puppet::Error.new("Mac OS X PKG DMG's must specify a
package source.")
        end
        unless name = @resource[:name]
            raise Puppet::Error.new("Mac OS X PKG DMG's must specify a
package name.")
        end
        self.class.installflatpkg(source,name)
    end
end


Thanks,
-Roy

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to