@@ -54,6 +54,10 @@ def preinit
5454 options [ :detailed_exitcodes ] = true
5555 end
5656
57+ option ( "--libdir LIBDIR" ) do |arg |
58+ options [ :libdir ] = arg
59+ end
60+
5761 option ( "--apply MANIFEST" ) do |arg |
5862 options [ :apply ] = arg . to_s
5963 end
@@ -97,6 +101,7 @@ def help
97101 puppet device [-h|--help] [-v|--verbose] [-d|--debug]
98102 [-l|--logdest syslog|<file>|console] [--detailed-exitcodes]
99103 [--deviceconfig <file>] [-w|--waitforcert <seconds>]
104+ [--libdir <directory>]
100105 [-a|--apply <file>] [-f|--facts] [-r|--resource <type> [name]]
101106 [-t|--target <device>] [--user=<user>] [-V|--version]
102107
@@ -173,6 +178,10 @@ def help
173178 certificate request. This is useful for the initial setup of a target.
174179 You can turn off waiting for certificates by specifying a time of 0.
175180
181+ * --libdir:
182+ Override the per-device libdir with a local directory. Specifying a libdir also
183+ disables pluginsync. This is useful for testing.
184+
176185* --apply:
177186 Apply a manifest against a remote target. Target must be specified.
178187
@@ -253,11 +262,11 @@ def main
253262
254263 # override local $vardir and $certname
255264 Puppet [ :confdir ] = ::File . join ( Puppet [ :devicedir ] , device . name )
256- Puppet [ :libdir ] = ::File . join ( Puppet [ :devicedir ] , device . name , 'lib' )
265+ Puppet [ :libdir ] = options [ :libdir ] || ::File . join ( Puppet [ :devicedir ] , device . name , 'lib' )
257266 Puppet [ :vardir ] = ::File . join ( Puppet [ :devicedir ] , device . name )
258267 Puppet [ :certname ] = device . name
259268
260- unless options [ :resource ] || options [ :facts ] || options [ :apply ]
269+ unless options [ :resource ] || options [ :facts ] || options [ :apply ] || options [ :libdir ]
261270 Puppet ::Configurer ::PluginHandler . new . download_plugins ( env )
262271 end
263272 # this init the device singleton, so that the facts terminus
0 commit comments