cm 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d05228dd289bffb3d2c8be98aad43c5b5fa57fa
4
- data.tar.gz: 40b139ff6302463f604cafb6a2ae76a378c9d001
3
+ metadata.gz: 43114deae0d0a5a16b27cf22708d0181fa55f98f
4
+ data.tar.gz: 2b0a9a2184272ff5af48fa7fb762a8ba9ec07276
5
5
  SHA512:
6
- metadata.gz: 094fe4e3533a99cb4893bad66e79fb4cb9804b4009fa90ec06920f843267b82f6879b07401b2bb97cff569700e94970b796d7bed82a9a58016c8534f138b442d
7
- data.tar.gz: 2f90ff99791b7b60a51deb6c2b9dbae728771a7773438e07b1882a0be61af959b52c688a8a8d5355ec206ad08ab0b5f5c2fc8febd6fa8e2066e341bc31442e16
6
+ metadata.gz: 9011215f6338f7a2e73fba8f441fb505e8428f7d25d65ef2dcd598defff2e176951fd28bc9a8631ed6150aad1d87484e8191ea1fff66c53dc9f0b71aba938d6d
7
+ data.tar.gz: dc9b882a12f4a03bb3fdf36cf744ac3bcb842facac3410fa63e33bd3f88a42e143b77cef801872c001605467c3b85573fd4bed4b0cb2863a7860c06c631e4240
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/cm.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: cm 0.1.3 ruby lib
5
+ # stub: cm 0.1.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "cm"
9
- s.version = "0.1.3"
9
+ s.version = "0.1.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Adrian Webb"]
14
- s.date = "2015-12-09"
14
+ s.date = "2015-12-11"
15
15
  s.description = "\nPluggable cloud management framework that provides a simple foundation for\ndeploying and destroying enterprise ready cloud environments and components\nthat integrate; cloud provider components and services, cloud orchestration\nand configuration management tools, and continuous integration and delivery\npipelines.\n"
16
16
  s.email = "adrian.webb@gsa.gov"
17
17
  s.executables = ["cm"]
@@ -29,8 +29,10 @@ Gem::Specification.new do |s|
29
29
  "lib/CM/batch/celluloid.rb",
30
30
  "lib/CM/configuration/directory.rb",
31
31
  "lib/CM/configuration/file.rb",
32
+ "lib/CM/function/generate_password.rb",
32
33
  "lib/CM/job/AWS.rb",
33
34
  "lib/CM/job/BOSH.rb",
35
+ "lib/CM/job/MicroBOSH.rb",
34
36
  "lib/CM/job/concourse.rb",
35
37
  "lib/CM/job/keypair.rb",
36
38
  "lib/CM/job/variables.rb",
@@ -46,6 +48,8 @@ Gem::Specification.new do |s|
46
48
  "lib/core/plugin/cm_action.rb",
47
49
  "lib/core/plugin/configuration.rb",
48
50
  "lib/core/plugin/disk_configuration.rb",
51
+ "lib/core/plugin/docker_job.rb",
52
+ "lib/core/plugin/function.rb",
49
53
  "lib/core/plugin/job.rb",
50
54
  "lib/core/plugin/parallel_base.rb",
51
55
  "lib/core/plugin/plan.rb",
@@ -27,7 +27,7 @@ class Celluloid < Nucleon.plugin_class(:CM, :batch)
27
27
  values = []
28
28
  jobs.each do |job|
29
29
  values << Celluloid::Future.new(job) do
30
- job.execute(sequence.settings)
30
+ job.execute
31
31
  end
32
32
  end
33
33
  values = values.map { |future| future.value }
@@ -0,0 +1,30 @@
1
+
2
+ module CM
3
+ module Function
4
+ class GeneratePassword < Nucleon.plugin_class(:CM, :function)
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Plugin interface
8
+
9
+ #-----------------------------------------------------------------------------
10
+ # Checks
11
+
12
+ #-----------------------------------------------------------------------------
13
+ # Property accessors / modifiers
14
+
15
+ #-----------------------------------------------------------------------------
16
+ # Operations
17
+
18
+ def execute(args)
19
+ super do
20
+ length = (args.length == 1 ? args[0] : 40)
21
+ `openssl rand -base64 "$((#{length} * 2))" | perl -pe 's/[^a-zA-Z0-9]//g' - | cut -c1-#{length}`
22
+ end
23
+ end
24
+
25
+ #-----------------------------------------------------------------------------
26
+ # Utilities
27
+
28
+ end
29
+ end
30
+ end
@@ -24,6 +24,12 @@ class AWS < Nucleon.plugin_class(:CM, :job)
24
24
  #-----------------------------------------------------------------------------
