foreman_chef 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -9
- data/app/lib/actions/foreman_chef/client/destroy.rb +1 -2
- data/app/lib/actions/foreman_chef/host/destroy.rb +1 -2
- data/app/models/foreman_chef/fact_importer.rb +4 -0
- data/app/models/foreman_chef/fact_parser.rb +13 -3
- data/app/models/foreman_chef/smart_proxy_extensions.rb +2 -2
- data/db/seeds.rb +1 -1
- data/lib/foreman_chef/engine.rb +1 -1
- data/lib/foreman_chef/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34baa9fbd879b204ef8fd14c6bc7b10718a0325c
|
4
|
+
data.tar.gz: 09983b5418b094d2821a7d51fb43bac42a53291e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 046f7031449f7bf4724d463d4986604bcd844dc7df446ea09f30ce9a4d50bedf6a0418f217f18c376167fdaa71553c96332961d154ace1e3d846e6befe574abf
|
7
|
+
data.tar.gz: 241ecedcb2ee2d5df74cc6e4af89a36c8d7fccdee8de3c16f7020b680d61bf450f0925aa80dfdce8ee2daf8fd163d77bf626a2614cbe208dce875aab97e02941
|
data/README.md
CHANGED
@@ -1,29 +1,27 @@
|
|
1
1
|
# ForemanChef
|
2
2
|
|
3
|
-
This plugin adds a Chef
|
4
|
-
|
5
|
-
this plugin you receive nested facts from chef-client.
|
3
|
+
This plugin adds a Chef support to Foreman. You can find all information
|
4
|
+
[in the plugin manual](http://www.theforeman.org/plugins/foreman_chef/0.2)
|
6
5
|
|
7
6
|
# Installation
|
8
7
|
|
9
|
-
|
10
|
-
(https://github.com/ohadlevy/foreman-background) which runs report and facts import as a background
|
11
|
-
tasks.
|
8
|
+
There are two ways to install the plugin:
|
12
9
|
|
13
10
|
## Foreman Installer (recommended)
|
14
11
|
|
15
|
-
Follow the
|
12
|
+
Follow the instructions on: http://www.theforeman.org/plugins/foreman_chef/0.2/#2.Installation
|
16
13
|
|
17
14
|
## Manual
|
18
15
|
|
19
|
-
This plugin expects foreman to support nested facts which is was added in 1.4.
|
20
16
|
To install this plugin you just have to add this line to your Gemfile.
|
21
17
|
|
22
18
|
```ruby
|
23
19
|
gem 'foreman_chef'
|
24
20
|
```
|
25
21
|
|
26
|
-
and run ```bundle install```. Don't forget to restart foreman after this change.
|
22
|
+
and run ```bundle install```. Don't forget to restart foreman after this change. You also have
|
23
|
+
to run migrations and seed. Note that this plugin requires also plugin on smart proxy and chef-handler-foreman
|
24
|
+
on client side.
|
27
25
|
|
28
26
|
## License
|
29
27
|
|
@@ -11,8 +11,7 @@ module Actions
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
rescue => e
|
14
|
-
|
15
|
-
Rails.logger.debug e.backtrace.join("\n")
|
14
|
+
Foreman::Logging.exception('Unable to communicate with Chef proxy', e)
|
16
15
|
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
17
16
|
end
|
18
17
|
|
@@ -16,8 +16,7 @@ module Actions
|
|
16
16
|
plan_action Actions::ForemanChef::Client::Destroy, host.name, proxy
|
17
17
|
end
|
18
18
|
rescue => e
|
19
|
-
|
20
|
-
Rails.logger.debug e.backtrace.join("\n")
|
19
|
+
Foreman::Logging.exception('Unable to communicate with Chef proxy', e)
|
21
20
|
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
22
21
|
end
|
23
22
|
|
@@ -12,8 +12,14 @@ module ForemanChef
|
|
12
12
|
else
|
13
13
|
major, minor = release.split('.')
|
14
14
|
end
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
if facts['platform'] == 'windows'
|
17
|
+
release_name = facts['kernel::name']
|
18
|
+
os_name = os_name.capitalize
|
19
|
+
else
|
20
|
+
description = facts['lsb::description']
|
21
|
+
release_name = facts['lsb::codename']
|
22
|
+
end
|
17
23
|
|
18
24
|
begin
|
19
25
|
klass = os_name.constantize
|
@@ -23,7 +29,7 @@ module ForemanChef
|
|
23
29
|
end
|
24
30
|
|
25
31
|
args = { :name => os_name, :major => major.to_s, :minor => minor.to_s }
|
26
|
-
klass.where(args).first || klass.new(args.merge(:description => description, :release_name => release_name)).save!
|
32
|
+
klass.where(args).first || klass.new(args.merge(:description => description, :release_name => release_name)).tap(&:save!)
|
27
33
|
end
|
28
34
|
|
29
35
|
def environment
|
@@ -71,6 +77,10 @@ module ForemanChef
|
|
71
77
|
|
72
78
|
private
|
73
79
|
|
80
|
+
def logger
|
81
|
+
Foreman::Logging.logger('foreman_chef')
|
82
|
+
end
|
83
|
+
|
74
84
|
# meant to be implemented in inheriting classes
|
75
85
|
# should return hash with indifferent access in following format:
|
76
86
|
# { 'link': 'true',
|
@@ -7,7 +7,7 @@ module ForemanChef
|
|
7
7
|
reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).show_node(fqdn)
|
8
8
|
JSON.parse(reply)
|
9
9
|
rescue RestClient::ResourceNotFound
|
10
|
-
logger.debug "Node '#{fqdn}' not found"
|
10
|
+
Foreman::Logging.logger('foreman_chef').debug "Node '#{fqdn}' not found"
|
11
11
|
return false
|
12
12
|
end
|
13
13
|
|
@@ -23,7 +23,7 @@ module ForemanChef
|
|
23
23
|
reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).show_client(fqdn)
|
24
24
|
JSON.parse(reply)
|
25
25
|
rescue RestClient::ResourceNotFound
|
26
|
-
logger.debug "Client '#{fqdn}' not found"
|
26
|
+
Foreman::Logging.logger('foreman_chef').debug "Client '#{fqdn}' not found"
|
27
27
|
return false
|
28
28
|
end
|
29
29
|
|
data/db/seeds.rb
CHANGED
@@ -11,7 +11,7 @@ templates = [
|
|
11
11
|
|
12
12
|
templates.each do |template|
|
13
13
|
template[:template] = File.read(File.join(ForemanChef::Engine.root, "app/views/foreman/unattended", template.delete(:source)))
|
14
|
-
|
14
|
+
ProvisioningTemplate.find_or_create_by_name(template).update_attributes(defaults.merge(template))
|
15
15
|
end
|
16
16
|
|
17
17
|
# Global parameters used in configuration snippets
|
data/lib/foreman_chef/engine.rb
CHANGED
@@ -26,7 +26,7 @@ module ForemanChef
|
|
26
26
|
|
27
27
|
initializer 'foreman_chef.register_plugin', :after => :finisher_hook do |app|
|
28
28
|
Foreman::Plugin.register :foreman_chef do
|
29
|
-
requires_foreman '>= 1.
|
29
|
+
requires_foreman '>= 1.9'
|
30
30
|
allowed_template_helpers :chef_bootstrap
|
31
31
|
end
|
32
32
|
end
|
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.
|
4
|
+
version: 0.2.0
|
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-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|