smart_proxy_chef 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65d721182fbd48d1c3ca2dad32fd6a32d1de3d19
4
- data.tar.gz: 67cebe73ee91e8b2338293084fe56d254fafc44a
3
+ metadata.gz: f52bafb874c675e729ede6b64f05a61d30522d50
4
+ data.tar.gz: 3ea968011835b0bb98e1406ab814c560a5ca3067
5
5
  SHA512:
6
- metadata.gz: ff52af84bcdc9b646dad703df3a1ecedcf779c21ec06c08374f32c5687dc167cc2d07249094f5e286c3fe63d2e35d88ecacd6c5b6cc8ea4be8f0e502f93fce33
7
- data.tar.gz: c4e0ae11fb9a6365aa1b9076447c5c45f7e18b8468fb532cdaa4bb8be389404d14f886be929224877b07b92d596e4503ac0f6451e1d048072293a3c38b3ab6ab
6
+ metadata.gz: 2e3f9c348e46e3e5d02f48a05a7a6747c03a8adbcb65b54faa7179e882329e08964c74e5d5f97be2e7ce27b48445ab64ab84b6d7dbd7fbd3c3e0cca3ab1ebc76
7
+ data.tar.gz: 021689d60f75eb6102ffd0ee48d170d091d35882ede4062f8c366f1e5181a9e309e0e959478f10933d0487ddd6dc496e53ec90ae3831fd271e9bf212104f58d2
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in smart-proxy-chef.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem 'smart_proxy', :git => "https://github.com/theforeman/smart-proxy"
8
+ end
@@ -1,36 +1,7 @@
1
- require 'proxy/request'
2
- require 'smart_proxy_chef_plugin/authentication'
3
1
  require 'smart_proxy_chef_plugin/resources/node'
4
2
  require 'smart_proxy_chef_plugin/resources/client'
5
3
 
6
4
  module ChefPlugin
7
- class ForemanApi < ::Sinatra::Base
8
- helpers ::Proxy::Helpers
9
- authorize_with_trusted_hosts
10
-
11
- error Proxy::Error::BadRequest do
12
- log_halt(400, "Bad request : " + env['sinatra.error'].message )
13
- end
14
-
15
- error Proxy::Error::Unauthorized do
16
- log_halt(401, "Unauthorized : " + env['sinatra.error'].message )
17
- end
18
-
19
- post "/hosts/facts" do
20
- logger.debug 'facts upload request received'
21
- ChefPlugin::Authentication.new.authenticated(request) do |content|
22
- Proxy::HttpRequest::Facts.new.post_facts(content)
23
- end
24
- end
25
-
26
- post "/reports" do
27
- logger.debug 'report upload request received'
28
- ChefPlugin::Authentication.new.authenticated(request) do |content|
29
- Proxy::HttpRequest::Reports.new.post_report(content)
30
- end
31
- end
32
- end
33
-
34
5
  class ChefApi < ::Sinatra::Base
35
6
  get "/nodes/:fqdn" do
36
7
  logger.debug "Showing node #{params[:fqdn]}"
@@ -54,7 +25,7 @@ module ChefPlugin
54
25
  end
55
26
  end
56
27
 
57
- delete "/chef/nodes/:fqdn" do
28
+ delete "/nodes/:fqdn" do
58
29
  logger.debug "Starting deletion of node #{params[:fqdn]}"
59
30
 
60
31
  result = Resources::Node.new.delete(params[:fqdn])
@@ -64,7 +35,7 @@ module ChefPlugin
64
35
  { :result => result }.to_json
65
36
  end
66
37
 
67
- delete "/chef/clients/:fqdn" do
38
+ delete "/clients/:fqdn" do
68
39
  logger.debug "Starting deletion of client #{params[:fqdn]}"
69
40
 
70
41
  result = Resources::Client.new.delete(params[:fqdn])
@@ -0,0 +1,31 @@
1
+ require 'proxy/request'
2
+ require 'smart_proxy_chef_plugin/authentication'
3
+
4
+ module ChefPlugin
5
+ class ForemanApi < ::Sinatra::Base
6
+ helpers ::Proxy::Helpers
7
+ authorize_with_trusted_hosts
8
+
9
+ error Proxy::Error::BadRequest do
10
+ log_halt(400, "Bad request : " + env['sinatra.error'].message )
11
+ end
12
+
13
+ error Proxy::Error::Unauthorized do
14
+ log_halt(401, "Unauthorized : " + env['sinatra.error'].message )
15
+ end
16
+
17
+ post "/hosts/facts" do
18
+ logger.debug 'facts upload request received'
19
+ ChefPlugin::Authentication.new.authenticated(request) do |content|
20
+ Proxy::HttpRequest::Facts.new.post_facts(content)
21
+ end
22
+ end
23
+
24
+ post "/reports" do
25
+ logger.debug 'report upload request received'
26
+ ChefPlugin::Authentication.new.authenticated(request) do |content|
27
+ Proxy::HttpRequest::Reports.new.post_report(content)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,4 @@
1
+ require 'smart_proxy_chef_plugin/foreman_api'
1
2
  require 'smart_proxy_chef_plugin/chef_api'
2
3
 
3
4
  map "/api" do
@@ -1,3 +1,3 @@
1
1
  module ChefPlugin
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
@@ -38,6 +38,76 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '10'
41
111
  - !ruby/object:Gem::Dependency
42
112
  name: chef
43
113
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +147,7 @@ files:
77
147
  - bundler.d/chef.rb
78
148
  - lib/smart_proxy_chef_plugin/http_config.ru
79
149
  - lib/smart_proxy_chef_plugin/chef_api.rb
150
+ - lib/smart_proxy_chef_plugin/foreman_api.rb
80
151
  - lib/smart_proxy_chef_plugin/authentication.rb
81
152
  - lib/smart_proxy_chef_plugin/resources/client.rb
82
153
  - lib/smart_proxy_chef_plugin/resources/base.rb