25
25
  # Operations
26
26
 
27
+ def execute
28
+ super do
29
+ success = true
30
+ end
31
+ end
32
+
27
33
  #-----------------------------------------------------------------------------
28
34
  # Utilities
29
35
 
@@ -24,6 +24,12 @@ class BOSH < Nucleon.plugin_class(:CM, :job)
24
24
  #-----------------------------------------------------------------------------
25
25
  # Operations
26
26
 
27
+ def execute
28
+ super do
29
+ success = true
30
+ end
31
+ end
32
+
27
33
  #-----------------------------------------------------------------------------
28
34
  # Utilities
29
35
 
@@ -0,0 +1,38 @@
1
+
2
+ module CM
3
+ module Job
4
+ class MicroBOSH < Nucleon.plugin_class(:CM, :job)
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Plugin interface
8
+
9
+ def normalize(reload)
10
+ super
11
+ yield if block_given?
12
+ end
13
+
14
+ #-----------------------------------------------------------------------------
15
+ # Checks
16
+
17
+ def initialized?(options = {})
18
+ true
19
+ end
20
+
21
+ #-----------------------------------------------------------------------------
22
+ # Property accessors / modifiers
23
+
24
+ #-----------------------------------------------------------------------------
25
+ # Operations
26
+
27
+ def execute
28
+ super do
29
+ success = true
30
+ end
31
+ end
32
+
33
+ #-----------------------------------------------------------------------------
34
+ # Utilities
35
+
36
+ end
37
+ end
38
+ end
@@ -24,6 +24,12 @@ class Concourse < Nucleon.plugin_class(:CM, :job)
24
24
  #-----------------------------------------------------------------------------
25
25
  # Operations
26
26
 
27
+ def execute
28
+ super do
29
+ success = true
30
+ end
31
+ end
32
+
27
33
  #-----------------------------------------------------------------------------
28
34
  # Utilities
29
35
 
@@ -24,6 +24,12 @@ class Keypair < Nucleon.plugin_class(:CM, :job)
24
24
  #-----------------------------------------------------------------------------
25
25
  # Operations
26
26
 
27
+ def execute
28
+ super do
29
+ success = true
30
+ end
31
+ end
32
+
27
33
  #-----------------------------------------------------------------------------
28
34
  # Utilities
29
35
 
@@ -14,16 +14,18 @@ class Variables < Nucleon.plugin_class(:CM, :job)
14
14
  #-----------------------------------------------------------------------------
15
15
  # Checks
16
16
 
17
- def initialized?(options = {})
18
- true
19
- end
20
-
21
17
  #-----------------------------------------------------------------------------
22
18
  # Property accessors / modifiers
23
19
 
24
20
  #-----------------------------------------------------------------------------
25
21
  # Operations
26
22
 
23
+ def execute
24
+ super do
25
+ success = true
26
+ end
27
+ end
28
+
27
29
  #-----------------------------------------------------------------------------
28
30
  # Utilities
29
31
 
@@ -23,7 +23,8 @@ class Default < Nucleon.plugin_class(:CM, :sequence)
23
23
  def forward(options)
24
24
  super do |config, success|
25
25
  jobs.each do |job|
26
- success = false unless job.execute(settings)
26
+ success = false unless job.execute
27
+ break if trap && step
27
28
  end
28
29
  success
29
30
  end
@@ -34,7 +35,8 @@ class Default < Nucleon.plugin_class(:CM, :sequence)
34
35
  def reverse(options)
35
36
  super do |config, success|
36
37
  jobs.reverse.each do |job|
37
- success = false unless job.execute(settings)
38
+ success = false unless job.execute
39
+ break if trap && step
38
40
  end
39
41
  success
40
42
  end
data/lib/cm.rb CHANGED
@@ -107,7 +107,8 @@ module CM
107
107
  :configuration => :file, # Component and manifest storage
108
108
  :sequence => :default, # Event sequence
109
109
  :batch => :celluloid,# Batch processor
110
- :job => :variables # Individual job
110
+ :job => :variables,# Individual job
111
+ :function => nil # Configuration processing function
111
112
  }
112
113
  end
113
114
  end
@@ -62,5 +62,15 @@ module Facade
62
62
  def jobs(data, build_hash = false, keep_array = false)
63
63
  Nucleon.plugins(:CM, :job, data, build_hash, keep_array)
