Class: AvstCloud::PostProvisionCleanup

Inherits:
SshCommandTask show all
Defined in:
lib/avst-cloud/task.rb

Instance Method Summary collapse

Methods inherited from SshCommandTask

#ssh_command

Methods inherited from SshTask

#execute, #ssh_command

Methods inherited from Task

#execute

Methods included from Logging

included, logger, #logger, logger=, mask_message, show_passwords=

Constructor Details

#initialize(os, debug, tmp_folder = "/tmp/avst_cloud_tmp_#{Time.now.to_i}") ⇒ PostProvisionCleanup

Returns a new instance of PostProvisionCleanup.



245
246
247
# File 'lib/avst-cloud/task.rb', line 245

def initialize(os, debug, tmp_folder = "/tmp/avst_cloud_tmp_#{Time.now.to_i}")
    super(make_commands(os, tmp_folder), debug, false)
end

Instance Method Details

#make_commands(os, tmp_folder) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/avst-cloud/task.rb', line 249

def make_commands(os, tmp_folder)
    cmds = []
    case os
        when /ubuntu/, /debian/
            cmds << 'apt-get clean'

        when /centos/, /redhat/
            cmds << 'yum clean all'
    end
    cmds << "rm -rf #{tmp_folder}"
    cmds
end