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.
Files changed (122) hide show
  1. data/Gemfile +5 -10
  2. data/Gemfile.lock +13 -11
  3. data/README.rdoc +1 -1
  4. data/Rakefile +3 -3
  5. data/VERSION +1 -1
  6. data/bin/corl +2 -54
  7. data/bootstrap/bootstrap.sh +91 -0
  8. data/bootstrap/lib/shell/LICENSE.txt +674 -0
  9. data/bootstrap/lib/shell/command.sh +214 -0
  10. data/bootstrap/lib/shell/filesystem.sh +139 -0
  11. data/bootstrap/lib/shell/load.sh +73 -0
  12. data/bootstrap/lib/shell/os.sh +67 -0
  13. data/bootstrap/lib/shell/script.sh +160 -0
  14. data/bootstrap/lib/shell/starter.sh +64 -0
  15. data/bootstrap/lib/shell/validators.sh +50 -0
  16. data/bootstrap/os/ubuntu/00_base.sh +5 -0
  17. data/bootstrap/os/ubuntu/01_git.sh +5 -0
  18. data/bootstrap/os/ubuntu/05_ruby.sh +7 -0
  19. data/bootstrap/os/ubuntu/06_puppet.sh +38 -0
  20. data/bootstrap/os/ubuntu/10_corl.sh +9 -0
  21. data/corl.gemspec +61 -124
  22. data/lib/{corl → CORL}/action/bootstrap.rb +13 -7
  23. data/lib/CORL/action/exec.rb +39 -0
  24. data/lib/CORL/action/image.rb +31 -0
  25. data/lib/{corl → CORL}/action/images.rb +1 -1
  26. data/lib/CORL/action/lookup.rb +34 -0
  27. data/lib/{corl → CORL}/action/machines.rb +1 -1
  28. data/lib/CORL/action/provision.rb +31 -0
  29. data/lib/{corl → CORL}/action/seed.rb +3 -3
  30. data/lib/{corl → CORL}/action/spawn.rb +2 -2
  31. data/lib/CORL/action/start.rb +31 -0
  32. data/lib/CORL/action/stop.rb +31 -0
  33. data/lib/{corl → CORL}/configuration/file.rb +1 -1
  34. data/lib/{corl → CORL}/event/puppet.rb +1 -1
  35. data/lib/{corl → CORL}/extension/puppetloader.rb +1 -1
  36. data/lib/{corl → CORL}/machine/fog.rb +3 -3
  37. data/lib/{corl → CORL}/machine/physical.rb +2 -2
  38. data/lib/{corl → CORL}/network/default.rb +1 -1
  39. data/lib/{corl → CORL}/node/aws.rb +0 -4
  40. data/lib/{corl → CORL}/node/google.rb +0 -4
  41. data/lib/{corl → CORL}/node/local.rb +1 -1
  42. data/lib/{corl → CORL}/node/rackspace.rb +0 -4
  43. data/lib/{corl → CORL}/provisioner/puppetnode.rb +1 -14
  44. data/lib/{corl → CORL}/provisioner/puppetnode/resource.rb +0 -0
  45. data/lib/{corl → CORL}/provisioner/puppetnode/resource_group.rb +0 -0
  46. data/lib/{corl → CORL}/template/environment.rb +1 -1
  47. data/lib/core/facade.rb +49 -0
  48. data/lib/{corl_core → core}/mixin/action/keypair.rb +10 -10
  49. data/lib/{corl_core → core}/mixin/lookup.rb +0 -0
  50. data/lib/{corl_core → core}/mod/hiera_backend.rb +0 -0
  51. data/lib/{corl_core/mixin/action/node.rb → core/plugin/action.rb} +66 -33
  52. data/lib/{corl_core → core}/plugin/configuration.rb +2 -2
  53. data/lib/{corl/node → core/plugin}/fog.rb +5 -1
  54. data/lib/{corl_core → core}/plugin/machine.rb +2 -2
  55. data/lib/{corl_core → core}/plugin/network.rb +4 -4
  56. data/lib/{corl_core → core}/plugin/node.rb +11 -9
  57. data/lib/{corl_core → core}/plugin/provisioner.rb +2 -2
  58. data/lib/{corl_core → core}/util/ssh.rb +1 -1
  59. data/lib/corl.rb +53 -112
  60. data/lib/puppet/parser/functions/ensure.rb +0 -4
  61. data/locales/en.yml +55 -148
  62. metadata +84 -222
  63. data/lib/corl/action/add.rb +0 -69
  64. data/lib/corl/action/clone.rb +0 -40
  65. data/lib/corl/action/create.rb +0 -55
  66. data/lib/corl/action/exec.rb +0 -41
  67. data/lib/corl/action/extract.rb +0 -49
  68. data/lib/corl/action/image.rb +0 -30
  69. data/lib/corl/action/lookup.rb +0 -35
  70. data/lib/corl/action/provision.rb +0 -37
  71. data/lib/corl/action/remove.rb +0 -51
  72. data/lib/corl/action/save.rb +0 -53
  73. data/lib/corl/action/start.rb +0 -37
  74. data/lib/corl/action/stop.rb +0 -30
  75. data/lib/corl/action/update.rb +0 -37
  76. data/lib/corl/command/shell.rb +0 -164
  77. data/lib/corl/event/regex.rb +0 -52
  78. data/lib/corl/project/git.rb +0 -465
  79. data/lib/corl/project/github.rb +0 -108
  80. data/lib/corl/template/json.rb +0 -16
  81. data/lib/corl/template/wrapper.rb +0 -16
  82. data/lib/corl/template/yaml.rb +0 -16
  83. data/lib/corl/translator/json.rb +0 -27
  84. data/lib/corl/translator/yaml.rb +0 -27
  85. data/lib/corl_core/codes.rb +0 -107
  86. data/lib/corl_core/config.rb +0 -337
  87. data/lib/corl_core/config/collection.rb +0 -57
  88. data/lib/corl_core/config/options.rb +0 -70
  89. data/lib/corl_core/core.rb +0 -59
  90. data/lib/corl_core/corl.rb +0 -254
  91. data/lib/corl_core/errors.rb +0 -84
  92. data/lib/corl_core/facade.rb +0 -126
  93. data/lib/corl_core/gems.rb +0 -72
  94. data/lib/corl_core/manager.rb +0 -425
  95. data/lib/corl_core/mixin/action/commit.rb +0 -58
  96. data/lib/corl_core/mixin/action/project.rb +0 -53
  97. data/lib/corl_core/mixin/action/push.rb +0 -52
  98. data/lib/corl_core/mixin/config/collection.rb +0 -53
  99. data/lib/corl_core/mixin/config/ops.rb +0 -53
  100. data/lib/corl_core/mixin/config/options.rb +0 -39
  101. data/lib/corl_core/mixin/macro/object_interface.rb +0 -361
  102. data/lib/corl_core/mixin/macro/plugin_interface.rb +0 -380
  103. data/lib/corl_core/mixin/settings.rb +0 -46
  104. data/lib/corl_core/mixin/sub_config.rb +0 -148
  105. data/lib/corl_core/mod/hash.rb +0 -29
  106. data/lib/corl_core/plugin/action.rb +0 -381
  107. data/lib/corl_core/plugin/base.rb +0 -374
  108. data/lib/corl_core/plugin/command.rb +0 -98
  109. data/lib/corl_core/plugin/event.rb +0 -53
  110. data/lib/corl_core/plugin/extension.rb +0 -12
  111. data/lib/corl_core/plugin/project.rb +0 -927
  112. data/lib/corl_core/plugin/template.rb +0 -80
  113. data/lib/corl_core/plugin/translator.rb +0 -38
  114. data/lib/corl_core/util/cli.rb +0 -352
  115. data/lib/corl_core/util/data.rb +0 -404
  116. data/lib/corl_core/util/disk.rb +0 -114
  117. data/lib/corl_core/util/git.rb +0 -47
  118. data/lib/corl_core/util/interface.rb +0 -319
  119. data/lib/corl_core/util/liquid.rb +0 -17
  120. data/lib/corl_core/util/package.rb +0 -93
  121. data/lib/corl_core/util/shell.rb +0 -239
  122. 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::Action
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(Gems.core.full_gem_path, 'bootstrap') do |value|
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 = Manager.connection.loaded_plugins(:node)
36
+ node_plugins = CORL.loaded_plugins(:node)
37
37
  success = true
