Puppet: System Administration Automated

Support

Ticket #1007 (closed refactor: fixed)

Opened 8 months ago

Last modified 7 months ago

exec type has paramater 'env' whereas cron type has parameter 'environment'

Reported by: Fujin Assigned to: luke
Priority: normal Milestone: unplanned
Component: library Version: 0.24.1
Severity: minor Keywords: exec cron env environment
Cc: Triage Stage: Ready for checkin
Attached Patches: Tests Complexity: Trivial

Description

Not sure if there was a particular reason for this, but for consistency across the types I've patched exec.rb so that env is now environment, as per the cron{} type.

Please feel free to shoot me down if there was some smart reason for this ;) They appear to behave identically, so I naturally assumed they'd be identical.

Attachments

exec.rb.patch (2.4 kB) - added by Fujin on 01/15/08 09:51:11.
path for exec.rb to change env to environment

Change History

(in reply to: ↑ description ) 01/15/08 09:17:16 changed by Fujin

root@puppet:/tmp# cat test.pp
exec {
   "/usr/bin/env > /tmp/env":
      environment => [
                        "HOME=/tmp/poos/and/wees",
                        "PATH=/usr/bin:/usr/bin/poo"
                     ];
}
root@puppet:/tmp# puppet --verbose --debug test.pp
info: Loading fact interfaces
info: Loading fact netmask
info: Loading fact acpi_available
debug: Creating default schedules
debug: //Exec[/usr/bin/env > /tmp/env]: Changing returns
debug: //Exec[/usr/bin/env > /tmp/env]: 1 change(s)
debug: //Exec[/usr/bin/env > /tmp/env]: Executing '/usr/bin/env > /tmp/env'
debug: Executing '/usr/bin/env > /tmp/env'
notice: //Exec[/usr/bin/env > /tmp/env]/returns: executed successfully
debug: Finishing transaction -610447648 with 1 changes
root@puppet:/tmp# egrep "HOME|PATH" env
HOME=/tmp/poos/and/wees
PATH=/usr/bin:/usr/bin/poo

01/15/08 09:51:11 changed by Fujin

  • attachment exec.rb.patch added.

path for exec.rb to change env to environment

01/22/08 02:02:48 changed by plathrop

  • status changed from new to assigned.
  • severity changed from normal to minor.
  • complexity changed from Unknown to Trivial.
  • owner changed from community to plathrop.
  • type changed from defect to refactor.
  • stage changed from Unreviewed to Ready for checkin.

Patch looks good to me. I've made this patch available in my public repo as commit [3a3516522245e9ca01f97703e06a91b092cfb099] of branch 0.24.x

01/22/08 02:14:32 changed by plathrop

  • owner changed from plathrop to luke.
  • status changed from assigned to new.
  • milestone set to unplanned.

02/05/08 07:06:22 changed by luke

  • stage changed from Ready for checkin to Accepted.
  • patch changed from Code to Insufficient.

Unfortunately, this test breaks backward compatibility.

Please make a non-functional :env parameter that just throws a warning and sets :environment, something like:

newparam(:env)
  munge do |value|
    warning "'env' is deprecated on exec; use 'environment'"
    resource[:environment] = value
  end
end

Please also include at least one test demonstrating that using the :env parameter will correctly set the :environment parameter.

02/05/08 23:03:07 changed by plathrop

  • owner changed from luke to plathrop.
  • status changed from new to assigned.

(follow-up: ↓ 7 ) 02/05/08 23:08:32 changed by plathrop

  • owner changed from plathrop to luke.
  • status changed from assigned to new.
  • stage changed from Accepted to Ready for checkin.
  • patch changed from Insufficient to Tests.

Added :env parameter and tests in commit 8f0d87d498ca12417a7d20b81ba46465658fa210 of branch fix-1007 in my repository.

The existing test already demonstrates that using :env correctly sets :environment. I also added a test that shows that :environment works.

I hope this is better than my first attempt :-D

(in reply to: ↑ 6 ) 02/06/08 07:15:07 changed by Fujin

Replying to plathrop:

Added :env parameter and tests in commit 8f0d87d498ca12417a7d20b81ba46465658fa210 of branch fix-1007 in my repository. The existing test already demonstrates that using :env correctly sets :environment. I also added a test that shows that :environment works. I hope this is better than my first attempt :-D

Thanks for finishing this off :)

02/07/08 19:58:15 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Pushed.