Module: VagrantPlugins::OpenStack::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-openstack/action.rb,
lib/vagrant-openstack/action/is_created.rb,
lib/vagrant-openstack/action/read_state.rb,
lib/vagrant-openstack/action/sync_folders.rb,
lib/vagrant-openstack/action/create_server.rb,
lib/vagrant-openstack/action/delete_server.rb,
lib/vagrant-openstack/action/connect_openstack.rb,
lib/vagrant-openstack/action/message_not_created.rb,
lib/vagrant-openstack/action/read_ssh_info_from_api.rb,
lib/vagrant-openstack/action/message_already_created.rb,
lib/vagrant-openstack/action/read_ssh_info_from_cache.rb

Defined Under Namespace

Classes: ConnectOpenStack, CreateServer, DeleteServer, IsCreated, MessageAlreadyCreated, MessageNotCreated, ReadSSHInfoFromAPI, ReadSSHInfoFromCache, ReadState, SyncFolders

Class Method Summary collapse

Class Method Details

.action_destroyObject

This action is called to destroy the remote machine.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vagrant-openstack/action.rb', line 12

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use ConnectOpenStack
      b2.use DeleteServer
    end
  end
end

.action_provisionObject



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/vagrant-openstack/action.rb', line 100

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Provision
      b2.use SyncFolders
    end
  end
end

.action_read_ssh_infoObject

This action is called to read the SSH info of the machine. The resulting state is expected to be put into the ‘:machine_ssh_info` key.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vagrant-openstack/action.rb', line 30

def self.action_read_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadSSHInfoFromCache do |env, b2|
      if !env[:machine_ssh_info]
        b2.use ConnectOpenStack
        b2.use ReadSSHInfoFromAPI
      end
    end
  end
end

.action_read_stateObject

This action is called to read the state of the machine. The resulting state is expected to be put into the ‘:machine_state_id` key.



45
46
47
48
49
50
51
# File 'lib/vagrant-openstack/action.rb', line 45

def self.action_read_state
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectOpenStack
    b.use ReadState
  end
end

.action_sshObject



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-openstack/action.rb', line 53

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use SSHExec
    end
  end
end

.action_ssh_runObject



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/vagrant-openstack/action.rb', line 67

def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use SSHRun
    end
  end
end

.action_upObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vagrant-openstack/action.rb', line 81

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use defined?(HandleBox) ? HandleBox : HandleBoxUrl
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if env[:result]
        b2.use MessageAlreadyCreated
        next
      end

      b2.use ConnectOpenStack
      b2.use Provision
      b2.use SyncFolders
      b2.use SetHostname
      b2.use CreateServer
    end
  end
end