corl 0.4.0 → 0.4.1
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/Gemfile +5 -10
- data/Gemfile.lock +13 -11
- data/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/corl +2 -54
- data/bootstrap/bootstrap.sh +91 -0
- data/bootstrap/lib/shell/LICENSE.txt +674 -0
- data/bootstrap/lib/shell/command.sh +214 -0
- data/bootstrap/lib/shell/filesystem.sh +139 -0
- data/bootstrap/lib/shell/load.sh +73 -0
- data/bootstrap/lib/shell/os.sh +67 -0
- data/bootstrap/lib/shell/script.sh +160 -0
- data/bootstrap/lib/shell/starter.sh +64 -0
- data/bootstrap/lib/shell/validators.sh +50 -0
- data/bootstrap/os/ubuntu/00_base.sh +5 -0
- data/bootstrap/os/ubuntu/01_git.sh +5 -0
- data/bootstrap/os/ubuntu/05_ruby.sh +7 -0
- data/bootstrap/os/ubuntu/06_puppet.sh +38 -0
- data/bootstrap/os/ubuntu/10_corl.sh +9 -0
- data/corl.gemspec +61 -124
- data/lib/{corl → CORL}/action/bootstrap.rb +13 -7
- data/lib/CORL/action/exec.rb +39 -0
- data/lib/CORL/action/image.rb +31 -0
- data/lib/{corl → CORL}/action/images.rb +1 -1
- data/lib/CORL/action/lookup.rb +34 -0
- data/lib/{corl → CORL}/action/machines.rb +1 -1
- data/lib/CORL/action/provision.rb +31 -0
- data/lib/{corl → CORL}/action/seed.rb +3 -3
- data/lib/{corl → CORL}/action/spawn.rb +2 -2
- data/lib/CORL/action/start.rb +31 -0
- data/lib/CORL/action/stop.rb +31 -0
- data/lib/{corl → CORL}/configuration/file.rb +1 -1
- data/lib/{corl → CORL}/event/puppet.rb +1 -1
- data/lib/{corl → CORL}/extension/puppetloader.rb +1 -1
- data/lib/{corl → CORL}/machine/fog.rb +3 -3
- data/lib/{corl → CORL}/machine/physical.rb +2 -2
- data/lib/{corl → CORL}/network/default.rb +1 -1
- data/lib/{corl → CORL}/node/aws.rb +0 -4
- data/lib/{corl → CORL}/node/google.rb +0 -4
- data/lib/{corl → CORL}/node/local.rb +1 -1
- data/lib/{corl → CORL}/node/rackspace.rb +0 -4
- data/lib/{corl → CORL}/provisioner/puppetnode.rb +1 -14
- data/lib/{corl → CORL}/provisioner/puppetnode/resource.rb +0 -0
- data/lib/{corl → CORL}/provisioner/puppetnode/resource_group.rb +0 -0
- data/lib/{corl → CORL}/template/environment.rb +1 -1
- data/lib/core/facade.rb +49 -0
- data/lib/{corl_core → core}/mixin/action/keypair.rb +10 -10
- data/lib/{corl_core → core}/mixin/lookup.rb +0 -0
- data/lib/{corl_core → core}/mod/hiera_backend.rb +0 -0
- data/lib/{corl_core/mixin/action/node.rb → core/plugin/action.rb} +66 -33
- data/lib/{corl_core → core}/plugin/configuration.rb +2 -2
- data/lib/{corl/node → core/plugin}/fog.rb +5 -1
- data/lib/{corl_core → core}/plugin/machine.rb +2 -2
- data/lib/{corl_core → core}/plugin/network.rb +4 -4
- data/lib/{corl_core → core}/plugin/node.rb +11 -9
- data/lib/{corl_core → core}/plugin/provisioner.rb +2 -2
- data/lib/{corl_core → core}/util/ssh.rb +1 -1
- data/lib/corl.rb +53 -112
- data/lib/puppet/parser/functions/ensure.rb +0 -4
- data/locales/en.yml +55 -148
- metadata +84 -222
- data/lib/corl/action/add.rb +0 -69
- data/lib/corl/action/clone.rb +0 -40
- data/lib/corl/action/create.rb +0 -55
- data/lib/corl/action/exec.rb +0 -41
- data/lib/corl/action/extract.rb +0 -49
- data/lib/corl/action/image.rb +0 -30
- data/lib/corl/action/lookup.rb +0 -35
- data/lib/corl/action/provision.rb +0 -37
- data/lib/corl/action/remove.rb +0 -51
- data/lib/corl/action/save.rb +0 -53
- data/lib/corl/action/start.rb +0 -37
- data/lib/corl/action/stop.rb +0 -30
- data/lib/corl/action/update.rb +0 -37
- data/lib/corl/command/shell.rb +0 -164
- data/lib/corl/event/regex.rb +0 -52
- data/lib/corl/project/git.rb +0 -465
- data/lib/corl/project/github.rb +0 -108
- data/lib/corl/template/json.rb +0 -16
- data/lib/corl/template/wrapper.rb +0 -16
- data/lib/corl/template/yaml.rb +0 -16
- data/lib/corl/translator/json.rb +0 -27
- data/lib/corl/translator/yaml.rb +0 -27
- data/lib/corl_core/codes.rb +0 -107
- data/lib/corl_core/config.rb +0 -337
- data/lib/corl_core/config/collection.rb +0 -57
- data/lib/corl_core/config/options.rb +0 -70
- data/lib/corl_core/core.rb +0 -59
- data/lib/corl_core/corl.rb +0 -254
- data/lib/corl_core/errors.rb +0 -84
- data/lib/corl_core/facade.rb +0 -126
- data/lib/corl_core/gems.rb +0 -72
- data/lib/corl_core/manager.rb +0 -425
- data/lib/corl_core/mixin/action/commit.rb +0 -58
- data/lib/corl_core/mixin/action/project.rb +0 -53
- data/lib/corl_core/mixin/action/push.rb +0 -52
- data/lib/corl_core/mixin/config/collection.rb +0 -53
- data/lib/corl_core/mixin/config/ops.rb +0 -53
- data/lib/corl_core/mixin/config/options.rb +0 -39
- data/lib/corl_core/mixin/macro/object_interface.rb +0 -361
- data/lib/corl_core/mixin/macro/plugin_interface.rb +0 -380
- data/lib/corl_core/mixin/settings.rb +0 -46
- data/lib/corl_core/mixin/sub_config.rb +0 -148
- data/lib/corl_core/mod/hash.rb +0 -29
- data/lib/corl_core/plugin/action.rb +0 -381
- data/lib/corl_core/plugin/base.rb +0 -374
- data/lib/corl_core/plugin/command.rb +0 -98
- data/lib/corl_core/plugin/event.rb +0 -53
- data/lib/corl_core/plugin/extension.rb +0 -12
- data/lib/corl_core/plugin/project.rb +0 -927
- data/lib/corl_core/plugin/template.rb +0 -80
- data/lib/corl_core/plugin/translator.rb +0 -38
- data/lib/corl_core/util/cli.rb +0 -352
- data/lib/corl_core/util/data.rb +0 -404
- data/lib/corl_core/util/disk.rb +0 -114
- data/lib/corl_core/util/git.rb +0 -47
- data/lib/corl_core/util/interface.rb +0 -319
- data/lib/corl_core/util/liquid.rb +0 -17
- data/lib/corl_core/util/package.rb +0 -93
- data/lib/corl_core/util/shell.rb +0 -239
- data/spec/corl_core/interface_spec.rb +0 -489
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Action
|
4
|
-
class Bootstrap < Plugin::
|
4
|
+
class Bootstrap < Plugin::CloudAction
|
5
5
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Settings
|
@@ -22,7 +22,7 @@ class Bootstrap < Plugin::Action
|
|
22
22
|
end
|
23
23
|
register :home_env_var, :str, 'HOME'
|
24
24
|
register :home, :str, nil
|
25
|
-
register :bootstrap_path, :str, File.join(
|
25
|
+
register :bootstrap_path, :str, File.join(CORL.lib_path, '..', 'bootstrap') do |value|
|
26
26
|
unless File.directory?(value)
|
27
27
|
warn('corl.actions.bootstrap.errors.bootstrap_path', { :value => value })
|
28
28
|
next false
|
@@ -33,11 +33,11 @@ class Bootstrap < Plugin::Action
|
|
33
33
|
register :bootstrap_init, :str, 'bootstrap.sh'
|
34
34
|
|
35
35
|
register :bootstrap_nodes, :array, nil do |values|
|
36
|
-
node_plugins =
|
36
|
+
node_plugins = CORL.loaded_plugins(:node)
|
37
37
|
success = true
|
38
38
|
|
39
39
|
values.each do |value|
|
40
|
-
if info =
|
40
|
+
if info = CORL.plugin_class(:node).translate_reference(value)
|
41
41
|
if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
|
42
42
|
warn('corl.actions.bootstrap.errors.bootstrap_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
|
43
43
|
success = false
|
@@ -63,14 +63,20 @@ class Bootstrap < Plugin::Action
|
|
63
63
|
# Operations
|
64
64
|
|
65
65
|
def execute
|
66
|
-
super do |local_node, network|
|
66
|
+
super do |local_node, network|
|
67
67
|
if network
|
68
68
|
batch_success = network.batch(settings[:bootstrap_nodes], settings[:node_provider], settings[:parallel]) do |node|
|
69
69
|
render_options = { :id => node.id, :hostname => node.hostname }
|
70
70
|
|
71
71
|
info('corl.actions.bootstrap.start', render_options)
|
72
|
-
node.bootstrap(network.home, extended_config(:bootstrap, settings))
|
73
|
-
|
72
|
+
success = node.bootstrap(network.home, extended_config(:bootstrap, settings))
|
73
|
+
if success
|
74
|
+
info('corl.actions.bootstrap.success', render_options)
|
75
|
+
else
|
76
|
+
render_options[:status] = node.status
|
77
|
+
error('corl.actions.bootstrap.failure', render_options)
|
78
|
+
end
|
79
|
+
success
|
74
80
|
end
|
75
81
|
myself.status = code.batch_error unless batch_success
|
76
82
|
else
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Action
|
4
|
+
class Exec < Plugin::CloudAction
|
5
|
+
|
6
|
+
#----------------------------------------------------------------------------
|
7
|
+
# Settings
|
8
|
+
|
9
|
+
def configure
|
10
|
+
super do
|
11
|
+
codes :network_failure
|
12
|
+
|
13
|
+
register :command, :array, nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
#---
|
18
|
+
|
19
|
+
def arguments
|
20
|
+
[ :command ]
|
21
|
+
end
|
22
|
+
|
23
|
+
#-----------------------------------------------------------------------------
|
24
|
+
# Operations
|
25
|
+
|
26
|
+
def execute
|
27
|
+
super do |node, network|
|
28
|
+
if network && node
|
29
|
+
command_str = settings[:command].join(' ')
|
30
|
+
result = node.exec({ :commands => [ command_str ] }).first
|
31
|
+
myself.status = result.status
|
32
|
+
else
|
33
|
+
myself.status = code.network_failure
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Action
|
4
|
+
class Image < Plugin::CloudAction
|
5
|
+
|
6
|
+
#-----------------------------------------------------------------------------
|
7
|
+
# Settings
|
8
|
+
|
9
|
+
def configure
|
10
|
+
super do
|
11
|
+
codes :network_failure
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
#-----------------------------------------------------------------------------
|
16
|
+
# Operations
|
17
|
+
|
18
|
+
def execute
|
19
|
+
super do |node, network|
|
20
|
+
info('corl.actions.image.start')
|
21
|
+
|
22
|
+
if network && node
|
23
|
+
|
24
|
+
else
|
25
|
+
myself.status = code.network_failure
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Action
|
4
|
+
class Lookup < Plugin::CloudAction
|
5
|
+
|
6
|
+
#-----------------------------------------------------------------------------
|
7
|
+
# Settings
|
8
|
+
|
9
|
+
def configure
|
10
|
+
super do
|
11
|
+
register :property, :str, nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
#---
|
16
|
+
|
17
|
+
def arguments
|
18
|
+
[ :property ]
|
19
|
+
end
|
20
|
+
|
21
|
+
#-----------------------------------------------------------------------------
|
22
|
+
# Operations
|
23
|
+
|
24
|
+
def execute
|
25
|
+
super do |node, network|
|
26
|
+
property = settings[:property]
|
27
|
+
value = lookup(property)
|
28
|
+
|
29
|
+
render(sprintf("#{property} = %s", value.inspect))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Action
|
4
|
+
class Provision < Plugin::CloudAction
|
5
|
+
|
6
|
+
#-----------------------------------------------------------------------------
|
7
|
+
# Settings
|
8
|
+
|
9
|
+
def configure
|
10
|
+
super do
|
11
|
+
register :provider, :str, :puppetnode
|
12
|
+
register :directory, :str, :default
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def arguments
|
17
|
+
[ :directory ]
|
18
|
+
end
|
19
|
+
|
20
|
+
#-----------------------------------------------------------------------------
|
21
|
+
# Operations
|
22
|
+
|
23
|
+
def execute
|
24
|
+
super do |node, network|
|
25
|
+
info('corl.actions.provision.start')
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Action
|
4
|
-
class Seed < Plugin::
|
4
|
+
class Seed < Plugin::CloudAction
|
5
5
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Settings
|
@@ -19,9 +19,9 @@ class Seed < Plugin::Action
|
|
19
19
|
register :project_branch, :str, 'master'
|
20
20
|
register :project_reference, :str, nil do |value|
|
21
21
|
value = value.to_sym
|
22
|
-
project_plugins =
|
22
|
+
project_plugins = CORL.loaded_plugins(:project)
|
23
23
|
|
24
|
-
if @project_info =
|
24
|
+
if @project_info = CORL.plugin_class(:project).translate_reference(value, true)
|
25
25
|
provider = @project_info[:provider]
|
26
26
|
else
|
27
27
|
provider = value
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Action
|
4
|
-
class Spawn < Plugin::
|
4
|
+
class Spawn < Plugin::CloudAction
|
5
5
|
|
6
6
|
include Mixin::Action::Keypair
|
7
7
|
|
@@ -46,7 +46,7 @@ class Spawn < Plugin::Action
|
|
46
46
|
|
47
47
|
def execute
|
48
48
|
super do |node, network|
|
49
|
-
info('corl.
|
49
|
+
info('corl.actions.spawn.start')
|
50
50
|
|
51
51
|
if network
|
52
52
|
if keypair && keypair_clean
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Action
|
4
|
+
class Start < Plugin::CloudAction
|
5
|
+
|
6
|
+
#-----------------------------------------------------------------------------
|
7
|
+
# Settings
|
8
|
+
|
9
|
+
def configure
|
10
|
+
super do
|
11
|
+
codes :network_failure
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
#-----------------------------------------------------------------------------
|
16
|
+
# Operations
|
17
|
+
|
18
|
+
def execute
|
19
|
+
super do |node, network|
|
20
|
+
info('corl.actions.start.start')
|
21
|
+
|
22
|
+
if network && node
|
23
|
+
|
24
|
+
else
|
25
|
+
myself.status = code.network_failure
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Action
|
4
|
+
class Stop < Plugin::CloudAction
|
5
|
+
|
6
|
+
#-----------------------------------------------------------------------------
|
7
|
+
# Settings
|
8
|
+
|
9
|
+
def configure
|
10
|
+
super do
|
11
|
+
codes :network_failure
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
#-----------------------------------------------------------------------------
|
16
|
+
# Operations
|
17
|
+
|
18
|
+
def execute
|
19
|
+
super do |node, network|
|
20
|
+
info('corl.actions.stop.start')
|
21
|
+
|
22
|
+
if network && node
|
23
|
+
|
24
|
+
else
|
25
|
+
myself.status = code.network_failure
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Machine
|
4
|
-
class Fog <
|
4
|
+
class Fog < CORL.plugin_class(:machine)
|
5
5
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Checks
|
@@ -54,7 +54,7 @@ class Fog < Plugin::Machine
|
|
54
54
|
unless @server.nil?
|
55
55
|
myself.name = @server.id
|
56
56
|
|
57
|
-
node[:id] =
|
57
|
+
node[:id] = plugin_name
|
58
58
|
node[:hostname] = @server.name
|
59
59
|
node[:public_ip] = @server.public_ip_address
|
60
60
|
node[:private_ip] = @server.private_ip_address
|
@@ -136,7 +136,7 @@ class Fog < Plugin::Machine
|
|
136
136
|
|
137
137
|
def load
|
138
138
|
super do
|
139
|
-
myself.server =
|
139
|
+
myself.server = plugin_name if compute && ! plugin_name.empty?
|
140
140
|
server.nil? ? false : true
|
141
141
|
end
|
142
142
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Machine
|
4
|
-
class Physical <
|
4
|
+
class Physical < CORL.plugin_class(:machine)
|
5
5
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Machine plugin interface
|
@@ -104,7 +104,7 @@ class Physical < Plugin::Machine
|
|
104
104
|
logger.debug("Executing shell commands ( #{commands.inspect} ) on machine #{name}")
|
105
105
|
|
106
106
|
commands.each do |command|
|
107
|
-
result =
|
107
|
+
result = CORL.cli_run(command, config) do |op, command_str, data|
|
108
108
|
block_given? ? yield(op, command_str, data) : true
|
109
109
|
end
|
110
110
|
results << result
|