64
64
  end
65
+
66
+ #---
67
+
68
+ def function(options, provider = nil)
69
+ Nucleon.plugin(:CM, :function, provider, options)
70
+ end
71
+
72
+ def functions(data, build_hash = false, keep_array = false)
73
+ Nucleon.plugins(:CM, :function, data, build_hash, keep_array)
74
+ end
65
75
  end
66
76
  end
@@ -104,7 +104,7 @@ module Registration
104
104
  #---
105
105
 
106
106
  def register_job_provider(name, default = nil, locale = nil, &code)
107
- register_plugin_provider(:CM, :jobch, name.to_sym, default, locale, &code)
107
+ register_plugin_provider(:CM, :job, name.to_sym, default, locale, &code)
108
108
  end
109
109
 
110
110
  #---
@@ -124,6 +124,30 @@ module Registration
124
124
  def register_jobs(name, default = nil, locale = nil, &code)
125
125
  register_plugins(:CM, :job, name.to_sym, default, locale, &code)
126
126
  end
127
+
128
+ #---
129
+
130
+ def register_function_provider(name, default = nil, locale = nil, &code)
131
+ register_plugin_provider(:CM, :function, name.to_sym, default, locale, &code)
132
+ end
133
+
134
+ #---
135
+
136
+ def register_function_providers(name, default = nil, locale = nil, &code)
137
+ register_plugin_providers(:CM, :function, name.to_sym, default, locale, &code)
138
+ end
139
+
140
+ #---
141
+
142
+ def register_function(name, default = nil, locale = nil, &code)
143
+ register_plugin(:CM, :function, name.to_sym, default, locale, &code)
144
+ end
145
+
146
+ #---
147
+
148
+ def register_functions(name, default = nil, locale = nil, &code)
149
+ register_plugins(:CM, :function, name.to_sym, default, locale, &code)
150
+ end
127
151
  end
128
152
  end
129
153
  end
@@ -61,9 +61,9 @@ class Batch < Nucleon.plugin_class(:nucleon, :parallel_base)
61
61
  #-----------------------------------------------------------------------------
62
62
  # Operations
63
63
 
64
- def execute(settings, parallel = true)
64
+ def execute
65
65
  if initialized?
66
- if Nucleon.parallel? && parallel
66
+ if Nucleon.parallel?
67
67
  success = execute_parallel
68
68
  else
69
69
  success = execute_sequence
@@ -86,7 +86,8 @@ class Batch < Nucleon.plugin_class(:nucleon, :parallel_base)
86
86
  def execute_sequence
87
87
  success = true
88
88
  jobs.each do |job|
89
- success = false unless job.execute(sequence.settings)
89
+ success = false unless job.execute
90
+ break if sequence.trap && sequence.step
90
91
  end
91
92
  success
92
93
  end
@@ -0,0 +1,52 @@
1
+
2
+ nucleon_require(File.dirname(__FILE__), :job)
3
+
4
+ #---
5
+
6
+ module CM
7
+ module Plugin
8
+ class DockerJob < Nucleon.plugin_class(:CM, :job)
9
+
10
+ #-----------------------------------------------------------------------------
11
+ # Plugin interface
12
+
13
+ def normalize(reload)
14
+ super
15
+ yield if block_given?
16
+ end
17
+
18
+ #-----------------------------------------------------------------------------
19
+ # Checks
20
+
21
+ def initialized?(options = {})
22
+ true
23
+ end
24
+
25
+ #-----------------------------------------------------------------------------
26
+ # Property accessors / modifiers
27
+
28
+ def image
29
+ settings[:image]
30
+ end
31
+
32
+ def image=image
33
+ settings[:image] = image
34
+ end
35
+
36
+ #-----------------------------------------------------------------------------
37
+ # Operations
38
+
39
+ def execute
40
+ super do
41
+ success = true
42
+ success = yield if block_given?
43
+ success
44
+ end
45
+ end
46
+
47
+ #-----------------------------------------------------------------------------
48
+ # Utilities
49
+
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,42 @@
1
+
2
+ module CM
3
+ module Plugin
4
+ class Function < Nucleon.plugin_class(:nucleon, :base)
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Plugin interface
8
+
9
+ def normalize(reload)
10
+ super
11
+ yield if block_given?
12
+ end
13
+
14
+ #-----------------------------------------------------------------------------
15
+ # Checks
16
+
17
+ def initialized?(options = {})
18
+ true
19
+ end
20
+
21
+ #-----------------------------------------------------------------------------
22
+ # Property accessors / modifiers
23
+
24
+ #-----------------------------------------------------------------------------
25
+ # Operations
26
+
27
+ def execute(args)
28
+ if initialized?
29
+ output = ''
30
+ output = yield if block_given?
31
+ else
32
+ output = ''
33
+ end
34
+ output.strip
35
+ end
36
+
37
+ #-----------------------------------------------------------------------------
38
+ # Utilities
39
+
40
+ end
41
+ end
42
+ end
@@ -7,14 +7,43 @@ module CM
7
7
  module Plugin
