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
- module CORL
2
+ module Nucleon
3
3
  module Plugin
4
- class Provisioner < Base
4
+ class Provisioner < CORL.plugin_class(:base)
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # Provisioner plugin interface
@@ -1,7 +1,7 @@
1
1
 
2
2
  module CORL
3
3
  module Util
4
- class SSH < Core
4
+ class SSH < Nucleon::Core
5
5
 
6
6
  #-----------------------------------------------------------------------------
7
7
  # User key home
data/lib/corl.rb CHANGED
@@ -1,103 +1,42 @@
1
1
 
2
2
  #*******************************************************************************
3
- # CORL Core Library
3
+ # CORL (Cluster Orchestration and Research Library)
4
4
  #
5
- # This provides core data elements and utilities used in the CORL gems.
5
+ # built on Nucleon (github.com/coralnexus/nucleon)
6
+ #
7
+ # A framework that provides a simple foundation for growing organically in
8
+ # the cloud.
6
9
  #
7
10
  # Author:: Adrian Webb (mailto:adrian.webb@coralnexus.com)
8
11
  # License:: GPLv3
9
12
 
10
- #-------------------------------------------------------------------------------
11
- # Global namespace
12
-
13
- module Kernel
14
-
15
- def dbg(data, label = '')
16
- # Invocations of this function should NOT be committed to the project
17
- require 'pp'
18
-
19
- puts '>>----------------------'
20
- unless label.empty?
21
- puts label
22
- puts '---'
23
- end
24
- pp data
25
- puts '<<'
26
- end
27
-
28
- #---
29
-
30
- def corl_locate(command)
31
- command = command.to_s
32
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
33
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
34
- exts.each do |ext|
35
- exe = File.join(path, "#{command}#{ext}")
36
- return exe if File.executable?(exe)
37
- end
38
- end
39
- return nil
40
- end
41
-
42
- #---
43
-
44
- def corl_require(base_dir, name)
45
- name = name.to_s
46
- top_level_file = File.join(base_dir, "#{name}.rb")
47
-
48
- require top_level_file if File.exists?(top_level_file)
49
-
50
- directory = File.join(base_dir, name)
51
-
52
- if File.directory?(directory)
53
- Dir.glob(File.join(directory, '**', '*.rb')).each do |sub_file|
54
- require sub_file
55
- end
56
- end
57
- end
58
- end
59
-
60
13
  #-------------------------------------------------------------------------------
61
14
  # Top level properties
62
15
 
63
16
  lib_dir = File.dirname(__FILE__)
64
- core_dir = File.join(lib_dir, 'corl_core')
17
+ core_dir = File.join(lib_dir, 'core')
65
18
  mixin_dir = File.join(core_dir, 'mixin')
66
- mixin_config_dir = File.join(mixin_dir, 'config')
67
19
  mixin_action_dir = File.join(mixin_dir, 'action')
68
- macro_dir = File.join(mixin_dir, 'macro')
69
20
  util_dir = File.join(core_dir, 'util')
70
21
  mod_dir = File.join(core_dir, 'mod')
71
- plugin_dir = File.join(core_dir, 'plugin')
72
22
 
73
23
  #-------------------------------------------------------------------------------
74
24
  # CORL requirements
75
25
 
76
- git_location = corl_locate('git')
77
-
78
26
  $:.unshift(lib_dir) unless $:.include?(lib_dir) || $:.include?(File.expand_path(lib_dir))
79
27
 
80
28
  #---
81
29
 
82
30
  require 'rubygems'
83
31
 
84
- require 'pp'
85
- require 'i18n'
86
- require 'log4r'
87
- require 'log4r/configurator'
88
- require 'base64'
32
+ require 'nucleon_base'
33
+ CORL = Nucleon
34
+
35
+ require 'tmpdir'
89
36
  require 'sshkey'
90
- require 'deep_merge'
37
+
91
38
  require 'hiera'
92
39
  require 'facter'
93
- require 'yaml'
94
- require 'multi_json'
95
- require 'digest/sha1'
96
- require 'optparse'
97
- require 'thread' # Eventually depreciated
98
- require 'celluloid'
99
- require 'celluloid/autostart'
100
- require 'tmpdir'
101
40
 
