gentoo / puppet-portage

[ORIGIN] Puppet module providing various Gentoo portage features
GNU General Public License v2.0
49 stars 30 forks source link

[SOLVED] Could not autoload /etc/puppet/modules/portage/lib/puppet/type/package_keywords.rb: cannot load such file -- puppet/util/portage #69

Closed brownandsticky closed 11 years ago

brownandsticky commented 11 years ago

Trying to get started with Puppet, but want to be sure Gentoo package.* are handled before embarking too far.

Fresh install of Gentoo and Puppet. Once the module is installed Puppet will complete no commands, returning: Could not run: Could not autoload /etc/puppet/modules/portage/lib/puppet/type/package_keywords.rb: cannot load such file -- puppet/util/portage

I've tried having portage.* as directories and files, revdep-rebuild, etc.

There was a closed issue on a very similar issue, but the solution the guy used still eludes me.

'hopefully the info below will be of use and it's a simple config error on my part. The Ruby warnings could be significant but again are beyond my ken.

leg ~ # emerge --info
Portage 2.1.11.55 (default/linux/amd64/13.0/desktop, gcc-4.6.3, glibc-2.15-r3, 3.7.10-gentoo x86_64)
=================================================================
System uname: Linux-3.7.10-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8400_@_3.00GHz-with-gentoo-2.1
KiB Mem:     1018432 total,    834080 free
KiB Swap:     785404 total,    785404 free
Timestamp of tree: Thu, 11 Apr 2013 23:15:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles getbinpkg merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://spleen.jrcpoole.com/gentoo-distfiles rsync://mirror.bytemark.co.uk/gentoo/ http://mirror.qubenet.net/mirror/gentoo/ http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/ ftp://ftp.mirrorservice.org/sites/www.ibiblio.org/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://spleen.jrcpoole.com/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gif gpm iconv jpeg kerberos lcms ldap libnotify mad mmext mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 readline sdl session spell sse sse2 ssl startup-notification svg threads tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="virtualbox" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

