foreman_acd 0.11.0 → 0.12.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/app/controllers/foreman_acd/ansible_playbooks_controller.rb +3 -2
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +2 -1
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +2 -1
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +2 -1
- data/app/controllers/foreman_acd/app_definitions_controller.rb +4 -6
- data/app/controllers/foreman_acd/app_instances_controller.rb +9 -8
- data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +7 -7
- data/app/controllers/ui_acd_controller.rb +3 -4
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +2 -1
- data/app/lib/actions/foreman_acd/run_configurator.rb +2 -1
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +6 -6
- data/app/models/foreman_acd/acd_provider.rb +6 -3
- data/app/models/foreman_acd/ansible_playbook.rb +1 -1
- data/app/models/foreman_acd/app_instance.rb +7 -8
- data/app/services/foreman_acd/app_configurator.rb +3 -1
- data/app/services/foreman_acd/app_deployer.rb +1 -1
- data/app/services/foreman_acd/inventory_creator.rb +1 -1
- data/config/routes.rb +5 -5
- data/lib/foreman_acd/engine.rb +1 -1
- data/lib/foreman_acd/plugin.rb +66 -66
- data/lib/foreman_acd/version.rb +1 -1
- data/lib/foreman_acd.rb +2 -2
- data/lib/tasks/foreman_acd_tasks.rake +6 -13
- data/test/controllers/ansible_playbooks_controller_test.rb +2 -2
- data/test/controllers/app_definitions_controller_test.rb +2 -2
- data/test/controllers/app_instances_controller_test.rb +2 -2
- data/test/models/acd_provider_test.rb +2 -2
- data/test/models/concerns/host_extensions_test.rb +4 -4
- metadata +17 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60909ff875d630caeef92444ab88930dddc19cd77dd4efa9fd7ea5a4ec83051c
|
4
|
+
data.tar.gz: 3df06d54fe0037ea0fdfbb7009194c1ebe537191d8bc2617e716bdd924a81425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0a1d085fd5d14737a1c37c12743dae3f4e704f01d7b4c2834879635979e4c2d11784b056f854b018405debe488b056a6659205bd647e6e4590df7f3539e334
|
7
|
+
data.tar.gz: dbb30190d5976d84ef76571596397a1811169cd987c10737bd2dbe02b696c6218adb7c2ba537d9ecbaab32cbecf23c28265556f51d14631917addf84411952ea
|
@@ -32,7 +32,8 @@ module ForemanAcd
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def edit
|
35
|
+
def edit
|
36
|
+
end
|
36
37
|
|
37
38
|
def update
|
38
39
|
# Move synced repo to new path if ansible_playbook name is changed
|
@@ -80,7 +81,7 @@ module ForemanAcd
|
|
80
81
|
if sync_params[:git_commit].empty?
|
81
82
|
if ForemanAcd.proxy_setting.present?
|
82
83
|
err_msg = _('Please set the Git Branch/Tag/Commit. This setting is necessary if a HTTP proxy is used!')
|
83
|
-
raise StandardError
|
84
|
+
raise StandardError, err_msg
|
84
85
|
else
|
85
86
|
commit = Git.ls_remote(sync_params[:git_url])['head'][:sha]
|
86
87
|
end
|
@@ -14,7 +14,8 @@ module ForemanAcd
|
|
14
14
|
|
15
15
|
api :GET, '/ansible_playbooks/:id', N_('Show ansible playbook')
|
16
16
|
param :id, :identifier, :required => true
|
17
|
-
def show
|
17
|
+
def show
|
18
|
+
end
|
18
19
|
|
19
20
|
api :GET, '/ansible_playbooks', N_('List ansible playbooks')
|
20
21
|
param_group :search_and_pagination, ::Api::V2::BaseController
|
@@ -11,7 +11,8 @@ module ForemanAcd
|
|
11
11
|
|
12
12
|
api :GET, '/app_definitions/:id', N_('Show application definition')
|
13
13
|
param :id, :identifier, :required => true
|
14
|
-
def show
|
14
|
+
def show
|
15
|
+
end
|
15
16
|
|
16
17
|
api :GET, '/app_definitions', N_('List application definitions')
|
17
18
|
param_group :search_and_pagination, ::Api::V2::BaseController
|
@@ -13,7 +13,8 @@ module ForemanAcd
|
|
13
13
|
param :id, :identifier, :required => true
|
14
14
|
param :organization_id, :identifier, :required => true
|
15
15
|
param :location_id, :identifier, :required => true
|
16
|
-
def show
|
16
|
+
def show
|
17
|
+
end
|
17
18
|
|
18
19
|
api :GET, '/app_instances', N_('List application instances')
|
19
20
|
param :organization_id, :identifier, :required => true
|
@@ -37,14 +37,13 @@ module ForemanAcd
|
|
37
37
|
process_error
|
38
38
|
end
|
39
39
|
rescue StandardError, ValidationError => e
|
40
|
-
if params[:foreman_acd_app_definition_import].present?
|
41
|
-
AnsiblePlaybook.find(params[:foreman_acd_app_definition][:acd_ansible_playbook_id]).delete if params[:foreman_acd_app_definition][:acd_ansible_playbook_id].present?
|
42
|
-
end
|
40
|
+
AnsiblePlaybook.find(params[:foreman_acd_app_definition][:acd_ansible_playbook_id]).delete if params[:foreman_acd_app_definition_import].present? && params[:foreman_acd_app_definition][:acd_ansible_playbook_id].present?
|
43
41
|
redirect_to new_app_definition_path, :flash => { :error => _(e.message) }
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
47
|
-
def edit
|
45
|
+
def edit
|
46
|
+
end
|
48
47
|
|
49
48
|
def update
|
50
49
|
if @app_definition.update(app_definition_params)
|
@@ -132,8 +131,7 @@ module ForemanAcd
|
|
132
131
|
FileUtils.cp_r "#{dir}/#{ansible_playbook['path']}/.", dir_path
|
133
132
|
ansible_playbook['path'] = dir_path
|
134
133
|
ansible_playbook['name'] = File.basename(dir_path)
|
135
|
-
|
136
|
-
new_playbook
|
134
|
+
AnsiblePlaybook.create(ansible_playbook)
|
137
135
|
rescue StandardError => e
|
138
136
|
logger.info("Error while creating AnsiblePlaybook: #{e}")
|
139
137
|
end
|
@@ -38,7 +38,8 @@ module ForemanAcd
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
def edit
|
41
|
+
def edit
|
42
|
+
end
|
42
43
|
|
43
44
|
def update
|
44
45
|
if @app_instance.update(app_instance_params)
|
@@ -110,7 +111,7 @@ module ForemanAcd
|
|
110
111
|
|
111
112
|
@app_instance.foreman_hosts.where(:hostname => h['hostname']).
|
112
113
|
update(:service => h['service'], :description => h['description'],
|
113
|
-
|
114
|
+
:foremanParameters => JSON.dump(h['foremanParameters']), :ansibleParameters => JSON.dump(h['ansibleParameters']))
|
114
115
|
|
115
116
|
updated_host = @app_instance.foreman_hosts.find_by(:hostname => h['hostname'])
|
116
117
|
|
@@ -118,11 +119,11 @@ module ForemanAcd
|
|
118
119
|
session[:remember_hosts] << updated_host.id if updated_host.updated_at != old_host.updated_at
|
119
120
|
else
|
120
121
|
@app_instance.foreman_hosts.create(:hostname => h['hostname'],
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
:service => h['service'],
|
123
|
+
:description => h['description'],
|
124
|
+
:is_existing_host => h['isExistingHost'],
|
125
|
+
:foremanParameters => JSON.dump(h['foremanParameters']),
|
126
|
+
:ansibleParameters => JSON.dump(h['ansibleParameters']))
|
126
127
|
# Store new hosts for safe deploy
|
127
128
|
session[:remember_hosts] << @app_instance.foreman_hosts.find_by(:hostname => h['hostname']).id
|
128
129
|
end
|
@@ -143,7 +144,7 @@ module ForemanAcd
|
|
143
144
|
:description => h.description,
|
144
145
|
:isExistingHost => h.is_existing_host,
|
145
146
|
:foremanParameters => JSON.parse(h.foremanParameters),
|
146
|
-
:ansibleParameters => JSON.parse(h.ansibleParameters)
|
147
|
+
:ansibleParameters => JSON.parse(h.ansibleParameters),
|
147
148
|
}
|
148
149
|
end
|
149
150
|
hosts_data
|
@@ -15,17 +15,17 @@ module ForemanAcd
|
|
15
15
|
:name => foreman_host.hostname,
|
16
16
|
:build => nil,
|
17
17
|
:hostUrl => nil,
|
18
|
-
:progress_report => foreman_host.last_progress_report.empty? ? [] : JSON.parse(foreman_host.last_progress_report)
|
18
|
+
:progress_report => foreman_host.last_progress_report.empty? ? [] : JSON.parse(foreman_host.last_progress_report),
|
19
19
|
}
|
20
20
|
|
21
21
|
if foreman_host.host.present?
|
22
22
|
a_host.update({
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
:id => foreman_host.host.id,
|
24
|
+
:build => foreman_host.host.build,
|
25
|
+
:hostUrl => host_path(foreman_host.host),
|
26
|
+
:isExistingHost => foreman_host.is_existing_host,
|
27
|
+
:powerStatusUrl => power_api_host_path(foreman_host.host),
|
28
|
+
})
|
29
29
|
end
|
30
30
|
report_data << OpenStruct.new(a_host)
|
31
31
|
end
|
@@ -62,7 +62,7 @@ class UIAcdController < ::Api::V2::BaseController
|
|
62
62
|
report_data = {
|
63
63
|
:hosts => collect_host_report_data(app_instance),
|
64
64
|
:deploymentState => app_instance.deployment_state.to_s,
|
65
|
-
:initialConfigureState => app_instance.initial_configure_state.to_s
|
65
|
+
:initialConfigureState => app_instance.initial_configure_state.to_s,
|
66
66
|
}
|
67
67
|
report_data['initialConfigureJobUrl'] = job_invocation_path(app_instance.initial_configure_job) unless app_instance.initial_configure_job.nil?
|
68
68
|
|
@@ -71,15 +71,14 @@ class UIAcdController < ::Api::V2::BaseController
|
|
71
71
|
|
72
72
|
def hostname_duplicate?(app_def_id, service_id, hostname)
|
73
73
|
app_definition = ForemanAcd::AppDefinition.find(app_def_id)
|
74
|
-
service_data = JSON.parse(app_definition.services).
|
74
|
+
service_data = JSON.parse(app_definition.services).find { |k| k['id'] == service_id }
|
75
75
|
domain_name = Hostgroup.find(service_data['hostgroup']).domain.name
|
76
76
|
validation_hostname = "#{hostname}.#{domain_name}"
|
77
77
|
|
78
|
-
|
78
|
+
OpenStruct.new(
|
79
79
|
:hostname => hostname,
|
80
80
|
:fqdn => validation_hostname,
|
81
81
|
:result => Host.find_by(:name => validation_hostname).nil?
|
82
82
|
)
|
83
|
-
vdata
|
84
83
|
end
|
85
84
|
end
|
@@ -13,12 +13,12 @@ module ForemanAcd
|
|
13
13
|
has_many :app_instances, :through => :foreman_hosts, :class_name => 'ForemanAcd::AppInstance'
|
14
14
|
|
15
15
|
scoped_search :relation => :app_instances,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
:on => :name,
|
17
|
+
:rename => :acd_app_instance,
|
18
|
+
:only_explicit => true,
|
19
|
+
:complete_value => true,
|
20
|
+
:operators => ['= '],
|
21
|
+
:ext_method => :find_by_acd_app_instance_name
|
22
22
|
end
|
23
23
|
|
24
24
|
base.singleton_class.prepend ClassMethods
|
@@ -20,11 +20,14 @@ module ForemanAcd
|
|
20
20
|
super(template_invocation, host).merge(:name => host.name)
|
21
21
|
end
|
22
22
|
|
23
|
-
def ssh_password(_host)
|
23
|
+
def ssh_password(_host)
|
24
|
+
end
|
24
25
|
|
25
|
-
def ssh_key_passphrase(_host)
|
26
|
+
def ssh_key_passphrase(_host)
|
27
|
+
end
|
26
28
|
|
27
|
-
def sudo_password(_host)
|
29
|
+
def sudo_password(_host)
|
30
|
+
end
|
28
31
|
|
29
32
|
# Workaround till infrastructure jobs on proxies are possible. See
|
30
33
|
# configure in services/foreman_acd/app_configurator.rb for more details.
|
@@ -48,7 +48,7 @@ module ForemanAcd
|
|
48
48
|
when 'directory' || 'git'
|
49
49
|
File.read(File.join(path, playfile))
|
50
50
|
else
|
51
|
-
raise NotImplementedError
|
51
|
+
raise NotImplementedError, "scm_type #{scm_type.inspect} not supported!"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -61,14 +61,13 @@ module ForemanAcd
|
|
61
61
|
return :new if last_deploy_task.nil?
|
62
62
|
return :initiated if !last_deploy_task.nil? && last_deploy_task.ended_at.nil?
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
state
|
64
|
+
if all_hosts_deployed?
|
65
|
+
:finished
|
66
|
+
elsif last_deploy_task.ended_at? && last_deploy_task.result != 'success'
|
67
|
+
:failed
|
68
|
+
else
|
69
|
+
:pending
|
70
|
+
end
|
72
71
|
end
|
73
72
|
|
74
73
|
def initial_configure_job
|
@@ -5,6 +5,8 @@ module ForemanAcd
|
|
5
5
|
class AppConfigurator
|
6
6
|
delegate :logger, :to => :Rails
|
7
7
|
|
8
|
+
PROXY_NOT_SUPPORTED_LABELS = [:not_available, :not_defined].freeze
|
9
|
+
|
8
10
|
def initialize(app_instance)
|
9
11
|
@app_instance = app_instance
|
10
12
|
end
|
@@ -42,7 +44,7 @@ module ForemanAcd
|
|
42
44
|
return [result, job]
|
43
45
|
end
|
44
46
|
proxy = proxy_selector.determine_proxy(h.host, 'ACD')
|
45
|
-
raise StandardError
|
47
|
+
raise StandardError, 'Proxy without ACD feature' if proxy.nil? || PROXY_NOT_SUPPORTED_LABELS.include?(proxy)
|
46
48
|
proxy_hosts[proxy.name] = [] unless proxy_hosts.key?(proxy.name)
|
47
49
|
proxy_hosts[proxy.name] << h
|
48
50
|
result.success = true
|
@@ -21,7 +21,7 @@ module ForemanAcd
|
|
21
21
|
end
|
22
22
|
|
23
23
|
foreman_hosts.each do |foreman_host|
|
24
|
-
service_data = services.
|
24
|
+
service_data = services.find { |k| k['id'] == foreman_host.service.to_i }
|
25
25
|
|
26
26
|
# Handle already deployed hosts
|
27
27
|
if foreman_host.existing_host?
|
@@ -27,7 +27,7 @@ module ForemanAcd
|
|
27
27
|
end
|
28
28
|
|
29
29
|
service_id = foreman_host.service.to_i
|
30
|
-
host_service = services.
|
30
|
+
host_service = services.find { |s| s['id'] == service_id }
|
31
31
|
ansible_group = host_service['ansibleGroup']
|
32
32
|
|
33
33
|
children[ansible_group] = { 'hosts' => {} } unless children.key?(host_service['ansibleGroup'])
|
data/config/routes.rb
CHANGED
@@ -40,16 +40,16 @@ Rails.application.routes.draw do
|
|
40
40
|
|
41
41
|
match '/remote_execution', :controller => 'foreman_acd/remote_execution', :action => 'create', :via => [:post]
|
42
42
|
|
43
|
-
get 'ui_acd_app/:id', :to => 'ui_acd#app', :constraints => { :id => /[\w
|
44
|
-
get 'ui_acd_foreman_data/:id', :to => 'ui_acd#foreman_data', :constraints => { :id => /[\w
|
45
|
-
get 'ui_acd_ansible_data/:id', :to => 'ui_acd#ansible_data', :constraints => { :id => /[\w
|
46
|
-
get 'ui_acd_report_data/:id', :to => 'ui_acd#report_data', :constraints => { :id => /[\w
|
43
|
+
get 'ui_acd_app/:id', :to => 'ui_acd#app', :constraints => { :id => /[\w.-]+/ }, :as => :ui_acd_app
|
44
|
+
get 'ui_acd_foreman_data/:id', :to => 'ui_acd#foreman_data', :constraints => { :id => /[\w.-]+/ }, :as => :ui_acd_foreman_data
|
45
|
+
get 'ui_acd_ansible_data/:id', :to => 'ui_acd#ansible_data', :constraints => { :id => /[\w.-]+/ }, :as => :ui_acd_ansible_data
|
46
|
+
get 'ui_acd_report_data/:id', :to => 'ui_acd#report_data', :constraints => { :id => /[\w.-]+/ }, :as => :ui_acd_report_data
|
47
47
|
get 'ui_acd_validate_hostname', :to => 'ui_acd#validate_hostname', :as => :ui_acd_validate_hostname
|
48
48
|
|
49
49
|
scope :api, :path => '/api', :defaults => { :format => 'json' } do
|
50
50
|
scope '(:apiv)', :defaults => { :apiv => 'v2' },
|
51
51
|
:apiv => /v1|v2/, :constraints => ApiConstraints.new(:version => 2) do
|
52
|
-
constraints(:id => /[\w
|
52
|
+
constraints(:id => /[\w.-]+/) do
|
53
53
|
resources :app_definitions, :only => [:show, :index], :controller => 'foreman_acd/api/v2/app_definitions', :as => :acd_api_v2_app_definitions
|
54
54
|
resources :app_instances, :only => [:show, :index], :controller => 'foreman_acd/api/v2/app_instances', :as => :api_v2_foreman_acd_app_instances
|
55
55
|
resources :ansible_playbooks, :only => [:show, :index], :controller => 'foreman_acd/api/v2/ansible_playbooks', :as => :api_v2_foreman_acd_ansible_playbooks do
|
data/lib/foreman_acd/engine.rb
CHANGED
@@ -70,7 +70,7 @@ module ForemanAcd
|
|
70
70
|
N_('Run playbook for ACD'),
|
71
71
|
{
|
72
72
|
:description => N_('Run an Ansible playbook to configure ACD application'),
|
73
|
-
:provided_inputs => %w[application_name playbook_name playbook_path inventory_path]
|
73
|
+
:provided_inputs => %w[application_name playbook_name playbook_path inventory_path],
|
74
74
|
}
|
75
75
|
)
|
76
76
|
end
|
data/lib/foreman_acd/plugin.rb
CHANGED
@@ -8,123 +8,123 @@ Foreman::Plugin.register :foreman_acd do
|
|
8
8
|
# Menus
|
9
9
|
sub_menu :top_menu, :application, :caption => N_('Applications'), :after => :hosts_menu, :icon => 'pficon pficon-integration' do
|
10
10
|
menu :top_menu, :ansible_playbooks,
|
11
|
-
|
12
|
-
|
11
|
+
:url_hash => { :controller => :'foreman_acd/ansible_playbooks', :action => :index },
|
12
|
+
:caption => 'Ansible Playbooks'
|
13
13
|
|
14
14
|
menu :top_menu, :app_definitions,
|
15
|
-
|
16
|
-
|
15
|
+
:url_hash => { :controller => :'foreman_acd/app_definitions', :action => :index },
|
16
|
+
:caption => 'App Definitions'
|
17
17
|
|
18
18
|
menu :top_menu, :app_instances,
|
19
|
-
|
20
|
-
|
19
|
+
:url_hash => { :controller => :'foreman_acd/app_instances', :action => :index },
|
20
|
+
:caption => 'App Instances'
|
21
21
|
end
|
22
22
|
|
23
23
|
# Add permissions
|
24
24
|
security_block :foreman_acd do
|
25
25
|
permission :create_ansible_playbooks,
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
{ :'foreman_acd/ansible_playbooks' => [:new, :create],
|
27
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:create] },
|
28
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
29
29
|
|
30
30
|
permission :view_ansible_playbooks,
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
{ :'foreman_acd/ansible_playbooks' => [:index, :show, :auto_complete_search],
|
32
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:index, :show] },
|
33
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
34
34
|
|
35
35
|
permission :edit_ansible_playbooks,
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
{ :'foreman_acd/ansible_playbooks' => [:update, :edit, :sync_git_repo],
|
37
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:update] },
|
38
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
39
39
|
|
40
40
|
permission :destroy_ansible_playbooks,
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
{ :'foreman_acd/ansible_playbooks' => [:destroy],
|
42
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:destroy] },
|
43
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
44
44
|
|
45
45
|
permission :import_vars_ansible_playbooks,
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
{ :'foreman_acd/ansible_playbooks' => [:import_vars],
|
47
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:import_vars] },
|
48
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
49
49
|
|
50
50
|
permission :grab_ansible_playbooks,
|
51
|
-
|
52
|
-
|
51
|
+
{ :'foreman_acd/api/v2/ansible_playbooks' => [:grab] },
|
52
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
53
53
|
|
54
54
|
permission :create_app_definitions,
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
{ :'foreman_acd/app_definitions' => [:new, :create],
|
56
|
+
:'foreman_acd/api/v2/app_definitions' => [:create] },
|
57
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
58
58
|
|
59
59
|
permission :view_app_definitions,
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
{ :'foreman_acd/app_definitions' => [:index, :show, :auto_complete_search],
|
61
|
+
:'foreman_acd/api/v2/app_definitions' => [:index, :show] },
|
62
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
63
63
|
|
64
64
|
permission :edit_app_definitions,
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
{ :'foreman_acd/app_definitions' => [:update, :edit],
|
66
|
+
:'foreman_acd/api/v2/app_definitions' => [:update] },
|
67
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
68
68
|
|
69
69
|
permission :destroy_app_definitions,
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
{ :'foreman_acd/app_definitions' => [:destroy],
|
71
|
+
:'foreman_acd/api/v2/app_definitions' => [:destroy] },
|
72
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
73
73
|
|
74
74
|
permission :export_app_definitions,
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
{ :'foreman_acd/app_definitions' => [:export, :handle_file_upload],
|
76
|
+
:'foreman_acd/api/v2/app_definitions' => [:export] },
|
77
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
78
78
|
|
79
79
|
permission :import_app_definitions,
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
{ :'foreman_acd/app_definitions' => [:import],
|
81
|
+
:'foreman_acd/api/v2/app_definitions' => [:import] },
|
82
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
83
83
|
|
84
84
|
permission :create_app_instances,
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
{ :'foreman_acd/app_instances' => [:new, :create],
|
86
|
+
:'foreman_acd/api/v2/app_instances' => [:create] },
|
87
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
88
88
|
|
89
89
|
permission :view_app_instances,
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
{ :'foreman_acd/app_instances' => [:index, :show, :auto_complete_search],
|
91
|
+
:'foreman_acd/api/v2/app_instances' => [:index, :show] },
|
92
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
93
93
|
|
94
94
|
permission :edit_app_instances,
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
{ :'foreman_acd/app_instances' => [:update, :edit],
|
96
|
+
:'foreman_acd/api/v2/app_instances' => [:update] },
|
97
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
98
98
|
|
99
99
|
permission :destroy_app_instances,
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
{ :'foreman_acd/app_instances' => [:destroy, :destroy_with_hosts],
|
101
|
+
:'foreman_acd/api/v2/app_instances' => [:destroy, :destroy_with_hosts] },
|
102
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
103
103
|
|
104
104
|
permission :deploy_app_instances,
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
{ :'foreman_acd/app_instances' => [:deploy],
|
106
|
+
:'foreman_acd/api/v2/app_instances' => [:deploy] },
|
107
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
108
108
|
|
109
109
|
permission :report_app_instances,
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
{ :'foreman_acd/app_instances' => [:report],
|
111
|
+
:'foreman_acd/api/v2/app_instances' => [:report] },
|
112
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
113
113
|
|
114
114
|
permission :new_acd_configure_job,
|
115
|
-
|
116
|
-
|
115
|
+
{ :'foreman_acd/remote_execution' => [:new] },
|
116
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
117
117
|
|
118
118
|
permission :create_acd_configure_job,
|
119
|
-
|
120
|
-
|
119
|
+
{ :'foreman_acd/remote_execution' => [:create] },
|
120
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
121
121
|
|
122
122
|
permission :view_ui_acd,
|
123
|
-
|
123
|
+
{ :ui_acd => [:app, :foreman_data, :ansible_data, :validate_hostname, :report_data] }
|
124
124
|
|
125
125
|
permission :acd_foreman_hosts,
|
126
|
-
|
127
|
-
|
126
|
+
{ :'foreman_acd/app_instances' => [:create, :edit, :update, :deploy, :destroy_with_hosts, :destroy] },
|
127
|
+
:resource_type => 'ForemanAcd::ForemanHost'
|
128
128
|
end
|
129
129
|
|
130
130
|
# Manager Role
|
data/lib/foreman_acd/version.rb
CHANGED
data/lib/foreman_acd.rb
CHANGED
@@ -29,8 +29,8 @@ module ForemanAcd
|
|
29
29
|
|
30
30
|
def start_acd_app_configurator(app_instance)
|
31
31
|
task = ForemanTasks.delay(::Actions::ForemanAcd::RunConfigurator,
|
32
|
-
|
33
|
-
|
32
|
+
{ :start_at => Time.zone.now + RUN_CONFIGURATOR_DELAY },
|
33
|
+
app_instance)
|
34
34
|
app_instance.update(:initial_configure_task_id => task.id)
|
35
35
|
end
|
36
36
|
end
|
@@ -13,20 +13,13 @@ namespace :test do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
namespace :foreman_acd do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
task.patterns = ["#{ForemanAcd::Engine.root}/app/**/*.rb",
|
21
|
-
"#{ForemanAcd::Engine.root}/lib/**/*.rb",
|
22
|
-
"#{ForemanAcd::Engine.root}/test/**/*.rb"]
|
23
|
-
end
|
24
|
-
rescue StandardError
|
25
|
-
puts 'Rubocop not loaded.'
|
26
|
-
end
|
27
|
-
|
28
|
-
Rake::Task['rubocop_foreman_acd'].invoke
|
16
|
+
require 'rubocop/rake_task'
|
17
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
18
|
+
task.options = ['--force-exclusion']
|
19
|
+
task.patterns = [ForemanAcd::Engine.root.to_s]
|
29
20
|
end
|
21
|
+
rescue LoadError
|
22
|
+
puts 'Rubocop not loaded.'
|
30
23
|
end
|
31
24
|
|
32
25
|
Rake::Task[:test].enhance ['test:foreman_acd']
|
@@ -18,8 +18,8 @@ module ForemanAcd
|
|
18
18
|
test 'should destroy ansible playbook' do
|
19
19
|
assert_difference('AnsiblePlaybook.count', -1) do
|
20
20
|
delete :destroy,
|
21
|
-
|
22
|
-
|
21
|
+
:params => { :id => @model.id },
|
22
|
+
:session => set_session_user
|
23
23
|
end
|
24
24
|
assert_redirected_to ansible_playbooks_url
|
25
25
|
end
|
@@ -18,8 +18,8 @@ module ForemanAcd
|
|
18
18
|
test 'should destroy app definition' do
|
19
19
|
assert_difference('AppDefinition.count', -1) do
|
20
20
|
delete :destroy,
|
21
|
-
|
22
|
-
|
21
|
+
:params => { :id => @model.id },
|
22
|
+
:session => set_session_user
|
23
23
|
end
|
24
24
|
assert_redirected_to app_definitions_url
|
25
25
|
end
|
@@ -24,8 +24,8 @@ module ForemanAcd
|
|
24
24
|
test 'should destroy app instance' do
|
25
25
|
assert_difference('AppInstance.count', -1) do
|
26
26
|
delete :destroy_with_hosts,
|
27
|
-
|
28
|
-
|
27
|
+
:params => { :id => @model.id },
|
28
|
+
:session => set_session_user
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -10,13 +10,13 @@ module ForemanAcd
|
|
10
10
|
|
11
11
|
it 'returns only strings' do
|
12
12
|
provider_names.each do |name|
|
13
|
-
|
13
|
+
expect(name).must_be_kind_of String
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'provider is registetered under :custom symbol' do
|
18
18
|
before { AcdProvider.register(:ACD, String) }
|
19
|
-
it {
|
19
|
+
it { expect(provider_names).must_include 'ACD' }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -14,10 +14,10 @@ module ForemanAcd
|
|
14
14
|
app = FactoryBot.create :app_instance
|
15
15
|
|
16
16
|
foreman_host = app.foreman_hosts.create(:hostname => host.name,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
:service => 'DB',
|
18
|
+
:description => 'Description',
|
19
|
+
:foremanParameters => nil,
|
20
|
+
:ansibleParameters => nil)
|
21
21
|
foreman_host.host = host
|
22
22
|
foreman_host.save
|
23
23
|
assert host.deployed_via_acd?
|
metadata
CHANGED
@@ -1,43 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_acd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rubocop
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.89.0
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.89.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rubocop-rails
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 2.8.1
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 2.8.1
|
41
12
|
- !ruby/object:Gem::Dependency
|
42
13
|
name: foreman_remote_execution
|
43
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +51,20 @@ dependencies:
|
|
80
51
|
- - ">="
|
81
52
|
- !ruby/object:Gem::Version
|
82
53
|
version: '0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: theforeman-rubocop
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.1.0
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.1.0
|
83
68
|
description: Foreman plugin to provide application centric deployment and self service
|
84
69
|
portal
|
85
70
|
email:
|
@@ -364,7 +349,6 @@ homepage: https://www.orcharhino.com
|
|
364
349
|
licenses:
|
365
350
|
- GPL-3.0
|
366
351
|
metadata: {}
|
367
|
-
post_install_message:
|
368
352
|
rdoc_options: []
|
369
353
|
require_paths:
|
370
354
|
- lib
|
@@ -382,8 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
382
366
|
- !ruby/object:Gem::Version
|
383
367
|
version: '0'
|
384
368
|
requirements: []
|
385
|
-
rubygems_version: 3.
|
386
|
-
signing_key:
|
369
|
+
rubygems_version: 3.6.7
|
387
370
|
specification_version: 4
|
388
371
|
summary: Foreman plugin to provide application centric deployment and self service
|
389
372
|
portal
|