Various Puppet lint fixes

* Fix following warnings:
    * double quoted string containing no variables
    * indentation of => is not properly aligned
    * quoted boolean value found
    * variable not enclosed in {}
* Fix following errors:
    * two-space soft tabs not used
* Remove quotes around class in include/require statements
* Remove some comments from the code, they added no value

Change-Id: I341b37f2c6795951f3285037b2fa612d767a4474
This commit is contained in:
Mathieu Gagné 2013-07-01 17:24:57 -04:00
parent ffbe1c566f
commit d5567e6aef
10 changed files with 42 additions and 47 deletions

View File

@ -1,5 +1,5 @@
# #
# == Paremeters: # == Parameters
# #
# #
# * keystone_password Password used to authemn # * keystone_password Password used to authemn
@ -63,8 +63,7 @@ class glance::api(
$sql_connection = 'sqlite:///var/lib/glance/glance.sqlite' $sql_connection = 'sqlite:///var/lib/glance/glance.sqlite'
) inherits glance { ) inherits glance {
# used to configure concat require keystone::python
require 'keystone::python'
validate_re($sql_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') validate_re($sql_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
@ -125,7 +124,8 @@ class glance::api(
} }
# db connection config # 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... # TODO figure out if I need this...
glance_api_config { glance_api_config {
'DEFAULT/sql_connection': value => $sql_connection; 'DEFAULT/sql_connection': value => $sql_connection;
@ -134,9 +134,9 @@ class glance::api(
# auth config # auth config
glance_api_config { glance_api_config {
'keystone_authtoken/auth_host': value => $auth_host; 'keystone_authtoken/auth_host': value => $auth_host;
'keystone_authtoken/auth_port': value => $auth_port; 'keystone_authtoken/auth_port': value => $auth_port;
'keystone_authtoken/auth_protocol': value => $auth_protocol; 'keystone_authtoken/auth_protocol': value => $auth_protocol;
} }
if $auth_admin_prefix { if $auth_admin_prefix {
@ -179,8 +179,7 @@ class glance::api(
file { ['/etc/glance/glance-api.conf', file { ['/etc/glance/glance-api.conf',
'/etc/glance/glance-api-paste.ini', '/etc/glance/glance-api-paste.ini',
'/etc/glance/glance-cache.conf' '/etc/glance/glance-cache.conf']:
]:
} }
if $enabled { if $enabled {

View File

@ -16,20 +16,19 @@ class glance::db::mysql(
Class['glance::db::mysql'] -> Exec<| title == 'glance-manage db_sync' |> Class['glance::db::mysql'] -> Exec<| title == 'glance-manage db_sync' |>
Database[$dbname] ~> Exec<| title == 'glance-manage db_sync' |> Database[$dbname] ~> Exec<| title == 'glance-manage db_sync' |>
require 'mysql::python' require mysql::python
mysql::db { $dbname: mysql::db { $dbname:
user => $user, user => $user,
password => $password, password => $password,
host => $host, host => $host,
charset => $charset, charset => $charset,
# I may want to inject some sql
require => Class['mysql::config'], require => Class['mysql::config'],
} }
if $allowed_hosts { if $allowed_hosts {
# TODO this class should be in the mysql namespace # TODO this class should be in the mysql namespace
glance::db::mysql::host_access { $allowed_hosts: glance::db::mysql::host_access { $allowed_hosts:
user => $user, user => $user,
password => $password, password => $password,
database => $dbname, database => $dbname,

View File

@ -4,13 +4,13 @@
define glance::db::mysql::host_access ($user, $password, $database) { define glance::db::mysql::host_access ($user, $password, $database) {
database_user { "${user}@${name}": database_user { "${user}@${name}":
password_hash => mysql_password($password), password_hash => mysql_password($password),
provider => 'mysql', provider => 'mysql',
require => Database[$database], require => Database[$database],
} }
database_grant { "${user}@${name}/${database}": database_grant { "${user}@${name}/${database}":
# TODO figure out which privileges to grant. # TODO figure out which privileges to grant.
privileges => "all", privileges => 'all',
provider => 'mysql', provider => 'mysql',
require => Database_user["${user}@${name}"] require => Database_user["${user}@${name}"]
} }
} }

View File

@ -8,14 +8,14 @@ class glance::db::postgresql(
$user = 'glance' $user = 'glance'
) { ) {
require 'postgresql::python' require postgresql::python
Postgresql::Db[$dbname] ~> Exec<| title == 'glance-manage db_sync' |> Postgresql::Db[$dbname] ~> Exec<| title == 'glance-manage db_sync' |>
Package['python-psycopg2'] -> Exec<| title == 'glance-manage db_sync' |> Package['python-psycopg2'] -> Exec<| title == 'glance-manage db_sync' |>
postgresql::db { "${dbname}": postgresql::db { $dbname:
user => "${user}", user => $user,
password => "${password}", password => $password,
} }
} }

View File

@ -38,17 +38,20 @@ class glance::keystone::auth(
email => $email, email => $email,
tenant => $tenant, tenant => $tenant,
} }
keystone_user_role { "${auth_name}@${tenant}": keystone_user_role { "${auth_name}@${tenant}":
ensure => present, ensure => present,
roles => 'admin', roles => 'admin',
} }
keystone_service { $auth_name: keystone_service { $auth_name:
ensure => present, ensure => present,
type => $service_type, type => $service_type,
description => "Openstack Image Service", description => 'Openstack Image Service',
} }
if $configure_endpoint { if $configure_endpoint {
keystone_endpoint { "${region}/$auth_name": keystone_endpoint { "${region}/${auth_name}":
ensure => present, ensure => present,
public_url => "${public_protocol}://${public_address}:${port}", public_url => "${public_protocol}://${public_address}:${port}",
admin_url => "http://${admin_address}:${port}", admin_url => "http://${admin_address}:${port}",

View File

@ -81,7 +81,7 @@ class glance::registry(
$enabled = true $enabled = true
) inherits glance { ) inherits glance {
require 'keystone::python' require keystone::python
validate_re($sql_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') 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+/) { 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 =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
} elsif($sql_connection =~ /sqlite:\/\//) { } elsif($sql_connection =~ /sqlite:\/\//) {
@ -108,7 +108,6 @@ class glance::registry(
fail("Invalid db connection ${sql_connection}") fail("Invalid db connection ${sql_connection}")
} }
# basic service config
glance_registry_config { glance_registry_config {
'DEFAULT/verbose': value => $verbose; 'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug; 'DEFAULT/debug': value => $debug;
@ -116,7 +115,6 @@ class glance::registry(
'DEFAULT/bind_port': value => $bind_port; 'DEFAULT/bind_port': value => $bind_port;
} }
# db connection config
glance_registry_config { glance_registry_config {
'DEFAULT/sql_connection': value => $sql_connection; 'DEFAULT/sql_connection': value => $sql_connection;
'DEFAULT/sql_idle_timeout': value => $sql_idle_timeout; 'DEFAULT/sql_idle_timeout': value => $sql_idle_timeout;
@ -162,8 +160,7 @@ class glance::registry(
} }
file { ['/etc/glance/glance-registry.conf', file { ['/etc/glance/glance-registry.conf',
'/etc/glance/glance-registry-paste.ini' '/etc/glance/glance-registry-paste.ini']:
]:
} }
if $enabled { if $enabled {

View File

@ -1,5 +1,3 @@
class glance::scrubber ( class glance::scrubber {
fail('glance::scrubber needs to be implemented')
) {
fail("glance::scrubber needs to be implemented")
} }

View File

@ -1,4 +1,4 @@
class { 'glance::api': class { 'glance::api':
debug => 'true', debug => true,
verbose => 'true', verbose => true,
} }

View File

@ -1,4 +1,4 @@
class { 'glance::registry': class { 'glance::registry':
debug =>'true', debug => true,
verbose => 'true', verbose => true,
} }

View File

@ -6,8 +6,8 @@ Exec { logoutput => 'on_failure' }
node glance_keystone_mysql { node glance_keystone_mysql {
class { 'mysql::server': } class { 'mysql::server': }
class { 'keystone': class { 'keystone':
verbose => true, verbose => true,
debug => true, debug => true,
catalog_type => 'sql', catalog_type => 'sql',
admin_token => 'admin_token', admin_token => 'admin_token',
} }
@ -31,8 +31,8 @@ node default {
class role_glance_mysql { class role_glance_mysql {
class { 'glance::api': class { 'glance::api':
verbose => 'True', verbose => true,
debug => 'True', debug => true,
auth_type => 'keystone', auth_type => 'keystone',
keystone_tenant => 'services', keystone_tenant => 'services',
keystone_user => 'glance', keystone_user => 'glance',
@ -46,18 +46,17 @@ class role_glance_mysql {
dbname => 'glance', dbname => 'glance',
user => 'glance', user => 'glance',
host => '127.0.0.1', host => '127.0.0.1',
# allowed_hosts = undef, # allowed_hosts = undef,
# $cluster_id = 'localzone' # $cluster_id = 'localzone'
} }
class { 'glance::registry': class { 'glance::registry':
verbose => 'True', verbose => true,
debug => 'True', debug => true,
auth_type => 'keystone', auth_type => 'keystone',
keystone_tenant => 'services', keystone_tenant => 'services',
keystone_user => 'glance', keystone_user => 'glance',
keystone_password => 'glance_password', keystone_password => 'glance_password',
sql_connection => 'mysql://glance:glance@127.0.0.1/glance', sql_connection => 'mysql://glance:glance@127.0.0.1/glance',
} }
} }