corl 0.5.11 → 0.5.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/corl.gemspec +12 -12
- data/lib/CORL/builder/identity.rb +7 -6
- data/lib/CORL/builder/project.rb +1 -1
- data/lib/core/mixin/machine/ssh.rb +17 -1
- data/lib/core/plugin/cloud_action.rb +1 -1
- data/lib/core/plugin/node.rb +3 -2
- data/lib/nucleon/action/{cloud → network}/config.rb +86 -86
- data/lib/nucleon/action/{cloud → network}/create.rb +15 -15
- data/lib/nucleon/action/{cloud → network}/images.rb +14 -14
- data/lib/nucleon/action/{cloud → network}/inspect.rb +12 -12
- data/lib/nucleon/action/{cloud → network}/machines.rb +12 -12
- data/lib/nucleon/action/{cloud → network}/regions.rb +15 -15
- data/lib/nucleon/action/{cloud → network}/remote.rb +17 -17
- data/lib/nucleon/action/{cloud → network}/settings.rb +54 -54
- data/lib/nucleon/action/{cloud → network}/vagrantfile.rb +18 -18
- data/lib/nucleon/action/node/identity.rb +75 -29
- data/lib/nucleon/action/node/keypair.rb +29 -27
- data/lib/nucleon/action/node/revoke.rb +13 -13
- data/locales/en.yml +15 -2
- metadata +11 -11
@@ -1,41 +1,41 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Action
|
4
|
-
module
|
4
|
+
module Network
|
5
5
|
class Inspect < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
|
-
super(:
|
11
|
+
super(:network, :inspect, 955)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
18
|
super do
|
19
19
|
codes :configuration_parse_failed
|
20
|
-
|
20
|
+
|
21
21
|
register_array :elements
|
22
22
|
register_translator :format, :json
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
#---
|
27
|
-
|
27
|
+
|
28
28
|
def ignore
|
29
29
|
node_ignore
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def arguments
|
33
33
|
[ :elements ]
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
#-----------------------------------------------------------------------------
|
37
37
|
# Operations
|
38
|
-
|
38
|
+
|
39
39
|
def execute
|
40
40
|
super do |node|
|
41
41
|
ensure_network do
|
@@ -1,44 +1,44 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Action
|
4
|
-
module
|
4
|
+
module Network
|
5
5
|
class Machines < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
|
-
super(:
|
11
|
+
super(:network, :machines, 860)
|
12
12
|
end
|
13
13
|
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
18
|
super do
|
19
19
|
codes :node_load_failure,
|
20
20
|
:machine_load_failure
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def node_config
|
25
25
|
super
|
26
26
|
config[:node_provider].default = nil
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
#---
|
30
|
-
|
30
|
+
|
31
31
|
def ignore
|
32
32
|
node_ignore - [ :node_provider ]
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def arguments
|
36
36
|
[ :node_provider ]
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
#-----------------------------------------------------------------------------
|
40
40
|
# Operations
|
41
|
-
|
41
|
+
|
42
42
|
def execute
|
43
43
|
super do |local_node|
|
44
44
|
ensure_network do
|
@@ -47,7 +47,7 @@ class Machines < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
47
47
|
machine_types.each do |machine_type|
|
48
48
|
prefixed_message(:info, ' ', node.render_machine_type(machine_type), { :i18n => false, :prefix => false })
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
myself.result = machine_types
|
52
52
|
success('results', { :machines => machine_types.length }) if machine_types.length > 1
|
53
53
|
else
|
@@ -1,56 +1,56 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Action
|
4
|
-
module
|
4
|
+
module Network
|
5
5
|
class Regions < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
|
-
super(:
|
11
|
+
super(:network, :regions, 855)
|
12
12
|
end
|
13
13
|
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
18
|
super do
|
19
19
|
codes :node_load_failure,
|
20
20
|
:region_load_failure
|
21
|
-
end
|
21
|
+
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def node_config
|
25
25
|
super
|
26
26
|
config[:node_provider].default = nil
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
#---
|
30
|
-
|
30
|
+
|
31
31
|
def ignore
|
32
32
|
node_ignore - [ :node_provider ]
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def arguments
|
36
36
|
[ :node_provider ]
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
#-----------------------------------------------------------------------------
|
40
40
|
# Operations
|
41
|
-
|
41
|
+
|
42
42
|
def execute
|
43
43
|
super do |local_node|
|
44
44
|
ensure_network do
|
45
45
|
if node = network.test_node(settings[:node_provider])
|
46
46
|
if regions = node.regions
|
47
|
-
region_info = node.region_info
|
47
|
+
region_info = node.region_info
|
48
48
|
max_length = regions.collect {|value| value.length }.sort.pop
|
49
|
-
|
49
|
+
|
50
50
|
regions.each do |region|
|
51
51
|
prefixed_message(:info, ' ', sprintf("%-#{max_length + 10}s %s", purple(region), yellow(region_info[region.to_sym])), { :i18n => false, :prefix => false })
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
myself.result = regions
|
55
55
|
else
|
56
56
|
myself.status = code.region_load_failure
|
@@ -1,59 +1,59 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Action
|
4
|
-
module
|
4
|
+
module Network
|
5
5
|
class Remote < CORL.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
include Mixin::Action::Project
|
8
8
|
include Mixin::Action::Push
|
9
|
-
|
9
|
+
|
10
10
|
#-----------------------------------------------------------------------------
|
11
11
|
# Info
|
12
|
-
|
12
|
+
|
13
13
|
def self.describe
|
14
|
-
super(
|
14
|
+
super(:network, :remote, 980)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
#-----------------------------------------------------------------------------
|
18
18
|
# Settings
|
19
|
-
|
19
|
+
|
20
20
|
def configure
|
21
21
|
super do
|
22
22
|
codes :project_failure, :push_failure
|
23
|
-
|
23
|
+
|
24
24
|
project_config
|
25
25
|
push_config
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
#---
|
30
|
-
|
30
|
+
|
31
31
|
def ignore
|
32
32
|
node_ignore + [ :propogate_push, :pull, :push, :net_remote ]
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def arguments
|
36
36
|
[ :project_reference ]
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
#-----------------------------------------------------------------------------
|
40
40
|
# Operations
|
41
|
-
|
41
|
+
|
42
42
|
def execute
|
43
43
|
super do |node|
|
44
44
|
ensure_network do
|
45
45
|
info('start')
|
46
|
-
|
46
|
+
|
47
47
|
settings[:pull] = false
|
48
48
|
settings[:push] = true
|
49
|
-
|
49
|
+
|
50
50
|
if project = project_load(network.directory, false, false)
|
51
51
|
provider = settings[:project_provider]
|
52
|
-
|
52
|
+
|
53
53
|
if settings[:project_reference].match(/^\s*([a-zA-Z0-9_-]+):::(.*)\s*$/)
|
54
54
|
provider = $1
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
Nucleon::Plugin::Project.store_provider(project.directory, provider)
|
58
58
|
myself.status = code.push_failure unless push(project)
|
59
59
|
else
|
@@ -1,150 +1,150 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Action
|
4
|
-
module
|
4
|
+
module Network
|
5
5
|
class Settings < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
|
-
super(:
|
11
|
+
super(:network, :settings, 950)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
18
|
super do
|
19
19
|
codes :settings_save_failed,
|
20
20
|
:settings_delete_failed
|
21
|
-
|
21
|
+
|
22
22
|
register_str :group
|
23
23
|
register_str :name
|
24
24
|
register_array :value
|
25
|
-
|
25
|
+
|
26
26
|
register_bool :array
|
27
27
|
register_bool :delete
|
28
28
|
register_bool :append
|
29
29
|
register_bool :groups
|
30
|
-
|
30
|
+
|
31
31
|
register_translator :input_format
|
32
32
|
register_translator :format, :json
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
#---
|
37
|
-
|
37
|
+
|
38
38
|
def ignore
|
39
39
|
node_ignore
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def arguments
|
43
43
|
[ :group, :name, :value ]
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
#-----------------------------------------------------------------------------
|
47
47
|
# Operations
|
48
|
-
|
48
|
+
|
49
49
|
def execute
|
50
50
|
super do |node|
|
51
51
|
ensure_network do
|
52
52
|
if settings[:groups]
|
53
53
|
render_groups
|
54
|
-
|
54
|
+
|
55
55
|
elsif settings[:group].empty?
|
56
56
|
render_settings
|
57
|
-
|
57
|
+
|
58
58
|
elsif settings[:name].empty?
|
59
59
|
render_settings(settings[:group])
|
60
|
-
|
60
|
+
|
61
61
|
else
|
62
62
|
name = settings[:name].gsub(/\]$/, '').split(/\]?\[/)
|
63
|
-
|
63
|
+
|
64
64
|
if settings.get(:delete, false)
|
65
65
|
delete_settings(name)
|
66
|
-
|
66
|
+
|
67
67
|
elsif ! settings[:value].empty?
|
68
68
|
set_settings(name, settings[:value])
|
69
|
-
|
69
|
+
|
70
70
|
else
|
71
|
-
render_settings([ settings[:group], name ])
|
72
|
-
end
|
71
|
+
render_settings([ settings[:group], name ])
|
72
|
+
end
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
#-----------------------------------------------------------------------------
|
79
79
|
# Settings operations
|
80
|
-
|
80
|
+
|
81
81
|
def render_groups
|
82
82
|
groups = network.config.get(:settings).keys
|
83
|
-
|
83
|
+
|
84
84
|
info('groups')
|
85
85
|
groups.each do |group|
|
86
86
|
info("-> #{green(group)}", { :i18n => false })
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
#---
|
91
|
-
|
91
|
+
|
92
92
|
def render_settings(elements = [])
|
93
93
|
format = settings[:format]
|
94
|
-
|
94
|
+
|
95
95
|
if elements.size > 0
|
96
96
|
myself.result = network.config.get([ :settings, elements ])
|
97
97
|
else
|
98
98
|
myself.result = network.config.get(:settings)
|
99
99
|
end
|
100
|
-
render result, :format => format
|
100
|
+
render result, :format => format
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
#---
|
104
|
-
|
104
|
+
|
105
105
|
def delete_settings(property)
|
106
106
|
group = settings[:group]
|
107
|
-
name = parse_property_name(property)
|
107
|
+
name = parse_property_name(property)
|
108
108
|
remote_text = remote_message(settings[:net_remote])
|
109
|
-
|
109
|
+
|
110
110
|
render_options = { :group => blue(group), :name => blue(name), :remote_text => yellow(remote_text) }
|
111
|
-
|
111
|
+
|
112
112
|
network.config.delete([ :settings, group, property ])
|
113
|
-
|
113
|
+
|
114
114
|
if network.save({ :remote => settings[:net_remote], :message => "Deleting #{group} setting #{name}", :allow_empty => true })
|
115
115
|
success('delete', render_options)
|
116
116
|
else
|
117
117
|
error('delete', render_options)
|
118
|
-
myself.status = code.settings_delete_failed
|
118
|
+
myself.status = code.settings_delete_failed
|
119
119
|
end
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
#---
|
123
|
-
|
123
|
+
|
124
124
|
def set_settings(property, values)
|
125
125
|
group = settings[:group]
|
126
|
-
name = parse_property_name(property)
|
126
|
+
name = parse_property_name(property)
|
127
127
|
remote_text = remote_message(settings[:net_remote])
|
128
|
-
|
128
|
+
|
129
129
|
render_options = { :group => blue(group), :name => blue(name), :remote_text => yellow(remote_text) }
|
130
|
-
|
130
|
+
|
131
131
|
input_format = settings[:input_format]
|
132
|
-
|
133
|
-
values.each_with_index do |value, index|
|
134
|
-
values[index] = render(value, {
|
135
|
-
:format => input_format,
|
136
|
-
:silent => true
|
132
|
+
|
133
|
+
values.each_with_index do |value, index|
|
134
|
+
values[index] = render(value, {
|
135
|
+
:format => input_format,
|
136
|
+
:silent => true
|
137
137
|
}) if input_format
|
138
138
|
values[index] = Util::Data.value(values[index])
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
if settings[:append]
|
142
142
|
if prev_value = network.config.get([ :settings, group, property ])
|
143
143
|
prev_value = array(prev_value)
|
144
|
-
|
144
|
+
|
145
145
|
values.each do |value|
|
146
146
|
prev_value.push(value)
|
147
|
-
end
|
147
|
+
end
|
148
148
|
values = prev_value
|
149
149
|
end
|
150
150
|
else
|
@@ -152,17 +152,17 @@ class Settings < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
152
152
|
values = array(values)
|
153
153
|
elsif values.size == 1
|
154
154
|
values = values[0]
|
155
|
-
end
|
155
|
+
end
|
156
156
|
end
|
157
|
-
|
158
|
-
myself.result = values
|
157
|
+
|
158
|
+
myself.result = values
|
159
159
|
network.config.set([ :settings, group, property ], result)
|
160
|
-
|
160
|
+
|
161
161
|
if network.save({ :remote => settings[:net_remote], :message => "Updating #{group} setting #{name}", :allow_empty => true })
|
162
162
|
success('update', render_options)
|
163
163
|
else
|
164
164
|
error('update', render_options)
|
165
|
-
myself.status = code.settings_save_failed
|
165
|
+
myself.status = code.settings_save_failed
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
@@ -1,65 +1,65 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Action
|
4
|
-
module
|
4
|
+
module Network
|
5
5
|
class Vagrantfile < CORL.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
|
-
super(:
|
11
|
+
super(:network, :vagrantfile, 800)
|
12
12
|
end
|
13
13
|
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
|
-
super do
|
18
|
+
super do
|
19
19
|
codes :vagrant_backup_failure,
|
20
20
|
:vagrant_save_failure,
|
21
21
|
:network_save_failure
|
22
|
-
|
22
|
+
|
23
23
|
register_bool :save
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
#---
|
28
|
-
|
28
|
+
|
29
29
|
def ignore
|
30
30
|
node_ignore
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
#-----------------------------------------------------------------------------
|
34
34
|
# Action operations
|
35
|
-
|
35
|
+
|
36
36
|
def execute
|
37
37
|
super do |node|
|
38
38
|
ensure_network do
|
39
|
-
generated_vagrantfile_name = File.join(CORL.lib_path, 'core', 'vagrant', 'Vagrantfile')
|
39
|
+
generated_vagrantfile_name = File.join(CORL.lib_path, 'core', 'vagrant', 'Vagrantfile')
|
40
40
|
project_vagrantfile_name = File.join(network.directory, 'Vagrantfile')
|
41
41
|
success = true
|
42
|
-
|
42
|
+
|
43
43
|
corl_vagrantfile = Util::Disk.read(generated_vagrantfile_name)
|
44
|
-
|
44
|
+
|
45
45
|
if settings[:save]
|
46
46
|
if File.exists?(project_vagrantfile_name)
|
47
47
|
backup_file = "#{project_vagrantfile_name}.backup"
|
48
|
-
|
48
|
+
|
49
49
|
unless FileUtils.mv(project_vagrantfile_name, backup_file, :force => true)
|
50
50
|
error('file_save', { :file => blue(backup_file) })
|
51
51
|
myself.status = code.vagrant_backup_failure
|
52
52
|
success = false
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
if success
|
57
57
|
unless Util::Disk.write(project_vagrantfile_name, corl_vagrantfile)
|
58
58
|
error('file_save', { :file => blue(project_vagrantfile_name) })
|
59
59
|
myself.status = code.vagrant_save_failure
|
60
60
|
success = false
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
if success
|
64
64
|
if network.save({ :files => 'Vagrantfile', :remote => settings[:net_remote], :message => "Saving new Vagrantfile.", :allow_empty => true })
|
65
65
|
success('update', { :file => blue('Vagrantfile'), :remote_text => yellow(remote_message(settings[:net_remote])) })
|
@@ -71,7 +71,7 @@ class Vagrantfile < CORL.plugin_class(:nucleon, :cloud_action)
|
|
71
71
|
end
|
72
72
|
else
|
73
73
|
puts corl_vagrantfile
|
74
|
-
end
|
74
|
+
end
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|