Tim Mooney
2014-Apr-12 00:15 UTC
[Puppet Users] selecting a command in a provider based on class variable?
Hi All! The tl;dr version: Can anyone point me at an example of an existing provider that selects a particular command based not on a facter fact or whether a particular path exists, but instead on a variable from a puppet class? The full version: We have puppet 3.4.2 on master and all agents, generally from the PuppetLabs packages for OpenSource puppet. Red Hat has begun providing alternate (updated) versions of some packages as part of its "Software Collections Library", aka SCL. If you have a RHEL 6.5 system subscribed to the appropriate software collections channel, it's entirely possible to have something like this: $ rpm -q -f /usr/bin/mysql mysql-5.1.73-3.el6_5.x86_64 $ rpm -q -f /opt/rh/mysql55/root/usr/bin/mysql mysql55-mysql-5.5.36-1.1.el6.x86_64 For a provider that relies on the mysql command-line tool to accomplish certain tasks, it's no longer a great solution to just do commands :mysql => 'mysql' I also don't want to just have it always use the binary from /opt/rh/mysql55/root/usr/bin/mysql if it's present, since it's at least conceivable that one might need to use a particular version of the client when accessing a particular database. The best idea I've come up with is to have the provider decide which specific version of a command to use based on a variable that has already been set in the class, but I haven't found any examples of providers that do that. If anyone can point me at some prior art, I would greatly appreciate it. Thanks, Tim -- Tim Mooney Tim.Mooney@ndsu.edu Enterprise Computing & Infrastructure 701-231-1076 (Voice) Room 242-J6, Quentin Burdick Building 701-231-8541 (Fax) North Dakota State University, Fargo, ND 58105-5164 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/alpine.SOC.2.11.1404111843100.17447%40dogbert.cc.ndsu.NoDak.edu. For more options, visit https://groups.google.com/d/optout.