managedmac icon indicating copy to clipboard operation
managedmac copied to clipboard

Could not autoload puppet/type/propertylist

Open abuzze opened this issue 11 years ago • 6 comments

I am rather new to puppet and my goal is to manage some macs with managedmac 0.7.2 on a puppetmaster 3.8. It's running on Ubuntu 14.04.

After moving the module to /etc/puppet/environments/production/modules, i already figured out how to join a client to the active directory and enabling the remote management. The next step should be managing some plist files. But running sudo puppet agent -tv results in this error:

Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/propertylist: cannot load such file -- /lib/puppet/managedmac/common.rb on node vmtest.local
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

I verified that pluginsync is true in [main] on the server and the client in the puppet.conf. Changing the module files, results in a download to the client, so it should be working. I can also see all files in /lib/puppet/ on the client.

/lib/puppet
├── feature
│   ├── cfpropertylist.rb
│   ├── macadmin.rb
│   └── rubycocoa.rb
├── functions
│   └── type_of.rb
├── managedmac
│   └── common.rb
├── parser
│   └── functions
│       ├── abs.rb
...
├── provider
│   ├── dsconfigad
│   │   └── default.rb
│   ├── file_line
│   │   └── ruby.rb
│   ├── macauthdb
│   │   └── default.rb
│   ├── macgroup
│   │   └── default.rb
│   ├── mobileconfig
│   │   └── default.rb
│   ├── mobileconfig.rb
│   ├── property_list_key
│   │   ├── cfpropertylist.rb
│   │   └── rubycocoa.rb
│   ├── propertylist
│   │   ├── default.rb
│   │   └── defaults.rb
│   ├── propertylist.rb
│   └── remotemanagement
│       └── default.rb
└── type
    ├── anchor.rb
    ├── dsconfigad.rb
    ├── file_line.rb
    ├── macauthdb.rb
    ├── macgroup.rb
    ├── mobileconfig.rb
    ├── property_list_key.rb
    ├── propertylist.rb
    └── remotemanagement.rb

I installed CFPropertyList (2.3.1, 2.2.8) and sqlite3 (1.3.7) on the client and the server via gem install ... To test if my Hashes contain an error i used the example and added this to the site.pp. It resulted in the same error.

node vmtest{
 $defaults = { owner => 'root', method => insert, }
 $files = {
   '/this/is/a/file.plist' => {
     'content' => { 'some_key' => 'some_value'},
     format => xml,
   },
 }

 class { 'managedmac::propertylists':
   files    => $files,
   defaults => $defaults,
 }
}

I also run puppet agent -t on the server, as mentioned in other similar issues. It tried 3 different clients. All OS X 10.10.4.

Any hints on how to debug this problem would be highly appreciated.

abuzze avatar Jul 28 '15 15:07 abuzze

I believe the issue you are seeing is caused by you moving the module into an environment.

Puppet environments are funky -- they do not provide real isolation -- and I believe the issue you are seeing is likely related to the fact that the module no longer resides in /etc/puppet/modules.

Our setup is very similar. To fix this, we are required to either:

a) keep a copy of the managedmac module in /etc/puppet/modules

OR

b) symlink the module out of the environment back into /etc/puppet/modules

Neither of these solutions is great, but if you are using a module that contains plugins AND environments, your efforts to fully isolate the environment that requires such a module will be futile.

Try symlinking the module back into /etc/puppet/modules, running puppet agent -t on the master and then syncing the puppet client again.

HTH

B.

dayglojesus avatar Jul 28 '15 19:07 dayglojesus

For what it's worth, I'm keeping managedmac in /etc/puppet/environments/production/managedmac, but I have pluginsync enabled, and managedmac is magically added to /etc/pupppet/environments

Do you have pluginsync enabled?

groob avatar Jul 28 '15 19:07 groob

@groob Are you saying you are NOT placing the module in /etc/puppet/modules or an environmental equivalent? Or maybe you got the path incorrect?

dayglojesus avatar Jul 28 '15 20:07 dayglojesus

Sorry, I fumbled that above comment. I don't use a puppet master so I might not experience this behavior. My managedmac module is under /etc/puppet/environments/production/modules

However, I had to write the class below to even get plugins to work with puppet apply

# A hack to get around the fact that pluginsync doesn't work properly
# when using 'puppet apply'
# Will recursively sync the plugins folder to the right directory.
class profile::puppet::pluginsync (
  $libdir = "/var/lib/puppet/lib",
) {
  file {"$libdir":
    source  => "puppet:///plugins",
    recurse => true,
    purge   => true,
    force   => true,
  }
}

I'm suggesting that if @abuzze has not done it yet, he should try enabling pluginsync=true in his puppet config.
https://docs.puppetlabs.com/guides/plugins_in_modules.html

groob avatar Jul 28 '15 20:07 groob

@groob couple things:

  1. he already stated he enabled pluginsync
  2. if you are not using a master, then there's is little point in trying to leverage environments -- you could have just put the module in /etc/puppet/modules and saved yourself a heap of trouble

dayglojesus avatar Jul 28 '15 20:07 dayglojesus

I am not quite sure what happened, but i continued working on this problem this morning and it worked without any changes. Also i cannot reproduce the error any more. Maybe it's some strange caching problem with the puppet master. Thank you very much for the quick replies and keep up the work on this great module.

abuzze avatar Jul 29 '15 07:07 abuzze