mistral_client 1.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +3 -1
- data/.ruby-version +1 -1
- data/.travis.yml +2 -7
- data/CHANGELOG.md +20 -1
- data/README.md +3 -4
- data/lib/mistral_client/action_execution.rb +1 -0
- data/lib/mistral_client/client.rb +8 -6
- data/lib/mistral_client/environment.rb +3 -4
- data/lib/mistral_client/error.rb +2 -0
- data/lib/mistral_client/execution.rb +2 -1
- data/lib/mistral_client/health.rb +1 -0
- data/lib/mistral_client/mixins/definable.rb +2 -4
- data/lib/mistral_client/mixins/mistral_object.rb +6 -4
- data/lib/mistral_client/task.rb +1 -0
- data/lib/mistral_client/version.rb +1 -1
- data/lib/mistral_client/workflow.rb +4 -3
- data/mistral_client.gemspec +10 -10
- metadata +27 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90addb71051ae5cbbb705a0fe9854e1886679dc13925b11d50ea30e099c76642
|
4
|
+
data.tar.gz: c2f00c0eceec0bf3e36c69869d88cd828b6a358fb75abafa6394b86bff15fae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a9877af1fec3a8dbe35eac14106303d943b3a19961957cfc0bf275efe69847f4cb1c9f235232925496d68d8b15da18dec67987f7daa674920e3b98ef5e89fe
|
7
|
+
data.tar.gz: 225f79f8b62fc39c86101d2200f2c7ebc639b05a91c1f91d1d58bfd8b12d8149fe406e30cd3268a0efd2734574d7b8ab3f701ee18de573d0ba028795939c42ac
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.4
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.0.0] - 2021-02-09
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Added Ruby 2.7 and 3.0 to the Travis build matrix
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Bumped the Ruby version for development to 3.0.0
|
15
|
+
- Fixed deprecation warnings around positional and keyword arguments from ruby 2.7.0
|
16
|
+
- Updated rubocop to v1.9.1, and fixed rubocop violations
|
17
|
+
- Configured rspec to emit warnings, and fix them
|
18
|
+
- Re-recorded the spec cassettes
|
19
|
+
- Fixed broken links in the README
|
20
|
+
|
21
|
+
### Removed
|
22
|
+
- Removed Ruby 2.3 and 2.4 from the Travis build matrix
|
23
|
+
|
8
24
|
## [1.3.0] - 2020-04-20
|
9
25
|
|
10
26
|
### Changed
|
@@ -34,6 +50,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
34
50
|
|
35
51
|
* Initial Release
|
36
52
|
|
37
|
-
[Unreleased]: https://github.com/civisanalytics/mistral_client/compare/
|
53
|
+
[Unreleased]: https://github.com/civisanalytics/mistral_client/compare/v2.0.0...HEAD
|
54
|
+
[2.0.0]: https://github.com/civisanalytics/mistral_client/compare/v1.3.0...v2.0.0
|
55
|
+
[1.3.0]: https://github.com/civisanalytics/mistral_client/compare/v1.2.1...v1.3.0
|
56
|
+
[1.2.1]: https://github.com/civisanalytics/mistral_client/compare/v1.2.0...v1.2.1
|
38
57
|
[1.2.0]: https://github.com/civisanalytics/mistral_client/compare/v1.1.0...v1.2.0
|
39
58
|
[1.1.0]: https://github.com/civisanalytics/mistral_client/compare/v1.0.0...v1.1.0
|
data/README.md
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
# MistralClient
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/civisanalytics/mistral_client.svg?branch=master)](https://travis-ci.com/civisanalytics/mistral_client)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/mistral_client.svg)](http://badge.fury.io/rb/mistral_client)
|
5
|
-
[![Dependency Status](https://gemnasium.com/civisanalytics/mistral_client.svg)](https://gemnasium.com/civisanalytics/mistral_client)
|
6
5
|
|
7
6
|
MistralClient provides a Ruby interface to a limited subset of
|
8
7
|
the [Mistral] [API].
|
9
8
|
|
10
|
-
[Mistral]: https://
|
11
|
-
[API]: https://docs.openstack.org/mistral/latest/
|
9
|
+
[Mistral]: https://docs.openstack.org/mistral/latest/
|
10
|
+
[API]: https://docs.openstack.org/mistral/latest/user/rest_api_v2.html
|
12
11
|
|
13
12
|
## Installation
|
14
13
|
|
@@ -38,9 +38,13 @@ module MistralClient
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
-
def method_missing(name, *args, &block)
|
41
|
+
def method_missing(name, *args, **kwargs, &block)
|
42
42
|
if self.class.resources.keys.include?(name)
|
43
|
-
|
43
|
+
if kwargs.nil? || kwargs.empty?
|
44
|
+
self.class.resources[name].new(self, *args)
|
45
|
+
else
|
46
|
+
self.class.resources[name].new(self, *args, **kwargs)
|
47
|
+
end
|
44
48
|
else
|
45
49
|
super
|
46
50
|
end
|
@@ -60,7 +64,7 @@ module MistralClient
|
|
60
64
|
else
|
61
65
|
{ 'Content-Type' => 'text/plain' }
|
62
66
|
end
|
63
|
-
options = @http_options.merge(headers
|
67
|
+
options = @http_options.merge(headers:, body:)
|
64
68
|
resp = HTTParty.send(verb, "#{@base}/#{path}", options)
|
65
69
|
check_for_error(resp)
|
66
70
|
JSON.parse(resp.body)
|
@@ -68,9 +72,7 @@ module MistralClient
|
|
68
72
|
|
69
73
|
def check_for_error(resp)
|
70
74
|
return if resp.code >= 200 && resp.code < 300
|
71
|
-
if resp.code == 404
|
72
|
-
raise MissingObjectError, JSON.parse(resp.body)['faultstring']
|
73
|
-
end
|
75
|
+
raise MissingObjectError, JSON.parse(resp.body)['faultstring'] if resp.code == 404
|
74
76
|
|
75
77
|
raise MistralResponseError.new(resp),
|
76
78
|
"Could not perform the requested operation:\n#{resp.body}"
|
@@ -8,8 +8,9 @@ module MistralClient
|
|
8
8
|
include MistralClient::Mixins::Definable
|
9
9
|
|
10
10
|
def initialize(server, definition = nil, name: nil)
|
11
|
+
super()
|
11
12
|
@server = server
|
12
|
-
@definition = parse_definition(definition)
|
13
|
+
@definition = definition ? parse_definition(definition) : nil
|
13
14
|
@name = name
|
14
15
|
if @name
|
15
16
|
reload
|
@@ -38,9 +39,7 @@ module MistralClient
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def massage_definition(definition)
|
41
|
-
if definition['variables'].is_a? Hash
|
42
|
-
definition['variables'] = definition['variables'].to_json
|
43
|
-
end
|
42
|
+
definition['variables'] = definition['variables'].to_json if definition['variables'].is_a? Hash
|
44
43
|
definition
|
45
44
|
end
|
46
45
|
end
|
data/lib/mistral_client/error.rb
CHANGED
@@ -21,6 +21,7 @@ module MistralClient
|
|
21
21
|
# rubocop:disable Metrics/ParameterLists
|
22
22
|
def initialize(server, workflow_id: nil, env: nil, task_name: nil,
|
23
23
|
id: nil, input: nil)
|
24
|
+
super()
|
24
25
|
set_attributes(server, workflow_id, env, task_name, id, input)
|
25
26
|
if @id
|
26
27
|
reload
|
@@ -34,7 +35,7 @@ module MistralClient
|
|
34
35
|
body = {}
|
35
36
|
body[:description] = description unless description.nil?
|
36
37
|
body[:state] = state if state
|
37
|
-
body[:params] = { env:
|
38
|
+
body[:params] = { env: } if env
|
38
39
|
|
39
40
|
return if body.empty?
|
40
41
|
|
@@ -3,13 +3,11 @@ module MistralClient
|
|
3
3
|
module Definable
|
4
4
|
# rubocop:disable Metrics/MethodLength
|
5
5
|
def parse_definition(definition)
|
6
|
-
if definition.is_a?(Hash) || definition.is_a?(Array)
|
7
|
-
return YAML.dump(definition)
|
8
|
-
end
|
6
|
+
return YAML.dump(definition) if definition.is_a?(Hash) || definition.is_a?(Array)
|
9
7
|
|
10
8
|
definition = File.read(definition) if File.exist?(definition)
|
11
9
|
# Called outside the if/else to validate the YAML.
|
12
|
-
parsed = YAML.safe_load(definition,
|
10
|
+
parsed = YAML.safe_load(definition, aliases: true)
|
13
11
|
if defined? massage_definition
|
14
12
|
massage_definition(parsed)
|
15
13
|
else
|
@@ -17,7 +17,7 @@ module MistralClient
|
|
17
17
|
self
|
18
18
|
end
|
19
19
|
|
20
|
-
def list(params
|
20
|
+
def list(**params)
|
21
21
|
resp = @server.get("#{self.class::PATH}?#{URI.encode_www_form(params)}")
|
22
22
|
resp[self.class::PATH].map do |t|
|
23
23
|
task = self.class.new(@server)
|
@@ -27,7 +27,9 @@ module MistralClient
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# rubocop:disable Metrics/AbcSize
|
30
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
30
31
|
# rubocop:disable Metrics/MethodLength
|
32
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
31
33
|
def ivars_from_response(resp)
|
32
34
|
klass = self.class
|
33
35
|
@id = resp['id']
|
@@ -38,15 +40,15 @@ module MistralClient
|
|
38
40
|
instance_variable_set("@#{var}", resp[var]) if resp.key? var
|
39
41
|
end
|
40
42
|
klass::DATE_FIELDS.each do |var|
|
41
|
-
if resp[var]
|
42
|
-
instance_variable_set("@#{var}", DateTime.parse(resp[var]))
|
43
|
-
end
|
43
|
+
instance_variable_set("@#{var}", DateTime.parse(resp[var])) if resp[var]
|
44
44
|
end
|
45
45
|
klass::JSON_FIELDS.each do |var|
|
46
46
|
instance_variable_set("@#{var}", JSON.parse(resp[var])) if resp[var]
|
47
47
|
end
|
48
48
|
end
|
49
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
49
50
|
# rubocop:enable Metrics/MethodLength
|
51
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
50
52
|
# rubocop:enable Metrics/AbcSize
|
51
53
|
end
|
52
54
|
end
|
data/lib/mistral_client/task.rb
CHANGED
@@ -11,6 +11,7 @@ module MistralClient
|
|
11
11
|
include MistralClient::Mixins::Deletable
|
12
12
|
|
13
13
|
def initialize(server, definition = nil, id: nil, name: nil)
|
14
|
+
super()
|
14
15
|
@server = server
|
15
16
|
if definition
|
16
17
|
@definition = parse_definition(definition)
|
@@ -24,9 +25,9 @@ module MistralClient
|
|
24
25
|
def execute!(env: nil, task_name: nil, input: nil)
|
25
26
|
Execution.new(@server,
|
26
27
|
workflow_id: @id,
|
27
|
-
env
|
28
|
-
task_name
|
29
|
-
input:
|
28
|
+
env:,
|
29
|
+
task_name:,
|
30
|
+
input:)
|
30
31
|
end
|
31
32
|
|
32
33
|
def valid?(definition)
|
data/mistral_client.gemspec
CHANGED
@@ -10,11 +10,11 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = 'Ruby client for Mistral.'
|
12
12
|
spec.description = "A Ruby client for OpenStack's Mistral " \
|
13
|
-
'<https://
|
13
|
+
'<https://docs.openstack.org/mistral/latest/>.'
|
14
14
|
spec.homepage = 'https://github.com/civisanalytics/mistral_client'
|
15
|
-
spec.license = 'BSD
|
15
|
+
spec.license = 'BSD-3-Clause'
|
16
16
|
|
17
|
-
spec.required_ruby_version = '
|
17
|
+
spec.required_ruby_version = ['>= 3.1', '< 4']
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
19
|
f.match(%r{^(test|spec|features)/})
|
20
20
|
end
|
@@ -22,12 +22,12 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_dependency 'httparty', '~> 0.
|
26
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
27
|
-
spec.add_development_dependency 'pry', '~> 0.
|
25
|
+
spec.add_dependency 'httparty', '~> 0.21.0'
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.5.7'
|
27
|
+
spec.add_development_dependency 'pry', '~> 0.14.2'
|
28
28
|
spec.add_development_dependency 'rake', '~> 13.0'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
30
|
-
spec.add_development_dependency 'rubocop', '~>
|
31
|
-
spec.add_development_dependency 'vcr', '~>
|
32
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.13.0'
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 1.62.1'
|
31
|
+
spec.add_development_dependency 'vcr', '~> 6.2'
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.23'
|
33
33
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mistral_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brennan
|
8
8
|
- Jeff Cousens
|
9
9
|
- Mike Saelim
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-04-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -18,42 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.21.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 0.21.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 2.5.7
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 2.5.7
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: pry
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.14.2
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.14.2
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rake
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,57 +74,57 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 3.13.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
84
|
+
version: 3.13.0
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: rubocop
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
91
|
+
version: 1.62.1
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
version: 1.62.1
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: vcr
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: '
|
105
|
+
version: '6.2'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '
|
112
|
+
version: '6.2'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: webmock
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '3.
|
119
|
+
version: '3.23'
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: '3.
|
127
|
-
description: A Ruby client for OpenStack's Mistral <https://
|
126
|
+
version: '3.23'
|
127
|
+
description: A Ruby client for OpenStack's Mistral <https://docs.openstack.org/mistral/latest/>.
|
128
128
|
email:
|
129
129
|
- opensource@civisanalytics.com
|
130
130
|
executables: []
|
@@ -162,25 +162,28 @@ files:
|
|
162
162
|
- mistral_client.gemspec
|
163
163
|
homepage: https://github.com/civisanalytics/mistral_client
|
164
164
|
licenses:
|
165
|
-
- BSD
|
165
|
+
- BSD-3-Clause
|
166
166
|
metadata: {}
|
167
|
-
post_install_message:
|
167
|
+
post_install_message:
|
168
168
|
rdoc_options: []
|
169
169
|
require_paths:
|
170
170
|
- lib
|
171
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- - "
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '3.1'
|
176
|
+
- - "<"
|
174
177
|
- !ruby/object:Gem::Version
|
175
|
-
version: '
|
178
|
+
version: '4'
|
176
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
180
|
requirements:
|
178
181
|
- - ">="
|
179
182
|
- !ruby/object:Gem::Version
|
180
183
|
version: '0'
|
181
184
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
183
|
-
signing_key:
|
185
|
+
rubygems_version: 3.3.26
|
186
|
+
signing_key:
|
184
187
|
specification_version: 4
|
185
188
|
summary: Ruby client for Mistral.
|
186
189
|
test_files: []
|