diff options
author | Jorie Tappa <jorie@jorietappa.com> | 2018-08-01 16:51:24 -0500 |
---|---|---|
committer | Jorie Tappa <jorie@jorietappa.com> | 2018-08-01 16:51:24 -0500 |
commit | 6e4c49d512272fcfe363867bcc82943168ac0361 (patch) | |
tree | 6db34e918186e5963e07202c13f1331e7a18a614 /lib/puppet/provider | |
parent | ab27f19f5cc54322ec7fe2c4e970f3a54d40881f (diff) | |
download | puppet-cron_core-6e4c49d512272fcfe363867bcc82943168ac0361.tar.gz puppet-cron_core-6e4c49d512272fcfe363867bcc82943168ac0361.tar.bz2 |
Fix Lint/AssignmentInCondition violations.
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r-- | lib/puppet/provider/cron/crontab.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/puppet/provider/cron/crontab.rb b/lib/puppet/provider/cron/crontab.rb index a664629..e2cb6b6 100644 --- a/lib/puppet/provider/cron/crontab.rb +++ b/lib/puppet/provider/cron/crontab.rb @@ -34,11 +34,16 @@ Puppet::Type.type(:cron).provide(:crontab, parent: Puppet::Provider::ParsedFile, def post_parse(record) time = record.delete(:time) - if match = %r{@(\S+)}.match(time) + match = %r{@(\S+)}.match(time) + if match # is there another way to access the constant? Puppet::Type::Cron::ProviderCrontab::TIME_FIELDS.each { |f| record[f] = :absent } record[:special] = match.captures[0] - elsif match = %r{(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)}.match(time) + return record + end + + match = %r{(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)}.match(time) + if match record[:special] = :absent Puppet::Type::Cron::ProviderCrontab::TIME_FIELDS.zip(match.captures).each do |field, value| record[field] = if value == absent @@ -47,10 +52,11 @@ Puppet::Type.type(:cron).provide(:crontab, parent: Puppet::Provider::ParsedFile, value.split(',') end end - else - raise Puppet::Error, _('Line got parsed as a crontab entry but cannot be handled. Please file a bug with the contents of your crontab') + + return record end - record + + raise Puppet::Error, _('Line got parsed as a crontab entry but cannot be handled. Please file a bug with the contents of your crontab') end def pre_gen(record) |