Refactor vcsrepo to git resource to resolve refresh trigger issues

This patchset will replace the vcsrepo with puppet-community's
git_resource and resolve the resource change notification issues.

Change-Id: I4b0fc715f89062047ed32f4f89880ced76e54f9b
This commit is contained in:
Marton Kiss 2015-10-15 16:29:39 +02:00
parent b94e39588e
commit 46a421e013
6 changed files with 55 additions and 28 deletions

View File

@ -38,7 +38,7 @@ askbot_revision parameters.
class { 'askbot':
dist_root => '/srv/dist',
site_root => '/srv/askbot-site',
askbot_revision => 'master',
askbot_branch => 'master',
askbot_repo => 'https://github.com/ASKBOT/askbot-devel.git',
www_user => 'www-data',
www_group => 'www-data',
@ -81,6 +81,6 @@ OpenStack Askbot theme contains pure Sass files in the repository, for a
production deployment those files must be compiled into css.
askbot::theme::compass { 'os':
require => Vcsrepo['/srv/askbot-site/themes'],
require => Git['askbot-theme'],
before => Exec['askbot-static-generate'],
}

View File

@ -115,16 +115,17 @@ node 'default' {
}
# custom theme
vcsrepo { '/srv/askbot-site/themes':
ensure => latest,
provider => git,
revision => 'feature/development',
source => 'https://git.openstack.org/openstack-infra/askbot-theme',
require => [
git { 'askbot-theme':
ensure => present,
path => '/srv/askbot-site/themes',
branch => 'feature/development',
origin => 'https://git.openstack.org/openstack-infra/askbot-theme',
latest => true,
require => [
File['/srv/askbot-site'], Package['git']
],
before => Exec['askbot-syncdb'],
notify => [
before => Exec['askbot-syncdb'],
notify => [
Exec['theme-bundle-install-os'],
Exec['theme-bundle-compile-os'],
Exec['askbot-static-generate'],
@ -132,7 +133,7 @@ node 'default' {
}
askbot::theme::compass { 'os':
require => Vcsrepo['/srv/askbot-site/themes'],
require => Git['askbot-theme'],
before => Exec['askbot-static-generate'],
}
}

View File

@ -12,7 +12,10 @@
#
# Source repository:
# - askbot_repo: git repository of askbot source files
# - askbot_revision: branch of askbot repo used for deployment
# - versions to checkout (askbot_revision|askbot_branch|askbot_tag)
# - askbot_revision: commit ref of askbot repo used for deployment
# - askbot_branch: branch of askbot repo
# - askbot_tag: a specific version or tag of the askbot repo
#
# Custom askbot theme settings:
# - $custom_theme_enabled: set to true to enable custom themes, default: false
@ -56,7 +59,9 @@ class askbot (
$redis_password,
$dist_root = '/srv/dist',
$site_root = '/srv/askbot-site',
$askbot_revision = 'master',
$askbot_branch = 'master',
$askbot_tag = undef,
$askbot_revision = undef,
$askbot_repo = 'https://github.com/ASKBOT/askbot-devel.git',
$www_group = 'www-data',
$www_user = 'www-data',
@ -105,12 +110,33 @@ class askbot (
}
}
vcsrepo { "${dist_root}/askbot":
ensure => $askbot_ensure,
provider => git,
revision => $askbot_revision,
source => $askbot_repo,
require => [ File[$dist_root], Package['git'] ],
if ($askbot_revision) {
git { 'askbot':
ensure => present,
path => "${dist_root}/askbot",
origin => $askbot_repo,
latest => true,
commit => $askbot_revision,
require => [ File[$dist_root], Package['git'] ],
}
} elsif ($askbot_tag) {
git { 'askbot':
ensure => present,
path => "${dist_root}/askbot",
origin => $askbot_repo,
latest => true,
tag => $askbot_tag,
require => [ File[$dist_root], Package['git'] ],
}
} else {
git { 'askbot':
ensure => present,
path => "${dist_root}/askbot",
origin => $askbot_repo,
latest => true,
branch => $askbot_branch,
require => [ File[$dist_root], Package['git'] ],
}
}
class { '::askbot::config':
@ -143,6 +169,6 @@ class askbot (
smtp_port => $smtp_port,
smtp_host => $smtp_host,
template_settings => $template_settings,
require => [ Vcsrepo["${dist_root}/askbot"], Class['askbot::install'] ],
require => [ Git['askbot'], Class['askbot::install'] ],
}
}

View File

@ -89,7 +89,7 @@ class askbot::install (
command => "/usr/askbot-env/bin/pip install -q -r ${dist_root}/askbot/askbot_requirements.txt",
cwd => "${dist_root}/askbot",
logoutput => on_failure,
subscribe => Vcsrepo["${dist_root}/askbot"],
subscribe => Git['askbot'],
refreshonly => true,
}
@ -107,7 +107,7 @@ class askbot::install (
cwd => "${dist_root}/askbot",
command => '/usr/askbot-env/bin/python setup.py -q install',
logoutput => on_failure,
subscribe => Vcsrepo["${dist_root}/askbot"],
subscribe => Git['askbot'],
refreshonly => true,
require => Exec[ 'pip-requirements-install'],
}

View File

@ -70,14 +70,14 @@ class askbot::site::config (
File["${site_root}/log"],
Askbot::Site::Setup_template[ $setup_templates ],
File["${site_root}/config/settings.py"],
Vcsrepo["${dist_root}/askbot"],
Git['askbot'],
]
exec { 'askbot-static-generate':
cwd => "${site_root}/config",
command => '/usr/askbot-env/bin/python manage.py collectstatic --noinput',
require => $post_config_dependency,
subscribe => [Vcsrepo["${dist_root}/askbot"], File["${site_root}/config/settings.py"] ],
subscribe => [Git['askbot'], File["${site_root}/config/settings.py"] ],
refreshonly => true,
}
@ -85,7 +85,7 @@ class askbot::site::config (
cwd => "${site_root}/config",
command => '/usr/askbot-env/bin/python manage.py syncdb --noinput',
require => $post_config_dependency,
subscribe => [Vcsrepo["${dist_root}/askbot"], File["${site_root}/config/settings.py"] ],
subscribe => [Git['askbot'], File["${site_root}/config/settings.py"] ],
refreshonly => true,
}
@ -94,7 +94,7 @@ class askbot::site::config (
cwd => "${site_root}/config",
command => '/usr/askbot-env/bin/python manage.py migrate --noinput',
require => Exec['askbot-syncdb'],
subscribe => [Vcsrepo["${dist_root}/askbot"], File["${site_root}/config/settings.py"] ],
subscribe => [Git['askbot'], File["${site_root}/config/settings.py"] ],
refreshonly => true,
}

View File

@ -24,7 +24,7 @@
{ "name": "puppetlabs/mysql", "version_requirement": "= 0.6.1" },
{ "name": "openstackinfra/httpd", "version_requirement": "0.x" },
{ "name": "openstackinfra/redis", "version_requirement": "= 0.0.1" },
{ "name": "openstackinfra/vcsrepo", "version_requirement": "= 0.0.1" },
{ "name": "stankevich/python", "version_requirement": "= 1.9.4" }
{ "name": "stankevich/python", "version_requirement": "= 1.9.4" },
{ "name": "puppet-community/git_resource", "version_requirement": "= 0.3.0" }
]
}