102
41
  #---
103
42
 
@@ -108,13 +47,6 @@ I18n.load_path << File.expand_path(File.join('..', 'locales', 'en.yml'), lib_dir
108
47
 
109
48
  #---
110
49
 
111
- if git_location
112
- require 'grit'
113
- corl_require(util_dir, :git)
114
- end
115
-
116
- #---
117
-
118
50
  # Object modifications (100% pure monkey patches)
119
51
  Dir.glob(File.join(mod_dir, '*.rb')).each do |file|
120
52
  require file
@@ -126,48 +58,57 @@ end
126
58
  Dir.glob(File.join(mixin_dir, '*.rb')).each do |file|
127
59
  require file
128
60
  end
129
- Dir.glob(File.join(mixin_config_dir, '*.rb')).each do |file|
130
- require file
131
- end
132
61
  Dir.glob(File.join(mixin_action_dir, '*.rb')).each do |file|
133
62
  require file
134
63
  end
135
- Dir.glob(File.join(macro_dir, '*.rb')).each do |file|
136
- require file
137
- end
138
-
139
- #---
140
-
141
- # Include bootstrap classes
142
- corl_require(core_dir, :errors)
143
- corl_require(core_dir, :codes)
144
- corl_require(util_dir, :data)
145
- corl_require(core_dir, :config)
146
- corl_require(util_dir, :interface)
147
- corl_require(core_dir, :core)
148
64
 
149
65
  #---
150
66
 
151
- # Include core utilities
152
- [ :liquid,
153
- :cli,
154
- :disk,
155
- :package,
156
- :shell,
157
- :ssh
67
+ # Include CORL utilities
68
+ [ :ssh
158
69
  ].each do |name|
159
- corl_require(util_dir, name)
70
+ nucleon_require(util_dir, name)
160
71
  end
161
72
 
162
- # Include core systems
163
- corl_require(core_dir, :corl)
164
- corl_require(core_dir, :gems)
165
- corl_require(core_dir, :manager)
166
- corl_require(plugin_dir, :base)
167
- corl_require(core_dir, :plugin)
168
- corl_require(core_dir, :facade)
73
+ # Include facade
74
+ nucleon_require(core_dir, :facade)
75
+
76
+ # Include CORL core plugins
77
+ nucleon_require(core_dir, :plugin)
169
78
 
170
79
  #-------------------------------------------------------------------------------
171
- # CORL initialization
80
+ # CORL interface
81
+
82
+ module CORL
83
+
84
+ def self.VERSION
85
+ File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
86
+ end
87
+
88
+ #-----------------------------------------------------------------------------
89
+
90
+ class Config
91
+ include Mixin::Lookup
92
+ end
93
+
94
+ #-----------------------------------------------------------------------------
95
+ # CORL initialization
96
+
97
+ def self.lib_path
98
+ File.dirname(__FILE__)
99
+ end
100
+
101
+ #---
172
102
 
173
- CORL.initialize
103
+ reload(true) do |op, manager|
104
+ if op == :define
105
+ manager.define_namespace :CORL
106
+
107
+ manager.define_type :configuration => :file, # Core
108
+ :network => :default, # Cluster
109
+ :node => :local, # Cluster
110
+ :machine => :physical, # Cluster
111
+ :provisioner => :puppetnode # Cluster
112
+ end
113
+ end
114
+ end
@@ -18,11 +18,7 @@ This function checks a given test and returns the success value or a failure val
18
18
  success_value = (args.size > 1 ? args[1] : test)
19
19
  failure_value = (args.size > 2 ? args[2] : :undef)
20
20
 
21
- #dbg(test, 'test')
22
- #dbg(success_value, 'success')
23
-
24
21
  value = CORL::Util::Data.ensure(test, success_value, failure_value)
25
- #dbg(value, 'value')
26
22
  end
27
23
  return value
28
24
  end
data/locales/en.yml CHANGED
@@ -4,154 +4,53 @@ en:
4
4
  batch_error: |-
5
5
  An issue was encountered during batch processing
6
6
  core:
7
- util:
8
- cli:
9
- options:
10
- help: |-
11
- Display help information for this command
12
- log_level: |-
13
- Set the logging level for this execution run
14
- encoded: |-
15
- Optional encoded parameter set that contains default action settings (machine use only)
16
- parse:
17
- error: |-
18
- There was a problem with the command arguments given
19
- batch:
20
- unexpected_error: |
21
- There was a problem with batch %{process}: %{message}
22
- corl_error: |
23
- There was a problem with batch %{process}: %{message}
24
- mixins:
25
- project:
26
- options:
27
- provider: |-
28
- CORL plugin provider to use for this project (default %{default_value})
29
- reference: |-
30
- Project URL or reference string to set as primary remote (default %{default_value})
31
- revision: |-
32
- Revision or branch to load (default %{default_value})
33
- commit:
34
- options:
35
- commit: |-
36
- Commit any uncommitted changes (default %{default_value})
37
- empty: |-
38
- Allow commits with no changes (default %{default_value})
39
- message: |-
40
- Commit message (defaults to auto generated commit information)
41
- author: |-
42
- Author of the changes being committed if different from the committer
43
- propogate: |-
44
- Propogate commits throughout the project tree (default %{default_value})
45
- push:
46
- options:
47
- push: |-
48
- Push changes to remote server (default %{default_value})
49
- propogate: |-
50
- Propogate pushes to the remote throughout the project tree (default %{default_value})
51
- remote: |-
52
- Remote name to push to (default %{default_value})
53
- revision: |-
54
- Branch to push (default %{default_value})
55
- node:
56
- options:
57
- parallel: |-
58
- Enable parallelism of node action execution (default %{default_value})
59
- net_provider: |-
60
- CORL network provider to use for managing cloud nodes (default %{default_value})
61
- node_provider: |-
62
- Default to using a specific node provider but individual node references can override (default %{default_value})
63
- nodes: |-
64
- Optional nodes on which to execute this action
65
- errors:
66
- network_provider: |-
67
- Network plugin provider %{value} is not loaded >> Pick from the following: %{choices}
68
- node_provider: |-
69
- Node plugin provider %{value} is not loaded >> Pick from the following: %{choices}
70
- nodes: |-
71
- Node reference %{value} failed to parse or provider %{provider} isn't loaded (%{name})
72
- keypair:
73
- options:
74
- private_key: |-
75
- Optional existing private SSH key to use for SSH communication (new keys are generated by default)
76
- require_password: |-
77
- Require and prompt for a password for generated keys (default %{default_value})
78
- key_type: |-
79
- Type of SSH key to generate (default %{default_value})
80
- key_bits: |-
81
- Strength of generated key encryption in bits (default %{default_value})
82
- key_comment: |-
83
- Optional key comment (attached at the end of the public key)
84
- errors:
85
- private_key_not_found: |-
86
- Private key %{value} not found
87
- private_key_parse_error: |-
88
- Private key %{value} failed to parse and can not be accepted as a valid private SSH key
89
- key_type: |-
90
- SSH key type %{value} not supported >> Pick from the following: %{choices}
91
- key_bits: |-
92
- Encryption strength must be greater than %{required} bits (%{value} specified)
93
- no_password: |-
94
- Password verification of private key was terminated (verification required to use encrypted SSH keys)
95
- exec:
96
- help:
97
- usage: |-
98
- Usage
99
- header: |-
100
- Available actions
101
- footer: |-
102
- For help on any individual action run `corl <action> -h`
103
- errors:
104
- missing_argument: |-
105
- Argument <%{name}> must be specified
106
- actions:
107
- extract:
7
+ action:
108
8
  options:
109
- path: |-
110
- Base path in which to extract the encoded data
111
- encoded: |-
112
- Encoded data to be extracted into the base path
9
+ parallel: |-
10
+ Enable parallelism of node action execution (default %{default_value})
11
+ net_provider: |-
12
+ CORL network provider to use for managing cloud nodes (default %{default_value})
13
+ node_provider: |-
14
+ Default to using a specific node provider but individual node references can override (default %{default_value})
15
+ nodes: |-
16
+ Optional nodes on which to execute this action
113
17
  errors:
114
- path: |-
115
- "Base path for extracted files must be an existing directory"
116
- encoded: |-
117
- "Data is either not properly encoded or is empty %{value}"
118
- create:
119
- options:
120
- reference: |-
121
- Git repository URL of CORL cloud to start project from (default %{default_value})
122
- revision: |-
123
- Revision or branch to initialize the project with (default %{default_value})
124
- path: |-
125
- Project path (default %{default_value})
126
- start: |-
127
- Creating a new CORL cloud at %{path} from %{reference}
128
- add:
129
- options:
130
- sub_reference: |-
131
- Repository URL of CORL component (module or library) to include in the project
132
- sub_path: |-
133
- Subproject path
134
- editable: |-
135
- Whether or not this sub project should be added as an editable remote (default %{default_value})
136
- start: |-
137
- Adding new subproject from %{sub_reference} at %{sub_path}
138
- remove:
139
- options:
140
- sub_path: |-
141
- Subproject path
142
- start: |-
143
- Removing existing subproject at %{sub_path}
144
- update:
145
- start: |-
146
- Starting update run from provider %{project_provider} (ref: %{reference} rev: %{revision})
147
- provision: |-
148
- Running provisioning updates on %{node_name} from node provider %{node_provider}
149
- save:
150
- options:
151
- files: |-
152
- Optional space separated list of files to save
153
- start: |-
154
- Saving project changes with provider %{project_provider} (ref: %{reference} rev: %{revision})
18
+ network_provider: |-
19
+ Network plugin provider %{value} is not loaded >> Pick from the following: %{choices}
20
+ node_provider: |-
21
+ Node plugin provider %{value} is not loaded >> Pick from the following: %{choices}
22
+ nodes: |-
23
+ Node reference %{value} failed to parse or provider %{provider} isn't loaded (%{name})
24
+ node:
25
+ bootstrap:
26
+ status: |-
27
+ Bootstrap script %{script} failed with status %{status}
28
+ mixin:
29
+ action:
30
+ keypair:
31
+ options:
32
+ private_key: |-
33
+ Optional existing private SSH key to use for SSH communication (new keys are generated by default)
34
+ require_password: |-
35
+ Require and prompt for a password for generated keys (default %{default_value})
36
+ key_type: |-
37
+ Type of SSH key to generate (default %{default_value})
38
+ key_bits: |-
39
+ Strength of generated key encryption in bits (default %{default_value})
40
+ key_comment: |-
41
+ Optional key comment (attached at the end of the public key)
42
+ errors:
43
+ private_key_not_found: |-
44
+ Private key %{value} not found
45
+ private_key_parse_error: |-
46
+ Private key %{value} failed to parse and can not be accepted as a valid private SSH key
47
+ key_type: |-
48
+ SSH key type %{value} not supported >> Pick from the following: %{choices}
49
+ key_bits: |-
50
+ Encryption strength must be greater than %{required} bits (%{value} specified)
51
+ no_password: |-
52
+ Password verification of private key was terminated (verification required to use encrypted SSH keys)
53
+ actions:
155
54
  images:
156
55
  options:
157
56
  match_case: |-
@@ -219,14 +118,22 @@ en:
219
118
  Starting bootstrap of machine %{hostname} (%{id})
220
119
  success: |-
221
120
  Machine %{hostname} (%{id}) successfully bootstrapped
121
+ failure: |-
122
+ Machine %{hostname} (%{id}) bootstrap failed with status %{status}
222
123
  exec:
223
124
  options:
224
125
  command: |-
225
126
  Command line executable and arguments to execute on machine
226
127
  seed:
227
128
  options:
228
- home: |-
229
- Home directory in which to initialize the deploy SSH keys (default %default_value})
129
+ project_branch: |-
130
+ Project branch to seed project (default %{default_value})
131
+ project_reference: |-
132
+ Reference to seed project (default %{default_value})
230
133
  errors:
231
134
  project_reference: |-
232
135
  Project reference %{value} failed to parse or provider %{provider} isn't loaded >> Possible providers: %{choices}
136
+ provision:
137
+ options:
138
+ provider: |-
139
+ Provisioner provider to use to provision the node (default %{default_value})