File tree 2 files changed +5
-5
lines changed
lib/puppet/provider/foreman_smartproxy_host
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 4
4
def exists?
5
5
return false if host . nil? || proxy . nil?
6
6
7
- host [ 'smart_proxy_id' ] == proxy_id
7
+ host . fetch ( 'infrastructure_facet' , { } ) [ 'smart_proxy_id' ] == proxy_id
8
8
end
9
9
10
10
def create
Original file line number Diff line number Diff line change 52
52
describe '#exists?' do
53
53
it 'returns true when host is marked as current proxy' do
54
54
expect ( provider ) . to receive ( :proxy ) . thrice . and_return ( { "id" => 1 } )
55
- expect ( provider ) . to receive ( :host ) . twice . and_return ( { "smart_proxy_id" => 1 } )
55
+ expect ( provider ) . to receive ( :host ) . twice . and_return ( { "infrastructure_facet" => { " smart_proxy_id" => 1 } } )
56
56
expect ( provider . exists? ) . to be true
57
57
end
58
58
59
59
it 'returns false when host is marked as a different smart proxy' do
60
60
expect ( provider ) . to receive ( :proxy ) . thrice . and_return ( { "id" => 1 } )
61
- expect ( provider ) . to receive ( :host ) . twice . and_return ( { "smart_proxy_id" => 2 } )
61
+ expect ( provider ) . to receive ( :host ) . twice . and_return ( { "infrastructure_facet" => { " smart_proxy_id" => 2 } } )
62
62
expect ( provider . exists? ) . to be false
63
63
end
64
64
65
65
it 'returns false when host is not marked as a smart proxy' do
66
66
expect ( provider ) . to receive ( :proxy ) . thrice . and_return ( { "id" => 1 } )
67
- expect ( provider ) . to receive ( :host ) . twice . and_return ( { "smart_proxy_id" => nil } )
67
+ expect ( provider ) . to receive ( :host ) . twice . and_return ( { "infrastructure_facet" => { " smart_proxy_id" => nil } } )
68
68
expect ( provider . exists? ) . to be false
69
69
end
70
70
74
74
end
75
75
76
76
it 'returns false when smart proxy does not exist' do
77
- expect ( provider ) . to receive ( :host ) . and_return ( { "smart_proxy_id" => 1 } )
77
+ expect ( provider ) . to receive ( :host ) . and_return ( { "infrastructure_facet" => { " smart_proxy_id" => 1 } } )
78
78
expect ( provider ) . to receive ( :proxy ) . and_return ( nil )
79
79
expect ( provider . exists? ) . to be false
80
80
end
You can’t perform that action at this time.
0 commit comments