8
8
  class Job < Nucleon.plugin_class(:nucleon, :parallel_base)
9
9
 
10
+ def self.register_ids
11
+ [ :id ]
12
+ end
13
+
10
14
  #-----------------------------------------------------------------------------
11
15
  # Plugin interface
12
16
 
13
17
  def normalize(reload)
14
18
  super
19
+
20
+ @sequence = delete(:sequence, nil) unless reload
21
+
15
22
  yield if block_given?
16
23
  end
17
24
 
25
+ #---
26
+
27
+ def init_tokens
28
+ @tokens = {}
29
+
30
+ collect_tokens = lambda do |local_settings, token|
31
+ local_settings.each do |name, value|
32
+ setting_token = [ array(token), name ].flatten
33
+
34
+ if value.is_a?(Hash)
35
+ collect_tokens.call(value, setting_token)
36
+ else
37
+ token_base = setting_token.shift
38
+ sequence.set_token(token_base, setting_token, value)
39
+ end
40
+ end
41
+ end
42
+
43
+ # Generate parameter tokens
44
+ collect_tokens.call(settings[:parameters], id)
45
+ end
46
+
18
47
  #-----------------------------------------------------------------------------
19
48
  # Checks
20
49
 
@@ -25,12 +54,36 @@ class Job < Nucleon.plugin_class(:nucleon, :parallel_base)
25
54
  #-----------------------------------------------------------------------------
26
55
  # Property accessors / modifiers
27
56
 
57
+ def sequence
58
+ @sequence
59
+ end
60
+
61
+ #---
62
+
63
+ def settings
64
+ get_hash(:settings)
65
+ end
66
+
67
+ #---
68
+
69
+ def id
70
+ get(:id, '')
71
+ end
72
+
73
+ def parameters
74
+ hash(settings[:parameters])
75
+ end
76
+
28
77
  #-----------------------------------------------------------------------------
29
78
  # Operations
30
79
 
31
- def execute(settings)
80
+ def execute
32
81
  if initialized?
33
82
  success = true
83
+
84
+ execute_functions
85
+ interpolate_parameters
86
+
34
87
  success = yield if block_given?
35
88
  else
36
89
  success = false
@@ -41,6 +94,86 @@ class Job < Nucleon.plugin_class(:nucleon, :parallel_base)
41
94
  #-----------------------------------------------------------------------------
42
95
  # Utilities
43
96
 
