-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #5395 - smart proxy provider V2 API w/ timeout
- 26.1.0
- 26.0.0
- 25.3.0
- 25.2.2
- 25.2.1
- 25.2.0
- 25.1.0
- 25.0.0
- 24.2.1
- 24.2.0
- 24.1.0
- 24.0.0
- 23.2.0
- 23.1.0
- 23.0.0
- 22.2.0
- 22.1.2
- 22.1.1
- 22.1.0
- 22.0.0
- 21.2.0
- 21.1.0
- 21.0.0
- 20.2.0
- 20.1.0
- 20.0.0
- 19.3.0
- 19.2.2
- 19.2.1
- 19.2.0
- 19.1.1
- 19.1.0
- 19.0.0
- 18.2.0
- 18.1.0
- 18.0.0
- 17.0.0
- 16.1.0
- 16.0.0
- 15.1.2
- 15.1.1
- 15.1.0
- 15.0.3
- 15.0.2
- 15.0.1
- 15.0.0
- 14.0.2
- 14.0.1
- 14.0.0
- 13.1.0
- 13.0.1
- 13.0.0
- 12.2.0
- 12.1.0
- 12.0.0
- 11.0.3
- 11.0.2
- 11.0.1
- 11.0.0
- 10.0.0
- 9.2.0
- 9.1.0
- 9.0.1
- 9.0.0
- 8.1.1
- 8.1.0
- 8.0.0
- 7.2.0
- 7.1.0
- 7.0.0
- 6.0.0
- 5.2.2
- 5.2.1
- 5.2.0
- 5.1.0
- 5.0.2
- 5.0.1
- 5.0.0
- 4.0.1
- 4.0.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'puppet/util/feature' | ||
|
||
Puppet.features.add(:apipie_bindings, :libs => %{apipie_bindings}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Puppet::Type.type(:foreman_smartproxy).provide(:rest_v2) do | ||
|
||
confine :feature => :apipie_bindings | ||
|
||
# when both rest and rest_v2 providers are installed, use this one | ||
def self.specificity | ||
super + 1 | ||
end | ||
|
||
def api | ||
@api ||= ApipieBindings::API.new({ | ||
:uri => resource[:base_url], | ||
:api_version => 2, | ||
:oauth => { | ||
:consumer_key => resource[:consumer_key], | ||
:consumer_secret => resource[:consumer_secret] | ||
}, | ||
:timeout => resource[:timeout], | ||
:headers => { | ||
:foreman_user => resource[:effective_user] | ||
}}).resource(:smart_proxies) | ||
end | ||
|
||
# proxy hash or nil | ||
def proxy | ||
if @proxy | ||
@proxy | ||
else | ||
@proxy = api.call(:index, :search => "name=#{resource[:name]}")['results'][0] | ||
end | ||
end | ||
|
||
def id | ||
proxy ? proxy['id'] : nil | ||
end | ||
|
||
def exists? | ||
! id.nil? | ||
end | ||
|
||
def create | ||
api.call(:create, { | ||
'name' => resource[:name], | ||
'url' => resource[:url] | ||
}) | ||
end | ||
|
||
def destroy | ||
api.call(:destroy, :id => id) | ||
@proxy = nil | ||
end | ||
|
||
def url | ||
proxy ? proxy['url'] : nil | ||
end | ||
|
||
def url=(value) | ||
api.call(:update, :id => id, :url => value) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters