vcoworkflows 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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +1 -1
- data/README.md +6 -3
- data/lib/vcoworkflows/vcosession.rb +1 -1
- data/lib/vcoworkflows/version.rb +1 -1
- data/lib/vcoworkflows/workflow.rb +2 -0
- data/lib/vcoworkflows/workflowparameter.rb +3 -3
- data/lib/vcoworkflows/workflowservice.rb +5 -3
- data/lib/vcoworkflows/workflowtoken.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b98d551ecb8db61bdadef23f77d4b5a40bbd7b18
|
4
|
+
data.tar.gz: 3f9536b6642a09533c2fa5c2a3ed633edc4ef145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27c314bdd27f89daa8dcd4f855447c80952f876dac2c81a6b876df26e8bea3db296e16ad3cb5d7ff33be351573e8f293cfe740fe804e3dffd077df4a4c655074
|
7
|
+
data.tar.gz: a2bf7d2fc6dd66e1b59711f2268440171a0ee37ac0e71e802e4e247a492da5932003c418c1aceeff6c51004c107596ec99e244def48830cb89b24643907bc2ab
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -28,7 +28,7 @@ General cleanup and spit-polish. There are still a few rough spots that'll take
|
|
28
28
|
workflow.parameter? 'foo'
|
29
29
|
```
|
30
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.
|
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. (Resolves [#3](https://github.com/activenetwork-automation/vcoworkflows/issues/3))
|
32
32
|
```ruby
|
33
33
|
input_parameters = { 'name' => 'a string value',
|
34
34
|
'version' => '2',
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
[](https://waffle.io/activenetwork-automation/vcoworkflows)
|
2
|
+
[](https://gitter.im/activenetwork-automation/vcoworkflows?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
2
3
|
|
3
4
|
[][travis]
|
4
5
|
[][gemnasium]
|
@@ -10,6 +11,8 @@
|
|
10
11
|
[coveralls]: https://coveralls.io/r/activenetwork-automation/vcoworkflows
|
11
12
|
[inch]: http://inch-ci.org/github/activenetwork-automation/vcoworkflows
|
12
13
|
|
14
|
+
# Vcoworkflows
|
15
|
+
|
13
16
|
`vcoworkflows` provides a Ruby API for finding and executing vCenter
|
14
17
|
Orchestrator workflows. You can search for a workflow either by name or
|
15
18
|
by GUID, populate the resulting `VcoWorkflows::Workflow` object's
|
@@ -57,7 +60,7 @@ Quick example:
|
|
57
60
|
require 'vcoworkflows'
|
58
61
|
workflow = VcoWorkflows::Workflow.new(
|
59
62
|
'Request Component',
|
60
|
-
url: 'https://vco.example.com:8281/
|
63
|
+
url: 'https://vco.example.com:8281/',
|
61
64
|
username: 'jdoe',
|
62
65
|
password: 's3cr3t'
|
63
66
|
)
|
@@ -83,7 +86,7 @@ creating a new `Workflow` object:
|
|
83
86
|
workflow = VcoWorkflows::Workflow.new(
|
84
87
|
'Request Component',
|
85
88
|
id: '6e04a460-4a45-4e16-9603-db2922c24462',
|
86
|
-
url: 'https://vco.example.com:8281/
|
89
|
+
url: 'https://vco.example.com:8281/',
|
87
90
|
username: 'jdoe',
|
88
91
|
password: 's3cr3t'
|
89
92
|
)
|
@@ -16,7 +16,7 @@ module VcoWorkflows
|
|
16
16
|
# @param [String] password Password for vCO
|
17
17
|
# @param [Boolean] verify_ssl Whether or not to verify SSL certificates
|
18
18
|
def initialize(uri, user: nil, password: nil, verify_ssl: true)
|
19
|
-
api_url = "#{uri.gsub(
|
19
|
+
api_url = "#{uri.gsub(%r{\/$}, '')}/vco/api"
|
20
20
|
RestClient.proxy = ENV['http_proxy'] # Set a proxy if present
|
21
21
|
@rest_resource = RestClient::Resource.new(api_url,
|
22
22
|
user: user,
|
data/lib/vcoworkflows/version.rb
CHANGED
@@ -106,10 +106,12 @@ module VcoWorkflows
|
|
106
106
|
|
107
107
|
# Set up the attributes if they exist in the data json,
|
108
108
|
# otherwise nil them
|
109
|
+
# rubocop:disable SpaceAroundOperators
|
109
110
|
@id = workflow_data.key?('id') ? workflow_data['id'] : nil
|
110
111
|
@name = workflow_data.key?('name') ? workflow_data['name'] : nil
|
111
112
|
@version = workflow_data.key?('version') ? workflow_data['version'] : nil
|
112
113
|
@description = workflow_data.key?('description') ? workflow_data['description'] : nil
|
114
|
+
# rubocop:enable SpaceAroundOperators
|
113
115
|
|
114
116
|
# Process the input parameters
|
115
117
|
if workflow_data.key?('input-parameters')
|
@@ -37,9 +37,9 @@ module VcoWorkflows
|
|
37
37
|
@name = name
|
38
38
|
|
39
39
|
case type
|
40
|
-
when
|
41
|
-
@type = type.gsub(
|
42
|
-
@subtype = type.gsub(
|
40
|
+
when %r{\/}
|
41
|
+
@type = type.gsub(%r{\/.*$}, '')
|
42
|
+
@subtype = type.gsub(%r{^.*\/}, '')
|
43
43
|
else
|
44
44
|
@type = type
|
45
45
|
@subtype = nil
|
@@ -88,8 +88,8 @@ module VcoWorkflows
|
|
88
88
|
end
|
89
89
|
|
90
90
|
# Get the log for a specific execution
|
91
|
-
# @param [String] workflow_id
|
92
|
-
# @param [String] execution_id
|
91
|
+
# @param [String] workflow_id Workflow GUID
|
92
|
+
# @param [String] execution_id Workflow execution ID
|
93
93
|
# @return [String] JSON log document
|
94
94
|
def get_log(workflow_id, execution_id)
|
95
95
|
path = "/workflows/#{workflow_id}/executions/#{execution_id}/logs/"
|
@@ -105,7 +105,9 @@ module VcoWorkflows
|
|
105
105
|
response = @session.post(path, parameter_json)
|
106
106
|
# Execution ID is the final component in the Location header URL, so
|
107
107
|
# chop off the front, then pull off any trailing /
|
108
|
-
|
108
|
+
# rubocop:disable LineLength
|
109
|
+
response.headers[:location].gsub(%r{^.*/executions/}, '').gsub(%r{\/$}, '')
|
110
|
+
# rubocop:enable LineLength
|
109
111
|
end
|
110
112
|
end
|
111
113
|
end
|
@@ -81,6 +81,7 @@ module VcoWorkflows
|
|
81
81
|
|
82
82
|
token = JSON.parse(@json_content)
|
83
83
|
|
84
|
+
# rubocop:disable SpaceAroundOperators
|
84
85
|
@id = token.key?('id') ? token['id'] : nil
|
85
86
|
@name = token.key?('name') ? token['name'] : nil
|
86
87
|
@state = token.key?('state') ? token['state'] : nil
|
@@ -92,6 +93,7 @@ module VcoWorkflows
|
|
92
93
|
@current_item_state = token.key?('current-item-state') ? token['current-item-state'] : nil
|
93
94
|
@global_state = token.key?('global-state') ? token['global-state'] : nil
|
94
95
|
@content_exception = token.key?('content-exeption') ? token['content-exception'] : nil
|
96
|
+
# rubocop:enable SpaceAroundOperators
|
95
97
|
|
96
98
|
if token.key?('input-parameters')
|
97
99
|
@input_parameters = VcoWorkflows::Workflow.parse_parameters(token['input-parameters'])
|
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.4
|
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-
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|