|
25 | 25 |
|
26 | 26 | deactivate_action(:destroy)
|
27 | 27 | deactivate_action(:search)
|
28 |
| - find = get_action(:find) |
29 |
| - find.summary "Retrieve the catalog for the node from which the command is run." |
30 |
| - find.arguments "<certname>" |
31 |
| - find.returns <<-'EOT' |
32 |
| - A serialized catalog. When used from the Ruby API, returns a |
33 |
| - Puppet::Resource::Catalog object. |
34 |
| - EOT |
| 28 | + action(:find) do |
| 29 | + summary _("Retrieve the catalog for the node from which the comamand is run.") |
| 30 | + arguments "<certname>, <facts>" |
| 31 | + option("--facts_for_catalog") do |
| 32 | + summary _("Not yet implemented for the CLI; facts will be collected internally.") |
| 33 | + end |
| 34 | + returns <<-'EOT' |
| 35 | + A serialized catalog. When used from the Ruby API, returns a |
| 36 | + Puppet::Resource::Catalog object. |
| 37 | + EOT |
| 38 | + |
| 39 | + when_invoked do |*args| |
| 40 | + # Default the key to Puppet[:certname] if none is supplied |
| 41 | + if args.length == 1 |
| 42 | + key = Puppet[:certname] |
| 43 | + else |
| 44 | + key = args.shift |
| 45 | + end |
| 46 | + call_indirection_method :find, key, args.first |
| 47 | + end |
| 48 | + end |
35 | 49 |
|
36 | 50 | action(:apply) do
|
37 | 51 | summary "Find and apply a catalog."
|
|
135 | 149 | when_invoked do |_options|
|
136 | 150 | Puppet::Resource::Catalog.indirection.terminus_class = :rest
|
137 | 151 | Puppet::Resource::Catalog.indirection.cache_class = nil
|
| 152 | + facts = Puppet::Face[:facts, '0.0.1'].find(Puppet[:certname]) |
138 | 153 | catalog = nil
|
139 | 154 | retrieval_duration = thinmark do
|
140 |
| - catalog = Puppet::Face[:catalog, '0.0.1'].find(Puppet[:certname]) |
| 155 | + catalog = Puppet::Face[:catalog, '0.0.1'].find(Puppet[:certname], |
| 156 | + { facts_for_catalog: facts }) |
141 | 157 | end
|
142 | 158 | catalog.retrieval_duration = retrieval_duration
|
143 | 159 | catalog.write_class_file
|
|
0 commit comments