vcoworkflows 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/Guardfile +41 -0
- data/README.md +55 -20
- data/example.rb +3 -2
- data/lib/vcoworkflows/version.rb +1 -1
- data/lib/vcoworkflows/workflow.rb +60 -25
- data/spec/vcoworkflows/workflow_spec.rb +42 -17
- data/vcoworkflows.gemspec +5 -2
- metadata +35 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ced3f9cf999f3d9fbbe669c39240be0aac02e6b
|
4
|
+
data.tar.gz: 02bbb9a5a8951b80e7bbf01934097b4c327050c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01b9e9ddc5a548b1628dad6b7f7c548449140670465e60dc492bd934b01fd1ae6fc51bbae2571a6ccfa6cd6129d8ba14ebc43ae5f10cc55bf4ca165840b6c555
|
7
|
+
data.tar.gz: b21e531b8bf7cd252dbea6799183a1a16ac455af968794b1dee9c8a0841a3e5679a24370b3bfb85a05247d9621c36b79873b38a93b683175565d34b8a8dde271
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,54 @@
|
|
1
1
|
vcoworkflows CHANGELOG
|
2
2
|
================
|
3
3
|
|
4
|
+
## 0.1.3
|
5
|
+
|
6
|
+
### Third Time's the Charm
|
7
|
+
|
8
|
+
General cleanup and spit-polish. There are still a few rough spots that'll take some elbow grease, but at least all the parts are in the tin.
|
9
|
+
|
10
|
+
- Update gem spec and documentation to reflect the repo being transferred to [activenetwork-automation](https://github.com/activenetwork-automation)
|
11
|
+
- Set a minimum Ruby version (`>= 2.0`) for the gem (fixes [#9](https://github.com/activenetwork-automation/vcoworkflows/issues/9))
|
12
|
+
- Fix Coveralls integration for CI ([#7](https://github.com/activenetwork-automation/vcoworkflows/issues/7))
|
13
|
+
- Deprecate `Workflow#set_parameter` and `Workflow#get_parameter`, as they're not very Ruby-ish, and if we're going to do things, we might as well do things right. I think this might be more right-ish than before. Anyway, they're deprecated in favor of:
|
14
|
+
- `Workflow#parameter` - Set an input parameter using name and value:
|
15
|
+
```ruby
|
16
|
+
workflow.parameter('foo', 'bar')
|
17
|
+
```
|
18
|
+
|
19
|
+
- `Workflow#parameter=` - Set an input parameter using a WorkflowParameter object:
|
20
|
+
```ruby
|
21
|
+
workflow.parameter = VcoWorkflows::WorkflowParameter.new('my_parameter',
|
22
|
+
'string',
|
23
|
+
value: 'foo')
|
24
|
+
```
|
25
|
+
|
26
|
+
- `Workflow#parameter?` - Determine if an input parameter is set.
|
27
|
+
```ruby
|
28
|
+
workflow.parameter? 'foo'
|
29
|
+
```
|
30
|
+
|
31
|
+
- Add `Workflow#parameters=` to set all input parameters using a hash, instead of having to set parameter values individually. Basically, `Workflow` will do the work instead of making you do it.
|
32
|
+
```ruby
|
33
|
+
input_parameters = { 'name' => 'a string value',
|
34
|
+
'version' => '2',
|
35
|
+
'words' => %w(fe fi fo fum) }
|
36
|
+
workflow.parameters = input_parameters
|
37
|
+
```
|
38
|
+
|
39
|
+
- Added `Guardfile` to aid in development. See what you break as you break it! `rspec`, `rubocop` and `yard` will do their things, until you make them stop.
|
40
|
+
- Speaking of `rspec`, replaced lots of repetitive typing with a loop, because I'm *smart* like that.
|
41
|
+
- More fixes and updates to documentation.
|
42
|
+
- Pull my username out of some of the examples. *Embarrasing...* At least I didn't commit any passwords (yet).
|
43
|
+
|
44
|
+
## 0.1.2
|
45
|
+
|
46
|
+
- Fix lots of documentation typos
|
47
|
+
|
48
|
+
## 0.1.1
|
49
|
+
|
50
|
+
- Releases are scary.
|
51
|
+
|
4
52
|
## 0.1.0
|
5
53
|
|
6
54
|
* Initial setup of gem framework.
|
data/Guardfile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
notification :growl, sticky:true
|
2
|
+
|
3
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
4
|
+
# rspec may be run, below are examples of the most common uses.
|
5
|
+
# * bundler: 'bundle exec rspec'
|
6
|
+
# * bundler binstubs: 'bin/rspec'
|
7
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
8
|
+
# installed the spring binstubs per the docs)
|
9
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
10
|
+
# * 'just' rspec: 'rspec'
|
11
|
+
|
12
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
13
|
+
require "guard/rspec/dsl"
|
14
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
15
|
+
|
16
|
+
# Feel free to open issues for suggestions and improvements
|
17
|
+
|
18
|
+
# RSpec files
|
19
|
+
rspec = dsl.rspec
|
20
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
21
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
22
|
+
watch(rspec.spec_files)
|
23
|
+
|
24
|
+
# Ruby files
|
25
|
+
ruby = dsl.ruby
|
26
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
27
|
+
end
|
28
|
+
|
29
|
+
guard :rubocop do
|
30
|
+
watch(%r{.+\.rb$})
|
31
|
+
watch(%r{bin/.+\.rb$})
|
32
|
+
watch(%r{lib/vcoworkflows/.+\.rb$})
|
33
|
+
watch(%r{spec/.+\.rb$})
|
34
|
+
watch(%r{spec/vcoworkflows/.+_spec\.rb$})
|
35
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.direname(m[0]) }
|
36
|
+
end
|
37
|
+
|
38
|
+
guard 'yard' do
|
39
|
+
watch(%r{bin/.+\.rb})
|
40
|
+
watch(%r{lib/.+\.rb})
|
41
|
+
end
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# Vcoworkflows
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
4
|
-
[![Dependency Status](https://gemnasium.com/
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/
|
6
|
-
[![Inline docs](http://inch-ci.org/github/
|
3
|
+
[![Build Status](https://travis-ci.org/activenetwork-automation/vcoworkflows.svg?branch=master)][travis]
|
4
|
+
[![Dependency Status](https://gemnasium.com/activenetwork-automation/vcoworkflows.svg)][gemnasium]
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/activenetwork-automation/vcoworkflows/badge.png?branch=master)][coveralls]
|
6
|
+
[![Inline docs](http://inch-ci.org/github/activenetwork-automation/vcoworkflows.png?branch=master)][inch]
|
7
7
|
|
8
|
-
[travis]: http://travis-ci.org/
|
9
|
-
[gemnasium]: https://gemnasium.com/
|
10
|
-
[coveralls]: https://coveralls.io/r/
|
11
|
-
[inch]: http://inch-ci.org/github/
|
8
|
+
[travis]: http://travis-ci.org/activenetwork-automation/vcoworkflows
|
9
|
+
[gemnasium]: https://gemnasium.com/activenetwork-automation/vcoworkflows
|
10
|
+
[coveralls]: https://coveralls.io/r/activenetwork-automation/vcoworkflows
|
11
|
+
[inch]: http://inch-ci.org/github/activenetwork-automation/vcoworkflows
|
12
12
|
|
13
13
|
`vcoworkflows` provides a Ruby API for finding and executing vCenter
|
14
14
|
Orchestrator workflows. You can search for a workflow either by name or
|
@@ -96,12 +96,25 @@ required), then send call `execute`. This will return an execution ID from
|
|
96
96
|
vCenter Orchestrator, which identifies the run you have requested. The
|
97
97
|
execution ID is also preserved in the `Workflow` object for simplicity.
|
98
98
|
|
99
|
+
Setting parameters individually:
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
workflow.parameter('name', 'a string value')
|
103
|
+
worfklow.parameter('version', 2)
|
104
|
+
workflow.parameter('words', %w(fe fi fo fum))
|
105
|
+
```
|
106
|
+
|
107
|
+
Setting parameters via a hash:
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
workflow.parameters = { 'name' => 'a string value',
|
111
|
+
'version' => '2',
|
112
|
+
'words' => %w(fe fi fo fum) }
|
113
|
+
```
|
114
|
+
|
115
|
+
Then execute:
|
116
|
+
|
99
117
|
```ruby
|
100
|
-
input_parameters = { 'name' => 'a string value',
|
101
|
-
'version' => '2',
|
102
|
-
'words' => %w(fe fi fo fum) }
|
103
|
-
# ...
|
104
|
-
input_parameters.each { |k, v| workflow.set_parameter(k, v) }
|
105
118
|
workflow.execute
|
106
119
|
```
|
107
120
|
|
@@ -228,7 +241,7 @@ Workflow ID: 6e04a460-4a45-4e16-9603-db2922c24462
|
|
228
241
|
State: completed
|
229
242
|
Start Date: 2014-12-19 13:43:46 -0800
|
230
243
|
End Date: 2014-12-19 13:55:24 -0800
|
231
|
-
Started By:
|
244
|
+
Started By: jdoe@example.com
|
232
245
|
|
233
246
|
Input Parameters:
|
234
247
|
coreCount = 2
|
@@ -252,15 +265,37 @@ Output Parameters:
|
|
252
265
|
requestNumber = 326.0
|
253
266
|
requestCompletionDetails = Request succeeded. Created vm00378.
|
254
267
|
|
255
|
-
2014-12-19 13:43:46 -0800 info:
|
256
|
-
2014-12-19 13:43:59 -0800 info:
|
257
|
-
2014-12-19 13:55:23 -0800 info:
|
258
|
-
2014-12-19 13:55:24 -0800 info:
|
268
|
+
2014-12-19 13:43:46 -0800 info: jdoe: Workflow 'Request Component' has started
|
269
|
+
2014-12-19 13:43:59 -0800 info: jdoe: Workflow is paused; Workflow 'Request Component' has paused while waiting on signal
|
270
|
+
2014-12-19 13:55:23 -0800 info: jdoe: Workflow 'Request Component' has resumed
|
271
|
+
2014-12-19 13:55:24 -0800 info: jdoe: Workflow 'Request Component' has completed
|
259
272
|
```
|
260
273
|
|
274
|
+
## Current limitations
|
275
|
+
|
276
|
+
### General vCO REST API functionality
|
277
|
+
|
278
|
+
This gem is very specifically targeted at operation of workflows within vCO.
|
279
|
+
As such, anything that was not necessary or required to be able to operate
|
280
|
+
workflows has not yet been included.
|
281
|
+
|
282
|
+
### Cancellation / Termination of running workflows
|
283
|
+
|
284
|
+
There is currently no facility to cancel a running workflow. This will be
|
285
|
+
added at some point in the future.
|
286
|
+
|
287
|
+
### Parameter Types
|
288
|
+
|
289
|
+
Currently, there is no included support for complex parameter types (i.e.,
|
290
|
+
anything other than Strings, Numerics, or Arrays of same). This is not to say
|
291
|
+
they cannot be used, but you will need to marshall vCO object parameters into an
|
292
|
+
appropriately-constructed `Hash` to pass as the parameter value, such that when
|
293
|
+
the values are converted to JSON for the actual REST call, they are properly
|
294
|
+
constructed for vCO.
|
295
|
+
|
261
296
|
## Contributing
|
262
297
|
|
263
|
-
1. Fork it ( https://github.com/
|
298
|
+
1. Fork it ( https://github.com/activenetwork-automation/vcoworkflows/fork )
|
264
299
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
265
300
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
266
301
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -271,7 +306,7 @@ Output Parameters:
|
|
271
306
|
- [Gregory Ruiz-Ade](https://github.com/gkra)
|
272
307
|
|
273
308
|
```
|
274
|
-
Copyright 2014
|
309
|
+
Copyright 2014 ACTIVE Network, LLC
|
275
310
|
|
276
311
|
Licensed under the Apache License, Version 2.0 (the "License");
|
277
312
|
you may not use this file except in compliance with the License.
|
data/example.rb
CHANGED
@@ -25,9 +25,10 @@ workflow = VcoWorkflows::Workflow.new(workflow_name,
|
|
25
25
|
verify_ssl: false)
|
26
26
|
|
27
27
|
# Set the parameters in the workflow
|
28
|
-
|
28
|
+
workflow.parameters = input_parameters
|
29
29
|
|
30
|
-
# Execute the workflow.
|
30
|
+
# Execute the workflow. This will also save the execution id in our
|
31
|
+
# workflow object.
|
31
32
|
workflow.execute
|
32
33
|
|
33
34
|
# We're going to wait around until the execution is done, so we'll check
|
data/lib/vcoworkflows/version.rb
CHANGED
@@ -30,15 +30,18 @@ module VcoWorkflows
|
|
30
30
|
attr_reader :description
|
31
31
|
|
32
32
|
# Workflow Input Parameters
|
33
|
-
# @return [VcoWorkflows::WorkflowParameter
|
33
|
+
# @return [Hash<VcoWorkflows::WorkflowParameter>] Hash of
|
34
|
+
# WorkflowParameter objects, keyed by name
|
34
35
|
attr_reader :input_parameters
|
35
36
|
|
36
37
|
# Workflow Output Parameters
|
37
|
-
# @return [VcoWorkflows::WorkflowParameter
|
38
|
+
# @return [Hash<VcoWorkflows::WorkflowParameter>] Hash of
|
39
|
+
# WorkflowParameter objects, keyed by name
|
38
40
|
attr_reader :output_parameters
|
39
41
|
|
40
42
|
# Workflow Service
|
41
|
-
# @return [VcoWorkflows::WorkflowService] The WorkflowService
|
43
|
+
# @return [VcoWorkflows::WorkflowService] The WorkflowService
|
44
|
+
# currently being used to interface with vCO
|
42
45
|
attr_accessor :service
|
43
46
|
|
44
47
|
# Workflow execution ID
|
@@ -101,7 +104,8 @@ module VcoWorkflows
|
|
101
104
|
end
|
102
105
|
workflow_data = JSON.parse(workflow_json)
|
103
106
|
|
104
|
-
# Set up the attributes if they exist in the data json,
|
107
|
+
# Set up the attributes if they exist in the data json,
|
108
|
+
# otherwise nil them
|
105
109
|
@id = workflow_data.key?('id') ? workflow_data['id'] : nil
|
106
110
|
@name = workflow_data.key?('name') ? workflow_data['name'] : nil
|
107
111
|
@version = workflow_data.key?('version') ? workflow_data['version'] : nil
|
@@ -156,7 +160,7 @@ module VcoWorkflows
|
|
156
160
|
# rubocop:disable MethodLength, LineLength
|
157
161
|
|
158
162
|
# Parse json parameters and return a nice hash
|
159
|
-
# @param [Array] parameter_data
|
163
|
+
# @param [Array<Hash>] parameter_data Array of parameter data hashes
|
160
164
|
# by vCO
|
161
165
|
# @return [Hash]
|
162
166
|
def self.parse_parameters(parameter_data = [])
|
@@ -192,7 +196,7 @@ module VcoWorkflows
|
|
192
196
|
# rubocop:disable LineLength
|
193
197
|
|
194
198
|
# Process exceptions raised in parse_parameters by bravely ignoring them
|
195
|
-
#
|
199
|
+
# and forging ahead blindly!
|
196
200
|
# @param [Exception] error
|
197
201
|
def self.parse_failure(error)
|
198
202
|
$stderr.puts "\nWhoops!"
|
@@ -206,7 +210,8 @@ module VcoWorkflows
|
|
206
210
|
# rubocop:disable LineLength
|
207
211
|
|
208
212
|
# Get an array of the names of all the required input parameters
|
209
|
-
# @return [Hash] Hash of WorkflowParameter input parameters which
|
213
|
+
# @return [Hash] Hash of WorkflowParameter input parameters which
|
214
|
+
# are required for this workflow
|
210
215
|
def required_parameters
|
211
216
|
required = {}
|
212
217
|
@input_parameters.each_value { |v| required[v.name] = v if v.required? }
|
@@ -214,40 +219,70 @@ module VcoWorkflows
|
|
214
219
|
end
|
215
220
|
# rubocop:enable LineLength
|
216
221
|
|
217
|
-
#
|
218
|
-
# @param [String] parameter_name Name of the parameter whose value to get
|
219
|
-
# @return [VcoWorkflows::WorkflowParameter]
|
220
|
-
def parameter(parameter_name)
|
221
|
-
@input_parameters[parameter_name]
|
222
|
-
end
|
223
|
-
|
224
|
-
# rubocop:disable LineLength
|
222
|
+
# rubocop:disable LineLength, MethodLength
|
225
223
|
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
|
224
|
+
# Get the parameter object named. If a value is provided, set the value
|
225
|
+
# and return the parameter object.
|
226
|
+
#
|
227
|
+
# To get a parameter value, use parameter(parameter_name).value
|
228
|
+
#
|
229
|
+
# @param [String] parameter_name Name of the parameter to get
|
230
|
+
# @param [Object, nil] parameter_value Optional value for parameter.
|
231
|
+
# @return [VcoWorkflows::WorkflowParameter] The resulting WorkflowParameter
|
232
|
+
def parameter(parameter_name, parameter_value = nil)
|
230
233
|
if @input_parameters.key?(parameter_name)
|
231
|
-
@input_parameters[parameter_name].set
|
234
|
+
@input_parameters[parameter_name].set parameter_value
|
232
235
|
else
|
233
236
|
$stderr.puts "\nAttempted to set a value for a non-existent WorkflowParameter!"
|
234
237
|
$stderr.puts "It appears that there is no parameter \"#{parameter}\"."
|
235
238
|
$stderr.puts "Valid parameter names are: #{@input_parameters.keys.join(', ')}"
|
236
239
|
$stderr.puts ''
|
237
240
|
fail(IOError, ERR[:no_such_parameter])
|
238
|
-
end
|
241
|
+
end unless parameter_value.nil?
|
242
|
+
@input_parameters[parameter_name]
|
243
|
+
end
|
244
|
+
# rubocop:enable LineLength, MethodLength
|
245
|
+
|
246
|
+
# Set a parameter with a WorkflowParameter object
|
247
|
+
# @param [VcoWorkflows::WorkflowParameter] wfparameter New parameter
|
248
|
+
def parameter=(wfparameter)
|
249
|
+
@input_parameters[wfparameter.name] = wfparameter
|
250
|
+
end
|
251
|
+
|
252
|
+
# Determine whether a parameter has been set
|
253
|
+
# @param [String] parameter_name Name of the parameter to check
|
254
|
+
# @return [Boolean]
|
255
|
+
def parameter?(parameter_name)
|
256
|
+
parameter(parameter_name).set?
|
257
|
+
end
|
258
|
+
|
259
|
+
# Set all input parameters using the given hash
|
260
|
+
# @param [Hash] parameter_hash input parameter values keyed by
|
261
|
+
# input_parameter name
|
262
|
+
def parameters=(parameter_hash)
|
263
|
+
parameter_hash.each { |name, value| parameter(name, value) }
|
239
264
|
end
|
240
|
-
# rubocop:enable LineLength
|
241
265
|
|
242
266
|
# rubocop:disable LineLength
|
243
267
|
|
268
|
+
# Set a parameter to a value.
|
269
|
+
# @deprecated Use {#parameter} instead
|
270
|
+
# @param [String] parameter_name name of the parameter to set
|
271
|
+
# @param [Object] value value to set
|
272
|
+
# @return [VcoWorkflows::WorkflowParameter] The resulting WorkflowParameter
|
273
|
+
def set_parameter(parameter_name, value)
|
274
|
+
parameter(parameter_name, value)
|
275
|
+
end
|
276
|
+
|
244
277
|
# Get the value for an input parameter
|
245
|
-
# @
|
278
|
+
# @deprecated Use {#parameter} to retrieve the
|
279
|
+
# {VcoWorkflows::WorkflowParameter} object, instead
|
280
|
+
# @param [String] parameter_name Name of the input parameter
|
281
|
+
# whose value to get
|
246
282
|
# @return [Object]
|
247
283
|
def get_parameter(parameter_name)
|
248
|
-
|
284
|
+
parameter(parameter_name).value
|
249
285
|
end
|
250
|
-
# rubocop:enable LineLength
|
251
286
|
|
252
287
|
# rubocop:disable LineLength
|
253
288
|
|
@@ -14,6 +14,20 @@ describe VcoWorkflows::Workflow, 'Workflow' do
|
|
14
14
|
@param_string_json = '''{"type":"string","name":"stringparam","scope":"local","value":{"string":{"value":"squirrel!"}}}'''
|
15
15
|
@param_array_json = '''{"type":"Array/string","name":"arrayparam","scope":"local","value":{"array":{"elements":[{"string":{"value":"a"}},{"string":{"value":"b"}},{"string":{"value":"c"}}]}}}'''
|
16
16
|
|
17
|
+
@target_parameters = {
|
18
|
+
'coreCount' => 2,
|
19
|
+
'ramMB' => 2048,
|
20
|
+
'businessUnit' => 'aw',
|
21
|
+
'reservation' => 'nonprodlinux',
|
22
|
+
'environment' => 'dev1',
|
23
|
+
'image' => 'centos-6.6-x86_64-20141203-1',
|
24
|
+
'component' => 'api',
|
25
|
+
'onBehalfOf' => 'svcacct@example.com',
|
26
|
+
'location' => 'us_east',
|
27
|
+
'runlist' => %w(role[loc_uswest] role[base] role[api]),
|
28
|
+
'machineCount' => 1
|
29
|
+
}
|
30
|
+
|
17
31
|
# Mock the WorkflowService
|
18
32
|
@service = double('service')
|
19
33
|
allow(@service).to receive(:get_workflow_for_id) { @workflow_json }
|
@@ -87,32 +101,43 @@ describe VcoWorkflows::Workflow, 'Workflow' do
|
|
87
101
|
expect(wf.required_parameters.size).to eq(required_param_count)
|
88
102
|
end
|
89
103
|
|
90
|
-
it 'should set
|
104
|
+
it 'should set a parameter value' do
|
91
105
|
wf = VcoWorkflows::Workflow.new(@workflow_name, service: @service)
|
92
106
|
|
93
|
-
|
107
|
+
# Set the value and check the returned parameter
|
108
|
+
expect(wf.parameter('coreCount', 4).value).to eq(4)
|
109
|
+
|
110
|
+
# Check the parameter value
|
111
|
+
expect(wf.parameter('coreCount').value).to eq(4)
|
112
|
+
|
113
|
+
# Check the parameter by reaching through input_parameters
|
94
114
|
expect(wf.input_parameters['coreCount'].value).to eq(4)
|
95
|
-
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should set all parameters by hash' do
|
118
|
+
wf = VcoWorkflows::Workflow.new(@workflow_name, service: @service)
|
119
|
+
wf.parameters = @target_parameters
|
120
|
+
|
121
|
+
@target_parameters.each_key do |param_name|
|
122
|
+
expect(wf.parameter(param_name).value).to eql(@target_parameters[param_name])
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'should set a parameter by object' do
|
127
|
+
wf = VcoWorkflows::Workflow.new(@workflow_name, service: @service)
|
128
|
+
wfparam = VcoWorkflows::WorkflowParameter.new('coreCount', 'string', value: 2)
|
129
|
+
wf.parameter = wfparam
|
130
|
+
|
131
|
+
expect(wf.parameter('coreCount')).to_not eq(nil)
|
132
|
+
expect(wf.parameter('coreCount').type).to eql('string')
|
133
|
+
expect(wf.parameter('coreCount').value).to eq(2)
|
96
134
|
end
|
97
135
|
|
98
136
|
it 'should execute' do
|
99
137
|
allow(@service).to receive(:execute_workflow) { @execution_id }
|
100
|
-
target_parameters = {
|
101
|
-
'coreCount' => 2,
|
102
|
-
'ramMB' => 2048,
|
103
|
-
'businessUnit' => 'aw',
|
104
|
-
'reservation' => 'nonprodlinux',
|
105
|
-
'environment' => 'dev1',
|
106
|
-
'image' => 'centos-6.6-x86_64-20141203-1',
|
107
|
-
'component' => 'api',
|
108
|
-
'onBehalfOf' => 'svcacct@example.com',
|
109
|
-
'location' => 'us_east',
|
110
|
-
'runlist' => %w(role[loc_uswest] role[base] role[api]),
|
111
|
-
'machineCount' => 1
|
112
|
-
}
|
113
138
|
|
114
139
|
wf = VcoWorkflows::Workflow.new(@workflow_name, service: @service)
|
115
|
-
|
140
|
+
wf.parameters = @target_parameters
|
116
141
|
|
117
142
|
expect(wf.execute).to eql(@execution_id)
|
118
143
|
end
|
data/vcoworkflows.gemspec
CHANGED
@@ -11,22 +11,25 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = 'gregory.ruiz-ade@activenetwork.com'
|
12
12
|
spec.summary = 'vCO Workflows REST API Wrapper'
|
13
13
|
spec.description = 'Ruby implementation of vCenter Orchestrator REST API'
|
14
|
-
spec.homepage = ''
|
14
|
+
spec.homepage = 'https://github.com/activenetwork-automation/vcoworkflows'
|
15
15
|
spec.license = 'Apache 2.0'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
|
+
spec.required_ruby_version = '>= 2.0'
|
21
22
|
|
22
23
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
25
|
spec.add_development_dependency 'rubocop', '>= 0.27.0'
|
25
26
|
spec.add_development_dependency 'aruba', '>= 0.6'
|
26
27
|
spec.add_development_dependency 'rspec', '>= 3.0'
|
27
|
-
spec.add_development_dependency 'coveralls', '
|
28
|
+
spec.add_development_dependency 'coveralls', '~> 0.7.1'
|
28
29
|
spec.add_development_dependency 'guard', '>= 2.10.0'
|
29
30
|
spec.add_development_dependency 'guard-rubocop', '>= 1.1.0'
|
31
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5.0'
|
32
|
+
spec.add_development_dependency 'guard-yard', '~> 2.1.4'
|
30
33
|
# growl functionality in Guardfile depends on growl-notify
|
31
34
|
spec.add_development_dependency 'growl', '>= 1.0'
|
32
35
|
spec.add_development_dependency 'yard', '>= 0.8'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcoworkflows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Ruiz-ade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,14 +84,14 @@ dependencies:
|
|
84
84
|
name: coveralls
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.7.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.7.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.1.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: guard-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 4.5.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 4.5.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: guard-yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.1.4
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.1.4
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: growl
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,6 +219,7 @@ files:
|
|
191
219
|
- ".travis.yml"
|
192
220
|
- CHANGELOG.md
|
193
221
|
- Gemfile
|
222
|
+
- Guardfile
|
194
223
|
- LICENSE.txt
|
195
224
|
- README.md
|
196
225
|
- Rakefile
|
@@ -219,7 +248,7 @@ files:
|
|
219
248
|
- spec/vcoworkflows/workflowservice_spec.rb
|
220
249
|
- spec/vcoworkflows/workflowtoken_spec.rb
|
221
250
|
- vcoworkflows.gemspec
|
222
|
-
homepage:
|
251
|
+
homepage: https://github.com/activenetwork-automation/vcoworkflows
|
223
252
|
licenses:
|
224
253
|
- Apache 2.0
|
225
254
|
metadata: {}
|
@@ -231,7 +260,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
260
|
requirements:
|
232
261
|
- - ">="
|
233
262
|
- !ruby/object:Gem::Version
|
234
|
-
version: '0'
|
263
|
+
version: '2.0'
|
235
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
265
|
requirements:
|
237
266
|
- - ">="
|