foreman_chef 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/app/controllers/foreman_chef/concerns/hosts_controller_rescuer.rb +20 -0
- data/app/lib/actions/foreman_chef/client/destroy.rb +4 -0
- data/app/lib/actions/foreman_chef/host/destroy.rb +4 -0
- data/app/models/foreman_chef/fact_parser.rb +1 -1
- data/app/services/foreman_chef/proxy_exception.rb +4 -0
- data/lib/foreman_chef/engine.rb +2 -0
- data/lib/foreman_chef/version.rb +1 -1
- metadata +45 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d4855a9f4cdcc213a42b40d551c0b0a91cf7f4d
|
4
|
+
data.tar.gz: 114ed3cd40968c063e79b067c2aa997c34aedaf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b54f6e5e88bc389edc07c1f24d17e068fc750adc572b353d268a2ab1d5be4912144ac2e9c89236a23462b75b8ca91d078e96ba6d903f865ee795031cbf8e2bc
|
7
|
+
data.tar.gz: b494900b4d46b6ea4873c9557e0a3c2ab95fd12c90d4ef4b77635a1f3f480159d89a5b51a30a075d845af31f27dcbaad99e5e4b733eab9f66019d6445c811d31
|
data/README.md
CHANGED
@@ -4,6 +4,18 @@ This plugin adds a Chef fact importer to Foreman. It basically means that when y
|
|
4
4
|
clients to use foreman handlers (https://github.com/theforeman/chef-handler-foreman) and install
|
5
5
|
this plugin you receive nested facts from chef-client.
|
6
6
|
|
7
|
+
# Installation
|
8
|
+
|
9
|
+
If you want to use this in production I recommend to combine this plugin with foreman-background
|
10
|
+
(https://github.com/ohadlevy/foreman-background) which runs report and facts import as a background
|
11
|
+
tasks.
|
12
|
+
|
13
|
+
## Foreman Installer (recommended)
|
14
|
+
|
15
|
+
Follow the directions on: http://www.theforeman.org/plugins/foreman_chef/0.1/#2.Installation
|
16
|
+
|
17
|
+
## Manual
|
18
|
+
|
7
19
|
This plugin expects foreman to support nested facts which is was added in 1.4.
|
8
20
|
To install this plugin you just have to add this line to your Gemfile.
|
9
21
|
|
@@ -13,10 +25,6 @@ gem 'foreman_chef'
|
|
13
25
|
|
14
26
|
and run ```bundle install```. Don't forget to restart foreman after this change.
|
15
27
|
|
16
|
-
If you want to use this in production I recommend to combine this plugin with foreman-background
|
17
|
-
(https://github.com/ohadlevy/foreman-background) which runs report and facts import as a background
|
18
|
-
tasks.
|
19
|
-
|
20
28
|
## License
|
21
29
|
|
22
30
|
Copyright (c) 2013-2014 Marek Hulán
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ForemanChef
|
2
|
+
module Concerns
|
3
|
+
module HostsControllerRescuer
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
rescue_from ForemanChef::ProxyException, :with => :chef_exception
|
8
|
+
end
|
9
|
+
|
10
|
+
module InstanceMethods
|
11
|
+
private
|
12
|
+
|
13
|
+
def chef_exception(exception)
|
14
|
+
flash[:error] = _(exception.message)
|
15
|
+
redirect_to :back
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -10,6 +10,10 @@ module Actions
|
|
10
10
|
plan_self :chef_proxy_id => proxy.id, :fqdn => fqdn
|
11
11
|
end
|
12
12
|
end
|
13
|
+
rescue => e
|
14
|
+
Rails.logger.debug "Unable to communicate with Chef proxy, #{e.message}"
|
15
|
+
Rails.logger.debug e.backtrace.join("\n")
|
16
|
+
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
13
17
|
end
|
14
18
|
|
15
19
|
def run
|
@@ -15,6 +15,10 @@ module Actions
|
|
15
15
|
|
16
16
|
plan_action Actions::ForemanChef::Client::Destroy, host.name, proxy
|
17
17
|
end
|
18
|
+
rescue => e
|
19
|
+
Rails.logger.debug "Unable to communicate with Chef proxy, #{e.message}"
|
20
|
+
Rails.logger.debug e.backtrace.join("\n")
|
21
|
+
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
18
22
|
end
|
19
23
|
|
20
24
|
def run
|
@@ -5,7 +5,7 @@ module ForemanChef
|
|
5
5
|
|
6
6
|
def operatingsystem
|
7
7
|
os_name = facts['lsb::id'] || facts['platform']
|
8
|
-
release = facts['lsb::release'] ||
|
8
|
+
release = facts['lsb::release'] || facts['platform_version']
|
9
9
|
major, minor = release.split('.')
|
10
10
|
description = facts['lsb::description']
|
11
11
|
release_name = facts['lsb::codename']
|
data/lib/foreman_chef/engine.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'deface'
|
2
|
+
require 'foreman_tasks'
|
2
3
|
|
3
4
|
module ForemanChef
|
4
5
|
#Inherit from the Rails module of the parent app (Foreman), not the plugin.
|
@@ -49,6 +50,7 @@ module ForemanChef
|
|
49
50
|
::FactImporter.register_fact_importer(:foreman_chef, ForemanChef::FactImporter)
|
50
51
|
::FactParser.register_fact_importer(:foreman_chef, ForemanChef::FactParser)
|
51
52
|
::Host::Base.send :include, ForemanChef::Concerns::HostActionSubject
|
53
|
+
::HostsController.send :include, ForemanChef::Concerns::HostsControllerRescuer
|
52
54
|
end
|
53
55
|
|
54
56
|
config.after_initialize do
|
data/lib/foreman_chef/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: deface
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - <
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - <
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: foreman-tasks
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,66 +73,68 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
-
|
76
|
+
- LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- app/controllers/foreman_chef/concerns/hosts_controller_rescuer.rb
|
77
80
|
- app/helpers/foreman_chef/chef_proxy_form.rb
|
78
|
-
- app/models/foreman_chef/fact_parser.rb
|
79
|
-
- app/models/foreman_chef/fact_name.rb
|
80
|
-
- app/models/foreman_chef/smart_proxy_extensions.rb
|
81
|
-
- app/models/foreman_chef/chef_proxy_association.rb
|
82
|
-
- app/models/foreman_chef/hostgroup_extensions.rb
|
83
|
-
- app/models/foreman_chef/host_extensions.rb
|
84
|
-
- app/models/foreman_chef/fact_importer.rb
|
85
|
-
- app/models/foreman_chef/concerns/renderer.rb
|
86
|
-
- app/models/foreman_chef/concerns/host_action_subject.rb
|
87
|
-
- app/models/setting/foreman_chef.rb
|
88
81
|
- app/lib/actions/foreman_chef/client/destroy.rb
|
89
82
|
- app/lib/actions/foreman_chef/host/destroy.rb
|
90
83
|
- app/lib/proxy_api/foreman_chef/chef_proxy.rb
|
84
|
+
- app/models/foreman_chef/chef_proxy_association.rb
|
85
|
+
- app/models/foreman_chef/concerns/host_action_subject.rb
|
86
|
+
- app/models/foreman_chef/concerns/renderer.rb
|
87
|
+
- app/models/foreman_chef/fact_importer.rb
|
88
|
+
- app/models/foreman_chef/fact_name.rb
|
89
|
+
- app/models/foreman_chef/fact_parser.rb
|
90
|
+
- app/models/foreman_chef/host_extensions.rb
|
91
|
+
- app/models/foreman_chef/hostgroup_extensions.rb
|
92
|
+
- app/models/foreman_chef/smart_proxy_extensions.rb
|
93
|
+
- app/models/setting/foreman_chef.rb
|
94
|
+
- app/overrides/add_chef_proxy.rb
|
95
|
+
- app/services/foreman_chef/proxy_exception.rb
|
96
|
+
- app/views/foreman/unattended/snippets/_chef_client_bootstrap.erb
|
91
97
|
- app/views/foreman/unattended/snippets/_chef_client_gem_bootstrap.erb
|
92
98
|
- app/views/foreman/unattended/snippets/_chef_client_omnibus_bootstrap.erb
|
93
|
-
- app/views/foreman/unattended/snippets/_chef_client_bootstrap.erb
|
94
99
|
- config/routes.rb
|
95
|
-
- db/migrate/20140513144804_add_chef_proxy_id_to_hostgroup.rb
|
96
100
|
- db/migrate/20140220145827_add_chef_proxy_id_to_host.rb
|
101
|
+
- db/migrate/20140513144804_add_chef_proxy_id_to_hostgroup.rb
|
97
102
|
- db/seeds.rb
|
103
|
+
- lib/foreman_chef.rb
|
98
104
|
- lib/foreman_chef/engine.rb
|
99
105
|
- lib/foreman_chef/version.rb
|
100
|
-
- lib/foreman_chef.rb
|
101
106
|
- lib/tasks/foreman_chef.rake
|
102
|
-
-
|
103
|
-
- Rakefile
|
104
|
-
- README.md
|
105
|
-
- test/test_helper.rb
|
106
|
-
- test/integration/navigation_test.rb
|
107
|
-
- test/foreman_chef_test.rb
|
108
|
-
- test/dummy/app/helpers/application_helper.rb
|
107
|
+
- test/dummy/README.rdoc
|
108
|
+
- test/dummy/Rakefile
|
109
109
|
- test/dummy/app/assets/javascripts/application.js
|
110
110
|
- test/dummy/app/assets/stylesheets/application.css
|
111
111
|
- test/dummy/app/controllers/application_controller.rb
|
112
|
+
- test/dummy/app/helpers/application_helper.rb
|
112
113
|
- test/dummy/app/views/layouts/application.html.erb
|
113
|
-
- test/dummy/
|
114
|
-
- test/dummy/
|
115
|
-
- test/dummy/
|
116
|
-
- test/dummy/public/422.html
|
114
|
+
- test/dummy/config.ru
|
115
|
+
- test/dummy/config/application.rb
|
116
|
+
- test/dummy/config/boot.rb
|
117
117
|
- test/dummy/config/database.yml
|
118
118
|
- test/dummy/config/environment.rb
|
119
|
-
- test/dummy/config/
|
120
|
-
- test/dummy/config/
|
119
|
+
- test/dummy/config/environments/development.rb
|
120
|
+
- test/dummy/config/environments/production.rb
|
121
|
+
- test/dummy/config/environments/test.rb
|
122
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
121
123
|
- test/dummy/config/initializers/inflections.rb
|
124
|
+
- test/dummy/config/initializers/mime_types.rb
|
122
125
|
- test/dummy/config/initializers/secret_token.rb
|
123
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
124
126
|
- test/dummy/config/initializers/session_store.rb
|
125
127
|
- test/dummy/config/initializers/wrap_parameters.rb
|
126
|
-
- test/dummy/config/
|
127
|
-
- test/dummy/config/environments/production.rb
|
128
|
-
- test/dummy/config/environments/test.rb
|
129
|
-
- test/dummy/config/environments/development.rb
|
130
|
-
- test/dummy/config/application.rb
|
128
|
+
- test/dummy/config/locales/en.yml
|
131
129
|
- test/dummy/config/routes.rb
|
132
|
-
- test/dummy/
|
133
|
-
- test/dummy/
|
130
|
+
- test/dummy/public/404.html
|
131
|
+
- test/dummy/public/422.html
|
132
|
+
- test/dummy/public/500.html
|
133
|
+
- test/dummy/public/favicon.ico
|
134
134
|
- test/dummy/script/rails
|
135
|
-
- test/
|
135
|
+
- test/foreman_chef_test.rb
|
136
|
+
- test/integration/navigation_test.rb
|
137
|
+
- test/test_helper.rb
|
136
138
|
homepage: https://github.com/theforeman/foreman_chef
|
137
139
|
licenses:
|
138
140
|
- GPL-3
|
@@ -153,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
155
|
version: '0'
|
154
156
|
requirements: []
|
155
157
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.4.6
|
157
159
|
signing_key:
|
158
160
|
specification_version: 4
|
159
161
|
summary: Plugin for Chef integration with Foreman
|