Class: InstanceAgent::CodeDeployPlugin::RemoveCommand
- Inherits:
-
Object
- Object
- InstanceAgent::CodeDeployPlugin::RemoveCommand
- Defined in:
- lib/instance_agent/codedeploy_plugin/install_instruction.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(location) ⇒ RemoveCommand
constructor
A new instance of RemoveCommand.
Constructor Details
#initialize(location) ⇒ RemoveCommand
Returns a new instance of RemoveCommand.
189 190 191 |
# File 'lib/instance_agent/codedeploy_plugin/install_instruction.rb', line 189 def initialize(location) @file_path = location end |
Instance Method Details
#execute ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/instance_agent/codedeploy_plugin/install_instruction.rb', line 192 def execute #If the file doesn't exist the command is ignored if File.exist?(@file_path) if File.directory?(@file_path) # TODO (AWSGLUE-713): handle the exception if the directory is non-empty; # this might mean the customer has put files in this directory and we should # probably ignore the error and move on FileUtils.rmdir(@file_path) else FileUtils.rm(@file_path) end end end |