class InstanceAgent::Plugins::CodeDeployPlugin::ChangeAclCommand
Public Class Methods
new(object, acl)
click to toggle source
# File lib/instance_agent/plugins/codedeploy/install_instruction.rb, line 278 def initialize(object, acl) @object = object @acl = acl end
Public Instance Methods
clear_full_acl()
click to toggle source
# File lib/instance_agent/plugins/codedeploy/install_instruction.rb, line 295 def clear_full_acl @acl.clear_additional end
execute(cleanup_file)
click to toggle source
# File lib/instance_agent/plugins/codedeploy/install_instruction.rb, line 283 def execute(cleanup_file) begin get_full_acl acl = @acl.get_acl.join(",") if !system("setfacl --set #{acl} #{@object}") raise "Unable to set acl correctly: setfacl --set #{acl} #{@object}, exit code: #{$?}" end ensure clear_full_acl end end
get_full_acl()
click to toggle source
# File lib/instance_agent/plugins/codedeploy/install_instruction.rb, line 299 def get_full_acl() perm = "%o" % File.stat(@object).mode perm = perm[-3,3] @acl.add_ace(":#{perm[0]}") @acl.add_ace("g::#{perm[1]}") @acl.add_ace("o::#{perm[2]}") if @acl.has_base_named? && !@acl.has_base_mask? @acl.add_ace("m::#{perm[1]}") end if @acl.has_default? if !@acl.has_default_user? @acl.add_ace("d::#{perm[0]}") end if !@acl.has_default_group? @acl.add_ace("d:g::#{perm[1]}") end if !@acl.has_default_other? @acl.add_ace("d:o:#{perm[2]}") end if @acl.has_default_named? && !@acl.has_default_mask? @acl.add_ace(@acl.get_default_group_ace.sub("group:","mask")) end end end
to_h()
click to toggle source
# File lib/instance_agent/plugins/codedeploy/install_instruction.rb, line 324 def to_h {:type => :setfacl, :acl => @acl.get_acl, :file => @object} end