vagrant-nodemaster 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +10 -0
- data/README.md +2 -1
- data/lib/vagrant-nodemaster/node/nodeadd.rb +14 -3
- data/lib/vagrant-nodemaster/node/nodedbmanager.rb +187 -167
- data/lib/vagrant-nodemaster/node/nodeimport.rb +92 -0
- data/lib/vagrant-nodemaster/node/nodeinfo.rb +10 -2
- data/lib/vagrant-nodemaster/node/nodeoperation.rb +39 -0
- data/lib/vagrant-nodemaster/node/nodeoperationlast.rb +12 -2
- data/lib/vagrant-nodemaster/node/nodeoperationshow.rb +32 -18
- data/lib/vagrant-nodemaster/node/nodestatus.rb +1 -1
- data/lib/vagrant-nodemaster/nodecommand.rb +28 -12
- data/lib/vagrant-nodemaster/remote/remotebackuptake.rb +6 -6
- data/lib/vagrant-nodemaster/remote/remoteconfigcommand.rb +0 -3
- data/lib/vagrant-nodemaster/remote/remotehalt.rb +6 -4
- data/lib/vagrant-nodemaster/remote/remotesnapshotcommand.rb +0 -3
- data/lib/vagrant-nodemaster/remote/remotesnapshotrestore.rb +5 -5
- data/lib/vagrant-nodemaster/remote/remotesnapshottake.rb +8 -8
- data/lib/vagrant-nodemaster/remote/remotesuspend.rb +3 -3
- data/lib/vagrant-nodemaster/remote/remoteup.rb +1 -0
- data/lib/vagrant-nodemaster/remote/remotevminfo.rb +1 -1
- data/lib/vagrant-nodemaster/remotecommand.rb +4 -16
- data/lib/vagrant-nodemaster/requestcontroller.rb +28 -26
- data/lib/vagrant-nodemaster/version.rb +1 -1
- metadata +5 -2
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
vagrant-nodemaster
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Insertado la descarga de la configuración de los nodos
|
5
|
+
* Insertada la adición y eliminación de máquinas virtuales a la configuración de los
|
6
|
+
nodos remotos
|
7
|
+
* Añadida la funcionalidad de hacer upload de una configuración a un nodo y machacar
|
8
|
+
el contenido existente
|
9
|
+
|
10
|
+
|
data/README.md
CHANGED
@@ -2,11 +2,12 @@ vagrant-nodemaster
|
|
2
2
|
==================
|
3
3
|
This plugin allows you to control centralizely remote virtual environments configured with the plugin [Vagrant-Node](https://github.com/fjsanpedro/vagrant-nodemaster/tree/master/lib/vagrant-node).
|
4
4
|
|
5
|
+
You can also work with Vagrant-Node through a web application called [VagrantWeb](https://github.com/catedrasaes-umu/vagrantweb/). Watch the video [VagrantWeb Overview](https://www.youtube.com/watch?v=PslrNMAl_vU) to figure out all the functionality available.
|
5
6
|
|
6
7
|
This plugin has been developed in the context of the [Catedra SAES](http://www.catedrasaes.org) of the University of Murcia(Spain).
|
7
8
|
|
8
9
|
##Installation
|
9
|
-
Requires Vagrant 1.2 and libsqlite3-dev
|
10
|
+
Requires Vagrant (minimum version 1.2.2) and libsqlite3-dev. The miminum version required of the plugin Vagrant-Node in each node is 1.1.3.
|
10
11
|
|
11
12
|
```bash
|
12
13
|
$ vagrant plugin install vagrant-nodemaster
|
@@ -22,9 +22,20 @@ module Vagrant
|
|
22
22
|
|
23
23
|
#dbmanager=DB::NodeDBManager.new
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
|
26
|
+
begin
|
27
|
+
|
28
|
+
DB::NodeDBManager.add_node(argv[0],argv[1],argv[2].to_i,argv[3],options[:dns])
|
29
|
+
|
30
|
+
rescue Exception => e
|
31
|
+
if e.class == SQLite3::ConstraintException
|
32
|
+
@env.ui.error("Error adding node '#{argv[0]}': There is a node with the same name")
|
33
|
+
else
|
34
|
+
@env.ui.error("Error adding node '#{argv[0]}': "+e.message)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
0
|
28
39
|
end
|
29
40
|
|
30
41
|
end
|
@@ -1,192 +1,212 @@
|
|
1
1
|
require 'sqlite3'
|
2
2
|
|
3
3
|
module Vagrant
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
module NodeMaster
|
5
|
+
module DB
|
6
|
+
class NodeDBManager
|
7
|
+
|
8
|
+
def initialize(data_dir=nil)
|
9
|
+
|
10
|
+
@@db=check_database(data_dir) if data_dir
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_reference
|
15
|
+
@@db
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def self.import_node(node_name,node_address,node_port,node_password,raw)
|
20
|
+
if (!portvalid?(node_port))
|
21
|
+
raise "Node port must be above 1023"
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
if (!namevalid?(node_name))
|
26
|
+
raise "Node name Invalid (Special characters allowed: '_' and '-')."
|
27
|
+
end
|
28
|
+
|
29
|
+
sql="INSERT INTO #{TABLE_NAME} VALUES ( ? , ? , ?,?)"
|
30
|
+
|
31
|
+
password = node_password
|
32
|
+
password = Digest::MD5.hexdigest(password) if !raw
|
33
|
+
|
34
|
+
@@db.execute(sql,node_name,node_address,node_port,password)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.add_node(node_name,node_address,node_port,node_password,dnsformat)
|
39
|
+
|
40
|
+
if (!portvalid?(node_port))
|
41
|
+
raise "Node port must be above 1023"
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
if (!namevalid?(node_name))
|
46
|
+
raise "Node name Invalid (Special characters allowed: '_' and '-')."
|
47
|
+
end
|
48
|
+
|
49
|
+
if (dnsformat && !dnsvalid?(node_address)) ||
|
50
|
+
(!dnsformat && !ipvalid?(node_address))
|
51
|
+
|
52
|
+
raise "Invalid ip or dns address."
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
sql="INSERT INTO #{TABLE_NAME} VALUES ( ? , ? , ?,?)"
|
58
|
+
@@db.execute(sql,node_name,node_address,node_port,Digest::MD5.hexdigest(node_password))
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.update_node(node_name,node_address,node_port,dnsformat)
|
63
|
+
|
64
|
+
if (!portvalid?(node_port))
|
65
|
+
|
66
|
+
raise "Node port must be above 1023"
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
if (dnsformat && !dnsvalid?(node_address)) ||
|
71
|
+
(!dnsformat && !ipvalid?(node_address))
|
72
|
+
|
73
|
+
raise "Invalid ip or dns address."
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
sql="UPDATE #{TABLE_NAME} SET #{NODE_ADDRESS_COLUMN} = ?,#{NODE_PORT_COLUMN} = ? WHERE #{NODE_NAME_COLUMN}= ?"
|
78
|
+
@@db.execute(sql,node_address,node_port,node_name)
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
def self.update_node_password(node_name,password)
|
84
|
+
sql="UPDATE #{TABLE_NAME} SET #{NODE_PASSWORD_COLUMN} = ? WHERE #{NODE_NAME_COLUMN}= ?"
|
85
|
+
@@db.execute(sql,Digest::MD5.hexdigest(password),node_name)
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def self.remove_node(node_name)
|
90
|
+
sql="DELETE FROM #{TABLE_NAME} WHERE #{NODE_NAME_COLUMN}=?"
|
91
|
+
@@db.execute(sql,node_name)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.remove_nodes
|
95
|
+
sql="DELETE FROM #{TABLE_NAME}"
|
96
|
+
@@db.execute(sql)
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
def self.get_node_names
|
101
|
+
sql="SELECT #{NODE_NAME_COLUMN} FROM #{TABLE_NAME}"
|
102
|
+
@@db.execute(sql);
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.get_nodes
|
106
|
+
sql="SELECT * FROM #{TABLE_NAME}"
|
107
|
+
rows=@@db.execute(sql);
|
108
|
+
nodes = []
|
109
|
+
rows.each do |row|
|
110
|
+
node = {}
|
111
|
+
node[:name]=row[0]
|
112
|
+
node[:address]=row[1]
|
113
|
+
node[:port]=row[2]
|
114
|
+
node[:password]=row[3]
|
115
|
+
nodes << node
|
116
|
+
end
|
117
|
+
|
118
|
+
nodes
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.get_node(node_name)
|
123
|
+
sql="SELECT * FROM #{TABLE_NAME} WHERE #{NODE_NAME_COLUMN}=?"
|
124
|
+
raise "Node not found" if (nodear=@@db.execute(sql,node_name)).empty?
|
125
|
+
node = {}
|
126
|
+
node[:name]=nodear[0][0]
|
127
|
+
node[:address]=nodear[0][1]
|
128
|
+
node[:port]=nodear[0][2]
|
129
|
+
node[:password]=nodear[0][3]
|
130
|
+
node
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
private
|
135
|
+
|
136
|
+
TABLE_NAME='node_table'
|
137
|
+
NODE_NAME_COLUMN = 'node_name'
|
138
|
+
NODE_ADDRESS_COLUMN = 'node_address'
|
139
|
+
NODE_PORT_COLUMN = 'node_port'
|
140
|
+
NODE_PASSWORD_COLUMN = 'node_password'
|
141
|
+
|
142
|
+
def check_database(data_dir)
|
143
|
+
#Creates and/or open the database
|
144
|
+
db = SQLite3::Database.new( data_dir.to_s + "/nodemaster.db" )
|
145
|
+
|
146
|
+
if db.execute("SELECT name FROM sqlite_master
|
147
|
+
WHERE type='table' AND name='#{TABLE_NAME}';").length==0
|
148
|
+
# db.execute( "create table '#{TABLE_NAME}' (id INTEGER PRIMARY KEY AUTOINCREMENT,
|
149
|
+
# {NODE_NAME_COLUMN} TEXT, #{NODE_ADDRESS_COLUMN} TEXT);" )
|
150
|
+
db.execute( "create table '#{TABLE_NAME}' (#{NODE_NAME_COLUMN} TEXT PRIMARY KEY,#{NODE_ADDRESS_COLUMN} TEXT NOT NULL,#{NODE_PORT_COLUMN} INTEGER NOT NULL,#{NODE_PASSWORD_COLUMN} VARCHAR(64) NOT NULL);" )
|
151
|
+
end
|
152
|
+
|
153
|
+
db
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.ipvalid?(node_address)
|
13
158
|
|
14
|
-
|
15
|
-
@@db
|
16
|
-
end
|
159
|
+
ipreg= '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
|
17
160
|
|
18
|
-
def self.add_node(node_name,node_address,node_port,node_password,dnsformat)
|
19
|
-
|
20
|
-
if (!portvalid?(node_port))
|
21
|
-
raise "Node port must be above 1023"
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
if (!namevalid?(node_name))
|
26
|
-
raise "Node name Invalid (Spectial characters allowed: '_' and '-')."
|
27
|
-
end
|
28
|
-
|
29
|
-
if (dnsformat && !dnsvalid?(node_address)) ||
|
30
|
-
(!dnsformat && !ipvalid?(node_address))
|
31
|
-
|
32
|
-
raise "Invalid ip or dns address."
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
sql="INSERT INTO #{TABLE_NAME} VALUES ( ? , ? , ?,?)"
|
38
|
-
@@db.execute(sql,node_name,node_address,node_port,Digest::MD5.hexdigest(node_password))
|
39
|
-
|
40
|
-
end
|
41
161
|
|
42
|
-
|
43
|
-
|
44
|
-
if (!portvalid?(node_port))
|
45
|
-
|
46
|
-
raise "Node port must be above 1023"
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
if (dnsformat && !dnsvalid?(node_address)) ||
|
51
|
-
(!dnsformat && !ipvalid?(node_address))
|
52
|
-
|
53
|
-
raise "Invalid ip or dns address."
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
sql="UPDATE #{TABLE_NAME} SET #{NODE_ADDRESS_COLUMN} = ?,#{NODE_PORT_COLUMN} = ? WHERE #{NODE_NAME_COLUMN}= ?"
|
58
|
-
@@db.execute(sql,node_address,node_port,node_name)
|
59
|
-
|
60
|
-
end
|
162
|
+
ipregex = Regexp.new(ipreg)
|
61
163
|
|
62
164
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
165
|
+
if (node_address =~ ipregex)
|
166
|
+
return true
|
167
|
+
end
|
67
168
|
|
169
|
+
false
|
68
170
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.dnsvalid?(node_address)
|
73
174
|
|
74
|
-
def self.remove_nodes
|
75
|
-
sql="DELETE FROM #{TABLE_NAME}"
|
76
|
-
@@db.execute(sql)
|
77
|
-
end
|
78
|
-
|
79
175
|
|
80
|
-
|
81
|
-
sql="SELECT #{NODE_NAME_COLUMN} FROM #{TABLE_NAME}"
|
82
|
-
@@db.execute(sql);
|
83
|
-
end
|
176
|
+
hostreg='^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$'
|
84
177
|
|
85
|
-
def self.get_nodes
|
86
|
-
sql="SELECT * FROM #{TABLE_NAME}"
|
87
|
-
rows=@@db.execute(sql);
|
88
|
-
nodes = []
|
89
|
-
rows.each do |row|
|
90
|
-
node = {}
|
91
|
-
node[:name]=row[0]
|
92
|
-
node[:address]=row[1]
|
93
|
-
node[:port]=row[2]
|
94
|
-
node[:password]=row[3]
|
95
|
-
nodes << node
|
96
|
-
end
|
97
|
-
|
98
|
-
nodes
|
99
|
-
|
100
|
-
end
|
101
178
|
|
102
|
-
|
103
|
-
sql="SELECT * FROM #{TABLE_NAME} WHERE #{NODE_NAME_COLUMN}=?"
|
104
|
-
raise "Node not found" if (nodear=@@db.execute(sql,node_name)).empty?
|
105
|
-
node = {}
|
106
|
-
node[:name]=nodear[0][0]
|
107
|
-
node[:address]=nodear[0][1]
|
108
|
-
node[:port]=nodear[0][2]
|
109
|
-
node[:password]=nodear[0][3]
|
110
|
-
node
|
179
|
+
hregex = Regexp.new(hostreg)
|
111
180
|
|
181
|
+
if (node_address =~ hregex)
|
182
|
+
return true
|
112
183
|
end
|
113
184
|
|
114
|
-
|
115
|
-
|
116
|
-
TABLE_NAME='node_table'
|
117
|
-
NODE_NAME_COLUMN = 'node_name'
|
118
|
-
NODE_ADDRESS_COLUMN = 'node_address'
|
119
|
-
NODE_PORT_COLUMN = 'node_port'
|
120
|
-
NODE_PASSWORD_COLUMN = 'node_password'
|
185
|
+
false
|
121
186
|
|
122
|
-
|
123
|
-
#Creates and/or open the database
|
124
|
-
db = SQLite3::Database.new( data_dir.to_s + "/nodemaster.db" )
|
125
|
-
|
126
|
-
if db.execute("SELECT name FROM sqlite_master
|
127
|
-
WHERE type='table' AND name='#{TABLE_NAME}';").length==0
|
128
|
-
# db.execute( "create table '#{TABLE_NAME}' (id INTEGER PRIMARY KEY AUTOINCREMENT,
|
129
|
-
# {NODE_NAME_COLUMN} TEXT, #{NODE_ADDRESS_COLUMN} TEXT);" )
|
130
|
-
db.execute( "create table '#{TABLE_NAME}' (#{NODE_NAME_COLUMN} TEXT PRIMARY KEY,#{NODE_ADDRESS_COLUMN} TEXT NOT NULL,#{NODE_PORT_COLUMN} INTEGER NOT NULL,#{NODE_PASSWORD_COLUMN} VARCHAR(64) NOT NULL);" )
|
131
|
-
end
|
132
|
-
|
133
|
-
db
|
134
|
-
|
135
|
-
end
|
187
|
+
end
|
136
188
|
|
137
|
-
def self.ipvalid?(node_address)
|
138
|
-
|
139
|
-
ipreg= '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
|
140
|
-
|
141
|
-
|
142
|
-
ipregex = Regexp.new(ipreg)
|
143
|
-
|
144
|
-
|
145
|
-
if (node_address =~ ipregex)
|
146
|
-
return true
|
147
|
-
end
|
148
|
-
|
149
|
-
false
|
150
|
-
|
151
|
-
end
|
152
189
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
return true
|
163
|
-
end
|
164
|
-
|
165
|
-
false
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
|
-
|
170
|
-
def self.namevalid?(node_name)
|
171
|
-
#only allowing '_' and '-'
|
172
|
-
namereg = '^[a-z0-9_-]*$'
|
173
|
-
nameregex = Regexp.new(namereg)
|
174
|
-
if (node_name =~nameregex)
|
175
|
-
return true
|
176
|
-
end
|
177
|
-
|
178
|
-
false
|
179
|
-
|
180
|
-
end
|
190
|
+
def self.namevalid?(node_name)
|
191
|
+
#only allowing '_' and '-'
|
192
|
+
namereg = '^[a-zA-Z0-9_-]*$'
|
193
|
+
nameregex = Regexp.new(namereg)
|
194
|
+
if (node_name =~nameregex)
|
195
|
+
return true
|
196
|
+
end
|
197
|
+
|
198
|
+
false
|
181
199
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
end
|
188
|
-
|
200
|
+
end
|
201
|
+
|
202
|
+
def self.portvalid?(node_port)
|
203
|
+
if (node_port>=1024)
|
204
|
+
return true
|
189
205
|
end
|
206
|
+
false
|
190
207
|
end
|
208
|
+
|
191
209
|
end
|
192
210
|
end
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'vagrant-nodemaster/node/nodedbmanager'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
module Vagrant
|
5
|
+
module NodeMaster
|
6
|
+
|
7
|
+
class NodeImport < Vagrant.plugin(2, :command)
|
8
|
+
|
9
|
+
def execute
|
10
|
+
|
11
|
+
options = {}
|
12
|
+
|
13
|
+
options[:raw] = false
|
14
|
+
options[:sample] = false
|
15
|
+
|
16
|
+
opts = OptionParser.new do |opts|
|
17
|
+
opts.banner = "Usage: vagrant node import <file>"
|
18
|
+
opts.separator ""
|
19
|
+
opts.on("-r", "--raw", "Import file exactly. Used when file has encoded md5 passwords ") do |f|
|
20
|
+
options[:raw] = true
|
21
|
+
end
|
22
|
+
opts.on("-s", "--sample", "Writes a sample export file") do |f|
|
23
|
+
options[:sample] = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
argv = parse_options(opts)
|
28
|
+
return if !argv
|
29
|
+
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length != 1
|
30
|
+
|
31
|
+
if (!options[:sample])
|
32
|
+
if !File.exist?(argv[0])
|
33
|
+
@env.ui.error("The file does not exist")
|
34
|
+
else
|
35
|
+
#FILE IMPORT
|
36
|
+
#CHECK IF RAW IMPORT OR NOT
|
37
|
+
File.foreach(argv[0]).with_index { |line, line_num|
|
38
|
+
if (line_num>0)
|
39
|
+
|
40
|
+
line = line.gsub("\n",'')
|
41
|
+
parts=line.split(",")
|
42
|
+
#0 => node name
|
43
|
+
#1 => node address
|
44
|
+
#2 => node port
|
45
|
+
#3 => node password
|
46
|
+
|
47
|
+
begin
|
48
|
+
|
49
|
+
DB::NodeDBManager.import_node(parts[0],parts[1],parts[2].to_i,parts[3],options[:raw])
|
50
|
+
|
51
|
+
rescue Exception => e
|
52
|
+
if e.class == SQLite3::ConstraintException
|
53
|
+
@env.ui.error("Error importing node '#{parts[0]}': There is a node with the same name")
|
54
|
+
else
|
55
|
+
@env.ui.error("Error importing node '#{parts[0]}': "+e.message)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
}
|
60
|
+
end
|
61
|
+
else
|
62
|
+
#USER WANTS TO WRITE A SAMPLE FILE
|
63
|
+
|
64
|
+
#CHECK IF THE FILE EXISTS, SHOWING OVERWRITE QUESTION
|
65
|
+
if File.exist?(argv[0])
|
66
|
+
choice = @env.ui.ask("The file already exists, Do you really want to overwrite [N/Y]? ")
|
67
|
+
|
68
|
+
if (!choice || choice.upcase != "Y" )
|
69
|
+
return 0
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
$samplecontent = "\"Node Name\",\"Node Address\",\"Node Port\",\"Node Password\"\n"
|
76
|
+
$samplecontent << "examplenode,127.0.0.1,3333,examplepassword\n";
|
77
|
+
|
78
|
+
|
79
|
+
File.write(argv[0], $samplecontent)
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
0
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
@@ -37,8 +37,14 @@ module Vagrant
|
|
37
37
|
end
|
38
38
|
|
39
39
|
@env.ui.info("#{"CPU Average:".ljust(25)} #{result[:cpuaverage][0]}% (1 Minute) #{result[:cpuaverage][1]}% (5 Minutes) #{result[:cpuaverage][2]}% (15 Minutes)")
|
40
|
-
@env.ui.info("#{"Memory Size:".ljust(25)} #{result[:memorysize]} (#{result[:memoryfree]} Free)")
|
41
|
-
|
40
|
+
@env.ui.info("#{"Memory Size:".ljust(25)} #{result[:memorysize]} GB (#{result[:memoryfree]} GB Free)")
|
41
|
+
#@env.ui.info("#{"Disk Used:".ljust(25)}#{result[:diskusage]} GB")
|
42
|
+
@env.ui.info("Disk usage:")
|
43
|
+
|
44
|
+
result[:diskusage].each do |partition|
|
45
|
+
@env.ui.info("\tPartition #{partition[:partition]} => Free: #{partition[:free]} Total: #{partition[:total]} (Used: #{partition[:freepercent]})")
|
46
|
+
end
|
47
|
+
|
42
48
|
|
43
49
|
interfaces = result[:interfaces].split(",")
|
44
50
|
|
@@ -47,6 +53,8 @@ module Vagrant
|
|
47
53
|
puts "Interface #{i} => "+result[interface] if result[interface]
|
48
54
|
end
|
49
55
|
|
56
|
+
@env.ui.info("#{"Vagrant Version:".ljust(25)} #{result[:vagrant_version]}")
|
57
|
+
|
50
58
|
end
|
51
59
|
|
52
60
|
0
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'vagrant-nodemaster/node/nodedbmanager'
|
2
|
+
require 'vagrant-nodemaster/requestcontroller'
|
3
|
+
|
4
|
+
module Vagrant
|
5
|
+
module NodeMaster
|
6
|
+
|
7
|
+
class NodeOperation < Vagrant.plugin(2, :command)
|
8
|
+
|
9
|
+
def execute
|
10
|
+
|
11
|
+
options = {}
|
12
|
+
|
13
|
+
opts = OptionParser.new do |opts|
|
14
|
+
opts.banner = "Usage: vagrant node operation <node-name> <operation-id>"
|
15
|
+
end
|
16
|
+
|
17
|
+
argv = parse_options(opts)
|
18
|
+
return if !argv
|
19
|
+
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length != 2
|
20
|
+
|
21
|
+
result = RequestController.node_operation_queued(argv[0],argv[1])
|
22
|
+
|
23
|
+
|
24
|
+
case result[0]
|
25
|
+
when "IN PROGRESS"
|
26
|
+
@env.ui.info("The operation #{argv[1]} is \"IN PROGRESS\"")
|
27
|
+
when "SUCCESS"
|
28
|
+
@env.ui.success("The operation #{argv[1]} succeeded.")
|
29
|
+
else
|
30
|
+
@env.ui.error("The operation #{argv[1]} failed. The result is:\n#{result[1]}")
|
31
|
+
end
|
32
|
+
|
33
|
+
0
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -18,7 +18,13 @@ module Vagrant
|
|
18
18
|
return if !argv
|
19
19
|
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length != 1
|
20
20
|
|
21
|
+
|
22
|
+
|
21
23
|
result = RequestController.node_operation_queued_last(argv[0])
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
22
28
|
|
23
29
|
|
24
30
|
if (result.empty?)
|
@@ -26,11 +32,15 @@ module Vagrant
|
|
26
32
|
|
27
33
|
else
|
28
34
|
@env.ui.info("-------------------------------------------------------------------------------------")
|
29
|
-
@env.ui.info("| RESULT CODE |
|
35
|
+
@env.ui.info("| RESULT CODE | VIRTUAL MACHINE | RESULT INFO |")
|
30
36
|
@env.ui.info("-------------------------------------------------------------------------------------")
|
31
37
|
|
32
38
|
result.each do |operation|
|
33
|
-
|
39
|
+
code= operation[0]
|
40
|
+
rparams=JSON.parse(operation[1],{:quirks_mode => true,:symbolize_names => true})
|
41
|
+
vm = rparams[0].has_key?(:vmname) ? rparams[0][:vmname]: "--"
|
42
|
+
result = rparams[0][:status]
|
43
|
+
@env.ui.info("| #{code} | #{vm.ljust(5)} | #{result.ljust(5)} ")
|
34
44
|
@env.ui.info("-------------------------------------------------------------------------------------")
|
35
45
|
end
|
36
46
|
end
|
@@ -8,27 +8,41 @@ module Vagrant
|
|
8
8
|
|
9
9
|
def execute
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
options = {}
|
12
|
+
|
13
|
+
opts = OptionParser.new do |opts|
|
14
|
+
opts.banner = "Usage: vagrant node operation show <node-name> <operation-id>"
|
15
|
+
end
|
16
|
+
|
17
|
+
argv = parse_options(opts)
|
18
|
+
return if !argv
|
19
19
|
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length != 2
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
case result[0]
|
25
|
-
when 100
|
26
|
-
@env.ui.info("The operation #{argv[1]} is \"IN PROGRESS\"")
|
27
|
-
when 200
|
28
|
-
@env.ui.success("The operation #{argv[1]} succeeded.")
|
21
|
+
if (argv[1].to_i==0)
|
22
|
+
@env.ui.error("Invalid operation ID")
|
29
23
|
else
|
30
|
-
|
31
|
-
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
result = RequestController.node_operation_queued(argv[0],argv[1])
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
case result[0]
|
33
|
+
when 100
|
34
|
+
@env.ui.info("The operation #{argv[1]} is \"IN PROGRESS\"")
|
35
|
+
when 200
|
36
|
+
@env.ui.success("The operation #{argv[1]} succeeded.")
|
37
|
+
else
|
38
|
+
rparams=JSON.parse(result[1],{:quirks_mode => true,:symbolize_names => true})
|
39
|
+
rparams=rparams[0]
|
40
|
+
|
41
|
+
|
42
|
+
@env.ui.error("The operation #{argv[1]} in Virtual Machine '#{rparams[:vmname]}' failed. The result is:\n#{rparams[:status]}")
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
32
46
|
|
33
47
|
0
|
34
48
|
end
|
@@ -13,11 +13,8 @@ module Vagrant
|
|
13
13
|
@main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
14
14
|
|
15
15
|
#Initializing db structure
|
16
|
-
|
16
|
+
DB::NodeDBManager.new(@env.data_dir)
|
17
17
|
|
18
|
-
# puts "MAIN ARGS #{@main_args}"
|
19
|
-
# puts "SUB COMMAND #{@sub_command}"
|
20
|
-
# puts "SUB ARGS #{@sub_args}"
|
21
18
|
|
22
19
|
@subcommands = Vagrant::Registry.new
|
23
20
|
|
@@ -47,9 +44,9 @@ module Vagrant
|
|
47
44
|
end
|
48
45
|
|
49
46
|
@subcommands.register(:updatepw) do
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
require File.expand_path("../node/nodeupdatepw", __FILE__)
|
48
|
+
NodeUpdatePw
|
49
|
+
end
|
53
50
|
|
54
51
|
@subcommands.register(:status) do
|
55
52
|
require File.expand_path("../node/nodestatus", __FILE__)
|
@@ -57,9 +54,15 @@ module Vagrant
|
|
57
54
|
end
|
58
55
|
|
59
56
|
@subcommands.register(:operation) do
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
require File.expand_path("../node/nodeoperationcommand", __FILE__)
|
58
|
+
NodeOperationCommand
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
@subcommands.register(:import) do
|
63
|
+
require File.expand_path("../node/nodeimport", __FILE__)
|
64
|
+
NodeImport
|
65
|
+
end
|
63
66
|
|
64
67
|
end
|
65
68
|
|
@@ -75,18 +78,31 @@ module Vagrant
|
|
75
78
|
|
76
79
|
|
77
80
|
|
78
|
-
|
81
|
+
# If we reached this far then we must have a subcommand. If not,
|
79
82
|
# then we also just print the help and exit.
|
80
83
|
command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
|
81
84
|
return help if !command_class || !@sub_command
|
82
85
|
@logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
|
83
86
|
|
84
|
-
|
87
|
+
begin
|
85
88
|
# Initialize and execute the command class
|
86
89
|
command_class.new(@sub_args, @env).execute
|
87
90
|
rescue Exception => e
|
88
91
|
@env.ui.error(e.message)
|
89
92
|
end
|
93
|
+
|
94
|
+
# begin
|
95
|
+
# # Initialize and execute the command class
|
96
|
+
# command_class.new(@sub_args, @env).execute
|
97
|
+
# rescue RestClient::ExceptionWithResponse=> e
|
98
|
+
# @env.ui.error(e.response)
|
99
|
+
# rescue RestClient::RequestFailed => e
|
100
|
+
# @env.ui.error("Remote Client \"#{@sub_args[0]}\": Request Failed")
|
101
|
+
# rescue RestClient::ResourceNotFound => e
|
102
|
+
# @env.ui.error("Remote Client \"#{@sub_args[0]}\": Virtual Machine \"#{@sub_args[1]}\" could not be found")
|
103
|
+
# rescue Exception => e
|
104
|
+
# @env.ui.error(e.message)
|
105
|
+
# end
|
90
106
|
|
91
107
|
|
92
108
|
0
|
@@ -15,12 +15,12 @@ module Vagrant
|
|
15
15
|
opts = OptionParser.new do |opts|
|
16
16
|
opts.banner = "Usage: vagrant remote backup take [node-name] [vmname] [--download target_directory][--background] [-h]"
|
17
17
|
opts.separator ""
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
opts.on("-b", "--background", "Take backup in background") do |b|
|
19
|
+
options[:background] = b
|
20
|
+
end
|
21
|
+
opts.on("--download target_directory", String,"Download backup to target directory") do |d|
|
22
|
+
options[:download] = d
|
23
|
+
end
|
24
24
|
|
25
25
|
end
|
26
26
|
|
@@ -29,10 +29,12 @@ module Vagrant
|
|
29
29
|
|
30
30
|
machines=RequestController.vm_halt(argv[0],argv[1],options[:force],options[:async])
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
|
33
|
+
|
34
|
+
if options[:async] == false
|
35
|
+
machines.each do |machine|
|
36
|
+
@env.ui.success("Remote Client \"#{argv[0]}\": Virtual Machine \"#{machine["vmname"]}\" halted")
|
37
|
+
end
|
36
38
|
else
|
37
39
|
@env.ui.info("Remote Client \"#{argv[0]}\": The operation ID is \"#{machines.gsub!(/\D/, "")}\"")
|
38
40
|
end
|
@@ -12,8 +12,8 @@ module Vagrant
|
|
12
12
|
opts.banner = "Usage: vagrant remote snapshot restore <node-name> <vmname> <snapshot-uuid|snapshot-name] [--synchronous]>"
|
13
13
|
opts.separator ""
|
14
14
|
opts.on("-s", "--synchronous", "Wait until the operation finishes") do |f|
|
15
|
-
|
16
|
-
|
15
|
+
options[:async] = false
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
|
@@ -27,9 +27,9 @@ module Vagrant
|
|
27
27
|
|
28
28
|
if options[:async] == false
|
29
29
|
@env.ui.info("Remote Client \"#{argv[0]}\": Virtual Machine \"#{argv[1]}\" => Restoring snapshot \"#{argv[2]}\"", :prefix => false)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
else
|
31
|
+
@env.ui.info("Remote Client \"#{argv[0]}\": The operation ID is \"#{snapshot.gsub!(/\D/, "")}\"")
|
32
|
+
end
|
33
33
|
|
34
34
|
|
35
35
|
|
@@ -10,9 +10,9 @@ module Vagrant
|
|
10
10
|
opts = OptionParser.new do |opts|
|
11
11
|
opts.banner = "Usage: vagrant remote snapshot take <node-name> <vmname> <name> [description] [--synchronous]"
|
12
12
|
opts.separator ""
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
opts.on("-s", "--synchronous", "Wait until the operation finishes") do |f|
|
14
|
+
options[:async] = false
|
15
|
+
end
|
16
16
|
end
|
17
17
|
|
18
18
|
|
@@ -25,11 +25,11 @@ module Vagrant
|
|
25
25
|
snapshot = RequestController.vm_snapshot_take(argv[0],argv[1],argv[2],argv[3],options[:async])
|
26
26
|
|
27
27
|
if options[:async] == false
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
@env.ui.info("Remote Client: #{argv[0]}", :prefix => false)
|
29
|
+
@env.ui.info("Snapshot \"#{snapshot[:name]}\" with UUID #{snapshot[:id]} succesfully created.")
|
30
|
+
else
|
31
|
+
@env.ui.info("Remote Client \"#{argv[0]}\": The operation ID is \"#{snapshot.gsub!(/\D/, "")}\"")
|
32
|
+
end
|
33
33
|
|
34
34
|
|
35
35
|
0
|
@@ -11,9 +11,9 @@ module Vagrant
|
|
11
11
|
opts = OptionParser.new do |opts|
|
12
12
|
opts.banner = "Usage: vagrant remote suspend <node-name> [vm_name] [--synchronous]"
|
13
13
|
opts.separator ""
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
opts.on("-s", "--synchronous", "Wait until the operation finishes") do |f|
|
15
|
+
options[:async] = false
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
argv = parse_options(opts)
|
@@ -11,23 +11,11 @@ module Vagrant
|
|
11
11
|
|
12
12
|
@main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
#Initializing db structure
|
15
|
+
DB::NodeDBManager.new(@env.data_dir)
|
16
16
|
|
17
|
-
# puts "MAIN ARGS #{@main_args}"
|
18
|
-
# puts "SUB COMMAND #{@sub_command}"
|
19
|
-
# puts "SUB ARGS #{@sub_args}"
|
20
17
|
|
21
|
-
|
22
|
-
# @subcommands.register(:add) do
|
23
|
-
# require File.expand_path("../add", __FILE__)
|
24
|
-
# Add
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# @subcommands.register(:boxlist) do
|
28
|
-
# require File.expand_path("../remoteboxlist", __FILE__)
|
29
|
-
# BoxList
|
30
|
-
# end
|
18
|
+
@subcommands = Vagrant::Registry.new
|
31
19
|
|
32
20
|
@subcommands.register(:box) do
|
33
21
|
require File.expand_path("../remote/remoteboxcommand", __FILE__)
|
@@ -118,7 +106,7 @@ module Vagrant
|
|
118
106
|
# Initialize and execute the command class
|
119
107
|
command_class.new(@sub_args, @env).execute
|
120
108
|
rescue RestClient::ExceptionWithResponse=> e
|
121
|
-
|
109
|
+
@env.ui.error(e.response)
|
122
110
|
rescue RestClient::RequestFailed => e
|
123
111
|
@env.ui.error("Remote Client \"#{@sub_args[0]}\": Request Failed")
|
124
112
|
rescue RestClient::ResourceNotFound => e
|
@@ -19,6 +19,7 @@ module NodeMaster
|
|
19
19
|
DELETE_VERB = :delete
|
20
20
|
PUT_VERB = :put
|
21
21
|
SYNC_TIME = 10
|
22
|
+
OPERATION_IN_PROGRESS = 100
|
22
23
|
|
23
24
|
def self.box_downloads(host)
|
24
25
|
client=get_host_parameters(host)
|
@@ -61,7 +62,7 @@ module NodeMaster
|
|
61
62
|
|
62
63
|
resource = RestClient::Resource.new(
|
63
64
|
RouteManager.box_add_url(client[:address],client[:port]),
|
64
|
-
:timeout =>
|
65
|
+
:timeout => nil
|
65
66
|
)
|
66
67
|
|
67
68
|
|
@@ -80,12 +81,12 @@ module NodeMaster
|
|
80
81
|
#setting the request not to expire
|
81
82
|
resource = RestClient::Resource.new(
|
82
83
|
RouteManager.vm_up_url(client[:address],client[:port]),
|
83
|
-
:timeout =>
|
84
|
+
:timeout => nil
|
84
85
|
)
|
85
86
|
|
86
87
|
|
87
|
-
response = execute(client,POST_VERB,resource,{:vmname => vmname},async);
|
88
|
-
|
88
|
+
response = execute(client,POST_VERB,resource,{:vmname => vmname},async);
|
89
|
+
|
89
90
|
return JSON.parse(response.to_str) if async ==false
|
90
91
|
response
|
91
92
|
|
@@ -97,10 +98,11 @@ module NodeMaster
|
|
97
98
|
#setting the request not to expire
|
98
99
|
resource = RestClient::Resource.new(
|
99
100
|
RouteManager.vm_halt_url(client[:address],client[:port]),
|
100
|
-
:timeout =>
|
101
|
+
:timeout => nil
|
101
102
|
)
|
102
103
|
|
103
104
|
response = execute(client,POST_VERB,resource,{:vmname => vmname,:force=>force},async);
|
105
|
+
|
104
106
|
return JSON.parse(response.to_str) if async ==false
|
105
107
|
response
|
106
108
|
|
@@ -111,7 +113,7 @@ module NodeMaster
|
|
111
113
|
|
112
114
|
resource = RestClient::Resource.new(
|
113
115
|
RouteManager.vm_destroy_url(client[:address],client[:port]),
|
114
|
-
:timeout =>
|
116
|
+
:timeout => nil
|
115
117
|
)
|
116
118
|
|
117
119
|
|
@@ -141,7 +143,7 @@ module NodeMaster
|
|
141
143
|
|
142
144
|
resource = RestClient::Resource.new(
|
143
145
|
RouteManager.vm_add_url(client[:address],client[:port]),
|
144
|
-
:timeout =>
|
146
|
+
:timeout => nil ,
|
145
147
|
# :payload => {
|
146
148
|
# :content_type => 'text/plain',
|
147
149
|
# :file => File.new(config, 'rb')
|
@@ -202,7 +204,7 @@ module NodeMaster
|
|
202
204
|
#setting the request not to expire
|
203
205
|
resource = RestClient::Resource.new(
|
204
206
|
RouteManager.vm_suspend_url(client[:address],client[:port]),
|
205
|
-
:timeout =>
|
207
|
+
:timeout => nil
|
206
208
|
)
|
207
209
|
|
208
210
|
|
@@ -219,7 +221,7 @@ module NodeMaster
|
|
219
221
|
#setting the request not to expire
|
220
222
|
resource = RestClient::Resource.new(
|
221
223
|
RouteManager.vm_resume_url(client[:address],client[:port]),
|
222
|
-
:timeout =>
|
224
|
+
:timeout => nil
|
223
225
|
)
|
224
226
|
|
225
227
|
response = execute(client,POST_VERB,resource,{:vmname => vmname},async);
|
@@ -236,7 +238,7 @@ module NodeMaster
|
|
236
238
|
#setting the request not to expire
|
237
239
|
resource = RestClient::Resource.new(
|
238
240
|
RouteManager.vm_provision_url(client[:address],client[:port]),
|
239
|
-
:timeout =>
|
241
|
+
:timeout => nil
|
240
242
|
)
|
241
243
|
|
242
244
|
|
@@ -272,7 +274,7 @@ module NodeMaster
|
|
272
274
|
|
273
275
|
resource = RestClient::Resource.new(
|
274
276
|
RouteManager.vm_snapshot_take_url(client[:address],client[:port],vmname),
|
275
|
-
:timeout =>
|
277
|
+
:timeout => nil,
|
276
278
|
)
|
277
279
|
|
278
280
|
|
@@ -291,7 +293,7 @@ module NodeMaster
|
|
291
293
|
#setting the request not to expire
|
292
294
|
resource = RestClient::Resource.new(
|
293
295
|
RouteManager.vm_snapshot_delete_url(client[:address],client[:port],vmname,snapid),
|
294
|
-
:timeout =>
|
296
|
+
:timeout => nil,
|
295
297
|
)
|
296
298
|
|
297
299
|
|
@@ -308,7 +310,7 @@ module NodeMaster
|
|
308
310
|
|
309
311
|
resource = RestClient::Resource.new(
|
310
312
|
RouteManager.vm_snapshot_restore_url(client[:address],client[:port],vmname),
|
311
|
-
:timeout =>
|
313
|
+
:timeout => nil
|
312
314
|
)
|
313
315
|
|
314
316
|
response = execute(client,POST_VERB,resource,{:vmname => vmname,:snapid => snapid},async);
|
@@ -326,8 +328,8 @@ module NodeMaster
|
|
326
328
|
RouteManager.node_queue_url(client[:address],client[:port],id)
|
327
329
|
)
|
328
330
|
|
329
|
-
response = execute(client,GET_VERB,resource);
|
330
|
-
|
331
|
+
response = execute(client,GET_VERB,resource);
|
332
|
+
|
331
333
|
JSON.parse(response.to_str,{:symbolize_names => true})
|
332
334
|
end
|
333
335
|
|
@@ -338,6 +340,8 @@ module NodeMaster
|
|
338
340
|
)
|
339
341
|
|
340
342
|
response = execute(client,GET_VERB,resource);
|
343
|
+
|
344
|
+
|
341
345
|
|
342
346
|
JSON.parse(response.to_str,{:symbolize_names => true})
|
343
347
|
end
|
@@ -383,7 +387,7 @@ module NodeMaster
|
|
383
387
|
resource = RestClient::Resource.new(
|
384
388
|
RouteManager.vm_snapshot_take_url(client[:address],client[:port],vm["name"]),
|
385
389
|
:download => download_backup,
|
386
|
-
:timeout =>
|
390
|
+
:timeout => nil
|
387
391
|
)
|
388
392
|
|
389
393
|
#OLD. FIXME REMOVE
|
@@ -440,7 +444,7 @@ module NodeMaster
|
|
440
444
|
|
441
445
|
resource = RestClient::Resource.new(
|
442
446
|
RouteManager.backup_log_url(client[:address],client[:port],vmname),
|
443
|
-
:timeout =>
|
447
|
+
:timeout => nil
|
444
448
|
)
|
445
449
|
|
446
450
|
|
@@ -456,7 +460,7 @@ module NodeMaster
|
|
456
460
|
client=get_host_parameters(node)
|
457
461
|
|
458
462
|
resource = RestClient::Resource.new(
|
459
|
-
RouteManager.node_info_url(client[:address],client[:port]),:timeout =>
|
463
|
+
RouteManager.node_info_url(client[:address],client[:port]),:timeout => nil
|
460
464
|
)
|
461
465
|
|
462
466
|
response=execute(client,GET_VERB,resource);
|
@@ -474,7 +478,7 @@ module NodeMaster
|
|
474
478
|
|
475
479
|
|
476
480
|
resource = RestClient::Resource.new(
|
477
|
-
RouteManager.config_show_url(client[:address],client[:port]),:timeout =>
|
481
|
+
RouteManager.config_show_url(client[:address],client[:port]),:timeout => nil
|
478
482
|
)
|
479
483
|
|
480
484
|
|
@@ -490,7 +494,7 @@ module NodeMaster
|
|
490
494
|
|
491
495
|
resource = RestClient::Resource.new(
|
492
496
|
RouteManager.config_upload_url(client[:address],client[:port]),
|
493
|
-
:timeout =>
|
497
|
+
:timeout => nil
|
494
498
|
)
|
495
499
|
|
496
500
|
execute(client,POST_VERB,resource,{:file => File.read(config_path), :content_type => 'text/plain'})
|
@@ -503,7 +507,7 @@ module NodeMaster
|
|
503
507
|
|
504
508
|
|
505
509
|
resource = RestClient::Resource.new(
|
506
|
-
RouteManager.node_password_change_url(client[:address],client[:port]),:timeout =>
|
510
|
+
RouteManager.node_password_change_url(client[:address],client[:port]),:timeout => nil
|
507
511
|
)
|
508
512
|
|
509
513
|
execute(client,POST_VERB,resource,{:password => Digest::MD5.hexdigest(password)});
|
@@ -552,11 +556,9 @@ module NodeMaster
|
|
552
556
|
|
553
557
|
responseop = resourceop.send GET_VERB
|
554
558
|
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
end while (res[0].eql? "IN PROGRESS") #While operation code is IN PROGRESS iterate
|
559
|
+
res = JSON.parse(responseop.to_str)
|
560
|
+
|
561
|
+
end while (res[0] == OPERATION_IN_PROGRESS) #While operation code is IN PROGRESS iterate
|
560
562
|
|
561
563
|
res[1]
|
562
564
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-nodemaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -84,6 +84,7 @@ extensions: []
|
|
84
84
|
extra_rdoc_files: []
|
85
85
|
files:
|
86
86
|
- .gitignore
|
87
|
+
- CHANGELOG.md
|
87
88
|
- Gemfile
|
88
89
|
- LICENSE
|
89
90
|
- README.md
|
@@ -92,8 +93,10 @@ files:
|
|
92
93
|
- lib/vagrant-nodemaster/apidesc.rb
|
93
94
|
- lib/vagrant-nodemaster/node/nodeadd.rb
|
94
95
|
- lib/vagrant-nodemaster/node/nodedbmanager.rb
|
96
|
+
- lib/vagrant-nodemaster/node/nodeimport.rb
|
95
97
|
- lib/vagrant-nodemaster/node/nodeinfo.rb
|
96
98
|
- lib/vagrant-nodemaster/node/nodelist.rb
|
99
|
+
- lib/vagrant-nodemaster/node/nodeoperation.rb
|
97
100
|
- lib/vagrant-nodemaster/node/nodeoperationcommand.rb
|
98
101
|
- lib/vagrant-nodemaster/node/nodeoperationlast.rb
|
99
102
|
- lib/vagrant-nodemaster/node/nodeoperationshow.rb
|