Issue #22224 has been updated by Patrick Hemmer.
Here is the entire defined type which contained the error. The error I had was
on the `File["$dest_base/$package_name"]`.
<pre>
define cloud::app (
$source = undef,
$source_s3 = undef,
$env = {},
$engine = 'puma',
$engine_args = undef,
$proxy = 'haproxy',
$nosvc = false,
$controlscript = false,
$foreman = false,
$workers = 3,
$checks = [],
$nginx_options = [],
) {
validate_re("$source$source_s3", '.+', 'Must provide $source or $source_s3')
require cloud::app::base
$env_merge = merge($::cloud::app::base::env, $env)
$user = $::cloud::app::base::user
$dest_base = "${::cloud::app::base::home}/$name"
$app_dir = "$dest_base/current"
if "$source_s3" != "" {
$file_name = inline_template('<%= @source_s3.split("/")[-1] %>')
$package_name = inline_template('<%= @file_name.sub(/\.[^\.]*$/, "") %>')
include ptools::aws::s3cmd
exec { "$dest_base/$file_name":
provider => 'shell',
creates => "$dest_base/$file_name",
command => "s3cmd -c /etc/s3cmd-shared.cfg get 's3://$source_s3'
'$dest_base/$file_name'",
require => [ Class['ptools::aws::s3cmd'], File[$dest_base], ],
}
file { "$dest_base/$file_name":
ensure => file,
owner => $::cloud::app::base::user,
group => $::cloud::app::base::user_group,
require => Exec["$dest_base/$package_name"],
}
file { "$dest_base/$package_name":
ensure => directory,
owner => $::cloud::app::base::user,
group => $::cloud::app::base::user_group,
require => File["$dest_base/$package_name"],
}
exec { "$dest_base/$package_name":
provider => 'shell',
cwd => $dest_base,
creates => "$dest_base/$package_name",
command => "tar xzf '$dest_base/$file_name'",
require => Exec["$dest_base/$file_name"],
before => Anchor["base $name"],
}
ruby::application { $name:
source => "$dest_base/$package_name",
dest => $dest_base,
env_vars => $env_merge,
user => $user,
}
} else {
ruby::application { $name:
source => $source,
dest => $dest_base,
env_vars => $env_merge,
user => $user,
}
}
if !str2bool("$nosvc") {
case $engine {
'puma': {
$listeners = ['127.0.0.1:3000']
$rack_engine_args = "$engine_args -w $workers"
}
default: {
$ports = range(3000, 3000 + $workers)
$listeners = prefix($ports, '127.0.0.1:')
$rack_engine_args = $engine_args
}
}
ruby::application::service::rack { $name:
dir => $app_dir,
user => $user,
bundle => true,
engine => $engine,
args => $rack_engine_args,
listen => $listeners,
boot => false,
subscribe => Exec["reload $name"],
}
case $proxy {
'haproxy': {
ruby::application::proxy::haproxy { $name:
destinations => $listeners,
options => {
capture_headers => [ 'X-Request-Id' ],
},
require => Ruby::Application::Service::Rack[$name],
} -> anchor { "$name proxy": }
}
'nginx': {
ruby::application::proxy::nginx { $name:
dir => $app_dir,
destinations => $listeners,
require => Ruby::Application::Service::Rack[$name],
options => $nginx_options,
} -> anchor { "$name proxy": }
}
default: {
fail("Unsupported proxy type '$proxy'")
}
}
monitoring::check::utilization::script { 'httping':
source => 'puppet:///modules/cloud/app/httping.sh',
require => Anchor["$name proxy"],
}
if member($checks, 'version') {
monitoring::check::cloud_app_version { $name:
app_dir => $app_dir,
require => Ruby::Application[$name],
}
}
if member($checks, 'date') {
monitoring::check::cloud_app_date { $name:
require => Ruby::Application[$name],
}
}
if member($checks, 'migrations') {
file { "/etc/puppet/asirun-post.d/${name}-migrations.sh":
content => template('cloud/asirun-post-db_migrations.sh.erb'),
mode => '0755',
require => Anchor["$name proxy"],
}
}
if str2bool("$controlscript") {
ruby::application::service::script { "$name-workers":
path => 'script/control.sh',
boot => false,
dir => $app_dir,
user => $user,
require => Ruby::Application[$name],
subscribe => Exec["reload $name"],
}
}
if "$foreman" != "false" and "$foreman" != "" {
if "$foreman" == "true" {
$foreman_procfile = "Procfile"
} else {
$foreman_procfile = $foreman
}
ruby::application::service::foreman { $name:
procfile => $foreman_procfile,
boot => false,
dir => $app_dir,
user => $user,
require => Ruby::Application[$name],
subscribe => Exec["reload $name"],
}
}
}
}
</pre>
----------------------------------------
Bug #22224: Exec scheduled for refresh never runs
https://projects.puppetlabs.com/issues/22224#change-96521
* Author: Patrick Hemmer
* Status: Unreviewed
* Priority: Normal
* Assignee:
* Category: agent
* Target version:
* Affected Puppet version: 3.2.2
* Keywords: refresh, agent
* Branch:
----------------------------------------
I have an exec resource which gets scheduled for a refresh due to a subscribe
rule, however the exec never runs. It has no `unless`/`onlyif`/`creates`
parameter, only `refreshonly`.
Below is an example of the `puppet agent` run output. Notice the last 3 lines.
<pre>
Info: Applying configuration version 'v g
55af2aa10a16a0ddff20c656fb2eadcf16864dfb+2:aa3a8da'
Notice:
/Stage[main]/Cloud::Db/Postgresql::Db[dashboard]/Postgresql::Database[dashboard]/Postgresql_psql[Check
for existence of db 'dashboard']/command: command changed '' to 'SELECT 1'
Info:
/Stage[main]/Cloud::Db/Postgresql::Db[dashboard]/Postgresql::Database[dashboard]/Postgresql_psql[Check
for existence of db 'dashboard']: Scheduling refresh of
Exec[/usr/lib/postgresql/9.1/bin/createdb --template=template0 --encoding
'utf8' --locale=C 'dashboard']
Notice:
/Stage[main]/Cloud::Db/Postgresql::Db[dashboard]/Postgresql::Database[dashboard]/Exec[/usr/lib/postgresql/9.1/bin/createdb
--template=template0 --encoding 'utf8' --locale=C 'dashboard']: Triggered
'refresh' from 1 events
Info:
/Stage[main]/Cloud::Db/Postgresql::Db[dashboard]/Postgresql::Database[dashboard]/Exec[/usr/lib/postgresql/9.1/bin/createdb
--template=template0 --encoding 'utf8' --locale=C 'dashboard']: Scheduling
refresh of Postgresql_psql[REVOKE CONNECT ON DATABASE dashboard FROM public]
Notice:
/Stage[main]/Cloud::Db/Postgresql::Db[dashboard]/Postgresql::Database[dashboard]/Postgresql_psql[REVOKE
CONNECT ON DATABASE dashboard FROM public]: Triggered 'refresh' from 1 events
Notice:
/Stage[main]/Cloud::Db/Postgresql::Db[dashboard]/Postgresql::Database_grant[GRANT
dashboard - ALL - dashboard]/Postgresql_psql[GRANT ALL ON database dashboard
TO dashboard]/command: command changed '' to 'GRANT ALL ON database dashboard
TO dashboard'
Info: Postgresql::Db[dashboard]: Scheduling refresh of Exec[rake db:setup]
Notice:
/Stage[main]/Cloud::Db/Cloud::Db::Extension[hstore]/Exec[postgres-dashboard
extension hstore]/returns: executed successfully
Notice: Finished catalog run in 100.17 seconds
</pre>
I can reproduce this every time, however I have been unable to duplicate this
in a small stripped down config, and I can't share my entire repo. So I can
gather additional info as requested.
Attached is the `puppet agent -td --debug --evaltrace` output.
This is what the resource looks like:
<pre>
exec { 'rake db:setup':
provider => 'shell',
refreshonly => true,
user => $::cloud::app::base::user,
cwd => "/webapps/$app_name/current",
environment => [ "HOME=/webapps/$app_name/current/tmp" ],
command => ". config/env; bundle exec rake $task",
subscribe => Postgresql::Db[$cloud::db::db_name],
require => [ Class['cloud::db'], Class[$app_class], ],
}
</pre>
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.