97
+ def execute_functions
98
+ execute_value = lambda do |value|
99
+ if value.is_a?(String) && match = value.match(/\<\<([^\>]+)\>\>/)
100
+ match.captures.each do |function_id|
101
+ function_components = function_id.split(':')
102
+ function_provider = function_components.shift
103
+ function_args = function_components
104
+
105
+ function = CM.function({}, function_provider)
106
+ rendered_output = function.execute(function_args)
107
+
108
+ value.gsub!(/\<\<#{function_id}\>\>/, rendered_output)
109
+ end
110
+ end
111
+ value
112
+ end
113
+
114
+ execute = lambda do |settings|
115
+ settings.each do |name, value|
116
+ if value.is_a?(Hash)
117
+ execute.call(value)
118
+ elsif value.is_a?(Array)
119
+ final = []
120
+ value.each do |item|
121
+ final << execute_value.call(item)
122
+ end
123
+ settings[name] = final
124
+ else
125
+ settings[name] = execute_value.call(value)
126
+ end
127
+ end
128
+ end
129
+
130
+ execute.call(settings[:parameters])
131
+ end
132
+
133
+ #---
134
+
135
+ def interpolate_parameters
136
+ interpolate_value = lambda do |base_config, name, value|
137
+ interpolations = false
138
+ sequence.tokens.each do |token_name, token_value|
139
+ if value.is_a?(String) && value.gsub!(/\{\{#{token_name}\}\}/, token_value.to_s)
140
+ interpolations = true
141
+ end
142
+ end
143
+ base_config[name] = value
144
+ interpolations
145
+ end
146
+
147
+ interpolate = lambda do |settings|
148
+ interpolations = false
149
+
150
+ if settings.is_a?(Hash)
151
+ settings.each do |name, value|
152
+ if value.is_a?(Hash) || value.is_a?(Array)
153
+ interpolations = true if interpolate.call(value)
154
+ else
155
+ interpolations = true if interpolate_value.call(settings, name, value)
156
+ end
157
+ end
158
+ elsif settings.is_a?(Array)
159
+ settings.each_with_index do |value, index|
160
+ if value.is_a?(Hash) || value.is_a?(Array)
161
+ interpolations = true if interpolate.call(value)
162
+ else
163
+ interpolations = true if interpolate_value.call(settings, index, value)
164
+ end
165
+ end
166
+ end
167
+ interpolations
168
+ end
169
+
170
+ tries = 0
171
+ loop do
172
+ tries += 1
173
+ init_tokens
174
+ break if tries >= 10 || !interpolate.call(settings[:parameters])
175
+ end
176
+ end
44
177
  end
45
178
  end
46
179
  end
@@ -7,6 +7,10 @@ module CM
7
7
  module Plugin
8
8
  class Plan < Nucleon.plugin_class(:CM, :disk_configuration)
9
9
 
10
+ def self.register_ids
11
+ [ :directory, :revision ]
12
+ end
13
+
10
14
  #-----------------------------------------------------------------------------
11
15
  # Plugin interface
12
16
 
@@ -25,7 +29,7 @@ class Plan < Nucleon.plugin_class(:CM, :disk_configuration)
25
29
  :nucleon_file => false
26
30
  }))
27
31
 
28
- if project
32
+ if project && !reload
29
33
  @loaded_config = CM.configuration(extended_config(:config_data, {
30
34
  :provider => _get(:config_provider, :directory),
31
35
  :path => config_directory
@@ -136,7 +140,8 @@ class Plan < Nucleon.plugin_class(:CM, :disk_configuration)
136
140
  # Initialize job sequence
137
141
  @sequence = CM.sequence({
138
142
  :jobs => manifest_jobs,
139
- :settings => manifest_config
143
+ :settings => manifest_config,
144
+ :trap => _get(:trap, false)
140
145
  }, _get(:sequence_provider, :default))
141
146
 
142
147
  yield if block_given?
@@ -43,6 +43,7 @@ class PlanAction < Nucleon.plugin_class(:nucleon, :cm_action)
43
43
  'cm.action.plan.base.options.key_path',
44
44
  'cm.action.plan.base.errors.key_path'
45
45
  ]
46
+ register_bool :trap, false, 'cm.action.plan.options.trap'
46
47
 
47
48
  project_config
48
49
 
@@ -77,7 +78,8 @@ class PlanAction < Nucleon.plugin_class(:nucleon, :cm_action)
77
78
  :manifest_file => settings[:manifest],
78
79
  :project_provider => settings[:project_provider],
79
80
  :url => settings[:project_reference],
80
- :revision => settings[:project_revision]
81
+ :revision => settings[:project_revision],
82
+ :trap => settings[:trap]
81
83
  }), settings[:plan_provider])
82
84
  end
83
85
  end
@@ -13,10 +13,48 @@ class Sequence < Nucleon.plugin_class(:nucleon, :parallel_base)
13
13
  def normalize(reload)
14
14
  super
15
15
 
16
+ init_tokens
16
17
  init_jobs
18
+
17
19
  yield if block_given?
18
20
  end
19
21
 
22
+ #---
23
+
24
+ def init_jobs
25
+ @jobs = []
26
+ get_array(:jobs).each do |job_config|
27
+ if job_config.has_key?(:aggregate) # Array
28
+ @jobs << create_batch(job_config[:aggregate])
29
+ else # Atomic
30
+ @jobs << create_job(job_config)
31
+ end
32
+ end
33
+ @jobs
34
+ end
35
+
36
+ #---
37
+
38
+ def init_tokens
39
+ clear_tokens
40
+
41
+ collect_tokens = lambda do |local_settings, token|
42
+ local_settings.each do |name, value|
43
+ setting_token = [ array(token), name ].flatten
44
+
45
+ if value.is_a?(Hash)
46
+ collect_tokens.call(value, setting_token)
47
+ else
48
+ token_base = setting_token.shift
49
+ set_token(token_base, setting_token, value)
50
+ end
51
+ end
52
+ end
53
+
54
+ # Generate config tokens
55
+ collect_tokens.call(settings, 'config')
56
+ end
57
+
20
58
  #-----------------------------------------------------------------------------
