Skip to content

Commit 64bbcf1

Browse files
committed
Merge pull request #2 from briancline/general-prep-stuff
Regression fixes and additional cleanups
2 parents b030d82 + 2816984 commit 64bbcf1

15 files changed

Lines changed: 213 additions & 181 deletions

File tree

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*.gem
2+
*.rbc
3+
.bundle
4+
.config
5+
coverage
6+
InstalledFiles
7+
lib/bundler/man
8+
pkg
9+
rdoc
10+
spec/reports
11+
test/tmp
12+
test/version_tmp
13+
tmp
14+
15+
# YARD artifacts
16+
.yardoc
17+
_yardoc
18+
doc/

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ It is not recommended to change the physical network configuration unless you ha
158158

159159

160160
### Keystone ###
161+
* `node['keystone']['apache_frontend']` - Run Keystone under Apache's mod_wsgi to allow for more concurrent connections (default: true)
161162
* `node['keystone']['config']['debug']` - Set debug mode for Keystone services
162163
* `node['keystone']['config']['verbose']` - Set verbose logging mode for Keystone services
163164

@@ -168,9 +169,9 @@ It is not recommended to change the physical network configuration unless you ha
168169
* `node['keystone']['service_tenant_name']` - Keystone tenant name for Keystone services
169170
* `node['keystone']['service_user']` - Keystone user name for Keystone services
170171

171-
* `node['keystone']['config']['bind_host']` - IP to listen on (default 0.0.0.0)
172-
* `node['keystone']['config']['public_port']` - Public port to listen on (default 5000)
173-
* `node['keystone']['config']['admin_port']` - Admin port to listen on (default 35357)
172+
* `node['keystone']['config']['bind_host']` - IP to listen on (default: 0.0.0.0)
173+
* `node['keystone']['config']['public_port']` - Public port to listen on (default: 5000)
174+
* `node['keystone']['config']['admin_port']` - Admin port to listen on (default: 35357)
174175

175176
* `node['keystone']['region_servers']` - Horizon can be populated with your other OpenStack clusters. To do so add keypairs of the region names and their respective IP address location:
176177

attributes/default.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
default['admin']['banner'] = '# Generated by SoftLayer OpenStack Cookbooks.' \
66
' Changes will be overwritten by chef-client.'
77

8-
# Use eth1 and eth0 if provisioning CCI's or custom hardware.
9-
# Softlayer's hardware servers use bond1 and bond0.
8+
# Use eth1 and eth0 if provisioning CCIs or custom hardware.
9+
# SoftLayer's hardware servers use bond1 and bond0.
1010
# default['network']['public_interface'] = 'bond1'
1111
# default['network']['private_interface'] = 'bond0'
1212
default['network']['public_interface'] = 'eth1'

attributes/keystone.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
default['keystone']['service_tenant_name'] = 'service'
99
default['keystone']['service_user'] = 'keystone'
1010

11+
default['keystone']['apache_frontend'] = true
1112
default['keystone']['config']['bind_host'] = '0.0.0.0'
1213
default['keystone']['config']['public_port'] = '5000'
1314
default['keystone']['config']['admin_port'] = '35357'

libraries/stack.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Stack
2+
def self.keystone_admin_env(node)
3+
keystone_auth_url = "http://#{node[:keystone][:private_ip]}:" \
4+
"#{node['keystone']['config']['public_port']}/v2.0"
5+
6+
{ "OS_USERNAME" => "admin",
7+
"OS_PASSWORD" => node[:admin][:password],
8+
"OS_TENANT_NAME" => "admin",
9+
"OS_AUTH_URL" => keystone_auth_url }
10+
end
11+
12+
def self.keystone_service_env(node)
13+
keystone_service_url = "http://#{node[:keystone][:private_ip]}:" \
14+
"#{node['keystone']['config']['admin_port']}/v2.0"
15+
16+
{ 'SERVICE_TOKEN' => node[:admin][:password],
17+
'SERVICE_ENDPOINT' => keystone_service_url }
18+
end
19+
end

