dayglojesus / managedmac

Comprehensive Puppet module for OS X.
http://dayglojesus.github.io/managedmac/
Apache License 2.0
62 stars 21 forks source link

Could not autoload puppet/type/propertylist #88

Closed abuzze closed 9 years ago

abuzze commented 9 years ago

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.

dayglojesus commented 9 years ago

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.

groob commented 9 years ago

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?

dayglojesus commented 9 years ago

@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?

groob commented 9 years ago

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

dayglojesus commented 9 years ago

@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
abuzze commented 9 years ago

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.