leg ~ # emerge -va puppet
receiving incremental file list
Packages
      795636 100%   10.69MB/s    0:00:00 (xfer#1, to-check=0/1)

sent 56 bytes  received 795835 bytes  530594.00 bytes/sec
total size is 795636  speedup is 1.00

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-apps/net-tools-1.60_p20120127084908  USE="nls old-output* -static" 223 kB
[ebuild  N     ] virtual/ruby-ssl-0:ruby18  RUBY_TARGETS="(ruby18)" 0 kB
[ebuild  N     ] virtual/ruby-ssl-1:ruby19  RUBY_TARGETS="(ruby19)" 0 kB
[ebuild  N     ] dev-ruby/facter-1.6.16  USE="dmi {-test}" RUBY_TARGETS="ruby18 ruby19 -jruby (-ree18)" 136 kB
[ebuild  N     ] app-admin/puppet-2.7.21  USE="ldap -augeas -diff -doc -emacs -minimal -rrdtool (-selinux) -shadow -sqlite3 {-test} -vim-syntax -xemacs" RUBY_TARGETS="ruby18 ruby19" 1,984 kB                                                                                                                                                                        

Total: 5 packages (4 new, 1 reinstall), Size of downloads: 2,343 kB

Would you like to merge these packages? [Yes/No] y

<< snip >>

leg ~ # shutdown -r -y now

leg ~ # puppet describe -s package
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
racc/parser.rb:27: warning: already initialized constant Racc_Runtime_Version
racc/parser.rb:28: warning: already initialized constant Racc_Runtime_Revision
racc/parser.rb:30: warning: already initialized constant Racc_Runtime_Core_Version_R
racc/parser.rb:31: warning: already initialized constant Racc_Runtime_Core_Revision_R
racc/parser.rb:35: warning: already initialized constant Racc_Runtime_Core_Revision_C
racc/parser.rb:39: warning: already initialized constant Racc_Main_Parsing_Routine
racc/parser.rb:40: warning: already initialized constant Racc_YY_Parse_Method
racc/parser.rb:41: warning: already initialized constant Racc_Runtime_Core_Version
racc/parser.rb:42: warning: already initialized constant Racc_Runtime_Core_Revision
racc/parser.rb:43: warning: already initialized constant Racc_Runtime_Type
/usr/lib64/ruby/site_ruby/1.9.1/puppet/provider/service/freebsd.rb:8: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/provider/service/freebsd.rb:9: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/provider/service/freebsd.rb:10: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/provider/service/bsd.rb:12: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:104: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:109: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:109: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:110: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:110: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:111: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:111: warning: class variable access from toplevel
/usr/lib64/ruby/site_ruby/1.9.1/puppet/type/tidy.rb:151: warning: class variable access from toplevel

package
=======
Manage packages.  There is a basic dichotomy in package
support right now:  Some package types (e.g., yum and apt) can
retrieve their own package files, while others (e.g., rpm and sun)
cannot.  For those package formats that cannot retrieve their own files,
you can use the `source` parameter to point to the correct file.

Puppet will automatically guess the packaging format that you are
using based on the platform you are on, but you can override it
using the `provider` parameter; each provider defines what it
requires in order to function, and you must meet those requirements
to use a given provider.

**Autorequires:** If Puppet is managing the files specified as a
package's `adminfile`, `responsefile`, or `source`, the package
resource will autorequire those files.

Parameters
----------
    adminfile, allowcdrom, category, configfiles, description, ensure,
    flavor, install_options, instance, name, platform, responsefile, root,
    source, status, type, vendor

Providers
---------
    aix, appdmg, apple, apt, aptitude, aptrpm, blastwave, dpkg, fink,
    freebsd, gem, hpux, macports, msi, nim, openbsd, pacman, pip, pkg,
    pkgdmg, pkgutil, portage, ports, portupgrade, rpm, rug, sun,
    sunfreeware, up2date, urpmi, yum, zypper
leg ~ # 

leg ~ # puppet module install adrien/portage
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
Preparing to install into /etc/puppet/modules ...
Downloading from http://forge.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppet/modules
└─┬ adrien-portage (v2.0.1)
  └── ripienaar-concat (v0.2.0)

leg ~ # puppet describe package
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
Could not run: Could not autoload /etc/puppet/modules/portage/lib/puppet/type/package_keywords.rb: cannot load such file -- puppet/util/portage
leg ~

leg ~ # puppet describe file
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
Could not run: Could not autoload /etc/puppet/modules/portage/lib/puppet/type/package_keywords.rb: cannot load such file -- puppet/util/portage
leg ~ # 

leg ~ # ls -R /etc/puppet/
/etc/puppet/:
auth.conf  fileserver.conf  manifests  modules  puppet.conf

/etc/puppet/manifests:

/etc/puppet/modules:
concat  portage

/etc/puppet/modules/concat:
CHANGELOG  LICENSE  Modulefile  README.markdown  Rakefile  files  lib  manifests  metadata.json  spec

/etc/puppet/modules/concat/files:
concatfragments.sh  null

/etc/puppet/modules/concat/files/null:

/etc/puppet/modules/concat/lib:
facter

/etc/puppet/modules/concat/lib/facter:
concat_basedir.rb

/etc/puppet/modules/concat/manifests:
fragment.pp  init.pp  setup.pp

/etc/puppet/modules/concat/spec:
defines  fixtures  spec_helper.rb

/etc/puppet/modules/concat/spec/defines:
init_spec.rb

/etc/puppet/modules/concat/spec/fixtures:
manifests

/etc/puppet/modules/concat/spec/fixtures/manifests:
site.pp

/etc/puppet/modules/portage:
CHANGELOG  Gemfile  Gemfile.lock  LICENSE  Modulefile  README.markdown  Vagrantfile  lib  manifests  metadata.json  spec  templates

/etc/puppet/modules/portage/lib:
facter  puppet

/etc/puppet/modules/portage/lib/facter:
eselect.rb  portage.rb  util

/etc/puppet/modules/portage/lib/facter/util:
portage.rb

/etc/puppet/modules/portage/lib/puppet:
provider  type  util

/etc/puppet/modules/portage/lib/puppet/provider:
eselect  package_keywords  package_mask  package_unmask  package_use  portagefile.rb

/etc/puppet/modules/portage/lib/puppet/provider/eselect:
eselect.rb

/etc/puppet/modules/portage/lib/puppet/provider/package_keywords:
parsed.rb

/etc/puppet/modules/portage/lib/puppet/provider/package_mask:
parsed.rb

/etc/puppet/modules/portage/lib/puppet/provider/package_unmask:
parsed.rb

/etc/puppet/modules/portage/lib/puppet/provider/package_use:
parsed.rb

/etc/puppet/modules/portage/lib/puppet/type:
eselect.rb  package_keywords.rb  package_mask.rb  package_unmask.rb  package_use.rb

/etc/puppet/modules/portage/lib/puppet/util:
portage.rb

/etc/puppet/modules/portage/manifests:
init.pp  makeconf.pp  package.pp  params.pp  postsync.pp

/etc/puppet/modules/portage/spec:
integration  lib  spec_helper.rb  support  unit

/etc/puppet/modules/portage/spec/integration:
provider

/etc/puppet/modules/portage/spec/integration/provider:
package_keywords  package_mask  package_unmask  package_use

/etc/puppet/modules/portage/spec/integration/provider/package_keywords:
parsed_spec.rb

/etc/puppet/modules/portage/spec/integration/provider/package_mask:
parsed_spec.rb

/etc/puppet/modules/portage/spec/integration/provider/package_unmask:
parsed_spec.rb

/etc/puppet/modules/portage/spec/integration/provider/package_use:
parsed_spec.rb

/etc/puppet/modules/portage/spec/lib:
puppet_integration  puppet_integration.rb

/etc/puppet/modules/portage/spec/lib/puppet_integration:
files.rb  fixtures.rb  tmpdir_manager.rb

/etc/puppet/modules/portage/spec/support:
integration

/etc/puppet/modules/portage/spec/support/integration:
provider

/etc/puppet/modules/portage/spec/support/integration/provider:
shared_contexts.rb  shared_examples.rb

/etc/puppet/modules/portage/spec/unit:
provider  type  util

/etc/puppet/modules/portage/spec/unit/provider:
package_keywords  package_mask  package_unmask  package_use

/etc/puppet/modules/portage/spec/unit/provider/package_keywords:
parsed_spec.rb

/etc/puppet/modules/portage/spec/unit/provider/package_mask:
parsed_spec.rb

/etc/puppet/modules/portage/spec/unit/provider/package_unmask:
parsed_spec.rb

/etc/puppet/modules/portage/spec/unit/provider/package_use:
parsed_spec.rb

/etc/puppet/modules/portage/spec/unit/type:
package_keywords_spec.rb  package_mask_spec.rb  package_unmask_spec.rb  package_use_spec.rb

/etc/puppet/modules/portage/spec/unit/util:
portage_spec.rb

/etc/puppet/modules/portage/templates:
makeconf.conf.erb  makeconf.header.conf.erb  postsync.sh.erb
leg ~ # 

adrienthebo commented 11 years ago

@brownandsticky these errors indicate that the module isn't able to autoload all of the custom ruby plugin information for this package. I suspect that this should be fixed in Puppet 3.1 and greater; are you able to test that version of Puppet and see if this issue resolves itself?

Alternately this error might indicate that the autoloader needs to be updated to scan for libraries in puppet/util, but that's me musing more than anything else.

brownandsticky commented 11 years ago

@adrienthebo I installed puppet-3.1.1-r1 and the issue is resolved. Many thanks.

I'm just starting down the Puppet road. But this module brings Gentoo's packaging peculiarities under Puppet control perfectly. It creates/updates "/etc/portage/package.*/default" with the USE flags, keywords etc specified in the manifest.

lifaguiar commented 9 years ago

Change the file /usr/lib/ruby/site_ruby/1.8/puppet/util/autoload.rb to modify the load_file procedure to this form:

def load_file(name, env)
  file = get_file(name.to_s, env)
  return false unless file

  begin
    mark_loaded(name, file)
    Kernel.load file, @wrap
    return true
  rescue SystemExit,NoMemoryError
    raise
  rescue Exception => detail2
    begin
            mark_loaded(name, file)
            Kernel.load file, @wrap
            return true
    rescue Exception => detail
            message = "Could not autoload #{name}: #{detail}"
            Puppet.log_exception(detail, message)
            raise Puppet::Error, message, detail.backtrace
    end
  end
end

The Kernel.load is not loading the file fast enough.

mrVanDalo commented 9 years ago

I got the same error using puppet 4.0.0, i downgraded to version 3.7.4 and everything is fine again.