Class: Nucleon::Action::Cloud::Vagrantfile
- Inherits:
-
Object
- Object
- Nucleon::Action::Cloud::Vagrantfile
- Defined in:
- lib/nucleon/action/cloud/vagrantfile.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Action operations.
Class Method Details
.describe ⇒ Object
Info
10 11 12 |
# File 'lib/nucleon/action/cloud/vagrantfile.rb', line 10 def self.describe super(:cloud, :vagrantfile, 800) end |
Instance Method Details
#configure ⇒ Object
Settings
17 18 19 20 21 22 23 |
# File 'lib/nucleon/action/cloud/vagrantfile.rb', line 17 def configure super do codes :vagrant_backup_failure, :vagrant_save_failure, :network_save_failure end end |
#execute ⇒ Object
Action operations
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/nucleon/action/cloud/vagrantfile.rb', line 28 def execute super do |node, network| info('corl.actions.vagrantfile.start') ensure_network(network) do generated_vagrantfile_name = File.join(CORL.lib_path, 'core', 'vagrant', 'Vagrantfile') project_vagrantfile_name = File.join(network.directory, 'Vagrantfile') success = true corl_vagrantfile = Util::Disk.read(generated_vagrantfile_name) if File.exists?(project_vagrantfile_name) unless FileUtils.mv(project_vagrantfile_name, "#{project_vagrantfile_name}.backup", :force => true) myself.status = code.vagrant_backup_failure success = false end end if success unless Util::Disk.write(project_vagrantfile_name, corl_vagrantfile) myself.status = code.vagrant_save_failure success = false end if success unless network.save({ :files => 'Vagrantfile' }) myself.status = code.network_save_failure end end end end end end |