staypuft 0.0.12 → 0.0.13

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.
@@ -17,26 +17,24 @@ module Staypuft
17
17
  end
18
18
 
19
19
  def update
20
- # TODO(jtomasek):
21
- # in model we need to conditionally validate based on the step eg:
22
- # validates_presence_of :some_attribute, :if => :on_deployment_settings_step?
23
- # see wicked wiki for more info
24
-
25
20
  case step
26
21
  when :deployment_settings
27
22
  @layouts = ordered_layouts
28
23
 
29
24
  Deployment.transaction do
25
+ @deployment.form_step = Deployment::STEP_SETTINGS unless @deployment.form_complete?
30
26
  @deployment.update_attributes(params[:staypuft_deployment])
31
27
  @deployment.update_hostgroup_list
32
28
  @deployment.set_networking_params
33
29
  end
30
+ when :services_selection
31
+ @deployment.form_step = Deployment::STEP_SELECTION unless @deployment.form_complete?
34
32
  when :services_configuration
35
33
  # Collect services across all deployment's roles
36
34
  @services = @deployment.services.order(:name)
37
35
  if params[:staypuft_deployment]
36
+ @deployment.form_step = Deployment::STEP_CONFIGURATION unless @deployment.form_complete?
38
37
  param_data = params[:staypuft_deployment][:hostgroup_params]
39
- diffs = []
40
38
  param_data.each do |hostgroup_id, hostgroup_params|
41
39
  hostgroup = Hostgroup.find(hostgroup_id)
42
40
  hostgroup_params[:puppetclass_params].each do |puppetclass_id, puppetclass_params|
@@ -25,6 +25,7 @@ module Actions
25
25
  host = ::Host.find(input[:host_id])
26
26
  # return back to hostgroup's environment
27
27
  host.environment = nil
28
+ host.set_token
28
29
  host.save!
29
30
  host.send :setTFTP
30
31
  restart(host)
@@ -1,10 +1,18 @@
1
1
  module Staypuft
2
2
  class Deployment < ActiveRecord::Base
3
3
 
4
+ # Form step states
5
+ STEP_INACTIVE = :inactive
6
+ STEP_SETTINGS = :settings
7
+ STEP_CONFIGURATION = :configuration
8
+ STEP_COMPLETE = :complete
9
+ STEP_SELECTION = :selection
10
+
4
11
  NEW_NAME_PREFIX="uninitialized_"
5
12
 
6
13
  attr_accessible :description, :name, :layout_id, :layout
7
14
  after_save :update_hostgroup_name
15
+ after_validation :check_form_complete
8
16
 
9
17
  belongs_to :layout
10
18
  belongs_to :hostgroup, :dependent => :destroy
@@ -30,6 +38,13 @@ module Staypuft
30
38
  validates :layout, :presence => true
31
39
  validates :hostgroup, :presence => true
32
40
 
41
+ # TODO(mtaylor)
42
+ # Use conditional validations to validate the deployment multi-step form.
43
+ # deployment.form_step should be used to check the form step the user is
44
+ # currently on.
45
+ # e.g.
46
+ # validates :name, :presence => true, :if => :form_step_is_configuation?
47
+
33
48
  scoped_search :on => :name, :complete_value => :true
34
49
 
35
50
  def self.available_locks
@@ -93,12 +108,20 @@ module Staypuft
93
108
  self.hosts.any?(&:open_stack_deployed?)
94
109
  end
95
110
 
111
+ def form_complete?
112
+ self.form_step.to_sym == Deployment::STEP_COMPLETE
113
+ end
114
+
96
115
  private
97
116
  def update_hostgroup_name
98
117
  hostgroup.name = self.name
99
118
  hostgroup.save!
100
119
  end
101
120
 
102
-
121
+ # Checks to see if the form step was the last in the series. If so it sets
122
+ # the form_step field to complete.
123
+ def check_form_complete
124
+ self.form_step = Deployment::STEP_COMPLETE if self.form_step.to_sym == Deployment::STEP_CONFIGURATION
125
+ end
103
126
  end
104
127
  end
@@ -0,0 +1,186 @@
1
+ # for each service, a list of param names. Optionally, instead of a string
2
+ # for a param name, an array of [param_name, puppetclass] in the case where
3
+ # there are possibly multiple puppetclass matches. without this, we'll
4
+ # just grab the first puppetclass from the matching hostgroup
5
+
6
+ Staypuft::Service::UI_PARAMS = {
7
+ 'qpid (non-HA)' => ['qpid_ca',
8
+ 'qpid_cert',
9
+ 'qpid_host',
10
+ 'qpid_key',
11
+ 'qpid_nssdb_password'],
12
+ 'MySQL' => ['mysql_ca',
13
+ 'mysql_cert',
14
+ 'mysql_host',
15
+ 'mysql_key',
16
+ 'mysql_root_password'],
17
+ 'Keystone (non-HA)' => ['keystone_admin_token',
18
+ 'keystone_db_password'],
19
+ 'Nova (Controller)' => ['admin_email',
20
+ 'admin_password',
21
+ 'auto_assign_floating_ip',
22
+ 'controller_admin_host',
23
+ 'controller_priv_host',
24
+ 'controller_pub_host',
25
+ 'freeipa',
26
+ 'horizon_ca',
27
+ 'horizon_cert',
28
+ 'horizon_key',
29
+ 'horizon_secret_key',
30
+ 'nova_db_password',
31
+ 'nova_user_password',
32
+ 'ssl',
33
+ 'swift_admin_password',
34
+ 'swift_ringserver_ip',
35
+ 'swift_shared_secret',
36
+ 'swift_storage_device',
37
+ 'swift_storage_ips'],
38
+ 'Neutron (Controller)' => ['admin_email',
39
+ 'admin_password',
40
+ 'cisco_nexus_plugin',
41
+ 'cisco_vswitch_plugin',
42
+ 'controller_admin_host',
43
+ 'controller_priv_host',
44
+ 'controller_pub_host',
45
+ 'enable_tunneling',
46
+ 'freeipa',
47
+ 'horizon_ca',
48
+ 'horizon_cert',
49
+ 'horizon_key',
50
+ 'horizon_secret_key',
51
+ 'ml2_flat_networks',
52
+ 'ml2_install_deps',
53
+ 'ml2_mechanism_drivers',
54
+ 'ml2_network_vlan_ranges',
55
+ 'ml2_tenant_network_types',
56
+ 'ml2_tunnel_id_ranges',
57
+ 'ml2_type_drivers',
58
+ 'ml2_vni_ranges',
59
+ 'ml2_vxlan_group',
60
+ 'neutron_core_plugin',
61
+ 'neutron_db_password',
62
+ 'neutron_metadata_proxy_secret',
63
+ 'neutron_user_password',
64
+ 'nexus_config',
65
+ 'nexus_credentials',
66
+ 'nova_db_password',
67
+ 'nova_user_password',
68
+ 'ovs_vlan_ranges',
69
+ 'provider_vlan_auto_create',
70
+ 'provider_vlan_auto_trunk',
71
+ 'ssl',
72
+ 'tenant_network_type',
73
+ 'tunnel_id_ranges',
74
+ 'verbose',
75
+ 'swift_admin_password',
76
+ 'swift_ringserver_ip',
77
+ 'swift_shared_secret',
78
+ 'swift_storage_device',
79
+ 'swift_storage_ips'],
80
+ 'Glance (non-HA)' => ['glance_db_password',
81
+ 'glance_user_password'],
82
+ 'Cinder (controller)' => cinder_params = ['cinder_backend_gluster',
83
+ 'cinder_backend_iscsi',
84
+ 'cinder_db_password',
85
+ 'cinder_gluster_servers',
86
+ 'cinder_gluster_volume',
87
+ 'cinder_user_password',
88
+ 'controller_priv_host',
89
+ 'mysql_host',
90
+ 'qpid_host'],
91
+ 'Cinder (node)' => cinder_params,
92
+ 'Heat' => ['heat_cfn',
93
+ 'heat_cloudwatch',
94
+ 'heat_db_password',
95
+ 'heat_user_password',
96
+ 'heat_auth_encrypt_key'],
97
+ 'Ceilometer' => ['ceilometer',
98
+ 'ceilometer_host',
99
+ 'ceilometer_metering_secret',
100
+ 'ceilometer_user_password'
101
+ ],
102
+ 'Neutron - L3' => ['controller_priv_host',
103
+ 'enable_tunneling',
104
+ 'external_network_bridge',
105
+ 'fixed_network_range',
106
+ 'mysql_ca',
107
+ 'mysql_host',
108
+ 'neutron_db_password',
109
+ 'neutron_metadata_proxy_secret',
110
+ 'neutron_user_password',
111
+ 'nova_db_password',
112
+ 'nova_user_password',
113
+ 'qpid_host',
114
+ 'ssl',
115
+ 'tenant_network_type',
116
+ 'tunnel_id_ranges',
117
+ 'verbose'],
118
+ 'DHCP' => [],
119
+ 'OVS' => ['ovs_bridge_mappings',
120
+ 'ovs_bridge_uplinks',
121
+ 'ovs_tunnel_iface',
122
+ 'ovs_tunnel_network',
123
+ 'ovs_tunnel_types',
124
+ 'ovs_vlan_ranges',
125
+ 'ovs_vxlan_udp_port'],
126
+ 'Nova-compute' => ['admin_password',
127
+ 'auto_assign_floating_ip',
128
+ 'ceilometer',
129
+ 'ceilometer_host',
130
+ 'ceilometer_metering_secret',
131
+ 'ceilometer_user_password',
132
+ 'cinder_backend_gluster',
133
+ 'controller_priv_host',
134
+ 'controller_pub_host',
135
+ 'fixed_network_range',
136
+ 'floating_network_range',
137
+ 'mysql_ca',
138
+ 'mysql_host',
139
+ 'nova_db_password',
140
+ 'network_private_iface',
141
+ 'network_private_network',
142
+ 'network_public_iface',
143
+ 'network_public_network',
144
+ 'nova_user_password',
145
+ 'qpid_host',
146
+ 'ssl',
147
+ 'verbose',
148
+ 'use_qemu_for_poc'],
149
+ 'Neutron-compute' => ['admin_password',
150
+ 'ceilometer',
151
+ 'ceilometer_host',
152
+ 'ceilometer_metering_secret',
153
+ 'ceilometer_user_password',
154
+ 'cinder_backend_gluster',
155
+ 'controller_admin_host',
156
+ 'controller_priv_host',
157
+ 'controller_pub_host',
158
+ 'enable_tunneling',
159
+ 'mysql_ca',
160
+ 'mysql_host',
161
+ 'neutron_core_plugin',
162
+ 'neutron_db_password',
163
+ 'neutron_user_password',
164
+ 'nova_db_password',
165
+ 'nova_user_password',
166
+ 'ovs_bridge_mappings',
167
+ 'ovs_tunnel_iface',
168
+ 'ovs_tunnel_network',
169
+ 'ovs_tunnel_types',
170
+ 'ovs_vlan_ranges',
171
+ 'ovs_vxlan_udp_port',
172
+ 'qpid_host',
173
+ 'ssl',
174
+ 'tenant_network_type',
175
+ 'tunnel_id_ranges',
176
+ 'verbose',
177
+ 'use_qemu_for_poc'],
178
+ 'Neutron-ovs-agent' => [],
179
+ 'Swift (node)' => ['swift_all_ips',
180
+ 'swift_ext4_device',
181
+ 'swift_local_interface',
182
+ 'swift_local_network',
183
+ 'swift_loopback',
184
+ 'swift_ring_server',
185
+ 'swift_shared_secret'] }
186
+
@@ -9,119 +9,31 @@ module Staypuft
9
9
 
