dayglojesus / managedmac

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

issues distributing module using a puppet master #40

Closed gerardkok closed 10 years ago

gerardkok commented 10 years ago

Since my company already run a puppet master for our servers, we have our OS X laptops run puppet agent against the same puppet master, although in a different environment. When trying out this module with this setup, I ran into two issues. Because they seem to be related, I've put them in the same ticket.

For my test I included this (unmodified) module to the classes deployed at my test laptop, and ran 'puppet agent -tv': configlaptop:etc root# puppet agent -tv Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/mobileconfig: cannot load such file -- puppet/managedmac/common on node configlaptop.sig.eu Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Apparently the "require 'puppet/managedmac/common'" in puppet/type/mobileconfig.rb throws an error. I'm not a Ruby expert (nor a Puppet one), but when I replaced this with: "require File.expand_path(File.join(File.dirname(FILE), '../..', 'puppet/managedmac/common'))", the puppet agent run would get passed this problem (I got the idea from the puppetlabs/mysql module). At this point I hit another problem:

configlaptop:~ root# gem install CFPropertyList Successfully installed CFPropertyList-2.2.8 Parsing documentation for CFPropertyList-2.2.8 1 gem installed configlaptop:~ root# puppet agent -tv Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/mobileconfig: cannot load such file -- cfpropertylist on node configlaptop.sig.eu Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

So for some reason puppet can't find the CFPropertyList gem, although it has been installed. Because I didn't see references to this library from puppet/managedmac/common.rb, I tried if it would probably run without the "require 'cfpropertylist'", and it did. After this the module ran fine.

Although I think we have a reasonably standard puppet setup (both on the master and the OS X clients), I'm wondering if the issues are perhaps the result of a misconfiguration on my end.

Ginja commented 10 years ago

Hi @gerardkok,

You shouldn't have needed to make those changes, but I'm going to ask you to answer a couple of questions to help us troubleshoot:

  1. What version of Puppet and Facter are you using on the OS X client(s) and the Puppet master?
  2. Do you have "pluginsync = true" in both your client's and master's puppet.conf (specifically in the [main] or [agent] section)?
  3. It's been my experience that Puppet has issues distributing modules to clients that aren't in the default environment (i.e. 'production'). We found we needed to put the managedmac module in both the production environment and the environment our Macs use. As well as run puppet agent -t on our Master first so that it puts all the providers and types in the right location for distribution.
  4. Did you also install the sqlite3 gem?
  5. Are you using the default Ruby installation on your OS X client? What do you get when you type ruby --version, and what does Facter report as the value for rubyversion, and rubysitedir?
gerardkok commented 10 years ago

Hi @Ginja,

The answers to your questions:

  1. Both the master and the OS X clients are running facter 2.2.0 and puppet 3.7.1. I used the pkgs (instead of the gems) to install Facter and Puppet on the OS X clients.
  2. Both the clients and the master don't have pluginsync set explicitly (except that the master has it set in its '[agent]' section, but I think it's not relevant in this case).
  3. The OS X clients are using environment 'osx', and the managedmac module is distributed only to this environment.
  4. The sqlite3 has been installed on the clients, but I now notice there are two versions installed (1.3.9 and 1.3.7). The puppetmaster doesn't have the sqlite3 gem (nor the CFPropertyList one). The CFPropertyList gem is version 2.2.0 on the clients.
  5. I'm using the default Ruby version; 'ruby --version' outputs '2.0.0p481', 'facter rubyversion' outputs '2.0.0', 'facter rubysitedir' outputs '/Library/Ruby/Site/2.0.0'.

I've put the stock 0.5.5 managedmac module back, and verified the errors are then also back. Adding the managedmac module to the production environment on the puppet master, solves the first error ('cannot load such file -- puppet/managedmac/common'), but the second one ('cannot load such file -- cfpropertylist') persists. However, this one is solved by adding 'pluginsync = true' to the client's puppet.conf (I was moving away from setting pluginsync explicitly, because I thought 'true' had become the default in the meantime, but seeing this I guess I'll better put it back in).

Looks like it's all solved, thanks for your help.

dschaaff commented 9 years ago

I am experiencing the same error as the user above. " Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/macgroup: cannot load such file -- cfpropertylist on node"

puppet 3.8.1 facter 2.4.4

Ginja commented 9 years ago

Have you installed the CFPropertyList gem on your client node?

gem install CFPropertyList
dschaaff commented 9 years ago

Yes.

{code} dschaaff@dschaaff-mac:~$ gem list

* LOCAL GEMS *

bigdecimal (1.2.0) CFPropertyList (2.3.1, 2.2.8) io-console (0.4.2) json (1.7.7) libxml-ruby (2.6.0) minitest (4.3.2) nokogiri (1.5.6) psych (2.0.0) puppet-lint (1.1.0) rake (0.9.6) rdoc (4.0.0) sqlite3 (1.3.10, 1.3.7) test-unit (2.0.0.0) {code}

dschaaff commented 9 years ago

schaaff@dschaaff-mac:~$ ruby --version ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] dschaaff@dschaaff-mac:~$ facter rubyversion 2.0.0 dschaaff@dschaaff-mac:~$ facter rubysitedir /Library/Ruby/Site/2.0.0 dschaaff@dschaaff-mac:~$

dschaaff commented 9 years ago

Nevermind, solved it. The CFPropertyList wasn't in the gem list on the master.