Project

General

Profile

« Previous | Next » 

Revision d63b4316

Added by Ewoud Kohl van Wijngaarden about 7 years ago

Refactor the class inclusions and chaining

View differences:

manifests/apache.pp
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
} else {
file {'/etc/httpd/conf.d/pulp.conf':
......
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
}
......
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
}
manifests/apache_plugin.pp
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
}
......
owner => 'apache',
group => 'apache',
mode => '0600',
notify => Service['httpd'],
}
}
}
manifests/broker.pp
}
}
Service <| title == $broker_service |> -> Service['pulp_celerybeat']
Service <| title == $broker_service |> -> Service['pulp_workers']
Service <| title == $broker_service |> -> Service['pulp_resource_manager']
Service <| title == $broker_service |> -> Class['pulp::service']
Service <| title == $broker_service |> -> Exec['migrate_pulp_db']
}
manifests/database.pp
if $pulp::manage_db {
include ::mongodb::server
Service['mongodb'] -> Service['pulp_celerybeat']
Service['mongodb'] -> Service['pulp_workers']
Service['mongodb'] -> Service['pulp_resource_manager']
Service['mongodb'] -> Service['pulp_streamer']
Service['mongodb'] -> Class['pulp::service']
Service['mongodb'] -> Exec['migrate_pulp_db']
}
......
logoutput => 'on_failure',
user => 'apache',
creates => '/var/lib/pulp/init.flag',
require => File['/etc/pulp/server.conf'],
timeout => $pulp::migrate_db_timeout,
}
Class['pulp::install'] ~> Exec['migrate_pulp_db'] ~> Class['pulp::service']
Class['pulp::config'] ~> Exec['migrate_pulp_db'] ~> Class['pulp::service']
}
manifests/init.pp
}
include ::mongodb::client
include ::pulp::apache
include ::pulp::database
include ::pulp::broker
if $enable_crane {
......
}
}
class { '::pulp::install': } ->
class { '::pulp::config': } ~>
class { '::pulp::service': } ->
Class[pulp] ~>
Service['httpd']
contain ::pulp::install
contain ::pulp::config
contain ::pulp::database
contain ::pulp::service
contain ::pulp::apache
Class['pulp::install'] -> Class['pulp::config'] -> Class['pulp::database'] ~> Class['pulp::service', 'pulp::apache']
}
spec/classes/pulp_spec.rb
on_supported_os['redhat-7-x86_64']
end
it { should contain_class('pulp::install') }
it { should contain_class('pulp::config') }
it { should contain_class('pulp::service') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('pulp::install') }
it { is_expected.to contain_class('pulp::config') }
it { is_expected.to contain_class('pulp::broker') }
it { is_expected.to contain_class('pulp::database') }
it { is_expected.to contain_class('pulp::apache') }
it { is_expected.to contain_class('pulp::service') }
services = ['Service[pulp_celerybeat]', 'Service[pulp_workers]', 'Service[pulp_resource_manager]', 'Service[pulp_streamer]']
it { is_expected.to contain_apache__vhost('pulp-https') }
it { is_expected.to contain_exec('migrate_pulp_db').that_notifies(services + ['Apache::Vhost[pulp-https]']) }
it { is_expected.to contain_service('mongodb').that_comes_before(services) }
it { is_expected.to contain_service('qpidd').that_comes_before(services) }
end
end
spec/defines/pulp_apache_fragment_spec.rb
{ :ssl_content => "some_string" }
end
it do
should contain_concat__fragment("fragment_title").with_content('some_string')
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_concat__fragment("fragment_title").with_content('some_string') }
end
end
spec/defines/pulp_apache_plugin_spec.rb
require 'spec_helper'
describe 'pulp::apache_plugin' do
let :title do
'python'
end
let :pre_condition do
'service { "httpd": }'
end
context 'with default parameters' do
it { is_expected.to compile.with_all_deps }
it do
verify_exact_contents(catalogue, '/etc/httpd/conf.d/pulp_python.conf', [
'Alias /pulp/python /var/www/pub/python/',
'<Directory /var/www/pub/python>',
' Options FollowSymLinks Indexes',
'</Directory>',
])
end
it do
verify_exact_contents(catalogue, '/etc/pulp/vhosts80/python.conf', [])
end
end
context 'with parameters set to false' do
let :params do
{
:confd => false,
:vhosts80 => false,
}
end
it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_file('/etc/httpd/conf.d/pulp_python.conf') }
it { is_expected.not_to contain_file('/etc/pulp/vhosts80/python.conf') }
end
end

Also available in: Unified diff