10
10
  attr_accessible :description, :name
11
11
 
12
- validates :name, :presence => true, :uniqueness => true
13
-
14
- # for each service, a list of param names. Optionally, instead of a string
15
- # for a param name, an array of [param_name, puppetclass] in the case where
16
- # there are possibly multiple puppetclass matches. without this, we'll
17
- # just grab the first puppetclass from the matching hostgroup
18
- UI_PARAMS = {
19
- "qpid (non-HA)"=> ["qpid_ca", "qpid_cert", "qpid_host", "qpid_key", "qpid_nssdb_password"],
20
- "MySQL"=> ["mysql_ca", "mysql_cert", "mysql_host", "mysql_key",
21
- "mysql_root_password"],
22
- "Keystone (non-HA)"=> ["keystone_admin_token", "keystone_db_password"],
23
- "Nova (Controller)"=> ["admin_email", "admin_password", "auto_assign_floating_ip",
24
- "controller_admin_host", "controller_priv_host",
25
- "controller_pub_host", "freeipa", "horizon_ca",
26
- "horizon_cert", "horizon_key", "horizon_secret_key",
27
- "nova_db_password", "nova_user_password", "ssl",
28
- "swift_admin_password", "swift_ringserver_ip",
29
- "swift_shared_secret", "swift_storage_device",
30
- "swift_storage_ips"],
31
- "Neutron (Controller)" => ["admin_email", "admin_password",
32
- "cisco_nexus_plugin", "cisco_vswitch_plugin",
33
- "controller_admin_host", "controller_priv_host",
34
- "controller_pub_host", "enable_tunneling",
35
- "freeipa", "horizon_ca", "horizon_cert",
36
- "horizon_key", "horizon_secret_key",
37
- "ml2_flat_networks", "ml2_install_deps",
38
- "ml2_mechanism_drivers", "ml2_network_vlan_ranges",
39
- "ml2_tenant_network_types", "ml2_tunnel_id_ranges",
40
- "ml2_type_drivers", "ml2_vni_ranges",
41
- "ml2_vxlan_group", "neutron_core_plugin",
42
- "neutron_db_password", "neutron_metadata_proxy_secret",
43
- "neutron_user_password", "nexus_config",
44
- "nexus_credentials", "nova_db_password",
45
- "nova_user_password", "ovs_vlan_ranges",
46
- "provider_vlan_auto_create", "provider_vlan_auto_trunk",
47
- "ssl", "tenant_network_type", "tunnel_id_ranges",
48
- "verbose",
49
- "swift_admin_password", "swift_ringserver_ip",
50
- "swift_shared_secret", "swift_storage_device",
51
- "swift_storage_ips"],
52
- "Glance (non-HA)"=> ["glance_db_password", "glance_user_password"],
53
- "Cinder"=> ["cinder_backend_gluster", "cinder_backend_iscsi",
54
- "cinder_db_password", "cinder_gluster_servers",
55
- "cinder_gluster_volume", "cinder_user_password"],
56
- "Heat"=> ["heat_cfn", "heat_cloudwatch", "heat_db_password", "heat_user_password", "heat_auth_encrypt_key"],
57
- "Ceilometer"=> ["ceilometer", "ceilometer_host",
58
- "ceilometer_metering_secret", "ceilometer_user_password"
59
- ],
60
- "Neutron - L3" => ["controller_priv_host", "enable_tunneling",
61
- "external_network_bridge", "fixed_network_range",
62
- "mysql_ca", "mysql_host", "neutron_db_password",
63
- "neutron_metadata_proxy_secret", "neutron_user_password",
64
- "nova_db_password", "nova_user_password",
65
- "qpid_host", "ssl",
66
- "tenant_network_type", "tunnel_id_ranges", "verbose"],
67
- "DHCP" => [],
68
- "OVS" => ["ovs_bridge_mappings", "ovs_bridge_uplinks",
69
- "ovs_tunnel_iface", "ovs_tunnel_network", "ovs_tunnel_types",
70
- "ovs_vlan_ranges", "ovs_vxlan_udp_port" ],
71
- "Nova-compute" => ["admin_password", "auto_assign_floating_ip",
72
- "ceilometer", "ceilometer_host",
73
- "ceilometer_metering_secret", "ceilometer_user_password",
74
- "cinder_backend_gluster", "controller_priv_host",
75
- "controller_pub_host", "fixed_network_range",
76
- "floating_network_range", "mysql_ca", "mysql_host",
77
- "nova_db_password", "network_private_iface",
78
- "network_private_network",
79
- "network_public_iface",
80
- "network_public_network", "nova_user_password",
81
- "qpid_host", "ssl", "verbose", "use_qemu_for_poc"],
82
- "Neutron-compute" => ["admin_password", "ceilometer", "ceilometer_host",
83
- "ceilometer_metering_secret",
84
- "ceilometer_user_password", "cinder_backend_gluster",
85
- "controller_admin_host", "controller_priv_host",
86
- "controller_pub_host", "enable_tunneling", "mysql_ca",
87
- "mysql_host", "neutron_core_plugin",
88
- "neutron_db_password", "neutron_user_password",
89
- "nova_db_password", "nova_user_password",
90
- "ovs_bridge_mappings", "ovs_tunnel_iface",
91
- "ovs_tunnel_network", "ovs_tunnel_types", "ovs_vlan_ranges",
92
- "ovs_vxlan_udp_port", "qpid_host", "ssl",
93
- "tenant_network_type", "tunnel_id_ranges", "verbose",
94
- "use_qemu_for_poc"],
95
- "Neutron-ovs-agent"=> [],
96
- "Swift (node)" => ["swift_all_ips", "swift_ext4_device", "swift_local_interface",
97
- "swift_local_network","swift_loopback", "swift_ring_server",
98
- "swift_shared_secret"]
99
-
100
- }
12
+ validates :name, :presence => true, :uniqueness => true
101
13
 
