staypuft 0.0.5 → 0.0.7
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.
- data/app/controllers/staypuft/deployment_steps_controller.rb +1 -2
- data/app/controllers/staypuft/deployments_controller.rb +15 -7
- data/app/lib/actions/staypuft/host/build.rb +39 -13
- data/app/lib/actions/staypuft/hostgroup/deploy.rb +5 -1
- data/app/models/staypuft/concerns/environment_extensions.rb +12 -0
- data/app/models/staypuft/deployment.rb +2 -0
- data/app/models/staypuft/service.rb +28 -19
- data/app/views/staypuft/deployments/show.html.erb +3 -1
- data/app/views/staypuft/deployments/summary.html.erb +27 -0
- data/config/routes.rb +1 -0
- data/config/staypuft.local.rb +0 -3
- data/db/seeds.rb +73 -40
- data/lib/staypuft/engine.rb +1 -0
- data/lib/staypuft/version.rb +1 -1
- metadata +8 -6
@@ -10,8 +10,7 @@ module Staypuft
|
|
10
10
|
when :deployment_settings
|
11
11
|
@layouts = Layout.all
|
12
12
|
when :services_configuration
|
13
|
-
|
14
|
-
@services = @deployment.roles(:services).map(&:services).flatten.uniq
|
13
|
+
@services = @deployment.services
|
15
14
|
end
|
16
15
|
|
17
16
|
render_wizard
|
@@ -32,6 +32,11 @@ module Staypuft
|
|
32
32
|
@deployment = Deployment.find(params[:id])
|
33
33
|
end
|
34
34
|
|
35
|
+
def summary
|
36
|
+
@deployment = Deployment.find(params[:id])
|
37
|
+
@services = @deployment.services
|
38
|
+
end
|
39
|
+
|
35
40
|
def destroy
|
36
41
|
Deployment.find(params[:id]).destroy
|
37
42
|
process_success
|
@@ -54,20 +59,23 @@ module Staypuft
|
|
54
59
|
def associate_host
|
55
60
|
hostgroup = ::Hostgroup.find params[:hostgroup_id]
|
56
61
|
|
57
|
-
targeted_hosts =
|
62
|
+
targeted_hosts = ::Host::Base.find Array(params[:host_ids])
|
58
63
|
assigned_hosts = hostgroup.hosts
|
59
64
|
hosts_to_assign = targeted_hosts - assigned_hosts
|
60
65
|
hosts_to_remove = assigned_hosts - targeted_hosts
|
61
66
|
|
62
67
|
hosts_to_assign.each do |discovered_host|
|
63
|
-
host
|
64
|
-
host.type
|
65
|
-
host.managed
|
66
|
-
host.build
|
67
|
-
|
68
|
+
host = discovered_host.becomes(::Host::Managed)
|
69
|
+
host.type = 'Host::Managed'
|
70
|
+
host.managed = true
|
71
|
+
host.build = true
|
72
|
+
|
73
|
+
host.hostgroup = hostgroup
|
74
|
+
# set discovery environment to keep booting discovery image
|
75
|
+
host.environment = Environment.get_discovery
|
68
76
|
|
69
77
|
# root_pass is not copied for some reason
|
70
|
-
host.root_pass
|
78
|
+
host.root_pass = hostgroup.root_pass
|
71
79
|
|
72
80
|
# I do not why but the final save! adds following condytion to the update SQL command
|
73
81
|
# "WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 283"
|
@@ -22,27 +22,53 @@ module Actions
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def run
|
25
|
-
host
|
26
|
-
|
25
|
+
host = ::Host.find(input[:host_id])
|
26
|
+
# return back to hostgroup's environment
|
27
|
+
host.environment = nil
|
28
|
+
host.save!
|
29
|
+
host.send :setTFTP
|
30
|
+
restart(host)
|
31
|
+
end
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
private
|
34
|
+
|
35
|
+
def restart(host)
|
36
|
+
power_management = begin
|
37
|
+
host.power
|
38
|
+
rescue Foreman::Exception => e
|
39
|
+
if e.code == 'ERF42-9958' # Unknown power management support
|
40
|
+
nil
|
41
|
+
else
|
42
|
+
raise e
|
32
43
|
end
|
33
44
|
end
|
34
45
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if %w(shutoff off).include?(host.power.state)
|
40
|
-
host.power.start or fail(::Staypuft::Exception, 'Starting Host Failed')
|
46
|
+
if power_management
|
47
|
+
restart_with_power_management power_management
|
48
|
+
else
|
49
|
+
restart_with_foreman_proxy host
|
41
50
|
end
|
51
|
+
end
|
42
52
|
|
53
|
+
def restart_with_foreman_proxy(host)
|
54
|
+
host.setReboot # FIXME detect failures
|
43
55
|
end
|
44
56
|
|
45
|
-
|
57
|
+
def restart_with_power_management(power)
|
58
|
+
check_expected_state(power.state)
|
59
|
+
if %w(running on).include?(power.state)
|
60
|
+
if !power.reset
|
61
|
+
fail(::Staypuft::Exception, 'Resetting Host Failed')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# FIXME host.power.reset leaves the host in "shutdown" state for
|
66
|
+
# libvirt not tested in BMC. The following code makes sure the host starts again
|
67
|
+
check_expected_state(power.state)
|
68
|
+
if %w(shutoff off).include?(power.state)
|
69
|
+
power.start or fail(::Staypuft::Exception, 'Starting Host Failed')
|
70
|
+
end
|
71
|
+
end
|
46
72
|
|
47
73
|
def check_expected_state(state)
|
48
74
|
if !%w(running on cycle shutoff off).include?(state.downcase)
|
@@ -38,7 +38,11 @@ module Actions
|
|
38
38
|
|
39
39
|
def humanized_output
|
40
40
|
format "Hostgroup: %s\n%s", input[:name],
|
41
|
-
planned_actions.
|
41
|
+
planned_actions.
|
42
|
+
map(&:humanized_output).
|
43
|
+
tap { |lines| lines << '-' if lines.empty? }.
|
44
|
+
map { |l| ' ' + l }.
|
45
|
+
join("\n")
|
42
46
|
end
|
43
47
|
|
44
48
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Staypuft::Concerns::EnvironmentExtensions
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
module ClassMethods
|
5
|
+
def get_discovery
|
6
|
+
find_by_name('discovery') or
|
7
|
+
raise ::Staypuft::Exception,
|
8
|
+
'missing discovery environment, which ensures all its machines are booted ' +
|
9
|
+
'to discovery image.'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -16,10 +16,10 @@ module Staypuft
|
|
16
16
|
# there are possibly multiple puppetclass matches. without this, we'll
|
17
17
|
# just grab the first puppetclass from the matching hostgroup
|
18
18
|
UI_PARAMS = {
|
19
|
-
"qpid"=> ["qpid_ca", "qpid_cert", "qpid_host", "qpid_key", "qpid_nssdb_password"],
|
19
|
+
"qpid (non-HA)"=> ["qpid_ca", "qpid_cert", "qpid_host", "qpid_key", "qpid_nssdb_password"],
|
20
20
|
"MySQL"=> ["mysql_ca", "mysql_cert", "mysql_host", "mysql_key",
|
21
21
|
"mysql_root_password"],
|
22
|
-
"Keystone"=> ["keystone_admin_token", "keystone_db_password"],
|
22
|
+
"Keystone (non-HA)"=> ["keystone_admin_token", "keystone_db_password"],
|
23
23
|
"Nova (Controller)"=> ["admin_email", "admin_password", "auto_assign_floating_ip",
|
24
24
|
"controller_admin_host", "controller_priv_host",
|
25
25
|
"controller_pub_host", "freeipa", "horizon_ca",
|
@@ -49,7 +49,7 @@ module Staypuft
|
|
49
49
|
"swift_admin_password", "swift_ringserver_ip",
|
50
50
|
"swift_shared_secret", "swift_storage_device",
|
51
51
|
"swift_storage_ips"],
|
52
|
-
"Glance"=> ["glance_db_password", "glance_user_password"],
|
52
|
+
"Glance (non-HA)"=> ["glance_db_password", "glance_user_password"],
|
53
53
|
"Cinder"=> ["cinder_backend_gluster", "cinder_backend_iscsi",
|
54
54
|
"cinder_db_password", "cinder_gluster_servers",
|
55
55
|
"cinder_gluster_volume", "cinder_user_password"],
|
@@ -88,27 +88,36 @@ module Staypuft
|
|
88
88
|
"tenant_network_type", "tunnel_id_ranges", "verbose"],
|
89
89
|
"Neutron-ovs-agent"=> [],
|
90
90
|
"Swift" => ["swift_all_ips", "swift_ext4_device", "swift_local_interface",
|
91
|
-
"swift_loopback", "swift_ring_server", "swift_shared_secret"]
|
91
|
+
"swift_loopback", "swift_ring_server", "swift_shared_secret"]
|
92
92
|
|
93
93
|
}
|
94
94
|
|
95
95
|
def ui_params_for_form(hostgroup = self.hostgroups.first)
|
96
|
-
return [] if (hostgroup.nil?
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
96
|
+
return [] if (hostgroup.nil?)
|
97
|
+
if hostgroup.puppetclasses.blank?
|
98
|
+
params_from_hash = []
|
99
|
+
else
|
100
|
+
puppetclass = hostgroup.puppetclasses.first
|
101
|
+
params_from_hash = UI_PARAMS.fetch(self.name,[]).collect do |param_key|
|
102
|
+
if param_key.is_a?(Array)
|
103
|
+
param_name = param_key[0]
|
104
|
+
param_puppetclass = Puppetclass.find_by_name(param_key[1])
|
105
|
+
else
|
106
|
+
param_name = param_key
|
107
|
+
param_puppetclass = puppetclass
|
108
|
+
end
|
109
|
+
param_lookup_key = param_puppetclass.class_params.where(:key=>param_key).first
|
110
|
+
param_lookup_key.nil? ? nil : {:hostgroup => hostgroup,
|
111
|
+
:puppetclass => param_puppetclass,
|
112
|
+
:param_key => param_lookup_key}
|
113
|
+
end.compact
|
114
|
+
end
|
115
|
+
params_from_service = self.puppetclasses.collect do |pclass|
|
116
|
+
pclass.class_params.collect do |class_param|
|
117
|
+
{:hostgroup => hostgroup, :puppetclass => pclass, :param_key => class_param}
|
106
118
|
end
|
107
|
-
|
108
|
-
|
109
|
-
:puppetclass => param_puppetclass,
|
110
|
-
:param_key => param_lookup_key}
|
111
|
-
end.compact
|
119
|
+
end.flatten
|
120
|
+
params_from_hash + params_from_service
|
112
121
|
end
|
113
122
|
end
|
114
123
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
<% content_for(:title_actions) do %>
|
4
4
|
|
5
|
+
<%= link_to(_("Configuration Summary"), summary_deployment_path(@deployment.id), :class => '') %>
|
6
|
+
|
5
7
|
<% if Rails.env.development? %>
|
6
8
|
<div class="btn-group">
|
7
9
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
@@ -50,7 +52,7 @@
|
|
50
52
|
<% if child_hostgroup.own_and_free_hosts.present? %>
|
51
53
|
<%= form_tag(associate_host_deployments_path, class: 'form-horizontal well association') do |f| %>
|
52
54
|
<p>
|
53
|
-
<%= submit_tag _("
|
55
|
+
<%= submit_tag _("Assign"), :class => "btn btn-primary btn-sm" %>
|
54
56
|
</p>
|
55
57
|
<%= hidden_field_tag :hostgroup_id, child_hostgroup.id %>
|
56
58
|
<table class="table table-bordered table-striped table-condensed">
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% title_actions link_to _("Back to Deployment"), deployment_path(@deployment.id)%>
|
2
|
+
<% title _("%s Summary") % @deployment.name %>
|
3
|
+
|
4
|
+
<div class="col-md-12">
|
5
|
+
<% @services.each_with_index do |service, i| %>
|
6
|
+
<div class="well <%= 'active' if i == 0 %>" id="<%= service.name.parameterize.underscore %>">
|
7
|
+
<h3><%= "#{service.name} " + _("Service Configuration") %></h3>
|
8
|
+
<% if (params_hash = service.ui_params_for_form).size > 0 %>
|
9
|
+
<% params_hash.each do |param_hash| %>
|
10
|
+
<div class="row">
|
11
|
+
<div class="col-md-3 text-right">
|
12
|
+
<%= label_tag param_hash[:param_key].key %>
|
13
|
+
</div>
|
14
|
+
<div class="col-md-9">
|
15
|
+
<%= content_tag "staypuft_deployment[hostgroup_params][#{param_hash[:hostgroup].id}][puppetclass_params][#{param_hash[:puppetclass].id}][#{param_hash[:param_key].key}]", param_hash[:hostgroup].current_param_value_str(param_hash[:param_key]), :class=>"" %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<br/>
|
19
|
+
<% end %>
|
20
|
+
<% else %>
|
21
|
+
<div class="row">
|
22
|
+
<p class="col-md-12"><%= _("No configuration for this service.") %></p>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
data/config/routes.rb
CHANGED
data/config/staypuft.local.rb
CHANGED
data/db/seeds.rb
CHANGED
@@ -31,9 +31,11 @@ params = {
|
|
31
31
|
"gluster_open_port_count" => '10',
|
32
32
|
"heat_db_password" => SecureRandom.hex,
|
33
33
|
"heat_user_password" => SecureRandom.hex,
|
34
|
+
"heat_cfn_user_password" => SecureRandom.hex,
|
34
35
|
"horizon_secret_key" => SecureRandom.hex,
|
35
36
|
"keystone_admin_token" => SecureRandom.hex,
|
36
37
|
"keystone_db_password" => SecureRandom.hex,
|
38
|
+
"keystone_user_password" => SecureRandom.hex,
|
37
39
|
"mysql_root_password" => SecureRandom.hex,
|
38
40
|
"neutron_db_password" => SecureRandom.hex,
|
39
41
|
"neutron_user_password" => SecureRandom.hex,
|
@@ -42,6 +44,7 @@ params = {
|
|
42
44
|
"nova_default_floating_pool" => "nova",
|
43
45
|
"swift_admin_password" => SecureRandom.hex,
|
44
46
|
"swift_shared_secret" => SecureRandom.hex,
|
47
|
+
"swift_user_password" => SecureRandom.hex,
|
45
48
|
"swift_all_ips" => ['192.168.203.1', '192.168.203.2', '192.168.203.3', '192.168.203.4'],
|
46
49
|
"swift_ext4_device" => '/dev/sdc2',
|
47
50
|
"swift_local_interface" => 'eth3',
|
@@ -62,6 +65,8 @@ params = {
|
|
62
65
|
"mysql_resource_group_name" => 'mysqlgrp',
|
63
66
|
"mysql_clu_member_addrs" => '192.168.203.11 192.168.203.12 192.168.203.13',
|
64
67
|
"qpid_host" => '172.16.0.1',
|
68
|
+
"qpid_username" => 'openstack',
|
69
|
+
"qpid_password" => SecureRandom.hex,
|
65
70
|
"admin_email" => "admin@#{Facter.value(:domain)}",
|
66
71
|
"neutron_metadata_proxy_secret" => SecureRandom.hex,
|
67
72
|
"enable_ovs_agent" => "true",
|
@@ -83,6 +88,8 @@ params = {
|
|
83
88
|
"provider_vlan_auto_trunk" => "false",
|
84
89
|
"backend_server_names" => [],
|
85
90
|
"backend_server_addrs" => [],
|
91
|
+
"lb_backend_server_names" => [],
|
92
|
+
"lb_backend_server_addrs" => [],
|
86
93
|
"configure_ovswitch" => "true",
|
87
94
|
"neutron" => "false",
|
88
95
|
"ssl" => "false",
|
@@ -97,9 +104,7 @@ params = {
|
|
97
104
|
"horizon_cert" => "/etc/pki/tls/certs/PUB_HOST-horizon.crt",
|
98
105
|
"horizon_key" => "/etc/pki/tls/private/PUB_HOST-horizon.key",
|
99
106
|
"qpid_nssdb_password" => SecureRandom.hex,
|
100
|
-
"
|
101
|
-
"pacemaker_cluster_members" => "192.168.200.10 192.168.200.11 192.168.200.12",
|
102
|
-
"pacemaker_disable_stonith" => false,
|
107
|
+
"fence_xvm_key_file_password" => SecureRandom.hex,
|
103
108
|
}
|
104
109
|
|
105
110
|
def get_key_type(value)
|
@@ -128,29 +133,40 @@ layouts = {
|
|
128
133
|
|
129
134
|
# services don't have puppetclasses yet, since they aren't broken out on the back end
|
130
135
|
services = {
|
131
|
-
:
|
132
|
-
:mysql => {:name => "MySQL", :class =>
|
133
|
-
:
|
134
|
-
:nova_controller => {:name => "Nova (Controller)", :class =>
|
135
|
-
:neutron_controller => {:name => "Neutron (Controller)", :class =>
|
136
|
-
:
|
137
|
-
:cinder => {:name => "Cinder", :class =>
|
138
|
-
:heat => {:name => "Heat", :class =>
|
139
|
-
:ceilometer => {:name => "Ceilometer", :class =>
|
140
|
-
:neutron_l3 => {:name => "Neutron - L3", :class =>
|
141
|
-
:dhcp => {:name => "DHCP", :class =>
|
142
|
-
:ovs => {:name => "OVS", :class =>
|
143
|
-
:nova_compute => {:name => "Nova-compute", :class =>
|
144
|
-
:neutron_compute => {:name => "Neutron-compute", :class =>
|
145
|
-
:neutron_ovs_agent => {:name => "Neutron-ovs-agent", :class =>
|
146
|
-
:swift => {:name => "Swift", :class =>
|
136
|
+
:non_ha_qpid => {:name => "qpid (non-HA)", :class => []},
|
137
|
+
:mysql => {:name => "MySQL", :class => []},
|
138
|
+
:non_ha_keystone => {:name => "Keystone (non-HA)", :class => []},
|
139
|
+
:nova_controller => {:name => "Nova (Controller)", :class => []},
|
140
|
+
:neutron_controller => {:name => "Neutron (Controller)", :class => []},
|
141
|
+
:non_ha_glance => {:name => "Glance (non-HA)", :class => []},
|
142
|
+
:cinder => {:name => "Cinder", :class => []},
|
143
|
+
:heat => {:name => "Heat", :class => []},
|
144
|
+
:ceilometer => {:name => "Ceilometer", :class => []},
|
145
|
+
:neutron_l3 => {:name => "Neutron - L3", :class => []},
|
146
|
+
:dhcp => {:name => "DHCP", :class => []},
|
147
|
+
:ovs => {:name => "OVS", :class => []},
|
148
|
+
:nova_compute => {:name => "Nova-compute", :class => []},
|
149
|
+
:neutron_compute => {:name => "Neutron-compute", :class => []},
|
150
|
+
:neutron_ovs_agent => {:name => "Neutron-ovs-agent", :class => []},
|
151
|
+
:swift => {:name => "Swift", :class => []},
|
152
|
+
:ha_controller => {:name => "HA (Controller)", :class => ["quickstack::openstack_common",
|
153
|
+
"quickstack::pacemaker::common",
|
154
|
+
"quickstack::pacemaker::params"]},
|
155
|
+
:keystone_ha => {:name => "Keystone (HA)", :class => ["quickstack::pacemaker::keystone"]},
|
156
|
+
:load_balancer_ha => {:name => "Load Balancer (HA)", :class => ["quickstack::pacemaker::load_balancer"]},
|
157
|
+
:memcached_ha => {:name => "Memcached (HA)", :class => ["quickstack::pacemaker::memcached"]},
|
158
|
+
:qpid_ha => {:name => "qpid (HA)", :class => ["quickstack::pacemaker::qpid",
|
159
|
+
"qpid::server"]},
|
160
|
+
:glance_ha => {:name => "Glance (HA)", :class => ["quickstack::pacemaker::glance"]},
|
161
|
+
:nova_ha => {:name => "Nova (HA)", :class => ["quickstack::pacemaker::nova"]}
|
147
162
|
}
|
148
163
|
services.each do |skey, svalue|
|
149
164
|
service = Staypuft::Service.where(:name=>svalue[:name]).first_or_create!
|
150
165
|
|
151
166
|
# set params in puppetclass
|
152
|
-
|
153
|
-
|
167
|
+
pclassnames = svalue[:class].kind_of?(Array) ? svalue[:class] : [ svalue[:class] ]
|
168
|
+
service.puppetclasses = pclassnames.collect do |pclassname|
|
169
|
+
pclass = Puppetclass.find_by_name pclassname
|
154
170
|
# skip if puppet class isn't found (yet)
|
155
171
|
if pclass
|
156
172
|
pclass.class_params.each do |p|
|
@@ -161,9 +177,9 @@ services.each do |skey, svalue|
|
|
161
177
|
p.override = true
|
162
178
|
p.save!
|
163
179
|
end
|
164
|
-
|
180
|
+
pclass
|
165
181
|
end
|
166
|
-
end
|
182
|
+
end.compact
|
167
183
|
|
168
184
|
service.description = svalue[:description]
|
169
185
|
service.save!
|
@@ -178,36 +194,40 @@ end
|
|
178
194
|
roles = [
|
179
195
|
{:name=>"Controller (Nova)",
|
180
196
|
:class=>"quickstack::nova_network::controller",
|
181
|
-
:layouts=>[[:
|
182
|
-
:services=>[:
|
197
|
+
:layouts=>[[:non_ha_nova, 1]],
|
198
|
+
:services=>[:non_ha_qpid, :mysql, :non_ha_keystone, :nova_controller, :non_ha_glance, :cinder, :heat, :ceilometer]},
|
183
199
|
{:name=>"Compute (Nova)",
|
184
200
|
:class=>"quickstack::nova_network::compute",
|
185
201
|
:layouts=>[[:ha_nova, 10], [:non_ha_nova, 10]],
|
186
202
|
:services=>[:nova_compute]},
|
187
203
|
{:name=>"Controller (Neutron)",
|
188
204
|
:class=>"quickstack::neutron::controller",
|
189
|
-
:layouts=>[[:
|
190
|
-
:services=>[:
|
205
|
+
:layouts=>[[:non_ha_neutron, 1]],
|
206
|
+
:services=>[:non_ha_qpid, :mysql, :non_ha_keystone, :neutron_controller, :non_ha_glance, :cinder, :heat, :ceilometer]},
|
191
207
|
{:name=>"Compute (Neutron)",
|
192
208
|
:class=>"quickstack::neutron::compute",
|
193
209
|
:layouts=>[[:ha_neutron, 10], [:non_ha_neutron, 10]],
|
194
210
|
:services=>[:neutron_compute, :neutron_ovs_agent]},
|
195
211
|
{:name=>"Neutron Networker",
|
196
212
|
:class=>"quickstack::neutron::networker",
|
197
|
-
:layouts=>[[:
|
213
|
+
:layouts=>[[:non_ha_neutron, 2]],
|
198
214
|
:services=>[:neutron_l3, :dhcp, :ovs]},
|
199
215
|
{:name=>"LVM Block Storage",
|
200
216
|
:class=>"quickstack::storage_backend::lvm_cinder",
|
201
217
|
:layouts=>[[:ha_nova, 3], [:ha_neutron, 3], [:non_ha_nova, 3], [:non_ha_neutron, 3]],
|
202
218
|
:services=>[:cinder]},
|
203
|
-
{:name=>"Load Balancer",
|
204
|
-
:class=>"quickstack::load_balancer",
|
205
|
-
:layouts=>[[:ha_nova, 4], [:ha_neutron, 4]],
|
206
|
-
:services=>[]},
|
207
219
|
{:name=>"Swift Storage Node",
|
208
220
|
:class=>"quickstack::swift::storage",
|
209
|
-
:layouts=>[[:non_ha_nova, 5], [:non_ha_neutron, 5]],
|
210
|
-
:services=>[:swift]}
|
221
|
+
:layouts=>[[:ha_nova, 5], [:ha_neutron, 5], [:non_ha_nova, 5], [:non_ha_neutron, 5]],
|
222
|
+
:services=>[:swift]},
|
223
|
+
{:name=>"HA Controller (Nova)",
|
224
|
+
:class=>[],
|
225
|
+
:layouts=>[[:ha_nova, 1]],
|
226
|
+
:services=>[:ha_controller, :keystone_ha, :load_balancer_ha, :memcached_ha, :qpid_ha, :glance_ha, :nova_ha]},
|
227
|
+
{:name=>"HA Controller (Neutron)",
|
228
|
+
:class=>[],
|
229
|
+
:layouts=>[[:ha_neutron, 1]],
|
230
|
+
:services=>[]}
|
211
231
|
]
|
212
232
|
|
213
233
|
roles.each do |r|
|
@@ -215,8 +235,9 @@ roles.each do |r|
|
|
215
235
|
role = Staypuft::Role.where(:name => r[:name]).first_or_create!
|
216
236
|
|
217
237
|
# set params in puppetclass
|
218
|
-
|
219
|
-
|
238
|
+
pclassnames = r[:class].kind_of?(Array) ? r[:class] : [ r[:class] ]
|
239
|
+
role.puppetclasses = pclassnames.collect do |pclassname|
|
240
|
+
pclass = Puppetclass.find_by_name pclassname
|
220
241
|
# skip if puppet class isn't found (yet)
|
221
242
|
if pclass
|
222
243
|
pclass.class_params.each do |p|
|
@@ -227,18 +248,30 @@ roles.each do |r|
|
|
227
248
|
p.override = true
|
228
249
|
p.save!
|
229
250
|
end
|
230
|
-
|
251
|
+
pclass
|
231
252
|
end
|
232
|
-
end
|
253
|
+
end.compact
|
233
254
|
|
234
255
|
role.description = r[:description]
|
256
|
+
old_role_services_arr = role.role_services.to_a
|
235
257
|
r[:services].each do |key|
|
236
|
-
|
258
|
+
role_service = role.role_services.where(:service_id => services[key][:obj].id).first_or_create!
|
259
|
+
old_role_services_arr.delete(role_service)
|
260
|
+
end
|
261
|
+
# delete any prior mappings that remain
|
262
|
+
old_role_services_arr.each do |role_service|
|
263
|
+
role.services.destroy(role_service.service)
|
237
264
|
end
|
238
265
|
role.save!
|
266
|
+
old_layout_roles_arr = role.layout_roles.to_a
|
239
267
|
r[:layouts].each do |layout, deploy_order|
|
240
|
-
layout_role =
|
268
|
+
layout_role = role.layout_roles.where(:layout_id => layouts[layout].id).first_or_initialize
|
241
269
|
layout_role.deploy_order = deploy_order
|
242
270
|
layout_role.save!
|
271
|
+
old_layout_roles_arr.delete(layout_role)
|
272
|
+
end
|
273
|
+
# delete any prior mappings that remain
|
274
|
+
old_layout_roles_arr.each do |layout_role|
|
275
|
+
role.layouts.destroy(layout_role.layout)
|
243
276
|
end
|
244
277
|
end
|
data/lib/staypuft/engine.rb
CHANGED
@@ -25,6 +25,7 @@ module Staypuft
|
|
25
25
|
::Host::Managed.send :include, Staypuft::Concerns::HostOrchestrationBuildHook
|
26
26
|
::Puppetclass.send :include, Staypuft::Concerns::PuppetclassExtensions
|
27
27
|
::Hostgroup.send :include, Staypuft::Concerns::HostgroupExtensions
|
28
|
+
::Environment.send :include, Staypuft::Concerns::EnvironmentExtensions
|
28
29
|
end
|
29
30
|
|
30
31
|
rake_tasks do
|
data/lib/staypuft/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: staypuft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: foreman-tasks
|
@@ -64,17 +64,17 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 1.3.0.rc1
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 1.3.0.rc1
|
78
78
|
description: OpenStack Foreman Installer
|
79
79
|
email:
|
80
80
|
- foreman-dev+staypuft@googlegroups.com
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- app/lib/actions/staypuft/middleware/as_current_user.rb
|
104
104
|
- app/lib/staypuft/exception.rb
|
105
105
|
- app/models/setting/staypuft_provisioning.rb
|
106
|
+
- app/models/staypuft/concerns/environment_extensions.rb
|
106
107
|
- app/models/staypuft/concerns/host_orchestration_build_hook.rb
|
107
108
|
- app/models/staypuft/concerns/hostgroup_extensions.rb
|
108
109
|
- app/models/staypuft/concerns/puppetclass_extensions.rb
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- app/views/staypuft/deployment_steps/services_selection.html.erb
|
122
123
|
- app/views/staypuft/deployments/index.html.erb
|
123
124
|
- app/views/staypuft/deployments/show.html.erb
|
125
|
+
- app/views/staypuft/deployments/summary.html.erb
|
124
126
|
- app/views/staypuft/layouts/staypuft.html.erb
|
125
127
|
- config/routes.rb
|
126
128
|
- config/staypuft.local.rb
|