Issue #21678 has been reported by Daniel Taschik.

----------------------------------------
Bug #21678: inline_template hash always different on ${title} string
https://projects.puppetlabs.com/issues/21678

* Author: Daniel Taschik
* Status: Unreviewed
* Priority: Normal
* Assignee: 
* Category: cron
* Target version: 
* Affected Puppet version: 3.2.2
* Keywords: cron
* Branch: 
----------------------------------------
I am trying to create a cron entry using the cron function. The minutes shall 
be calculated out of the title. Every time I run the manifest it creates a 
different time. Somehow the hash is always different although the title is 
still the same.
<pre><code class="ruby">
define dbbackup() {
  $app_env = $title
  file { "/etc/profile.d/set_databasebackup_setting_${app_env}.sh":
    content   => template('dbbackup/databasebackup_setting.sh'),
    ensure    => present,
  }
  file {"/opt/backups/scripts/backup_${app_env}.sh":
    mode      => '0755',
    content   => template('dbbackup/backup.sh.erb'),
    require   => File['/opt/backups/scripts'],
  }
  cron {"run_database_backup_${app_env}":
    command   => "/opt/backups/scripts/backup_${app_env}.sh #${title}",
    minute    => inline_template("<%= @title.hash.abs % 60 %>"),
    ensure    => present,
  }
</pre>
I call the define like the following:
<pre><code class="ruby">
dbbackup{'master':}
dbbackup{'staging':}
</pre>
The created cron looks like this, except the time is always changing:
<pre>
# Puppet Name: run_database_backup_master
3 * * * * /opt/backups/scripts/backup_master.sh #master
# Puppet Name: run_database_backup_staging
36 * * * * /opt/backups/scripts/backup_staging.sh #staging
</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.


Reply via email to