floe 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fb1e855fda7d4a00a72e494b820a89304350945c14a71675d5cc6306e69f079
|
4
|
+
data.tar.gz: 9780e210073c41b4a5c534bdabd301c2df6275c13328dbb1ee43569470e8d590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec5c7f6337c74258e185b76abfc3953f05ef16cf4de640972d23b7dfa81bf4439df3ce00dd539c618f7d18905d783bfa55dc777365e1a48969942b182448107
|
7
|
+
data.tar.gz: cf584d349c69927dec6945fe21d652b79e96f6228754b1a91a57b3241825661ed6d977a7d53e3ebfae526551da2a4a573148e9d855840d8edc52b8ebeffc948b
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [0.13.1] - 2024-08-16
|
8
|
+
### Fixed
|
9
|
+
- Fix podman/docker container_ref trailing newline ([#265](https://github.com/ManageIQ/floe/pull/265))
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- Improve type check for States.Hash ([#261](https://github.com/ManageIQ/floe/pull/261))
|
13
|
+
- Use Numeric over Integer || Float ([#264](https://github.com/ManageIQ/floe/pull/264))
|
14
|
+
- In ChoiceRule::Data, parse compare key and variable ([#257](https://github.com/ManageIQ/floe/pull/257))
|
15
|
+
|
7
16
|
## [0.13.0] - 2024-08-12
|
8
17
|
### Added
|
9
18
|
- Choice rule payload validation path ([#253](https://github.com/ManageIQ/floe/pull/253))
|
@@ -233,7 +242,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
233
242
|
### Added
|
234
243
|
- Initial release
|
235
244
|
|
236
|
-
[Unreleased]: https://github.com/ManageIQ/floe/compare/v0.13.
|
245
|
+
[Unreleased]: https://github.com/ManageIQ/floe/compare/v0.13.1...HEAD
|
246
|
+
[0.13.1]: https://github.com/ManageIQ/floe/compare/v0.13.0...v0.13.1
|
237
247
|
[0.13.0]: https://github.com/ManageIQ/floe/compare/v0.12.0...v0.13.0
|
238
248
|
[0.12.0]: https://github.com/ManageIQ/floe/compare/v0.11.3...v0.12.0
|
239
249
|
[0.11.3]: https://github.com/ManageIQ/floe/compare/v0.11.2...v0.11.3
|
@@ -129,7 +129,7 @@ module Floe
|
|
129
129
|
logger.debug("Running #{AwesomeSpawn.build_command_line(self.class::DOCKER_COMMAND, params)}")
|
130
130
|
|
131
131
|
result = docker!(*params)
|
132
|
-
result.output
|
132
|
+
result.output.chomp
|
133
133
|
end
|
134
134
|
|
135
135
|
def run_container_params(image, env, secrets_file)
|
data/lib/floe/version.rb
CHANGED
@@ -4,6 +4,18 @@ module Floe
|
|
4
4
|
class Workflow
|
5
5
|
class ChoiceRule
|
6
6
|
class Data < Floe::Workflow::ChoiceRule
|
7
|
+
COMPARE_KEYS = %w[IsNull IsPresent IsNumeric IsString IsBoolean IsTimestamp String Numeric Boolean Timestamp].freeze
|
8
|
+
|
9
|
+
attr_reader :variable, :compare_key, :value, :path
|
10
|
+
|
11
|
+
def initialize(_workflow, _name, payload)
|
12
|
+
super
|
13
|
+
|
14
|
+
@variable = parse_path("Variable", payload)
|
15
|
+
parse_compare_key
|
16
|
+
@value = path ? parse_path(compare_key, payload) : payload[compare_key]
|
17
|
+
end
|
18
|
+
|
7
19
|
def true?(context, input)
|
8
20
|
return presence_check(context, input) if compare_key == "IsPresent"
|
9
21
|
|
@@ -72,7 +84,7 @@ module Floe
|
|
72
84
|
end
|
73
85
|
|
74
86
|
def is_numeric?(value) # rubocop:disable Naming/PredicateName
|
75
|
-
value.kind_of?(
|
87
|
+
value.kind_of?(Numeric)
|
76
88
|
end
|
77
89
|
|
78
90
|
def is_string?(value) # rubocop:disable Naming/PredicateName
|
@@ -92,12 +104,25 @@ module Floe
|
|
92
104
|
false
|
93
105
|
end
|
94
106
|
|
95
|
-
def
|
96
|
-
@compare_key
|
107
|
+
def parse_compare_key
|
108
|
+
@compare_key = payload.keys.detect { |key| key.match?(/^(#{COMPARE_KEYS.join("|")})/) }
|
109
|
+
parser_error!("requires a compare key") unless compare_key
|
110
|
+
|
111
|
+
@path = compare_key.end_with?("Path")
|
97
112
|
end
|
98
113
|
|
99
114
|
def compare_value(context, input)
|
100
|
-
|
115
|
+
path ? value.value(context, input) : value
|
116
|
+
end
|
117
|
+
|
118
|
+
def variable_value(context, input)
|
119
|
+
variable.value(context, input)
|
120
|
+
end
|
121
|
+
|
122
|
+
def parse_path(field_name, payload)
|
123
|
+
value = payload[field_name]
|
124
|
+
missing_field_error!(field_name) unless value
|
125
|
+
wrap_parser_error(field_name, value) { Path.new(value) }
|
101
126
|
end
|
102
127
|
end
|
103
128
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Floe
|
4
4
|
class Workflow
|
5
5
|
class ChoiceRule
|
6
|
+
include ValidationMixin
|
7
|
+
|
6
8
|
class << self
|
7
9
|
def build(workflow, name, payload)
|
8
10
|
if (sub_payloads = payload["Not"])
|
@@ -25,15 +27,15 @@ module Floe
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
attr_reader :next, :payload, :
|
30
|
+
attr_reader :next, :payload, :children, :name
|
29
31
|
|
30
|
-
def initialize(
|
32
|
+
def initialize(workflow, name, payload, children = nil)
|
31
33
|
@name = name
|
32
34
|
@payload = payload
|
33
35
|
@children = children
|
36
|
+
@next = payload["Next"]
|
34
37
|
|
35
|
-
|
36
|
-
@variable = payload["Variable"]
|
38
|
+
validate_next!(workflow)
|
37
39
|
end
|
38
40
|
|
39
41
|
def true?(*)
|
@@ -42,8 +44,31 @@ module Floe
|
|
42
44
|
|
43
45
|
private
|
44
46
|
|
45
|
-
def
|
46
|
-
|
47
|
+
def validate_next!(workflow)
|
48
|
+
if is_child?
|
49
|
+
# non-top level nodes don't allow a next
|
50
|
+
invalid_field_error!("Next", @next, "not allowed in a child rule") if @next
|
51
|
+
elsif !@next
|
52
|
+
# top level nodes require a next
|
53
|
+
missing_field_error!("Next")
|
54
|
+
elsif !workflow_state?(@next, workflow)
|
55
|
+
# top level nodes require a next field that is found
|
56
|
+
invalid_field_error!("Next", @next, "is not found in \"States\"")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# returns true if this is a child rule underneath an And/Or/Not
|
61
|
+
# {
|
62
|
+
# "Or": [
|
63
|
+
# {"Variable": "$.foo", "IsString": true},
|
64
|
+
# {"Variable": "$.foo", "IsBoolean": true}
|
65
|
+
# ], "Next": "Finished"
|
66
|
+
# }
|
67
|
+
#
|
68
|
+
# The Or node, has no conjunction parent, so it is not a child (requires a Next)
|
69
|
+
# The 2 Data nodes have a conjunction parent, so each one is a child (do not allow a Next)
|
70
|
+
def is_child? # rubocop:disable Naming/PredicateName
|
71
|
+
!(%w[And Or Not] & name[0..-2]).empty?
|
47
72
|
end
|
48
73
|
end
|
49
74
|
end
|
@@ -80,7 +80,7 @@ module Floe
|
|
80
80
|
STATES_FORMAT_PLACEHOLDER = /(?<!\\)\{\}/.freeze
|
81
81
|
|
82
82
|
rule(:states_format => {:args => subtree(:args)}) do
|
83
|
-
args = Transformer.process_args(args(), "States.Format", [String, VariadicArgs[[String, TrueClass, FalseClass,
|
83
|
+
args = Transformer.process_args(args(), "States.Format", [String, VariadicArgs[[String, TrueClass, FalseClass, Numeric, NilClass]]])
|
84
84
|
str, *rest = *args
|
85
85
|
|
86
86
|
# TODO: Handle templates with escaped characters, including invalid templates
|
@@ -191,13 +191,9 @@ module Floe
|
|
191
191
|
end
|
192
192
|
|
193
193
|
rule(:states_hash => {:args => subtree(:args)}) do
|
194
|
-
args = Transformer.process_args(args(), "States.Hash", [
|
194
|
+
args = Transformer.process_args(args(), "States.Hash", [[String, TrueClass, FalseClass, Numeric, Array, Hash], String])
|
195
195
|
data, algorithm = *args
|
196
196
|
|
197
|
-
if data.nil?
|
198
|
-
raise ArgumentError, "invalid value for argument 1 to States.Hash (given null, expected non-null)"
|
199
|
-
end
|
200
|
-
|
201
197
|
algorithms = %w[MD5 SHA-1 SHA-256 SHA-384 SHA-512]
|
202
198
|
unless algorithms.include?(algorithm)
|
203
199
|
raise ArgumentError, "invalid value for argument 2 to States.Hash (given #{algorithm.inspect}, expected one of #{algorithms.map(&:inspect).join(", ")})"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: floe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_spawn
|