foreman_chef 0.4.0 → 0.4.1
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/app/assets/images/Chef.png +0 -0
- data/app/assets/javascripts/foreman_chef/chef_proxy_environment_refresh.js +1 -1
- data/app/assets/javascripts/foreman_chef/chef_tab.js +55 -0
- data/app/assets/javascripts/jsoneditor.js +7854 -0
- data/app/assets/javascripts/jsoneditor.js.map +106 -0
- data/app/controllers/foreman_chef/concerns/hosts_controller_rescuer.rb +10 -0
- data/app/helpers/foreman_chef/chef_proxy_form.rb +20 -1
- data/app/lib/actions/foreman_chef/host/create.rb +9 -7
- data/app/lib/actions/foreman_chef/host/destroy.rb +4 -0
- data/app/lib/actions/foreman_chef/host/update.rb +38 -0
- data/app/lib/actions/foreman_chef/node/update.rb +43 -0
- data/app/lib/proxy_api/foreman_chef/chef_proxy.rb +9 -1
- data/app/models/foreman_chef/cached_run_list.rb +84 -0
- data/app/models/foreman_chef/concerns/host_action_subject.rb +5 -0
- data/app/models/foreman_chef/concerns/host_build.rb +12 -1
- data/app/models/foreman_chef/concerns/host_extensions.rb +69 -5
- data/app/models/foreman_chef/concerns/renderer.rb +1 -1
- data/app/models/foreman_chef/concerns/smart_proxy_extensions.rb +7 -0
- data/app/models/foreman_chef/fact_name.rb +3 -0
- data/app/models/foreman_chef/fact_parser.rb +2 -2
- data/app/overrides/add_chef_tab.rb +10 -0
- data/app/services/foreman_chef/object_does_not_exist_exception.rb +4 -0
- data/app/views/foreman/unattended/snippets/_chef_client_bootstrap.erb +11 -9
- data/app/views/foreman_chef/hosts/_chef_tab.html.erb +17 -0
- data/db/migrate/20160324151437_create_foreman_chef_cached_run_list.rb +8 -0
- data/lib/foreman_chef/engine.rb +5 -9
- data/lib/foreman_chef/version.rb +1 -1
- metadata +13 -2
@@ -5,10 +5,20 @@ module ForemanChef
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
rescue_from ForemanChef::ProxyException, :with => :chef_exception
|
8
|
+
# this route is only allowed to puppet proxies so we need to allow it for chef proxies too
|
9
|
+
alias_method_chain :require_smart_proxy_or_login, :chef
|
8
10
|
end
|
9
11
|
|
10
12
|
private
|
11
13
|
|
14
|
+
def require_smart_proxy_or_login_with_chef(features = nil)
|
15
|
+
if params[:action] == 'externalNodes' && features.kind_of?(Array) && features.include?('Puppet')
|
16
|
+
require_smart_proxy_or_login_without_chef(features + [ 'Chef' ])
|
17
|
+
else
|
18
|
+
require_smart_proxy_or_login_without_chef(features)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
12
22
|
def chef_exception(exception)
|
13
23
|
flash[:error] = _(exception.message)
|
14
24
|
redirect_to :back
|
@@ -12,9 +12,16 @@ module ForemanChef
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def chef_proxy_form_chef_environment_select(f, environments)
|
15
|
+
if f.object.is_a?(Host::Base) &&f.object.persisted? && f.object.chef_environment_differs?
|
16
|
+
help = content_tag(:span, ' ', :class => 'pficon pficon-warning-triangle-o') + ' ' + _('Chef environment is set to %s on Chef server, submitting will override it') % f.object.fresh_chef_environment
|
17
|
+
help = help.html_safe
|
18
|
+
else
|
19
|
+
help = nil
|
20
|
+
end
|
21
|
+
|
15
22
|
select_f(f, :chef_environment_id, environments, :id, :name,
|
16
23
|
{:include_blank => blank_or_inherit_f(f, :chef_environment_id)},
|
17
|
-
{:label => _("Chef environment")})
|
24
|
+
{:label => _("Chef environment"), :help_inline => help })
|
18
25
|
end
|
19
26
|
|
20
27
|
def chef_proxy_form_chef_proxy_select(f, proxies)
|
@@ -24,5 +31,17 @@ module ForemanChef
|
|
24
31
|
:help_inline => _("Use this foreman proxy as an entry point to your Chef, node will be managed via this proxy"),
|
25
32
|
:data => { :url => environments_for_chef_proxy_foreman_chef_environments_path } })
|
26
33
|
end
|
34
|
+
|
35
|
+
def chef_tab_menu
|
36
|
+
if SmartProxy.with_features("Chef").count > 0
|
37
|
+
content_tag :li do
|
38
|
+
'<a href="#chef" data-toggle="tab">Chef</a>'.html_safe
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def chef_tab_content(f)
|
44
|
+
render 'foreman_chef/hosts/chef_tab', :f => f
|
45
|
+
end
|
27
46
|
end
|
28
47
|
end
|
@@ -3,6 +3,10 @@ module Actions
|
|
3
3
|
module Host
|
4
4
|
class Create < Actions::EntryAction
|
5
5
|
|
6
|
+
def resource_locks
|
7
|
+
:link
|
8
|
+
end
|
9
|
+
|
6
10
|
def plan(host)
|
7
11
|
action_subject(host)
|
8
12
|
|
@@ -27,18 +31,16 @@ module Actions
|
|
27
31
|
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
28
32
|
end
|
29
33
|
|
30
|
-
# def run
|
31
|
-
# # TODO create node with runlist?
|
32
|
-
# end
|
33
|
-
|
34
34
|
def finalize
|
35
|
-
if input[:create_action_output][:private_key].present?
|
36
|
-
::Host.find(self.input[:host][:id])
|
35
|
+
if input[:create_action_output][:private_key].present? && Setting.validation_bootstrap_method
|
36
|
+
host = ::Host.find(self.input[:host][:id])
|
37
|
+
host.chef_private_key = input[:create_action_output][:private_key]
|
38
|
+
host.disable_dynflow_hooks { |h| h.save! }
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
def humanized_name
|
41
|
-
_("Create
|
43
|
+
_("Create host")
|
42
44
|
end
|
43
45
|
|
44
46
|
def humanized_input
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Actions
|
2
|
+
module ForemanChef
|
3
|
+
module Host
|
4
|
+
class Update < Actions::EntryAction
|
5
|
+
|
6
|
+
def resource_locks
|
7
|
+
:link
|
8
|
+
end
|
9
|
+
|
10
|
+
def plan(host)
|
11
|
+
action_subject(host)
|
12
|
+
|
13
|
+
if host.chef_proxy
|
14
|
+
node_exists_in_chef = host.chef_proxy.show_node(host.name)
|
15
|
+
|
16
|
+
if node_exists_in_chef && host.override_chef_attributes
|
17
|
+
plan_action Actions::ForemanChef::Node::Update, host, host.chef_proxy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
rescue => e
|
21
|
+
Rails.logger.debug "Unable to communicate with Chef proxy, #{e.message}"
|
22
|
+
Rails.logger.debug e.backtrace.join("\n")
|
23
|
+
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
24
|
+
# TODO these errors causing form not to display anything and double traces, we need reraise
|
25
|
+
end
|
26
|
+
|
27
|
+
def humanized_name
|
28
|
+
_("Update host")
|
29
|
+
end
|
30
|
+
|
31
|
+
def humanized_input
|
32
|
+
input[:host][:name]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Actions
|
2
|
+
module ForemanChef
|
3
|
+
module Node
|
4
|
+
class Update < Actions::EntryAction
|
5
|
+
|
6
|
+
def plan(host, proxy)
|
7
|
+
name = host.name
|
8
|
+
node_exists_in_chef = proxy.show_node(name)
|
9
|
+
if node_exists_in_chef
|
10
|
+
# we can't use host.run_list.list_changed? or similar since it's after_save already
|
11
|
+
if host.differs?
|
12
|
+
plan_self :chef_proxy_id => proxy.id, :host_id => host.id
|
13
|
+
else
|
14
|
+
Rails.logger.debug "Host data do not differ from corresponding Chef server Node, skipping update"
|
15
|
+
end
|
16
|
+
else
|
17
|
+
raise ::ForemanChef::ObjectDoesNotExistException.new(N_('Node with name %s does not exist on this Chef proxy' % name))
|
18
|
+
end
|
19
|
+
rescue => e
|
20
|
+
Rails.logger.debug "Unable to communicate with Chef proxy, #{e.message}"
|
21
|
+
Rails.logger.debug e.backtrace.join("\n")
|
22
|
+
raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.message))
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
proxy = ::SmartProxy.find_by_id(input[:chef_proxy_id])
|
27
|
+
host = ::Host.find(input[:host_id])
|
28
|
+
action_logger.debug "Updating node #{input[:name]} on proxy #{proxy.name} at #{proxy.url}"
|
29
|
+
proxy.update_node(host.name, host.run_list.as_chef_json.merge(:chef_environment => host.chef_environment.name))
|
30
|
+
end
|
31
|
+
|
32
|
+
def humanized_name
|
33
|
+
_("Update node")
|
34
|
+
end
|
35
|
+
|
36
|
+
def humanized_input
|
37
|
+
input[:name]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -30,11 +30,19 @@ module ProxyAPI
|
|
30
30
|
|
31
31
|
# Shows a Chef Node entry
|
32
32
|
# [+key+] : String containing the hostname
|
33
|
-
# Returns : Hash representation of
|
33
|
+
# Returns : Hash representation of node on chef server
|
34
34
|
def show_node(key)
|
35
35
|
Node.new(@args).send(:get, key)
|
36
36
|
end
|
37
37
|
|
38
|
+
# Updates a Chef Node entry
|
39
|
+
# [+key+] : String containing the hostname
|
40
|
+
# [+attributes+] : Hash containing attributes
|
41
|
+
# Returns : Hash representation of node on chef server
|
42
|
+
def update_node(key, attributes)
|
43
|
+
Node.new(@args).send(:put, { :node => attributes }, key )
|
44
|
+
end
|
45
|
+
|
38
46
|
# Deletes a Chef Node entry
|
39
47
|
# [+key+] : String containing the hostname
|
40
48
|
# Returns : Boolean status
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module ForemanChef
|
2
|
+
class CachedRunList < ActiveRecord::Base
|
3
|
+
serialize :list
|
4
|
+
|
5
|
+
belongs_to_host
|
6
|
+
|
7
|
+
class Jail < Safemode::Jail
|
8
|
+
allow :to_chef_json, :as_chef_json
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(run_list_data, run_list_object = nil)
|
12
|
+
data = parse_data(run_list_data)
|
13
|
+
|
14
|
+
if run_list_object.nil?
|
15
|
+
cached_run_list = new(:list => data)
|
16
|
+
else
|
17
|
+
cached_run_list = run_list_object.clone
|
18
|
+
cached_run_list.list = data
|
19
|
+
end
|
20
|
+
|
21
|
+
cached_run_list
|
22
|
+
end
|
23
|
+
|
24
|
+
# return data in format ready for serialization
|
25
|
+
# which means Hash like this
|
26
|
+
# { :run_list => [ 'role[default]', 'recipe[foreman]' ] }
|
27
|
+
def self.parse_data(run_list_data)
|
28
|
+
case run_list_data
|
29
|
+
when Array
|
30
|
+
parse_array(run_list_data)
|
31
|
+
when Hash
|
32
|
+
run_list_data = run_list_data.with_indifferent_access
|
33
|
+
if run_list_data.has_key?(:run_list)
|
34
|
+
parse_array(run_list_data.with_indifferent_access[:run_list])
|
35
|
+
else
|
36
|
+
# from form we get {'0' => { 'name' => ...}, '1' => {...}}
|
37
|
+
parse_array(run_list_data.values)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
raise ArgumentError, 'unsupported run_list_data format'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.parse_array(run_list_array)
|
45
|
+
raise ArgumentError, "run_list is #{run_list_array.class}, expected Array" unless run_list_array.is_a?(Array)
|
46
|
+
|
47
|
+
if run_list_array.first.is_a?(Hash)
|
48
|
+
run_list_array.map { |item| item_to_chef(item) }
|
49
|
+
elsif run_list_array.first.is_a?(String) or run_list_array.empty?
|
50
|
+
run_list_array
|
51
|
+
else
|
52
|
+
raise ArgumentError, "run_list_array Array contains unknown data format of class #{run_list_array.class}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# converts 'role[default]' to { :type => 'role', :name => 'default' }
|
57
|
+
def self.item_to_form(item)
|
58
|
+
type, name = item.split('[')
|
59
|
+
{ :type => type, :name => name.chop! }
|
60
|
+
end
|
61
|
+
|
62
|
+
# converts { :type => 'role', :name => 'default' } to 'role[default]'
|
63
|
+
def self.item_to_chef(item)
|
64
|
+
item = item.with_indifferent_access
|
65
|
+
"#{item[:type]}[#{item[:name]}]"
|
66
|
+
end
|
67
|
+
|
68
|
+
def as_chef_json
|
69
|
+
{ :run_list => self.list }
|
70
|
+
end
|
71
|
+
|
72
|
+
def to_chef_json
|
73
|
+
as_chef_json.to_json
|
74
|
+
end
|
75
|
+
|
76
|
+
def as_form_json
|
77
|
+
list.map { |item| self.class.item_to_form(item) }
|
78
|
+
end
|
79
|
+
|
80
|
+
def to_form_json
|
81
|
+
as_form_json.to_json
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -6,7 +6,18 @@ module ForemanChef
|
|
6
6
|
include ForemanTasks::Concerns::ActionSubject
|
7
7
|
include ForemanTasks::Concerns::ActionTriggering
|
8
8
|
|
9
|
-
after_build
|
9
|
+
after_build do |host|
|
10
|
+
::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Destroy, host.name, host.chef_proxy
|
11
|
+
# private key is no longer valid
|
12
|
+
host.chef_private_key = nil
|
13
|
+
|
14
|
+
if !::Setting.validation_bootstrap_method
|
15
|
+
new_client = ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Create, host.name, host.chef_proxy
|
16
|
+
host.chef_private_key = new_client.output[:private_key]
|
17
|
+
end
|
18
|
+
|
19
|
+
host.disable_dynflow_hooks { |h| h.save! }
|
20
|
+
end
|
10
21
|
end
|
11
22
|
|
12
23
|
end
|
@@ -3,15 +3,79 @@ module ForemanChef
|
|
3
3
|
module HostExtensions
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
+
DEFAULT = ['role[default]']
|
7
|
+
|
6
8
|
included do
|
7
|
-
alias_method_chain :
|
9
|
+
alias_method_chain :inherited_attributes, :chef_attributes
|
10
|
+
|
11
|
+
# even with autosave, save is called only if there's some change in attributes
|
12
|
+
has_one :cached_run_list, :autosave => true, :class_name => 'ForemanChef::CachedRunList', :foreign_key => :host_id
|
13
|
+
attr_accessor :override_chef_attributes
|
14
|
+
end
|
15
|
+
|
16
|
+
def run_list
|
17
|
+
self.cached_run_list || ForemanChef::CachedRunList.parse(DEFAULT, self.build_cached_run_list)
|
8
18
|
end
|
9
19
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
20
|
+
def run_list=(run_list)
|
21
|
+
# returns CachedRunList instance, if there was one for host, return that one with modified attributes
|
22
|
+
@run_list = ForemanChef::CachedRunList.parse(run_list, self.cached_run_list)
|
23
|
+
# this ensures that host#save will save the cached run list too
|
24
|
+
self.cached_run_list = @run_list
|
25
|
+
end
|
26
|
+
|
27
|
+
# although it does not save anything, it changes existing run list object attributes or builds new one
|
28
|
+
def refresh_run_list!
|
29
|
+
data = fresh_run_list_data
|
30
|
+
ForemanChef::CachedRunList.parse(data, self.cached_run_list || self.build_cached_run_list) unless data.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
def run_list_differs?
|
34
|
+
self.run_list.try(:list) != fresh_run_list.try(:list)
|
35
|
+
end
|
36
|
+
|
37
|
+
def fresh_run_list
|
38
|
+
data = fresh_run_list_data
|
39
|
+
@fresh_run_list ||= ForemanChef::CachedRunList.parse(data) unless data.nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
def fresh_run_list_data
|
43
|
+
if (data = load_node_data)
|
44
|
+
data['run_list']
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def chef_environment_differs?
|
51
|
+
self.chef_environment.try(:name) != fresh_chef_environment
|
52
|
+
end
|
53
|
+
|
54
|
+
def fresh_chef_environment
|
55
|
+
if (data = load_node_data)
|
56
|
+
data['chef_environment']
|
57
|
+
else
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def differs?
|
63
|
+
run_list_differs? || chef_environment_differs?
|
64
|
+
end
|
65
|
+
|
66
|
+
def inherited_attributes_with_chef_attributes
|
67
|
+
inherited_attributes_without_chef_attributes.concat(%w(chef_proxy_id chef_environment_id))
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def load_node_data
|
73
|
+
self.chef_proxy && self.chef_proxy.show_node(self.name)
|
14
74
|
end
|
15
75
|
end
|
16
76
|
end
|
17
77
|
end
|
78
|
+
|
79
|
+
class ::Host::Managed::Jail < Safemode::Jail
|
80
|
+
allow :run_list
|
81
|
+
end
|
@@ -16,6 +16,13 @@ module ForemanChef
|
|
16
16
|
return false
|
17
17
|
end
|
18
18
|
|
19
|
+
def update_node(fqdn, attributes)
|
20
|
+
begin
|
21
|
+
reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).update_node(fqdn, attributes)
|
22
|
+
JSON.parse(reply)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
19
26
|
def delete_node(fqdn)
|
20
27
|
begin
|
21
28
|
reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).delete_node(fqdn)
|
@@ -32,9 +32,9 @@ module ForemanChef
|
|
32
32
|
klass.where(args).first || klass.new(args.merge(:description => description, :release_name => release_name)).tap(&:save!)
|
33
33
|
end
|
34
34
|
|
35
|
+
# we don't want to parse puppet environment, foreman_chef already has its own environment
|
35
36
|
def environment
|
36
|
-
|
37
|
-
Environment.where(:name => name).first_or_create
|
37
|
+
nil
|
38
38
|
end
|
39
39
|
|
40
40
|
def architecture
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => "hosts/_form",
|
2
|
+
:name => "add_chef_tab",
|
3
|
+
:insert_before => 'li#network_tab',
|
4
|
+
:text => ("<%= chef_tab_menu %>")
|
5
|
+
)
|
6
|
+
Deface::Override.new(:virtual_path => "hosts/_form",
|
7
|
+
:name => "add_chef_tab_pane",
|
8
|
+
:insert_before => "div#primary",
|
9
|
+
:text => ("<%= chef_tab_content(f) %>")
|
10
|
+
)
|
@@ -1,14 +1,18 @@
|
|
1
|
-
<% if validation_bootstrap_method? -%>
|
2
|
-
echo "Creating validation.pem"
|
3
1
|
mkdir /etc/chef
|
4
|
-
|
5
|
-
|
2
|
+
<% if validation_bootstrap_method? -%>
|
3
|
+
echo "Creating validation.pem"
|
4
|
+
touch /etc/chef/validation.pem
|
5
|
+
chmod 600 /etc/chef/validation.pem
|
6
6
|
|
7
|
-
cat << 'EOF' > /etc/chef/validation.pem
|
7
|
+
cat << 'EOF' > /etc/chef/validation.pem
|
8
8
|
<%= @host.params['chef_validation_private_key'] %>
|
9
9
|
EOF
|
10
10
|
<% else -%>
|
11
|
-
|
11
|
+
echo "Creating client.pem"
|
12
|
+
touch /etc/chef/client.pem
|
13
|
+
chmod 600 /etc/chef/client.pem
|
14
|
+
|
15
|
+
cat << 'EOF' > /etc/chef/client.pem
|
12
16
|
<%= @host.chef_private_key %>
|
13
17
|
EOF
|
14
18
|
<% end -%>
|
@@ -41,9 +45,7 @@ EOF
|
|
41
45
|
|
42
46
|
# You may set here the default run list for all your nodes
|
43
47
|
cat << 'EOF' > /tmp/base.json
|
44
|
-
|
45
|
-
"run_list": ["role[default]"]
|
46
|
-
}
|
48
|
+
<%= @host.run_list.to_chef_json %>
|
47
49
|
EOF
|
48
50
|
|
49
51
|
#first run of chef-client
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% javascript('jsoneditor', 'foreman_chef/chef_tab') %>
|
2
|
+
|
3
|
+
<div class="tab-pane" id="chef">
|
4
|
+
|
5
|
+
<% if f.object.persisted? && f.object.run_list_differs? %>
|
6
|
+
<%= alert(:class => 'alert-warning', :header => 'Warning',
|
7
|
+
:text => _('Run list on chef server differs, by submitting the form, you will override the run list there. ').html_safe +
|
8
|
+
link_to(_('Reset'), '#', :class => 'refresh_run_list', :'data-run-list' => (f.object.fresh_run_list.try(:to_form_json) || '[]')) +
|
9
|
+
_(' to run list from chef-server').html_safe) %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<div id="runlist-editor" data-default="<%= f.object.run_list.to_form_json %>">
|
13
|
+
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<%= f.hidden_field(:override_chef_attributes, :value => true) %>
|
17
|
+
</div>
|
data/lib/foreman_chef/engine.rb
CHANGED
@@ -20,7 +20,7 @@ module ForemanChef
|
|
20
20
|
# content twice.
|
21
21
|
assets_to_precompile =
|
22
22
|
Dir.chdir(root) do
|
23
|
-
Dir['app/assets/javascripts/**/*', 'app/assets/stylesheets/**/*'].map do |f|
|
23
|
+
Dir['app/assets/javascripts/**/*', 'app/assets/stylesheets/**/*', 'app/assets/images/**/*'].map do |f|
|
24
24
|
f.split(File::SEPARATOR, 4).last.gsub(/\.scss\Z/, '')
|
25
25
|
end
|
26
26
|
end
|
@@ -48,7 +48,7 @@ module ForemanChef
|
|
48
48
|
initializer 'foreman_chef.register_plugin', :before => :finisher_hook do |app|
|
49
49
|
Foreman::Plugin.register :foreman_chef do
|
50
50
|
requires_foreman '>= 1.13'
|
51
|
-
|
51
|
+
extend_template_helpers ForemanChef::Concerns::Renderer
|
52
52
|
|
53
53
|
permission :import_chef_environments, { :environments => [:import, :synchronize] }, :resource_type => 'ForemanChef::Environment'
|
54
54
|
permission :view_chef_environments, { :environments => [:index, :environments_for_chef_proxy] }, :resource_type => 'ForemanChef::Environment'
|
@@ -62,14 +62,14 @@ module ForemanChef
|
|
62
62
|
parent: :configure_menu,
|
63
63
|
last: true
|
64
64
|
|
65
|
-
parameter_filter
|
65
|
+
parameter_filter ForemanChef::CachedRunList, :type, :name
|
66
|
+
parameter_filter Host::Managed, :chef_private_key, :chef_proxy_id, :override_chef_attributes, :chef_environment_id, :run_list => [ parameter_filters(ForemanChef::CachedRunList) ]
|
66
67
|
parameter_filter Hostgroup, :chef_proxy_id, :chef_environment_id
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
70
71
|
initializer 'foreman_chef.chef_proxy_form' do |app|
|
71
72
|
ActionView::Base.send :include, ChefProxyForm
|
72
|
-
ActionView::Base.send :include, ForemanChef::Concerns::Renderer
|
73
73
|
end
|
74
74
|
|
75
75
|
initializer 'foreman_chef.dynflow_world', :before => 'foreman_tasks.initialize_dynflow' do |app|
|
@@ -87,13 +87,9 @@ module ForemanChef
|
|
87
87
|
::Host::Managed.send :include, ForemanChef::Concerns::HostExtensions
|
88
88
|
::Hostgroup.send :include, ForemanChef::Concerns::HostgroupExtensions
|
89
89
|
::SmartProxy.send :include, ForemanChef::Concerns::SmartProxyExtensions
|
90
|
-
::Host::
|
90
|
+
::Host::Managed.send :include, ForemanChef::Concerns::HostActionSubject
|
91
91
|
::Host::Managed.send :include, ForemanChef::Concerns::HostBuild
|
92
92
|
::HostsController.send :include, ForemanChef::Concerns::HostsControllerRescuer
|
93
|
-
# Renderer Concern needs to be injected to controllers, ForemanRenderer was already included
|
94
|
-
(TemplatesController.descendants + [TemplatesController]).each do |klass|
|
95
|
-
klass.send(:include, ForemanChef::Concerns::Renderer)
|
96
|
-
end
|
97
93
|
end
|
98
94
|
|
99
95
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -62,7 +62,11 @@ files:
|
|
62
62
|
- LICENSE
|
63
63
|
- README.md
|
64
64
|
- Rakefile
|
65
|
+
- app/assets/images/Chef.png
|
65
66
|
- app/assets/javascripts/foreman_chef/chef_proxy_environment_refresh.js
|
67
|
+
- app/assets/javascripts/foreman_chef/chef_tab.js
|
68
|
+
- app/assets/javascripts/jsoneditor.js
|
69
|
+
- app/assets/javascripts/jsoneditor.js.map
|
66
70
|
- app/controllers/foreman_chef/application_controller.rb
|
67
71
|
- app/controllers/foreman_chef/concerns/environment_parameters.rb
|
68
72
|
- app/controllers/foreman_chef/concerns/hosts_controller_rescuer.rb
|
@@ -72,7 +76,10 @@ files:
|
|
72
76
|
- app/lib/actions/foreman_chef/client/destroy.rb
|
73
77
|
- app/lib/actions/foreman_chef/host/create.rb
|
74
78
|
- app/lib/actions/foreman_chef/host/destroy.rb
|
79
|
+
- app/lib/actions/foreman_chef/host/update.rb
|
80
|
+
- app/lib/actions/foreman_chef/node/update.rb
|
75
81
|
- app/lib/proxy_api/foreman_chef/chef_proxy.rb
|
82
|
+
- app/models/foreman_chef/cached_run_list.rb
|
76
83
|
- app/models/foreman_chef/concerns/host_action_subject.rb
|
77
84
|
- app/models/foreman_chef/concerns/host_and_hostgroup_extensions.rb
|
78
85
|
- app/models/foreman_chef/concerns/host_build.rb
|
@@ -86,7 +93,9 @@ files:
|
|
86
93
|
- app/models/foreman_chef/fact_parser.rb
|
87
94
|
- app/models/setting/foreman_chef.rb
|
88
95
|
- app/overrides/add_chef_proxy.rb
|
96
|
+
- app/overrides/add_chef_tab.rb
|
89
97
|
- app/services/foreman_chef/chef_server_importer.rb
|
98
|
+
- app/services/foreman_chef/object_does_not_exist_exception.rb
|
90
99
|
- app/services/foreman_chef/object_exists_exception.rb
|
91
100
|
- app/services/foreman_chef/proxy_exception.rb
|
92
101
|
- app/views/foreman/unattended/snippets/_chef_client_bootstrap.erb
|
@@ -98,10 +107,12 @@ files:
|
|
98
107
|
- app/views/foreman_chef/environments/import.html.erb
|
99
108
|
- app/views/foreman_chef/environments/index.html.erb
|
100
109
|
- app/views/foreman_chef/environments/new.html.erb
|
110
|
+
- app/views/foreman_chef/hosts/_chef_tab.html.erb
|
101
111
|
- config/routes.rb
|
102
112
|
- db/migrate/20140220145827_add_chef_proxy_id_to_host.rb
|
103
113
|
- db/migrate/20140513144804_add_chef_proxy_id_to_hostgroup.rb
|
104
114
|
- db/migrate/20150916141657_create_chef_environment.rb
|
115
|
+
- db/migrate/20160324151437_create_foreman_chef_cached_run_list.rb
|
105
116
|
- db/migrate/20160408091653_add_chef_private_key_to_host.rb
|
106
117
|
- db/seeds.rb
|
107
118
|
- lib/foreman_chef.rb
|