File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 123
123
124
124
Puppet ::Resource ::Catalog . indirection . terminus_class = :yaml
125
125
Puppet ::Face [ :catalog , "0.0.1" ] . save ( catalog )
126
- Puppet . notice "Saved catalog for #{ Puppet [ :certname ] } to yaml "
126
+ Puppet . notice "Saved catalog for #{ Puppet [ :certname ] } to #{ Puppet :: Resource :: Catalog . indirection . terminus . path ( Puppet [ :certname ] ) } "
127
127
nil
128
128
end
129
129
end
Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ def self.terminus_classes(indirection)
39
39
40
40
def call_indirection_method ( method , key , options )
41
41
begin
42
- result = indirection . __send__ ( method , key , options )
42
+ if method == :save
43
+ # key is really the instance to save
44
+ result = indirection . __send__ ( method , key , nil , options )
45
+ else
46
+ result = indirection . __send__ ( method , key , options )
47
+ end
43
48
rescue => detail
44
49
message = "Could not call '#{ method } ' on '#{ indirection_name } ': #{ detail } "
45
50
Puppet . log_exception ( detail , message )
Original file line number Diff line number Diff line change 40
40
end
41
41
42
42
[ :find , :search , :save , :destroy ] . each do |method |
43
+ def params ( method , options )
44
+ if method == :save
45
+ [ nil , options ]
46
+ else
47
+ [ options ]
48
+ end
49
+ end
50
+
43
51
it "should define a '#{ method } ' action" do
44
52
expect ( Puppet ::Indirector ::Face ) . to be_action ( method )
45
53
end
46
54
47
55
it "should call the indirection method with options when the '#{ method } ' action is invoked" do
48
- subject . indirection . expects ( method ) . with ( :test , { } )
56
+ subject . indirection . expects ( method ) . with ( :test , * params ( method , { } ) )
49
57
subject . send ( method , :test )
50
58
end
51
59
it "should forward passed options" do
52
- subject . indirection . expects ( method ) . with ( :test , { 'one' => '1' } )
60
+ subject . indirection . expects ( method ) . with ( :test , * params ( method , { 'one' => '1' } ) )
53
61
subject . send ( method , :test , :extra => { 'one' => '1' } )
54
62
end
55
63
end
You can’t perform that action at this time.
0 commit comments