level up swift test file
improve the file used to test swift. convert into a template. create a class to configure and deploy it.
This commit is contained in:
parent
7584ccf7cc
commit
a467efdc46
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ spec/fixtures/modules/ssh
|
||||
spec/fixtures/modules/stdlib
|
||||
spec/fixtures/modules/xinetd
|
||||
spec/fixtures/modules/*
|
||||
spec/fixtures/manifests/site.pp
|
||||
|
43
manifests/test_file.pp
Normal file
43
manifests/test_file.pp
Normal file
@ -0,0 +1,43 @@
|
||||
# == Class: swift::test_file
|
||||
#
|
||||
# Deploys a file that can be used to verify your swift installation.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# password used with tenant/user combination against auth_server. Required.
|
||||
# [*auth_server*]
|
||||
# server hosting keystone. Optional. Defaults to 127.0.0.1.
|
||||
# [*tenant*]
|
||||
# tenant used for authentication (required for retrieval of catalog). Optional. Defaults to openstack.
|
||||
# [*user*]
|
||||
# authenticated user. Optional. Defaults to 'admin'.
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# class { 'swift::test_file':
|
||||
# auth_server => '172.16.0.25',
|
||||
# tenant => 'services',
|
||||
# user => 'swift',
|
||||
# password => 'admin_password',
|
||||
# }
|
||||
#
|
||||
# === Authors
|
||||
#
|
||||
# Dan Bode <bodepd@gmail.com>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright 2011 PuppetLabs.
|
||||
#
|
||||
class swift::test_file (
|
||||
$password,
|
||||
$auth_server = '127.0.0.1',
|
||||
$tenant = 'openstack',
|
||||
$user = 'admin'
|
||||
) {
|
||||
file { '/tmp/swift_test_file.rb':
|
||||
mode => '755',
|
||||
content => template('swift/swift_keystone_test.erb')
|
||||
}
|
||||
}
|
49
spec/classes/swift_test_file_spec.rb
Normal file
49
spec/classes/swift_test_file_spec.rb
Normal file
@ -0,0 +1,49 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'swift::test_file' do
|
||||
|
||||
let :default_params do
|
||||
{:password => 'foo'}
|
||||
end
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
let :params do
|
||||
default_params
|
||||
end
|
||||
|
||||
it 'should create a reasonable test file' do
|
||||
verify_contents(subject, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.1"',
|
||||
"user='openstack:admin'",
|
||||
"password='foo'"
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'when overridding' do
|
||||
|
||||
let :params do
|
||||
default_params.merge({
|
||||
:auth_server => '127.0.0.2',
|
||||
:tenant => 'tenant',
|
||||
:user => 'user',
|
||||
:password => 'password'
|
||||
})
|
||||
end
|
||||
|
||||
it 'should create a configured test file' do
|
||||
verify_contents(subject, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.2"',
|
||||
"user='tenant:user'",
|
||||
"password='password'"
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -8,9 +8,9 @@ require 'open3'
|
||||
require 'fileutils'
|
||||
|
||||
# connection variables
|
||||
proxy_local_net_ip='127.0.0.1'
|
||||
user='openstack:admin'
|
||||
password='admin_password'
|
||||
proxy_local_net_ip="<%= auth_server %>"
|
||||
user='<%= tenant %>:<%= user %>'
|
||||
password='<%= password %>'
|
||||
|
||||
## headers for curl requests
|
||||
#user_header="-H 'X-Storage-User: #{user}'"
|
Loading…
x
Reference in New Issue
Block a user