Class: InstanceAgent::Plugins::CodeDeployPlugin::ChangeOwnerCommand
- Inherits:
-
Object
- Object
- InstanceAgent::Plugins::CodeDeployPlugin::ChangeOwnerCommand
- Defined in:
- lib/instance_agent/plugins/codedeploy/install_instruction.rb
Instance Method Summary collapse
- #execute(cleanup_file) ⇒ Object
-
#initialize(object, owner, group) ⇒ ChangeOwnerCommand
constructor
A new instance of ChangeOwnerCommand.
- #to_h ⇒ Object
Constructor Details
#initialize(object, owner, group) ⇒ ChangeOwnerCommand
328 329 330 331 332 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 328 def initialize(object, owner, group) @object = object @owner = owner @group = group end |
Instance Method Details
#execute(cleanup_file) ⇒ Object
334 335 336 337 338 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 334 def execute(cleanup_file) ownerid = Etc.getpwnam(@owner).uid if @owner groupid = Etc.getgrnam(@group).gid if @group File.chown(ownerid, groupid, @object) end |
#to_h ⇒ Object
340 341 342 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 340 def to_h {:type => :chown, :owner => @owner, :group => @group, :file => @object} end |