21
59
  # Checks
22
60
 
@@ -33,18 +71,24 @@ class Sequence < Nucleon.plugin_class(:nucleon, :parallel_base)
33
71
 
34
72
  #---
35
73
 
36
- def init_jobs
37
- @jobs = []
38
- get_array(:jobs).each do |job_config|
39
- if job_config.has_key?(:aggregate) # Array
40
- @jobs << create_batch(job_config[:aggregate])
41
- else # Atomic
42
- @jobs << create_job(job_config)
43
- end
44
- end
45
- @jobs
74
+ def tokens
75
+ @tokens
76
+ end
77
+
78
+ def set_token(id, location, value)
79
+ @tokens["#{id}:#{array(location).join('.')}"] = value
80
+ end
81
+
82
+ def remove_token(id, location)
83
+ @tokens.delete("#{id}:#{array(location).join('.')}")
46
84
  end
47
85
 
86
+ def clear_tokens
87
+ @tokens = {}
88
+ end
89
+
90
+ #---
91
+
48
92
  def jobs
49
93
  @jobs
50
94
  end
@@ -52,6 +96,13 @@ class Sequence < Nucleon.plugin_class(:nucleon, :parallel_base)
52
96
  def jobs=jobs
53
97
  set(:jobs, Nucleon::Util::Data.array(jobs))
54
98
  init_jobs
99
+ init_tokens
100
+ end
101
+
102
+ #---
103
+
104
+ def trap
105
+ get(:trap, false)
55
106
  end
56
107
 
57
108
  #-----------------------------------------------------------------------------
@@ -86,21 +137,41 @@ class Sequence < Nucleon.plugin_class(:nucleon, :parallel_base)
86
137
  #-----------------------------------------------------------------------------
87
138
  # Utilities
88
139
 
140
+ def step
141
+ answer = ask('Continue? (yes|no): ', { :i18n => false })
142
+ answer.match(/^[Yy][Ee][Ss]$/) ? false : true
143
+ end
144
+
145
+ #---
146
+
89
147
  def create_sequence(jobs)
90
- CM.sequence({ :settings => settings, :jobs => jobs }, get(:sequence_provider, :default))
148
+ CM.sequence({
149
+ :settings => settings,
150
+ :jobs => jobs,
151
+ :trap => trap,
152
+ :new => true,
153
+ }, get(:sequence_provider, :default))
91
154
  end
92
155
 
93
156
  #---
94
157
 
95
158
  def create_batch(jobs)
96
- CM.batch({ :sequence => myself, :jobs => jobs }, get(:batch_provider, :celluloid))
159
+ CM.batch({
160
+ :sequence => myself,
161
+ :jobs => jobs,
162
+ :new => true
163
+ }, get(:batch_provider, :celluloid))
97
164
  end
98
165
 
99
166
  #---
100
167
 
101
168
  def create_job(settings)
102
169
  settings[:type] ||= get(:default_job_provider, :variables)
103
- CM.job({ :settings => settings }, settings[:type])
170
+ CM.job({
171
+ :sequence => myself,
172
+ :settings => settings,
173
+ :id => settings[:name]
174
+ }, settings[:type])
104
175
  end
105
176
  end
106
177
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Webb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-09 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  type: :runtime
@@ -105,8 +105,10 @@ files:
105
105
  - lib/CM/batch/celluloid.rb
106
106
  - lib/CM/configuration/directory.rb
107
107
  - lib/CM/configuration/file.rb
108
+ - lib/CM/function/generate_password.rb
108
109
  - lib/CM/job/AWS.rb
109
110
  - lib/CM/job/BOSH.rb
111
+ - lib/CM/job/MicroBOSH.rb
110
112
  - lib/CM/job/concourse.rb
111
113
  - lib/CM/job/keypair.rb
112
114
  - lib/CM/job/variables.rb
@@ -122,6 +124,8 @@ files:
122
124
  - lib/core/plugin/cm_action.rb
123
125
  - lib/core/plugin/configuration.rb
124
126
  - lib/core/plugin/disk_configuration.rb
127
+ - lib/core/plugin/docker_job.rb
128
+ - lib/core/plugin/function.rb
125
129
  - lib/core/plugin/job.rb
126
130
  - lib/core/plugin/parallel_base.rb
127
131
  - lib/core/plugin/plan.rb