102
14
  def ui_params_for_form(hostgroup = self.hostgroups.first)
103
15
  return [] if (hostgroup.nil?)
104
16
  if hostgroup.puppetclasses.blank?
105
17
  params_from_hash = []
106
18
  else
107
- puppetclass = hostgroup.puppetclasses.first
108
- params_from_hash = UI_PARAMS.fetch(self.name,[]).collect do |param_key|
19
+ puppetclass = hostgroup.puppetclasses.first
20
+ params_from_hash = UI_PARAMS.fetch(self.name, []).collect do |param_key|
109
21
  if param_key.is_a?(Array)
110
- param_name = param_key[0]
22
+ param_name = param_key[0]
111
23
  param_puppetclass = Puppetclass.find_by_name(param_key[1])
112
24
  else
113
- param_name = param_key
25
+ param_name = param_key
114
26
  param_puppetclass = puppetclass
115
27
  end
116
- param_lookup_key = param_puppetclass.class_params.where(:key=>param_key).first
117
- param_lookup_key.nil? ? nil : {:hostgroup => hostgroup,
118
- :puppetclass => param_puppetclass,
119
- :param_key => param_lookup_key}
28
+ param_lookup_key = param_puppetclass.class_params.where(:key => param_key).first
29
+ param_lookup_key.nil? ? nil : { :hostgroup => hostgroup,
30
+ :puppetclass => param_puppetclass,
31
+ :param_key => param_lookup_key }
120
32
  end.compact
121
33
  end
122
34
  params_from_service = self.puppetclasses.collect do |pclass|
123
35
  pclass.class_params.collect do |class_param|
124
- {:hostgroup => hostgroup, :puppetclass => pclass, :param_key => class_param}
36
+ { :hostgroup => hostgroup, :puppetclass => pclass, :param_key => class_param }
125
37
  end
126
38
  end.flatten
127
39
  params_from_hash + params_from_service
@@ -23,15 +23,21 @@
23
23
  <h3><%= "#{service.name} " + _("Service Configuration") %></h3>
24
24
  <% if (params_hash = service.ui_params_for_form).size > 0 %>
25
25
  <% params_hash.each do |param_hash| %>
26
- <div class="row">
27
- <div class="col-md-4 control-label">
28
- <%= label_tag param_hash[:param_key].key %>
26
+ <div class="row">
27
+ <div class="col-md-4 control-label">
28
+ <%= label_tag param_hash[:param_key].key %>
29
+ </div>
30
+ <div class="col-md-5">
31
+ <%= text_field_tag format("staypuft_deployment[hostgroup_params][%s][puppetclass_params][%s][%s]",
32
+ param_hash[:hostgroup].id,
33
+ param_hash[:puppetclass].id,
34
+ param_hash[:param_key].key),
35
+ param_hash[:hostgroup].current_param_value_str(param_hash[:param_key]),
36
+ :class => "form-control",
37
+ :size => "45" %>
38
+ </div>
29
39
  </div>
30
- <div class="col-md-5">
31
- <%= text_field_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=>"form-control", :size=>"45"%>
32
- </div>
33
- </div>
34
- <br/>
40
+ <br/>
35
41
  <% end %>
36
42
  <% else %>
37
43
  <p><%= _("No configuration needed for this service.") %></p>
@@ -76,7 +76,7 @@
76
76
  <% if child_hostgroup.own_and_free_hosts.present? %>
77
77
  <%= form_tag(associate_host_deployments_path, class: 'form-horizontal well association') do |f| %>
78
78
  <p>
79
- <%= submit_tag _("Assign"), :class => "btn btn-primary btn-sm" %>
79
+ <%= submit_tag _("Assign / Unassign"), :class => "btn btn-primary btn-sm" %>
80
80
  </p>
81
81
  <%= hidden_field_tag :hostgroup_id, child_hostgroup.id %>
82
82
  <table class="table table-bordered table-striped table-condensed">
@@ -146,7 +146,11 @@
146
146
  </div>
147
147
  <div class="modal-footer">
148
148
  <button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button>
149
- <%= display_link_if_authorized(_("Deploy"), hash_for_deploy_deployment_path, :class => 'btn btn-primary') %>
149
+ <%= display_link_if_authorized(_("Deploy"),
150
+ hash_for_deploy_deployment_path,
151
+ :class => 'btn btn-primary',
152
+ :method => :post,
153
+ :data => { :disable_with => _("Deploying...")}) %>
150
154
  </div>
151
155
  </div>
152
156
  </div>
data/config/routes.rb CHANGED
@@ -6,7 +6,7 @@ Rails.application.routes.draw do
6
6
  post 'associate_host'
7
7
  end
8
8
  member do
9
- get 'deploy'
9
+ post 'deploy'
10
10
  get 'populate'
11
11
  get 'summary'
12
12
  end
@@ -0,0 +1,5 @@
1
+ class AddFormStepToStaypuftDeployment < ActiveRecord::Migration
2
+ def change
3
+ add_column :staypuft_deployments, :form_step, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeColumnDefaultFormStepOnStaypuftDeployment < ActiveRecord::Migration
2
+ def up
3
+ change_column :staypuft_deployments, :form_step, :string, :default => 'inactive', :null => false
4
+ end
5
+ end
data/db/seeds.rb CHANGED
@@ -9,113 +9,113 @@ require 'securerandom'
9
9
  # yet in place. In addition, I don't know if we want to break these down by
10
10
  # Role, or leave them in one big list (internally they get set per puppetclass)
