diff --git a/manifests/api.pp b/manifests/api.pp index 9cc303f0..afca8655 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -1,5 +1,5 @@ # -# == Paremeters: +# == Parameters # # # * keystone_password Password used to authemn @@ -63,8 +63,7 @@ class glance::api( $sql_connection = 'sqlite:///var/lib/glance/glance.sqlite' ) inherits glance { - # used to configure concat - require 'keystone::python' + require keystone::python validate_re($sql_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') @@ -125,7 +124,8 @@ class glance::api( } # db connection config - # I do not believe this was required in Essex. Does the API server now need to connect to the DB? + # I do not believe this was required in Essex. + # Does the API server now need to connect to the DB? # TODO figure out if I need this... glance_api_config { 'DEFAULT/sql_connection': value => $sql_connection; @@ -134,9 +134,9 @@ class glance::api( # auth config glance_api_config { - 'keystone_authtoken/auth_host': value => $auth_host; - 'keystone_authtoken/auth_port': value => $auth_port; - 'keystone_authtoken/auth_protocol': value => $auth_protocol; + 'keystone_authtoken/auth_host': value => $auth_host; + 'keystone_authtoken/auth_port': value => $auth_port; + 'keystone_authtoken/auth_protocol': value => $auth_protocol; } if $auth_admin_prefix { @@ -179,8 +179,7 @@ class glance::api( file { ['/etc/glance/glance-api.conf', '/etc/glance/glance-api-paste.ini', - '/etc/glance/glance-cache.conf' - ]: + '/etc/glance/glance-cache.conf']: } if $enabled { diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index dbd15d6e..ba736f4e 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -16,20 +16,19 @@ class glance::db::mysql( Class['glance::db::mysql'] -> Exec<| title == 'glance-manage db_sync' |> Database[$dbname] ~> Exec<| title == 'glance-manage db_sync' |> - require 'mysql::python' + require mysql::python mysql::db { $dbname: user => $user, password => $password, host => $host, charset => $charset, - # I may want to inject some sql require => Class['mysql::config'], } if $allowed_hosts { - # TODO this class should be in the mysql namespace - glance::db::mysql::host_access { $allowed_hosts: + # TODO this class should be in the mysql namespace + glance::db::mysql::host_access { $allowed_hosts: user => $user, password => $password, database => $dbname, diff --git a/manifests/db/mysql/host_access.pp b/manifests/db/mysql/host_access.pp index 92dcfe8b..6c18a041 100644 --- a/manifests/db/mysql/host_access.pp +++ b/manifests/db/mysql/host_access.pp @@ -4,13 +4,13 @@ define glance::db::mysql::host_access ($user, $password, $database) { database_user { "${user}@${name}": password_hash => mysql_password($password), - provider => 'mysql', - require => Database[$database], + provider => 'mysql', + require => Database[$database], } database_grant { "${user}@${name}/${database}": # TODO figure out which privileges to grant. - privileges => "all", - provider => 'mysql', - require => Database_user["${user}@${name}"] + privileges => 'all', + provider => 'mysql', + require => Database_user["${user}@${name}"] } } diff --git a/manifests/db/postgresql.pp b/manifests/db/postgresql.pp index 6a0e98c2..a1eb54c6 100644 --- a/manifests/db/postgresql.pp +++ b/manifests/db/postgresql.pp @@ -8,14 +8,14 @@ class glance::db::postgresql( $user = 'glance' ) { - require 'postgresql::python' + require postgresql::python Postgresql::Db[$dbname] ~> Exec<| title == 'glance-manage db_sync' |> Package['python-psycopg2'] -> Exec<| title == 'glance-manage db_sync' |> - postgresql::db { "${dbname}": - user => "${user}", - password => "${password}", + postgresql::db { $dbname: + user => $user, + password => $password, } } diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 9eb31e29..84c16156 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -38,17 +38,20 @@ class glance::keystone::auth( email => $email, tenant => $tenant, } + keystone_user_role { "${auth_name}@${tenant}": ensure => present, roles => 'admin', } + keystone_service { $auth_name: ensure => present, type => $service_type, - description => "Openstack Image Service", + description => 'Openstack Image Service', } + if $configure_endpoint { - keystone_endpoint { "${region}/$auth_name": + keystone_endpoint { "${region}/${auth_name}": ensure => present, public_url => "${public_protocol}://${public_address}:${port}", admin_url => "http://${admin_address}:${port}", diff --git a/manifests/registry.pp b/manifests/registry.pp index afaa6212..ffb5031b 100644 --- a/manifests/registry.pp +++ b/manifests/registry.pp @@ -81,7 +81,7 @@ class glance::registry( $enabled = true ) inherits glance { - require 'keystone::python' + require keystone::python validate_re($sql_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') @@ -99,7 +99,7 @@ class glance::registry( } if($sql_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { - require 'mysql::python' + require mysql::python } elsif($sql_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) { } elsif($sql_connection =~ /sqlite:\/\//) { @@ -108,7 +108,6 @@ class glance::registry( fail("Invalid db connection ${sql_connection}") } - # basic service config glance_registry_config { 'DEFAULT/verbose': value => $verbose; 'DEFAULT/debug': value => $debug; @@ -116,7 +115,6 @@ class glance::registry( 'DEFAULT/bind_port': value => $bind_port; } - # db connection config glance_registry_config { 'DEFAULT/sql_connection': value => $sql_connection; 'DEFAULT/sql_idle_timeout': value => $sql_idle_timeout; @@ -162,8 +160,7 @@ class glance::registry( } file { ['/etc/glance/glance-registry.conf', - '/etc/glance/glance-registry-paste.ini' - ]: + '/etc/glance/glance-registry-paste.ini']: } if $enabled { diff --git a/manifests/scrubber.pp b/manifests/scrubber.pp index ad7cd044..08057294 100644 --- a/manifests/scrubber.pp +++ b/manifests/scrubber.pp @@ -1,5 +1,3 @@ -class glance::scrubber ( - -) { - fail("glance::scrubber needs to be implemented") +class glance::scrubber { + fail('glance::scrubber needs to be implemented') } diff --git a/tests/api.pp b/tests/api.pp index 1664b191..7b493191 100644 --- a/tests/api.pp +++ b/tests/api.pp @@ -1,4 +1,4 @@ class { 'glance::api': - debug => 'true', - verbose => 'true', + debug => true, + verbose => true, } diff --git a/tests/registry.pp b/tests/registry.pp index 11fe4e44..8635cb26 100644 --- a/tests/registry.pp +++ b/tests/registry.pp @@ -1,4 +1,4 @@ class { 'glance::registry': - debug =>'true', - verbose => 'true', + debug => true, + verbose => true, } diff --git a/tests/site.pp b/tests/site.pp index acb67825..b810579c 100644 --- a/tests/site.pp +++ b/tests/site.pp @@ -6,8 +6,8 @@ Exec { logoutput => 'on_failure' } node glance_keystone_mysql { class { 'mysql::server': } class { 'keystone': - verbose => true, - debug => true, + verbose => true, + debug => true, catalog_type => 'sql', admin_token => 'admin_token', } @@ -31,8 +31,8 @@ node default { class role_glance_mysql { class { 'glance::api': - verbose => 'True', - debug => 'True', + verbose => true, + debug => true, auth_type => 'keystone', keystone_tenant => 'services', keystone_user => 'glance', @@ -46,18 +46,17 @@ class role_glance_mysql { dbname => 'glance', user => 'glance', host => '127.0.0.1', - # allowed_hosts = undef, - # $cluster_id = 'localzone' + # allowed_hosts = undef, + # $cluster_id = 'localzone' } class { 'glance::registry': - verbose => 'True', - debug => 'True', + verbose => true, + debug => true, auth_type => 'keystone', keystone_tenant => 'services', keystone_user => 'glance', keystone_password => 'glance_password', sql_connection => 'mysql://glance:glance@127.0.0.1/glance', } - }