providers/keystone.rb

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
service_env = { 'SERVICE_TOKEN' => new_resource.keystone_service_pass,
2-
'SERVICE_ENDPOINT' => 'http://localhost:35357/v2.0' }
3-
4-
id_regex = %r(/[a-f0-9]{25,}/)
5-
1+
id_regex = /[a-f0-9]{25,}/
62

73

84
action :create_user do
95
shell = Mixlib::ShellOut.new('keystone', 'user-get',
106
new_resource.user,
11-
:environment => service_env)
7+
:environment => new_resource.env)
128
shell.run_command
139

1410
if shell.stderr.index('No user with a name')
1511
create = Mixlib::ShellOut.new('keystone', 'user-create',
1612
"--name=#{new_resource.user}",
1713
"--pass=#{new_resource.password}",
1814
"--email=#{new_resource.email}",
19-
:environment => service_env)
15+
:environment => new_resource.env)
2016
create.run_command
2117
create.error! # Tell chef user if something went wrong
2218

@@ -26,21 +22,20 @@
2622
user_id = shell.stdout.match id_regex
2723
puts "\nUser #{new_resource.user} already exists with ID #{user_id}"
2824
end
29-
3025
end
3126

3227

3328

3429
action :create_tenant do
3530
find = Mixlib::ShellOut.new('keystone', 'tenant-get',
3631
new_resource.tenant,
37-
:environment => service_env)
32+
:environment => new_resource.env)
3833
find.run_command
3934

4035
if find.stderr.index('No tenant with a name')
4136
create = Mixlib::ShellOut.new('keystone', 'tenant-create',
4237
"--name=#{new_resource.tenant}",
43-
:environment => service_env)
38+
:environment => new_resource.env)
4439
create.run_command
4540
create.error! # Tell chef user if something went wrong
4641

@@ -57,13 +52,13 @@
5752
action :create_role do
5853
find = Mixlib::ShellOut.new('keystone', 'role-get',
5954
new_resource.role,
60-
:environment => service_env)
55+
:environment => new_resource.env)
6156
find.run_command
6257

6358
if find.stderr.index('No role with a name')
6459
create = Mixlib::ShellOut.new('keystone', 'role-create',
6560
"--name=#{new_resource.role}",
66-
:environment => service_env)
61+
:environment => new_resource.env)
6762
create.run_command
6863
create.error! # Tell chef user if something went wrong
6964

@@ -84,7 +79,7 @@
8479

8580
find = Mixlib::ShellOut.new('keystone', 'user-get',
8681
new_resource.user,
87-
:environment => service_env)
82+
:environment => new_resource.env)
8883
find.run_command
8984

9085
if find.stderr.index('No user with a name')
@@ -96,7 +91,7 @@
9691

9792
find = Mixlib::ShellOut.new('keystone', 'tenant-get',
9893
new_resource.tenant,
99-
:environment => service_env)
94+
:environment => new_resource.env)
10095
find.run_command
10196

10297
if find.stderr.index('No tenant with a name')
@@ -108,7 +103,7 @@
108103

109104
find = Mixlib::ShellOut.new('keystone', 'role-get',
110105
new_resource.role,
111-
:environment => service_env)
106+
:environment => new_resource.env)
112107
find.run_command
113108

114109
if find.stderr.index('No role with a name')
@@ -121,7 +116,7 @@
121116
'--user-id', user_id.to_s,
122117
'--tenant-id', tenant_id.to_s,
123118
'--role-id', role_id.to_s,
124-
:environment => service_env)
119+
:environment => new_resource.env)
125120
update.run_command
126121

127122
if update.stderr.index('already has')
@@ -137,15 +132,15 @@
137132
action :create_service do
138133
find = Mixlib::ShellOut.new('keystone', 'service-get',
139134
new_resource.name,
140-
:environment => service_env)
135+
:environment => new_resource.env)
141136
find.run_command
142137