11
11
  params = {
12
- "verbose" => "true",
13
- "heat_cfn" => "false",
14
- "heat_cloudwatch" => "false",
15
- "admin_password" => SecureRandom.hex,
16
- "ceilometer" => "true",
17
- "ceilometer_host" => "false",
18
- "ceilometer_metering_secret" => SecureRandom.hex,
19
- "ceilometer_user_password" => SecureRandom.hex,
20
- "cinder_db_password" => SecureRandom.hex,
21
- "cinder_user_password" => SecureRandom.hex,
22
- "cinder_backend_gluster" => "false",
23
- "cinder_backend_iscsi" => "false",
24
- "cinder_gluster_peers" => [],
25
- "cinder_gluster_volume" => "cinder",
26
- "cinder_gluster_replica_count" => '3',
27
- "cinder_gluster_servers" => [ '192.168.0.4', '192.168.0.5', '192.168.0.6' ],
28
- "glance_db_password" => SecureRandom.hex,
29
- "glance_user_password" => SecureRandom.hex,
30
- "glance_gluster_peers" => [],
31
- "glance_gluster_volume" => "glance",
32
- "glance_gluster_replica_count" => '3',
33
- "gluster_open_port_count" => '10',
34
- "heat_db_password" => SecureRandom.hex,
35
- "heat_user_password" => SecureRandom.hex,
36
- "heat_cfn_user_password" => SecureRandom.hex,
37
- "heat_auth_encrypt_key" => SecureRandom.hex,
38
- "horizon_secret_key" => SecureRandom.hex,
39
- "keystone_admin_token" => SecureRandom.hex,
40
- "keystone_db_password" => SecureRandom.hex,
41
- "keystone_user_password" => SecureRandom.hex,
42
- "mysql_root_password" => SecureRandom.hex,
43
- "neutron_db_password" => SecureRandom.hex,
44
- "neutron_user_password" => SecureRandom.hex,
45
- "nova_db_password" => SecureRandom.hex,
46
- "nova_user_password" => SecureRandom.hex,
47
- "nova_default_floating_pool" => "nova",
48
- "swift_admin_password" => SecureRandom.hex,
49
- "swift_shared_secret" => SecureRandom.hex,
50
- "swift_user_password" => SecureRandom.hex,
51
- "swift_all_ips" => ['192.168.203.1', '192.168.203.2', '192.168.203.3', '192.168.203.4'],
52
- "swift_ext4_device" => '/dev/sdc2',
53
- "swift_local_interface" => 'eth3',
54
- "swift_loopback" => true,
55
- "swift_ring_server" => '192.168.203.1',
56
- "fixed_network_range" => '10.0.0.0/24',
57
- "floating_network_range" => '10.0.1.0/24',
58
- "controller_admin_host" => '172.16.0.1',
59
- "controller_priv_host" => '172.16.0.1',
60
- "controller_pub_host" => '172.16.1.1',
61
- "mysql_host" => '172.16.0.1',
62
- "mysql_virtual_ip" => '192.168.200.220',
63
- "mysql_bind_address" => '0.0.0.0',
64
- "mysql_virt_ip_nic" => 'eth1',
65
- "mysql_virt_ip_cidr_mask" => '24',
66
- "mysql_shared_storage_device" => '192.168.203.200:/mnt/mysql',
67
- "mysql_shared_storage_type" => 'nfs',
68
- "mysql_resource_group_name" => 'mysqlgrp',
69
- "mysql_clu_member_addrs" => '192.168.203.11 192.168.203.12 192.168.203.13',
70
- "qpid_host" => '172.16.0.1',
71
- "qpid_username" => 'openstack',
72
- "qpid_password" => SecureRandom.hex,
73
- "admin_email" => "admin@#{Facter.value(:domain)}",
74
- "neutron_metadata_proxy_secret" => SecureRandom.hex,
75
- "enable_ovs_agent" => "true",
76
- "ovs_vlan_ranges" => '',
77
- "ovs_bridge_mappings" => [],
78
- "ovs_bridge_uplinks" => [],
79
- "ovs_tunnel_iface" => 'eth0',
80
- "tenant_network_type" => 'gre',
81
- "enable_tunneling" => 'True',
82
- "ovs_vxlan_udp_port" => '4789',
83
- "ovs_tunnel_types" => [],
84
- "auto_assign_floating_ip" => 'True',
85
- "neutron_core_plugin" => 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
86
- "cisco_vswitch_plugin" => 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
87
- "cisco_nexus_plugin" => 'neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin',
88
- "nexus_config" => {},
89
- "nexus_credentials" => [],
90
- "provider_vlan_auto_create" => "false",
91
- "provider_vlan_auto_trunk" => "false",
92
- "backend_server_names" => [],
93
- "backend_server_addrs" => [],
94
- "lb_backend_server_names" => [],
95
- "lb_backend_server_addrs" => [],
96
- "configure_ovswitch" => "true",
97
- "neutron" => "false",
98
- "ssl" => "false",
99
- "freeipa" => "false",
100
- "mysql_ca" => "/etc/ipa/ca.crt",
101
- "mysql_cert" => "/etc/pki/tls/certs/PRIV_HOST-mysql.crt",
102
- "mysql_key" => "/etc/pki/tls/private/PRIV_HOST-mysql.key",
103
- "qpid_ca" => "/etc/ipa/ca.crt",
104
- "qpid_cert" => "/etc/pki/tls/certs/PRIV_HOST-qpid.crt",
105
- "qpid_key" => "/etc/pki/tls/private/PRIV_HOST-qpid.key",
106
- "horizon_ca" => "/etc/ipa/ca.crt",
107
- "horizon_cert" => "/etc/pki/tls/certs/PUB_HOST-horizon.crt",
108
- "horizon_key" => "/etc/pki/tls/private/PUB_HOST-horizon.key",
109
- "qpid_nssdb_password" => SecureRandom.hex,
110
- "fence_xvm_key_file_password" => SecureRandom.hex,
111
- "use_qemu_for_poc" => "false",
12
+ 'verbose' => 'true',
13
+ 'heat_cfn' => 'false',
14
+ 'heat_cloudwatch' => 'false',
15
+ 'admin_password' => SecureRandom.hex,
16
+ 'ceilometer' => 'true',
17
+ 'ceilometer_host' => 'false',
18
+ 'ceilometer_metering_secret' => SecureRandom.hex,
19
+ 'ceilometer_user_password' => SecureRandom.hex,
20
+ 'cinder_db_password' => SecureRandom.hex,
21
+ 'cinder_user_password' => SecureRandom.hex,
22
+ 'cinder_backend_gluster' => 'false',
23
+ 'cinder_backend_iscsi' => 'false',
24
+ 'cinder_gluster_peers' => [],
25
+ 'cinder_gluster_volume' => 'cinder',
26
+ 'cinder_gluster_replica_count' => '3',
27
+ 'cinder_gluster_servers' => %w(192.168.0.4 192.168.0.5 192.168.0.6),
28
+ 'glance_db_password' => SecureRandom.hex,
29
+ 'glance_user_password' => SecureRandom.hex,
30
+ 'glance_gluster_peers' => [],
31
+ 'glance_gluster_volume' => 'glance',
32
+ 'glance_gluster_replica_count' => '3',
33
+ 'gluster_open_port_count' => '10',
34
+ 'heat_db_password' => SecureRandom.hex,
35
+ 'heat_user_password' => SecureRandom.hex,
36
+ 'heat_cfn_user_password' => SecureRandom.hex,
37
+ 'heat_auth_encrypt_key' => SecureRandom.hex,
38
+ 'horizon_secret_key' => SecureRandom.hex,
39
+ 'keystone_admin_token' => SecureRandom.hex,
40
+ 'keystone_db_password' => SecureRandom.hex,
41
+ 'keystone_user_password' => SecureRandom.hex,
42
+ 'mysql_root_password' => SecureRandom.hex,
43
+ 'neutron_db_password' => SecureRandom.hex,
44
+ 'neutron_user_password' => SecureRandom.hex,
45
+ 'nova_db_password' => SecureRandom.hex,
46
+ 'nova_user_password' => SecureRandom.hex,
47
+ 'nova_default_floating_pool' => 'nova',
48
+ 'swift_admin_password' => SecureRandom.hex,
49
+ 'swift_shared_secret' => SecureRandom.hex,
50
+ 'swift_user_password' => SecureRandom.hex,
51
+ 'swift_all_ips' => %w(192.168.203.1 192.168.203.2 192.168.203.3 192.168.203.4),
52
+ 'swift_ext4_device' => '/dev/sdc2',
53
+ 'swift_local_interface' => 'eth3',
54
+ 'swift_loopback' => true,
55
+ 'swift_ring_server' => '192.168.203.1',
56
+ 'fixed_network_range' => '10.0.0.0/24',
57
+ 'floating_network_range' => '10.0.1.0/24',
58
+ 'controller_admin_host' => '172.16.0.1',
59
+ 'controller_priv_host' => '172.16.0.1',
60
+ 'controller_pub_host' => '172.16.1.1',
61
+ 'mysql_host' => '172.16.0.1',
62
+ 'mysql_virtual_ip' => '192.168.200.220',
63
+ 'mysql_bind_address' => '0.0.0.0',
64
+ 'mysql_virt_ip_nic' => 'eth1',
65
+ 'mysql_virt_ip_cidr_mask' => '24',
66
+ 'mysql_shared_storage_device' => '192.168.203.200:/mnt/mysql',
67
+ 'mysql_shared_storage_type' => 'nfs',
68
+ 'mysql_resource_group_name' => 'mysqlgrp',
69
+ 'mysql_clu_member_addrs' => '192.168.203.11 192.168.203.12 192.168.203.13',
70
+ 'qpid_host' => '172.16.0.1',
71
+ 'qpid_username' => 'openstack',
72
+ 'qpid_password' => SecureRandom.hex,
73
+ 'admin_email' => "admin@#{Facter.value(:domain)}",
74
+ 'neutron_metadata_proxy_secret' => SecureRandom.hex,
75
+ 'enable_ovs_agent' => 'true',
76
+ 'ovs_vlan_ranges' => '',
77
+ 'ovs_bridge_mappings' => [],
78
+ 'ovs_bridge_uplinks' => [],
79
+ 'ovs_tunnel_iface' => 'eth0',
80
+ 'tenant_network_type' => 'gre',
81
+ 'enable_tunneling' => 'True',
82
+ 'ovs_vxlan_udp_port' => '4789',
83
+ 'ovs_tunnel_types' => [],
84
+ 'auto_assign_floating_ip' => 'True',
85
+ 'neutron_core_plugin' => 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
86
+ 'cisco_vswitch_plugin' => 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
87
+ 'cisco_nexus_plugin' => 'neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin',
88
+ 'nexus_config' => {},
89
+ 'nexus_credentials' => [],
90
+ 'provider_vlan_auto_create' => 'false',
91
+ 'provider_vlan_auto_trunk' => 'false',
92
+ 'backend_server_names' => [],
93
+ 'backend_server_addrs' => [],
94
+ 'lb_backend_server_names' => [],
95
+ 'lb_backend_server_addrs' => [],
96
+ 'configure_ovswitch' => 'true',
97
+ 'neutron' => 'false',
98
+ 'ssl' => 'false',
99
+ 'freeipa' => 'false',
100
+ 'mysql_ca' => '/etc/ipa/ca.crt',
101
+ 'mysql_cert' => '/etc/pki/tls/certs/PRIV_HOST-mysql.crt',
102
+ 'mysql_key' => '/etc/pki/tls/private/PRIV_HOST-mysql.key',
103
+ 'qpid_ca' => '/etc/ipa/ca.crt',
104
+ 'qpid_cert' => '/etc/pki/tls/certs/PRIV_HOST-qpid.crt',
105
+ 'qpid_key' => '/etc/pki/tls/private/PRIV_HOST-qpid.key',
106
+ 'horizon_ca' => '/etc/ipa/ca.crt',
107
+ 'horizon_cert' => '/etc/pki/tls/certs/PUB_HOST-horizon.crt',
108
+ 'horizon_key' => '/etc/pki/tls/private/PUB_HOST-horizon.key',
109
+ 'qpid_nssdb_password' => SecureRandom.hex,
110
+ 'fence_xvm_key_file_password' => SecureRandom.hex,
111
+ 'use_qemu_for_poc' => 'false',
112
112
  }