38
38
 
39
39
  values.each do |value|
40
- if info = Plugin::Node.translate_reference(value)
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
- info('corl.actions.bootstrap.success', render_options)
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
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Action
4
- class Images < Plugin::Action
4
+ class Images < Plugin::CloudAction
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Settings
@@ -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
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Action
4
- class Machines < Plugin::Action
4
+ class Machines < Plugin::CloudAction
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Settings
@@ -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::Action
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 = Manager.connection.loaded_plugins(:project)
22
+ project_plugins = CORL.loaded_plugins(:project)
23
23
 
24
- if @project_info = Plugin::Project.translate_reference(value, true)
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::Action
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.core.actions.spawn.start')
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 Configuration
4
- class File < Plugin::Configuration
4
+ class File < CORL.plugin_class(:configuration)
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Configuration plugin interface
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Event
4
- class Puppet < Plugin::Event
4
+ class Puppet < CORL.plugin_class(:event)
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Puppet event interface
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Extension
4
- class Puppetloader < Plugin::Extension
4
+ class Puppetloader < CORL.plugin_class(:extension)
5
5
 
6
6
  def register_plugins(config)
7
7
  connection = Manager.connection
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Machine
4
- class Fog < Plugin::Machine
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] = name
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 = name if compute && ! name.empty?
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 < Plugin::Machine
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 = Util::Shell.connection.exec(command, config) do |op, command_str, data|
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
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Network
4
- class Default < Plugin::Network
4
+ class Default < CORL.plugin_class(:network)
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Cloud plugin interface
@@ -1,8 +1,4 @@
1
1
 
2
- corl_require(File.dirname(__FILE__), :fog)
3
-
4
- #---
5
-
6
2
  module CORL
7
3
  module Node
8
4
  class Aws < Node::Fog
@@ -1,8 +1,4 @@
1
1
 
2
- corl_require(File.dirname(__FILE__), :fog)
3
-
4
- #---
5
-
6
2
  module CORL
7
3
  module Node
8
4
  class Google < Node::Fog
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Node
4
- class Local < Plugin::Node
4
+ class Local < CORL.plugin_class(:node)
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Node plugin interface
@@ -1,8 +1,4 @@
1
1
 
2
- corl_require(File.dirname(__FILE__), :fog)
3
-
4
- #---
5
-
6
2
  module CORL
7
3
  module Node
8
4
  class Rackspace < Node::Fog