143138
if find.stderr.index('No service with a name')
144139
create = Mixlib::ShellOut.new('keystone', 'service-create',
145140
'--name', new_resource.name,
146141
'--type', new_resource.service_type,
147142
'--description', new_resource.description,
148-
:environment => service_env)
143+
:environment => new_resource.env)
149144
create.run_command
150145
create.error! #Let chef user know something then wrong.
151146

@@ -162,7 +157,7 @@
162157
action :create_endpoint do
163158
find = Mixlib::ShellOut.new('keystone', 'service-get',
164159
new_resource.service_type,
165-
:environment => service_env)
160+
:environment => new_resource.env)
166161
find.run_command
167162

168163
if find.stderr.index('No service with a name')
@@ -173,7 +168,7 @@
173168
endpoint_found = false
174169

175170
find = Mixlib::ShellOut.new('keystone', 'endpoint-list',
176-
:environment => service_env)
171+
:environment => new_resource.env)
177172
find.run_command
178173

179174
find.stdout.each_line do |line|
@@ -194,7 +189,7 @@
194189
'--publicurl', new_resource.public_url,
195190
'--adminurl', new_resource.admin_url,
196191
'--internalurl', new_resource.internal_url,
197-
:environment => service_env)
192+
:environment => new_resource.env)
198193
create.run_command
199194
create.error!
200195

providers/neutron.rb

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,9 @@
88
neutron-l3-agent-public
99
neutron-l3-agent-private]
1010

11-
keystone_auth_url = "http://#{node[:keystone][:private_ip]}:" \
12-
"#{node['keystone']['config']['public_port']}/v2.0"
13-
14-
admin_env = {"OS_USERNAME" => "admin",
15-
"OS_PASSWORD" => node[:admin][:password],
16-
"OS_TENANT_NAME" => "admin",
17-
"OS_AUTH_URL" => keystone_auth_url}
18-
1911
uuid_regex = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/
2012

2113

22-
2314
action :setup_softlayer_networks do
2415

2516
bash "Create Neutron network for region" do
@@ -103,7 +94,7 @@
10394
"public-router",
10495
"--variable", "id",
10596
"-f", "shell",
106-
:environment => admin_env)
97+
:environment => env)
10798
command.run_command
10899

109100
if command.stderr.index("Unable to find router")
@@ -118,7 +109,7 @@
118109
"private-router",
119110
"--variable", "id",
120111
"-f", "shell",
121-
:environment => admin_env)
112+
:environment => env)
122113
command.run_command
123114

124115
if command.stderr.index("Unable to find router")
@@ -133,7 +124,7 @@
133124
"softlayer-public",
134125
"--variable", "id",
135126
"-f", "shell",
136-
:environment => admin_env)
127+
:environment => env)
137128
command.run_command
138129

139130
if command.stderr.index("Unable to find network")
@@ -149,7 +140,7 @@
149140
"softlayer-private",
150141
"--variable", "id",
151142
"-f", "shell",
152-
:environment => admin_env)
143+
:environment => env)
153144
command.run_command
154145

155146
if command.stderr.index("Unable to find network")

recipes/dashboard.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
source 'horizon/local_settings.py.erb'
3030
owner 'root'
3131
group 'root'
32-
mode 00644
33-
notifies :restart, resources(:service => 'apache2')
34-
notifies :restart, resources(:service => 'memcached')
32+
mode 00644
33+
notifies :restart, resources(:service => 'apache2')
34+
notifies :restart, resources(:service => 'memcached')
3535
end
3636

3737
template '/etc/openstack-dashboard/local_settings.py' do
38-
source 'horizon/local_settings.py.erb'
39-
owner 'root'
40-
group 'root'
41-
mode 00644
42-
notifies :restart, resources(:service => 'apache2'), :immediately
43-
notifies :restart, resources(:service => 'memcached'), :immediately
38+
source 'horizon/local_settings.py.erb'
39+
owner 'root'
40+
group 'root'
41+
mode 00644
42+
notifies :restart, resources(:service => 'apache2'), :immediately
43+
notifies :restart, resources(:service => 'memcached'), :immediately
4444
end

0 commit comments

Comments
 (0)