113
113
 
114
- def get_key_type(value)
115
- key_list = LookupKey::KEY_TYPES
114
+ get_key_type = lambda do |value|
115
+ key_list = LookupKey::KEY_TYPES
116
116
  value_type = value.class.to_s.downcase
117
117
  if key_list.include?(value_type)
118
- value_type
118
+ value_type
119
119
  elsif [FalseClass, TrueClass].include? value.class
120
120
  'boolean'
121
121
  end
@@ -124,75 +124,80 @@ end
124
124
 
125
125
 
126
126
  # key (:ha, etc) is only used internally for referencing from roles
127
- layouts = {
128
- :ha_nova => Staypuft::Layout.where(:name => "Distributed with High Availability",
129
- :networking => "nova").first_or_create!,
130
- :non_ha_nova => Staypuft::Layout.where(:name => "Distributed",
131
- :networking => "nova").first_or_create!,
132
- :ha_neutron => Staypuft::Layout.where(:name => "Distributed with High Availability",
133
- :networking => "neutron").first_or_create!,
134
- :non_ha_neutron => Staypuft::Layout.where(:name => "Distributed",
135
- :networking => "neutron").first_or_create!,
127
+ layouts = {
128
+ :ha_nova => Staypuft::Layout.where(:name => 'Distributed with High Availability',
129
+ :networking => 'nova').first_or_create!,
130
+ :non_ha_nova => Staypuft::Layout.where(:name => 'Distributed',
131
+ :networking => 'nova').first_or_create!,
132
+ :ha_neutron => Staypuft::Layout.where(:name => 'Distributed with High Availability',
133
+ :networking => 'neutron').first_or_create!,
134
+ :non_ha_neutron => Staypuft::Layout.where(:name => 'Distributed',
135
+ :networking => 'neutron').first_or_create!,
136
136
  }
137
137
 
138
138
  # services don't have puppetclasses yet, since they aren't broken out on the back end
139
- services = {
140
- :non_ha_qpid => {:name => "qpid (non-HA)", :class => []},
141
- :mysql => {:name => "MySQL", :class => []},
142
- :non_ha_keystone => {:name => "Keystone (non-HA)", :class => []},
143
- :nova_controller => {:name => "Nova (Controller)", :class => []},
144
- :neutron_controller => {:name => "Neutron (Controller)", :class => []},
145
- :non_ha_glance => {:name => "Glance (non-HA)", :class => []},
146
- :cinder => {:name => "Cinder", :class => []},
147
- :heat => {:name => "Heat", :class => []},
148
- :ceilometer => {:name => "Ceilometer", :class => []},
149
- :neutron_l3 => {:name => "Neutron - L3", :class => []},
150
- :dhcp => {:name => "DHCP", :class => []},
151
- :ovs => {:name => "OVS", :class => []},
152
- :nova_compute => {:name => "Nova-compute", :class => []},
153
- :neutron_compute => {:name => "Neutron-compute", :class => []},
154
- :neutron_ovs_agent => {:name => "Neutron-ovs-agent", :class => []},
155
- :swift => {:name => "Swift (node)", :class => []},
156
- :ha_controller => {:name => "HA (Controller)", :class => ["quickstack::openstack_common",
157
- "quickstack::pacemaker::common",
158
- "quickstack::pacemaker::params"]},
159
- :keystone_ha => {:name => "Keystone (HA)", :class => ["quickstack::pacemaker::keystone"]},
160
- :load_balancer_ha => {:name => "Load Balancer (HA)", :class => ["quickstack::pacemaker::load_balancer"]},
161
- :memcached_ha => {:name => "Memcached (HA)", :class => ["quickstack::pacemaker::memcached"]},
162
- :qpid_ha => {:name => "qpid (HA)", :class => ["quickstack::pacemaker::qpid"]},
163
- :glance_ha => {:name => "Glance (HA)", :class => ["quickstack::pacemaker::glance"]},
164
- :nova_ha => {:name => "Nova (HA)", :class => ["quickstack::pacemaker::nova"]},
165
- :heat_ha => {:name => "Heat (HA)", :class => ["quickstack::pacemaker::heat"]},
166
- :cinder_ha => {:name => "Cinder (HA)", :class => ["quickstack::pacemaker::cinder"]},
167
- :swift_ha => {:name => "Swift (HA)", :class => ["quickstack::pacemaker::swift"]},
168
- :horizon_ha => {:name => "Horizon (HA)", :class => ["quickstack::pacemaker::horizon"]},
169
- :mysql_ha => {:name => "Mysql (HA)", :class => ["quickstack::pacemaker::mysql"]},
170
- :neutron_ha => {:name => "Neutron (HA)", :class => ["quickstack::pacemaker::neutron"]}
139
+ services = {
140
+ :non_ha_qpid => { :name => 'qpid (non-HA)', :class => [] },
141
+ :mysql => { :name => 'MySQL', :class => [] },
142
+ :non_ha_keystone => { :name => 'Keystone (non-HA)', :class => [] },
143
+ :nova_controller => { :name => 'Nova (Controller)', :class => [] },
144
+ :neutron_controller => { :name => 'Neutron (Controller)', :class => [] },
145
+ :non_ha_glance => { :name => 'Glance (non-HA)', :class => [] },
146
+ :cinder_controller => { :name => 'Cinder (controller)', :class => [] },
147
+ :cinder_node => { :name => 'Cinder (node)', :class => [] },
148
+ :heat => { :name => 'Heat', :class => [] },
149
+ :ceilometer => { :name => 'Ceilometer', :class => [] },
150
+ :neutron_l3 => { :name => 'Neutron - L3', :class => [] },
151
+ :dhcp => { :name => 'DHCP', :class => [] },
152
+ :ovs => { :name => 'OVS', :class => [] },
153
+ :nova_compute => { :name => 'Nova-compute', :class => [] },
154
+ :neutron_compute => { :name => 'Neutron-compute', :class => [] },
155
+ :neutron_ovs_agent => { :name => 'Neutron-ovs-agent', :class => [] },
156
+ :swift => { :name => 'Swift (node)', :class => [] },
157
+ :ha_controller => { :name => 'HA (Controller)',
158
+ :class => ['quickstack::openstack_common',
159
+ 'quickstack::pacemaker::common',
160
+ 'quickstack::pacemaker::params'] },
161
+ :keystone_ha => { :name => 'Keystone (HA)',
162
+ :class => ['quickstack::pacemaker::keystone'] },
163
+ :load_balancer_ha => { :name => 'Load Balancer (HA)',
164
+ :class => ['quickstack::pacemaker::load_balancer'] },
165
+ :memcached_ha => { :name => 'Memcached (HA)',
166
+ :class => ['quickstack::pacemaker::memcached'] },
167
+ :qpid_ha => { :name => 'qpid (HA)', :class => ['quickstack::pacemaker::qpid'] },
168
+ :glance_ha => { :name => 'Glance (HA)', :class => ['quickstack::pacemaker::glance'] },
169
+ :nova_ha => { :name => 'Nova (HA)', :class => ['quickstack::pacemaker::nova'] },
170
+ :heat_ha => { :name => 'Heat (HA)', :class => ['quickstack::pacemaker::heat'] },
171
+ :cinder_ha => { :name => 'Cinder (HA)', :class => ['quickstack::pacemaker::cinder'] },
172
+ :swift_ha => { :name => 'Swift (HA)', :class => ['quickstack::pacemaker::swift'] },
173
+ :horizon_ha => { :name => 'Horizon (HA)', :class => ['quickstack::pacemaker::horizon'] },
174
+ :mysql_ha => { :name => 'Mysql (HA)', :class => ['quickstack::pacemaker::mysql'] },
175
+ :neutron_ha => { :name => 'Neutron (HA)', :class => ['quickstack::pacemaker::neutron'] }
171
176
  }
172
- services.each do |skey, svalue|
173
- service = Staypuft::Service.where(:name=>svalue[:name]).first_or_create!
177
+ services.each do |key, service_hash|
178
+ service = Staypuft::Service.where(:name => service_hash[:name]).first_or_create!
174
179
 
175
180
  # set params in puppetclass
176
- pclassnames = svalue[:class].kind_of?(Array) ? svalue[:class] : [ svalue[:class] ]
177
- service.puppetclasses = pclassnames.collect do |pclassname|
178
- pclass = Puppetclass.find_by_name pclassname
181
+ puppet_class_names = service_hash[:class].kind_of?(Array) ? service_hash[:class] : [service_hash[:class]]
182
+ service.puppetclasses = puppet_class_names.collect do |puppet_class_name|
183
+ puppet_class = Puppetclass.find_by_name puppet_class_name
179
184
  # skip if puppet class isn't found (yet)
180
- if pclass
181
- pclass.class_params.each do |p|
185
+ if puppet_class
186
+ puppet_class.class_params.each do |p|
182
187
  if params.include?(p.key)
183
- p.key_type = get_key_type(params[p.key])
188
+ p.key_type = get_key_type.(params[p.key])
184
189
  p.default_value = params[p.key]
185
190
  end
186
191
  p.override = true
187
192
  p.save!
188
193
  end
189
- pclass
194
+ puppet_class
190
195
  end
191
196
  end.compact
192
197
 
193
- service.description = svalue[:description]
198
+ service.description = service_hash[:description]
194
199
  service.save!
195
- svalue[:obj] = service
200
+ service_hash[:obj] = service
196
201
  end
197
202
 
198
203
  # The list of roles is still from astapor
@@ -201,76 +206,85 @@ end
201
206
  # until we get the real list of roles per layout
202
207
  # layout refs below specify layout keys from layouts hash
203
208
  roles = [
204
- {:name=>"Controller (Nova)",
205
- :class=>"quickstack::nova_network::controller",
206
- :layouts=>[[:non_ha_nova, 1]],
207
- :services=>[:non_ha_qpid, :mysql, :non_ha_keystone, :nova_controller, :non_ha_glance, :cinder, :heat, :ceilometer]},
208
- {:name=>"Compute (Nova)",
209
- :class=>"quickstack::nova_network::compute",
210
- :layouts=>[[:ha_nova, 10], [:non_ha_nova, 10]],
211
- :services=>[:nova_compute]},
212
- {:name=>"Controller (Neutron)",
213
- :class=>"quickstack::neutron::controller",
214
- :layouts=>[[:non_ha_neutron, 1]],
215
- :services=>[:non_ha_qpid, :mysql, :non_ha_keystone, :neutron_controller, :non_ha_glance, :cinder, :heat, :ceilometer]},
216
- {:name=>"Compute (Neutron)",
217
- :class=>"quickstack::neutron::compute",
218
- :layouts=>[[:ha_neutron, 10], [:non_ha_neutron, 10]],
219
- :services=>[:neutron_compute, :neutron_ovs_agent]},
220
- {:name=>"Neutron Networker",
221
- :class=>"quickstack::neutron::networker",
222
- :layouts=>[[:non_ha_neutron, 3]],
223
- :services=>[:neutron_l3, :dhcp, :ovs]},
224
- {:name=>"LVM Block Storage",
225
- :class=>"quickstack::storage_backend::lvm_cinder",
226
- :layouts=>[[:ha_nova, 2], [:ha_neutron, 2], [:non_ha_nova, 2], [:non_ha_neutron, 2]],
227
- :services=>[:cinder]},
228
- {:name=>"Swift Storage Node",
229
- :class=>"quickstack::swift::storage",
230
- :layouts=>[[:ha_nova, 5], [:ha_neutron, 5], [:non_ha_nova, 5], [:non_ha_neutron, 5]],
231
- :services=>[:swift]},
232
- {:name=>"HA Controller",
233
- :class=>[],
234
- :layouts=>[[:ha_nova, 1], [:ha_neutron, 1]],
235
- :services=>[:ha_controller, :keystone_ha, :load_balancer_ha, :memcached_ha, :qpid_ha, :glance_ha, :nova_ha, :heat_ha, :cinder_ha, :swift_ha, :horizon_ha, :mysql_ha, :neutron_ha]}
236
- ]
209
+ { :name => 'Controller (Nova)',
210
+ :class => 'quickstack::nova_network::controller',
211
+ :layouts => [[:non_ha_nova, 1]],
212
+ :services => [:non_ha_qpid, :mysql, :non_ha_keystone, :nova_controller, :non_ha_glance,
213
+ :cinder_controller, :heat, :ceilometer] },
214
+ { :name => 'Compute (Nova)',
215
+ :class => 'quickstack::nova_network::compute',
216
+ :layouts => [[:ha_nova, 10], [:non_ha_nova, 10]],
217
+ :services => [:nova_compute] },
218
+ { :name => 'Controller (Neutron)',
219
+ :class => 'quickstack::neutron::controller',
220
+ :layouts => [[:non_ha_neutron, 1]],
221
+ :services => [:non_ha_qpid, :mysql, :non_ha_keystone, :neutron_controller, :non_ha_glance,
222
+ :cinder_controller, :heat, :ceilometer] },
223
+ { :name => 'Compute (Neutron)',
224
+ :class => 'quickstack::neutron::compute',
225
+ :layouts => [[:ha_neutron, 10], [:non_ha_neutron, 10]],
226
+ :services => [:neutron_compute, :neutron_ovs_agent] },
227
+ { :name => 'Neutron Networker',
228
+ :class => 'quickstack::neutron::networker',
229
+ :layouts => [[:non_ha_neutron, 3]],
230
+ :services => [:neutron_l3, :dhcp, :ovs] },
231
+ { :name => 'LVM Block Storage',
232
+ :class => 'quickstack::storage_backend::lvm_cinder',
233
+ :layouts => [[:ha_nova, 2], [:ha_neutron, 2], [:non_ha_nova, 2], [:non_ha_neutron, 2]],
234
+ :services => [:cinder_node] },
235
+ { :name => 'Swift Storage Node',
236
+ :class => 'quickstack::swift::storage',
237
+ :layouts => [[:ha_nova, 5], [:ha_neutron, 5], [:non_ha_nova, 5], [:non_ha_neutron, 5]],
238
+ :services => [:swift] },
239
+ { :name => 'HA Controller',
240
+ :class => [],
241
+ :layouts => [[:ha_nova, 1], [:ha_neutron, 1]],
242
+ :services => [:ha_controller, :keystone_ha, :load_balancer_ha, :memcached_ha, :qpid_ha,
243
+ :glance_ha, :nova_ha, :heat_ha, :cinder_ha, :swift_ha, :horizon_ha, :mysql_ha,
244
+ :neutron_ha] }
245
+ ]
237
246
 
238
- roles.each do |r|
247
+ roles.each do |role_hash|
239
248
  #create role
240
- role = Staypuft::Role.where(:name => r[:name]).first_or_create!
249
+ role = Staypuft::Role.where(:name => role_hash[:name]).first_or_create!
241
250
 
242
251
  # set params in puppetclass
243
- pclassnames = r[:class].kind_of?(Array) ? r[:class] : [ r[:class] ]
244
- role.puppetclasses = pclassnames.collect do |pclassname|
245
- pclass = Puppetclass.find_by_name pclassname
252
+ puppet_class_names = role_hash[:class].kind_of?(Array) ? role_hash[:class] : [role_hash[:class]]
253
+ role.puppetclasses = puppet_class_names.collect do |puppet_class_name|
254
+ puppet_class = Puppetclass.find_by_name puppet_class_name
255
+
246
256
  # skip if puppet class isn't found (yet)
247
- if pclass
248
- pclass.class_params.each do |p|
249
- if params.include?(p.key)
250
- p.key_type = get_key_type(params[p.key])
251
- p.default_value = params[p.key]
257
+ if puppet_class
258
+ puppet_class.class_params.each do |param|
259
+ if params.include?(param.key)
260
+ param.key_type = get_key_type.(params[param.key])
261
+ param.default_value = params[param.key]
252
262
  end
253
- p.override = true
254
- p.save!
263
+ param.override = true
264
+ param.save!
255
265
  end
256
- pclass
266
+ puppet_class
267
+ else
268
+ Rails.logger.warn "no puppet_class: #{puppet_class_name} found"
269
+ nil
257
270
  end
258
271
  end.compact
259
272
 
260
- role.description = r[:description]
273
+ role.description = role_hash[:description]
261
274
  old_role_services_arr = role.role_services.to_a
262
- r[:services].each do |key|
275
+ role_hash[:services].each do |key|
263
276
  role_service = role.role_services.where(:service_id => services[key][:obj].id).first_or_create!
264
277
  old_role_services_arr.delete(role_service)
265
278
  end
279
+
266
280
  # delete any prior mappings that remain
267
281
  old_role_services_arr.each do |role_service|
268
282
  role.services.destroy(role_service.service)
269
283
  end
270
284
  role.save!
271
285
  old_layout_roles_arr = role.layout_roles.to_a
272
- r[:layouts].each do |layout, deploy_order|
273
- layout_role = role.layout_roles.where(:layout_id => layouts[layout].id).first_or_initialize
286
+ role_hash[:layouts].each do |layout, deploy_order|
287
+ layout_role = role.layout_roles.where(:layout_id => layouts[layout].id).first_or_initialize
274
288
  layout_role.deploy_order = deploy_order
275
289
  layout_role.save!
276
290
  old_layout_roles_arr.delete(layout_role)
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staypuft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Staypuft team
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
12
+ date: 2014-05-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: foreman-tasks
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: dynflow
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,20 +46,23 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: wicked
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: foreman_discovery
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -73,65 +82,68 @@ executables: []
73
82
  extensions: []
74
83
  extra_rdoc_files: []
75
84
  files:
76
- - app/helpers/staypuft/application_helper.rb
77
- - app/helpers/staypuft/deployments_helper.rb
78
85
  - app/assets/javascripts/staypuft/staypuft.js
79
- - app/assets/stylesheets/staypuft/staypuft.css.scss
80
86
  - app/assets/stylesheets/staypuft/bootstrap_and_overrides.css.scss
81
- - app/models/staypuft/service.rb
82
- - app/models/staypuft/role_class.rb
83
- - app/models/staypuft/deployment.rb
84
- - app/models/staypuft/role_service.rb
85
- - app/models/staypuft/deployment_role_hostgroup.rb
86
- - app/models/staypuft/layout.rb
87
- - app/models/staypuft/service_class.rb
87
+ - app/assets/stylesheets/staypuft/staypuft.css.scss
88
+ - app/controllers/staypuft/application_controller.rb
89
+ - app/controllers/staypuft/deployment_steps_controller.rb
90
+ - app/controllers/staypuft/deployments_controller.rb
91
+ - app/helpers/staypuft/application_helper.rb
92
+ - app/helpers/staypuft/deployments_helper.rb
93
+ - app/lib/actions/staypuft/deployment/deploy.rb
94
+ - app/lib/actions/staypuft/deployment/populate.rb
95
+ - app/lib/actions/staypuft/host/build.rb
96
+ - app/lib/actions/staypuft/host/create.rb
97
+ - app/lib/actions/staypuft/host/deploy.rb
98
+ - app/lib/actions/staypuft/host/puppet_run.rb
99
+ - app/lib/actions/staypuft/host/wait_until_host_ready.rb
100
+ - app/lib/actions/staypuft/host/wait_until_installed.rb
101
+ - app/lib/actions/staypuft/hostgroup/deploy.rb
102
+ - app/lib/actions/staypuft/hostgroup/ordered_deploy.rb
103
+ - app/lib/actions/staypuft/middleware/as_current_user.rb
104
+ - app/lib/staypuft/exception.rb
105
+ - app/models/setting/staypuft_provisioning.rb
106
+ - app/models/staypuft/concerns/environment_extensions.rb
107
+ - app/models/staypuft/concerns/host_open_stack_affiliation.rb
88
108
  - app/models/staypuft/concerns/host_orchestration_build_hook.rb
89
109
  - app/models/staypuft/concerns/hostgroup_extensions.rb
90
- - app/models/staypuft/concerns/host_open_stack_affiliation.rb
91
110
  - app/models/staypuft/concerns/puppetclass_extensions.rb
92
- - app/models/staypuft/concerns/environment_extensions.rb
111
+ - app/models/staypuft/deployment.rb
112
+ - app/models/staypuft/deployment_role_hostgroup.rb
113
+ - app/models/staypuft/layout.rb
93
114
  - app/models/staypuft/layout_role.rb
94
115
  - app/models/staypuft/role.rb
95
- - app/models/setting/staypuft_provisioning.rb
96
- - app/lib/staypuft/exception.rb
97
- - app/lib/actions/staypuft/middleware/as_current_user.rb
98
- - app/lib/actions/staypuft/hostgroup/deploy.rb
99
- - app/lib/actions/staypuft/hostgroup/ordered_deploy.rb
100
- - app/lib/actions/staypuft/host/deploy.rb
101
- - app/lib/actions/staypuft/host/build.rb
102
- - app/lib/actions/staypuft/host/wait_until_host_ready.rb
103
- - app/lib/actions/staypuft/host/puppet_run.rb
104
- - app/lib/actions/staypuft/host/create.rb
105
- - app/lib/actions/staypuft/host/wait_until_installed.rb
106
- - app/lib/actions/staypuft/deployment/deploy.rb
107
- - app/lib/actions/staypuft/deployment/populate.rb
108
- - app/controllers/staypuft/deployments_controller.rb
109
- - app/controllers/staypuft/application_controller.rb
110
- - app/controllers/staypuft/deployment_steps_controller.rb
116
+ - app/models/staypuft/role_class.rb
117
+ - app/models/staypuft/role_service.rb
118
+ - app/models/staypuft/service/ui_params.rb
119
+ - app/models/staypuft/service.rb
120
+ - app/models/staypuft/service_class.rb
121
+ - app/views/staypuft/deployment_steps/_title.html.erb
122
+ - app/views/staypuft/deployment_steps/deployment_settings.html.erb
123
+ - app/views/staypuft/deployment_steps/services_configuration.html.erb
124
+ - app/views/staypuft/deployment_steps/services_selection.html.erb
111
125
  - app/views/staypuft/deployments/index.html.erb
112
126
  - app/views/staypuft/deployments/show.html.erb
113
127
  - app/views/staypuft/deployments/summary.html.erb
114
- - app/views/staypuft/deployment_steps/deployment_settings.html.erb
115
- - app/views/staypuft/deployment_steps/services_selection.html.erb
116
- - app/views/staypuft/deployment_steps/_title.html.erb
117
- - app/views/staypuft/deployment_steps/services_configuration.html.erb
118
128
  - app/views/staypuft/layouts/staypuft.html.erb
119
- - config/staypuft.local.rb
120
129
  - config/routes.rb
121
- - db/migrate/20140312050615_create_staypuft_role_classes.rb
130
+ - config/staypuft.local.rb
122
131
  - db/migrate/20140309021811_create_staypuft_layouts.rb
123
- - db/migrate/20140310203855_create_staypuft_role_services.rb
132
+ - db/migrate/20140310004533_create_staypuft_deployments.rb
124
133
  - db/migrate/20140310023613_create_staypuft_roles.rb
125
- - db/migrate/20140325211410_add_role_to_staypuft_deployment_role_hostgroup.rb
126
- - db/migrate/20140326032027_drop_staypuft_hostgroup_roles.rb
134
+ - db/migrate/20140310174152_create_staypuft_layout_roles.rb
127
135
  - db/migrate/20140310194221_create_staypuft_services.rb
136
+ - db/migrate/20140310203855_create_staypuft_role_services.rb
137
+ - db/migrate/20140312044533_create_staypuft_deployment_role_hostgroups.rb
128
138
  - db/migrate/20140312050001_create_staypuft_hostgroup_roles.rb
129
- - db/migrate/20140310174152_create_staypuft_layout_roles.rb
130
- - db/migrate/20140318163222_add_deploy_order_to_staypuft_layout_role.rb
131
- - db/migrate/20140315031754_add_networking_to_staypuft_layout.rb
139
+ - db/migrate/20140312050615_create_staypuft_role_classes.rb
132
140
  - db/migrate/20140312051144_create_staypuft_service_classes.rb
133
- - db/migrate/20140312044533_create_staypuft_deployment_role_hostgroups.rb
134
- - db/migrate/20140310004533_create_staypuft_deployments.rb
141
+ - db/migrate/20140315031754_add_networking_to_staypuft_layout.rb
142
+ - db/migrate/20140318163222_add_deploy_order_to_staypuft_layout_role.rb
143
+ - db/migrate/20140325211410_add_role_to_staypuft_deployment_role_hostgroup.rb
144
+ - db/migrate/20140326032027_drop_staypuft_hostgroup_roles.rb
145
+ - db/migrate/20140507103716_add_form_step_to_staypuft_deployment.rb
146
+ - db/migrate/20140513124807_change_column_default_form_step_on_staypuft_deployment.rb
135
147
  - db/seeds.rb
136
148
  - lib/staypuft/engine.rb
137
149
  - lib/staypuft/version.rb
@@ -140,39 +152,40 @@ files:
140
152
  - LICENSE
141
153
  - Rakefile
142
154
  - README.md
143
- - test/test_helper.rb
144
- - test/staypuft_test.rb
145
- - test/unit/staypuft_test.rb
146
- - test/integration/navigation_test.rb
147
155
  - test/factories/staypuft_factories.rb
156
+ - test/integration/navigation_test.rb
157
+ - test/staypuft_test.rb
158
+ - test/test_helper.rb
148
159
  - test/test_plugin_helper.rb
160
+ - test/unit/staypuft_test.rb
149
161
  homepage: https://github.com/theforeman/staypuft
150
162
  licenses: []
151
- metadata: {}
152
163
  post_install_message:
153
164
  rdoc_options: []
154
165
  require_paths:
155
166
  - lib
156
167
  required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
157
169
  requirements:
158
- - - '>='
170
+ - - ! '>='
159
171
  - !ruby/object:Gem::Version
160
172
  version: '0'
161
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
162
175
  requirements:
163
- - - '>='
176
+ - - ! '>='
164
177
  - !ruby/object:Gem::Version
165
178
  version: '0'
166
179
  requirements: []
167
180
  rubyforge_project:
168
- rubygems_version: 2.0.3
181
+ rubygems_version: 1.8.23
169
182
  signing_key:
170
- specification_version: 4
183
+ specification_version: 3
171
184
  summary: OpenStack Foreman Installer
172
185
  test_files:
173
- - test/test_helper.rb
174
- - test/staypuft_test.rb
175
- - test/unit/staypuft_test.rb
176
- - test/integration/navigation_test.rb
177
186
  - test/factories/staypuft_factories.rb
187
+ - test/integration/navigation_test.rb
188
+ - test/staypuft_test.rb
189
+ - test/test_helper.rb
178
190
  - test/test_plugin_helper.rb
191
+ - test/unit/staypuft_test.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 54176ed2876a5cfe10a15aa19cbfdbf35d89d8a1
4
- data.tar.gz: 3fc002583ba2458fd7cf9c41a592c77f533023d6
5
- SHA512:
6
- metadata.gz: 34345fe56f017bc92e93c906ee7608aa6a0a6518522b39961153287ab8ef7bc91f0eb382410c124fdd30b1d51d8f42cb7f6e57ca4ab006668361f832ad649476
7
- data.tar.gz: f1a524875345eff51897ebc887811d3164d58404e1f55abce6b522c71d9a84bbee8a483ef429db09218b3087dbf11d6f85ac149af674830a735f6d00fa6b7b4d