Merge pull request #74 from puppetlabs/master
back port latest folsom changes to folsom branch
This commit is contained in:
commit
1a5b7504a5
|
@ -6,6 +6,5 @@ fixtures:
|
|||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||
"rabbitmq": "git://github.com/puppetlabs/puppetlabs-rabbitmq.git"
|
||||
'inifile': 'git://github.com/cprice-puppet/puppetlabs-inifile'
|
||||
"create_resources": 'git://github.com/puppetlabs/puppetlabs-create_resources'
|
||||
symlinks:
|
||||
"glance": "#{source_dir}"
|
||||
|
|
5
.gemfile
5
.gemfile
|
@ -1,5 +0,0 @@
|
|||
source :rubygems
|
||||
|
||||
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
|
||||
gem 'puppet', puppetversion
|
||||
gem 'puppetlabs_spec_helper', '>= 0.1.0'
|
35
.travis.yml
35
.travis.yml
|
@ -1,18 +1,33 @@
|
|||
language: ruby
|
||||
bundler_args: --without development
|
||||
before_script:
|
||||
- echo $PUPPET_GEM_VERSION | grep '2.6' && git clone git://github.com/puppetlabs/puppetlabs-create_resources.git spec/fixtures/modules/create_resources || true
|
||||
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||
rvm:
|
||||
- 1.8.7
|
||||
before_script:
|
||||
after_script:
|
||||
script: "rake spec"
|
||||
- 1.9.3
|
||||
- ruby-head
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- folsom
|
||||
- essex
|
||||
- master
|
||||
- folsom
|
||||
- essex
|
||||
env:
|
||||
- PUPPET_VERSION=2.7.13
|
||||
- PUPPET_VERSION=2.7.6
|
||||
- PUPPET_VERSION=2.6.9
|
||||
- PUPPET_GEM_VERSION="~> 2.6"
|
||||
- PUPPET_GEM_VERSION="~> 2.7"
|
||||
- PUPPET_GEM_VERSION="~> 3.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.1"
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rvm: ruby-head
|
||||
exclude:
|
||||
- rvm: 1.9.3
|
||||
env: PUPPET_GEM_VERSION="~> 2.7"
|
||||
- rvm: ruby-head
|
||||
env: PUPPET_GEM_VERSION="~> 2.7"
|
||||
- rvm: 1.9.3
|
||||
env: PUPPET_GEM_VERSION="~> 2.6"
|
||||
- rvm: ruby-head
|
||||
env: PUPPET_GEM_VERSION="~> 2.6"
|
||||
notifications:
|
||||
email: false
|
||||
gemfile: .gemfile
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
* 2013-03-19 1.1.0
|
||||
- update travis matrix (add ruby 1.9, puppet 3.0)
|
||||
- implement provider changes for purging
|
||||
- refactor of glance_image native types
|
||||
- remove /v1 from endpoints
|
||||
- allow specifying https for public endpoint
|
||||
- parse credentials out of apt-paste.conf
|
||||
* 2012-11-02 1.0.0
|
||||
- Add travisci support to repo
|
||||
- Remove essex support
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
source :rubygems
|
||||
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
gem 'puppet', puppetversion, :require => false
|
||||
else
|
||||
gem 'puppet', :require => false
|
||||
end
|
||||
|
||||
# vim:ft=ruby
|
|
@ -1,5 +1,5 @@
|
|||
name 'puppetlabs-glance'
|
||||
version '1.0.0'
|
||||
version '1.1.0'
|
||||
source 'git://github.com/puppetlabs/puppetlabs-glance'
|
||||
author 'Puppet Labs'
|
||||
license 'Apache'
|
||||
|
@ -8,6 +8,6 @@ description 'Openstack Glance module for folsom. Tested on Ubuntu Precise and RH
|
|||
project_page 'http://github.com/puppetlabs/puppetlabs-glance'
|
||||
|
||||
dependency 'cprice404/inifile', '>= 0.9.0'
|
||||
dependency 'puppetlabs/keystone', '>= 1.0.1'
|
||||
dependency 'puppetlabs/keystone', '>= 1.1.0'
|
||||
dependency 'puppetlabs/mysql', '>= 0.5.0'
|
||||
dependency 'puppetlabs/stdlib', '>= 2.4.0'
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
# PuppetLabs Glance module
|
||||
|
||||
This module provides a set of manifests that can be used to install and
|
||||
configure glance.
|
||||
|
||||
It is currently targettting the folsom release of OpenStack.
|
||||
|
||||
Use the essex branch for essex support.
|
||||
|
||||
## Platforms
|
||||
|
||||
* Ubuntu 11.04 (Natty)
|
||||
* Ubuntu 11.10 (Oneiric)
|
||||
* Ubuntu 12.04 (Precise)
|
||||
|
||||
## configurations
|
||||
|
||||
Glance is configured with the following classes:
|
||||
|
||||
|
||||
#configures glance::api service
|
||||
|
||||
class { 'glance::api':
|
||||
verbose => $verbose,
|
||||
debug => $verbose,
|
||||
auth_type => 'keystone',
|
||||
auth_port => '35357',
|
||||
auth_host => $keystone_host,
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
sql_connection => $sql_connection,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
# configures the glance registry
|
||||
|
||||
class { 'glance::registry':
|
||||
verbose => $verbose,
|
||||
debug => $verbose,
|
||||
auth_host => $keystone_host,
|
||||
auth_port => '35357',
|
||||
auth_type => 'keystone',
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
sql_connection => $sql_connection,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
# Configure file storage backend
|
||||
|
||||
class { 'glance::backend::file': }
|
||||
|
||||
# Create the Glance db, this should be configured on your mysql server
|
||||
class { 'glance::db::mysql':
|
||||
user => $glance_db_user,
|
||||
password => $glance_db_password,
|
||||
dbname => $glance_db_dbname,
|
||||
allowed_hosts => $allowed_hosts,
|
||||
}
|
||||
|
||||
# configures glance endpoints in keystone
|
||||
# should be run on your keystone server
|
||||
class { 'glance::keystone::auth':
|
||||
password => $glance_user_password,
|
||||
public_address => $glance_public_real,
|
||||
admin_address => $glance_admin_real,
|
||||
internal_address => $glance_internal_real,
|
||||
region => $region,
|
||||
}
|
||||
|
||||
for full examples, see the examples directory.
|
||||
|
||||
in the module, puppetlabs-openstack, the following classes
|
||||
configure parts of glance:
|
||||
|
||||
- openstack::glance # api, file backend, and registry
|
||||
- openstack::keystone # sets up endpoints
|
||||
- openstack::db::mysql # sets up db config
|
|
@ -0,0 +1,84 @@
|
|||
# PuppetLabs Glance module
|
||||
|
||||
This module provides a set of manifests that can be used to install and
|
||||
configure glance.
|
||||
|
||||
It is currently targettting the folsom release of OpenStack.
|
||||
|
||||
Use the essex branch for essex support.
|
||||
|
||||
[![Unit Test Status](https://secure.travis-ci.org/puppetlabs/puppetlabs-glance.png?branch=master)](http://travis-ci.org/puppetlabs/puppetlabs-glance)
|
||||
|
||||
## Platforms
|
||||
|
||||
* Ubuntu 11.04 (Natty)
|
||||
* Ubuntu 11.10 (Oneiric)
|
||||
* Ubuntu 12.04 (Precise)
|
||||
|
||||
## configurations
|
||||
|
||||
Glance is configured with the following classes:
|
||||
|
||||
|
||||
### configures glance::api service
|
||||
|
||||
class { 'glance::api':
|
||||
verbose => $verbose,
|
||||
debug => $verbose,
|
||||
auth_type => 'keystone',
|
||||
auth_port => '35357',
|
||||
auth_host => $keystone_host,
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
sql_connection => $sql_connection,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
### configures the glance registry
|
||||
|
||||
class { 'glance::registry':
|
||||
verbose => $verbose,
|
||||
debug => $verbose,
|
||||
auth_host => $keystone_host,
|
||||
auth_port => '35357',
|
||||
auth_type => 'keystone',
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
sql_connection => $sql_connection,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
### Configure file storage backend
|
||||
|
||||
class { 'glance::backend::file': }
|
||||
|
||||
### Create the Glance db, this should be configured on your mysql server
|
||||
|
||||
class { 'glance::db::mysql':
|
||||
user => $glance_db_user,
|
||||
password => $glance_db_password,
|
||||
dbname => $glance_db_dbname,
|
||||
allowed_hosts => $allowed_hosts,
|
||||
}
|
||||
|
||||
### configures glance endpoints in keystone
|
||||
should be run on your keystone server
|
||||
|
||||
class { 'glance::keystone::auth':
|
||||
password => $glance_user_password,
|
||||
public_address => $glance_public_real,
|
||||
admin_address => $glance_admin_real,
|
||||
internal_address => $glance_internal_real,
|
||||
region => $region,
|
||||
}
|
||||
|
||||
for full examples, see the examples directory.
|
||||
|
||||
in the module, puppetlabs-openstack, the following classes
|
||||
configure parts of glance:
|
||||
|
||||
- openstack::glance # api, file backend, and registry
|
||||
- openstack::keystone # sets up endpoints
|
||||
- openstack::db::mysql # sets up db config
|
|
@ -37,6 +37,7 @@ class role_glance_mysql {
|
|||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => 'glance_password',
|
||||
sql_connection => 'mysql://glance:glance@127.0.0.1/glance',
|
||||
}
|
||||
class { 'glance::backend::file': }
|
||||
|
||||
|
|
|
@ -15,8 +15,13 @@ Puppet::Type.type(:glance_api_config).provide(
|
|||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
def self.file_path
|
||||
'/etc/glance/glance-api.conf'
|
||||
end
|
||||
|
||||
# this needs to be removed. This has been replaced with the class method
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,8 +15,13 @@ Puppet::Type.type(:glance_api_paste_ini).provide(
|
|||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
def self.file_path
|
||||
'/etc/glance/glance-api-paste.ini'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,8 +15,13 @@ Puppet::Type.type(:glance_cache_config).provide(
|
|||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
def self.file_path
|
||||
'/etc/glance/glance-cache.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,25 +13,35 @@ Puppet::Type.type(:glance_image).provide(
|
|||
|
||||
commands :glance => 'glance'
|
||||
|
||||
def self.prefetch(resource)
|
||||
# rebuild the cache for every puppet run
|
||||
@image_hash = nil
|
||||
end
|
||||
|
||||
def self.image_hash
|
||||
@image_hash ||= build_image_hash
|
||||
end
|
||||
|
||||
def image_hash
|
||||
self.class.image_hash
|
||||
end
|
||||
mk_resource_methods
|
||||
|
||||
def self.instances
|
||||
image_hash.collect do |k, v|
|
||||
new(:name => k)
|
||||
list_glance_images.collect do |image|
|
||||
attrs = get_glance_image_attrs(image)
|
||||
new(
|
||||
:ensure => :present,
|
||||
:name => attrs['name'],
|
||||
:is_public => attrs['public'],
|
||||
:container_format => attrs['container format'],
|
||||
:id => attrs['id'],
|
||||
:disk_format => attrs['disk format']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def self.prefetch(resources)
|
||||
images = instances
|
||||
resources.keys.each do |name|
|
||||
if provider = images.find{ |pkg| pkg.name == name }
|
||||
resources[name].provider = provider
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def exists?
|
||||
@property_hash[:ensure] == :present
|
||||
end
|
||||
|
||||
def create
|
||||
stdin = nil
|
||||
if resource[:source]
|
||||
|
@ -50,64 +60,47 @@ Puppet::Type.type(:glance_image).provide(
|
|||
raise(Puppet::Error, "Must specify either source or location")
|
||||
end
|
||||
if stdin
|
||||
auth_glance_stdin('add', "name='#{resource[:name]}'", "is_public=#{resource[:is_public]}", "container_format=#{resource[:container_format]}", "disk_format=#{resource[:disk_format]}", location)
|
||||
result = auth_glance_stdin('add', "name=#{resource[:name]}", "is_public=#{resource[:is_public]}", "container_format=#{resource[:container_format]}", "disk_format=#{resource[:disk_format]}", location)
|
||||
else
|
||||
auth_glance('add', "name='#{resource[:name]}'", "is_public=#{resource[:is_public]}", "container_format=#{resource[:container_format]}", "disk_format=#{resource[:disk_format]}", location)
|
||||
results = auth_glance('add', "name=#{resource[:name]}", "is_public=#{resource[:is_public]}", "container_format=#{resource[:container_format]}", "disk_format=#{resource[:disk_format]}", location)
|
||||
end
|
||||
if results =~ /Added new image with ID: (\S+)/
|
||||
@property_hash = {
|
||||
:ensure => :present,
|
||||
:name => resource[:name],
|
||||
:is_public => resource[:is_public],
|
||||
:container_format => resource[:container_format],
|
||||
:disk_format => resource[:disk_format],
|
||||
:id => $1
|
||||
}
|
||||
else
|
||||
fail("did not get expected message from image creation, got #{results}")
|
||||
end
|
||||
end
|
||||
|
||||
def exists?
|
||||
image_hash[resource[:name]]
|
||||
end
|
||||
|
||||
def destroy
|
||||
auth_glance('delete', '-f', image_hash[resource[:name]]['id'])
|
||||
end
|
||||
|
||||
def location
|
||||
image_hash[resource[:name]]['location']
|
||||
auth_glance('delete', id)
|
||||
@property_hash[:ensure] = :absent
|
||||
end
|
||||
|
||||
def location=(value)
|
||||
auth_glance('update', image_hash[resource[:name]]['id'], "location=#{value}")
|
||||
end
|
||||
|
||||
def is_public
|
||||
image_hash[resource[:name]]['public']
|
||||
auth_glance('update', id, "location=#{value}")
|
||||
end
|
||||
|
||||
def is_public=(value)
|
||||
auth_glance('update', image_hash[resource[:name]]['id'], "is_public=#{value}")
|
||||
end
|
||||
|
||||
def disk_format
|
||||
image_hash[resource[:name]]['disk format']
|
||||
auth_glance('update', id, "is_public=#{value}")
|
||||
end
|
||||
|
||||
def disk_format=(value)
|
||||
auth_glance('update', image_hash[resource[:name]]['id'], "disk_format=#{value}")
|
||||
end
|
||||
|
||||
def container_format
|
||||
image_hash[resource[:name]]['container format']
|
||||
auth_glance('update', id, "disk_format=#{value}")
|
||||
end
|
||||
|
||||
def container_format=(value)
|
||||
auth_glance('update', image_hash[resource[:name]]['id'], "container_format=#{value}")
|
||||
auth_glance('update', id, "container_format=#{value}")
|
||||
end
|
||||
|
||||
def id
|
||||
image_hash[resource[:name]]['id']
|
||||
def id=(id)
|
||||
fail('id is read only')
|
||||
end
|
||||
|
||||
private
|
||||
def self.build_image_hash
|
||||
hash = {}
|
||||
list_glance_images.each do |image|
|
||||
attrs = get_glance_image_attrs(image)
|
||||
hash[attrs['name'].to_s] = attrs
|
||||
end
|
||||
hash
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,8 +15,13 @@ Puppet::Type.type(:glance_registry_config).provide(
|
|||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
def self.file_path
|
||||
'/etc/glance/glance-registry.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,8 +15,13 @@ Puppet::Type.type(:glance_registry_paste_ini).provide(
|
|||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
def self.file_path
|
||||
'/etc/glance/glance-registry-paste.ini'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -50,9 +50,9 @@ class glance::keystone::auth(
|
|||
if $configure_endpoint {
|
||||
keystone_endpoint { "${region}/$auth_name":
|
||||
ensure => present,
|
||||
public_url => "${public_protocol}://${public_address}:${port}/v1",
|
||||
admin_url => "http://${admin_address}:${port}/v1",
|
||||
internal_url => "http://${internal_address}:${port}/v1",
|
||||
public_url => "${public_protocol}://${public_address}:${port}",
|
||||
admin_url => "http://${admin_address}:${port}",
|
||||
internal_url => "http://${internal_address}:${port}",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,9 @@ describe 'glance::keystone::auth' do
|
|||
|
||||
it { should contain_keystone_endpoint('RegionOne/glance').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://127.0.0.1:9292/v1',
|
||||
:admin_url => 'http://127.0.0.1:9292/v1',
|
||||
:internal_url => 'http://127.0.0.1:9292/v1'
|
||||
:public_url => 'http://127.0.0.1:9292',
|
||||
:admin_url => 'http://127.0.0.1:9292',
|
||||
:internal_url => 'http://127.0.0.1:9292'
|
||||
)}
|
||||
|
||||
end
|
||||
|
@ -76,9 +76,9 @@ describe 'glance::keystone::auth' do
|
|||
|
||||
it { should contain_keystone_endpoint('RegionTwo/glance').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://10.0.0.1:9393/v1',
|
||||
:admin_url => 'http://10.0.0.2:9393/v1',
|
||||
:internal_url => 'http://10.0.0.3:9393/v1'
|
||||
:public_url => 'http://10.0.0.1:9393',
|
||||
:admin_url => 'http://10.0.0.2:9393',
|
||||
:internal_url => 'http://10.0.0.3:9393'
|
||||
)}
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue