Class: VagrantSubutai::Cleanup
- Inherits:
-
Object
- Object
- VagrantSubutai::Cleanup
- Defined in:
- lib/vagrant-subutai/cleanup.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
Instance Method Summary collapse
-
#cleanup ⇒ Object
This is the method called when destroying a machine that allows for any state related to the machine created by the provisioner to be cleaned up.
-
#configure(root_config) ⇒ Object
Called with the root configuration of the machine so the provisioner can add some configuration on top of the machine.
-
#initialize(machine, config) ⇒ Cleanup
constructor
Initializes the provisioner with the machine that it will be provisioning along with the provisioner configuration (if there is any).
-
#provision ⇒ Object
This is the method called when the actual provisioning should be done.
Constructor Details
#initialize(machine, config) ⇒ Cleanup
Initializes the provisioner with the machine that it will be provisioning along with the provisioner configuration (if there is any).
The provisioner should not do anything at this point except initialize internal state.
18 19 20 21 |
# File 'lib/vagrant-subutai/cleanup.rb', line 18 def initialize(machine, config) @machine = machine @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/vagrant-subutai/cleanup.rb', line 7 def config @config end |
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
6 7 8 |
# File 'lib/vagrant-subutai/cleanup.rb', line 6 def machine @machine end |
Instance Method Details
#cleanup ⇒ Object
This is the method called when destroying a machine that allows for any state related to the machine created by the provisioner to be cleaned up.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/vagrant-subutai/cleanup.rb', line 47 def cleanup case SubutaiConfig.provider when :hyper_v SubutaiDisk.hyperv_remove_disk end # cleanup virtual disks disks = SubutaiConfig.get(:_DISK_PATHES) unless disks.nil? disks.keys.each do |key| if File.exist?(disks[key]) begin File.delete(disks[key]) puts "==> default: Deleted file: #{disks[key]}" rescue Errno::EACCES puts "==> default: (Permission denied) Failed delete file: #{disks[key]}" end end end end # cleanup generated files if File.exist?(SubutaiConfig::GENERATED_FILE) begin File.delete SubutaiConfig::GENERATED_FILE puts "==> default: Deleted file: #{SubutaiConfig::GENERATED_FILE}" rescue Errno::EACCES puts "==> default: (Permission denied) Failed delete file: #{SubutaiConfig::GENERATED_FILE}" end end end |
#configure(root_config) ⇒ Object
Called with the root configuration of the machine so the provisioner can add some configuration on top of the machine.
During this step, and this step only, the provisioner should modify the root machine configuration to add any additional features it may need. Examples include sharing folders, networking, and so on. This step is guaranteed to be called before any of those steps are done so the provisioner may do that.
No return value is expected.
33 34 |
# File 'lib/vagrant-subutai/cleanup.rb', line 33 def configure(root_config) end |
#provision ⇒ Object
This is the method called when the actual provisioning should be done. The communicator is guaranteed to be ready at this point, and any shared folders or networks are already setup.
No return value is expected.
41 42 |
# File 'lib/vagrant-subutai/cleanup.rb', line 41 def provision end |