razor-client 1.9.4 → 1.9.5

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
- SHA256:
3
- metadata.gz: 7240c2a4e68fab8d04ae7084b400d7a7bd472858c2190b3dca337577e5aa5cf7
4
- data.tar.gz: 3f3b980e70b2d2de30f8fb49f4b8a34ad6ac67daf4e76b2d944250b1dd09894c
2
+ SHA1:
3
+ metadata.gz: e1defb4bea2f1d1998d77782490f2e4828ecfd29
4
+ data.tar.gz: 7f98e0a1282e359e159ea9e2983551d72d8cf790
5
5
  SHA512:
6
- metadata.gz: cf8b0cf692487781a22c34b2df625ad729a39fc283fb3cc3b6abd0beefec6d8392b1d10a33eeae05d94f21677ea5cf36f9755fc6365d1ca38862fbadad7b7a9c
7
- data.tar.gz: 5c56d03d1161b3c9d74c66b9ddb82123e072e24cebd7e42f703d579cc13d1e696f40d259670b673773ffb1b234fb76a38876528bdb7a6642199a61331a6a013e
6
+ metadata.gz: b5daf070483c704837ab46c11bb4d33ed15af45aa5c852915ec52ba1c2b2f1090d17dc50705ff4531ce0f29d5e3d2accac5d681cb067b81fa2e23beb894d41a5
7
+ data.tar.gz: a6cce4845b41e97498ec1e4b25df325d7ed17203f8a51984cd25315b0b28837d6b97e359c567971d258ba530601215239fb19f33298ad0a548ebcde36396698b
data/NEWS.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Razor Client Release Notes
2
2
 
3
+ ## 1.9.5 - 2019-08-29
4
+
5
+ * BUGFIX: Fixed handling of boolean arguments, e.g. `--enabled` in
6
+ `create-policy`, where the following arguments were not delineated properly.
7
+
3
8
  ## 1.9.4 - 2019-08-26
4
9
 
5
10
  * IMPROVEMENT: Moved from `rest-client` to `faraday` due to increasing
@@ -35,7 +35,7 @@ class Razor::CLI::Command
35
35
  # `--arg=value`/`--arg value`
36
36
  # `-a=value`/`-a value`
37
37
  arg_name, value = [$1, $3]
38
- value = @segments.shift if value.nil? && @segments[0] !~ /^-[a-z]/
38
+ value = @segments.shift if value.nil? && @segments[0] !~ /^-[-]?[a-z]/
39
39
  arg_name = self.class.resolve_alias(arg_name, @cmd_schema)
40
40
  body[arg_name] = self.class.convert_arg(arg_name, value, body[arg_name], @cmd_schema)
41
41
  elsif argument =~ /\A-([a-z][a-z_-]+)(=(.+))?\Z/ and
@@ -127,7 +127,9 @@ class Razor::CLI::Command
127
127
  {argument_name: arg_name, error: error.message}
128
128
  end
129
129
  when "boolean"
130
- ["true", nil].include?(value)
130
+ raise ArgumentError, _("Invalid boolean for argument '%{argument_name}': %{value}") %
131
+ {argument_name: arg_name, value: value} unless ["true", "false", nil].include?(value)
132
+ value != "false"
131
133
  when "number"
132
134
  begin
133
135
  Integer(value)
@@ -60,6 +60,16 @@ describe Razor::CLI::Command do
60
60
  to raise_error(ArgumentError, /Expected nothing for argument 'tags', but was: 'abc'/)
61
61
  end
62
62
  end
63
+ context "boolean conversion" do
64
+ it "errors when anything besides 'true', 'false' or nil are provided" do
65
+ cmd_schema = {"enabled"=>{"type"=>"boolean"}}
66
+ expect{Command.convert_arg('enabled', 'abc', existing_value, cmd_schema)}.
67
+ to raise_error(ArgumentError, /Invalid boolean for argument 'enabled': abc/)
68
+ expect(Command.convert_arg('enabled', 'true', existing_value, cmd_schema)).to eq(true)
69
+ expect(Command.convert_arg('enabled', nil, existing_value, cmd_schema)).to eq(true)
70
+ expect(Command.convert_arg('enabled', 'false', existing_value, cmd_schema)).to eq(false)
71
+ end
72
+ end
63
73
  end
64
74
 
65
75
  context "resolve_alias" do
@@ -104,6 +114,9 @@ describe Razor::CLI::Command do
104
114
  it "succeeds with a double dash for long flags" do
105
115
  extract({'schema' => {'name' => {'type' => 'array'}}},
106
116
  ['--name', 'abc'])['name'].should == ['abc']
117
+ extract({'schema' => {'true' => {'type' => 'boolean'},
118
+ 'other' => {'type' => 'number'}}},
119
+ ['--true', '--other', '123'])['true'].should be_true
107
120
  end
108
121
  it "succeeds with a single dash for short flags" do
109
122
  c = Razor::CLI::Command.new(nil, nil, {'schema' => {'n' => {'type' => 'array'}}},
metadata CHANGED
@@ -1,108 +1,108 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: razor-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.4
4
+ version: 1.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-26 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: mime-types
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0'
20
- type: :runtime
19
+ name: mime-types
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: multi_json
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
- type: :runtime
33
+ name: multi_json
35
34
  prerelease: false
35
+ type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: faraday
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0.15'
48
- type: :runtime
47
+ name: faraday
49
48
  prerelease: false
49
+ type: :runtime
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.15'
55
55
  - !ruby/object:Gem::Dependency
56
- name: command_line_reporter
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
60
  version: '3.0'
62
- type: :runtime
61
+ name: command_line_reporter
63
62
  prerelease: false
63
+ type: :runtime
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: gettext-setup
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - ">="
74
73
  - !ruby/object:Gem::Version
75
74
  version: '0.31'
76
- type: :runtime
75
+ name: gettext-setup
77
76
  prerelease: false
77
+ type: :runtime
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.31'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
86
  - - ">="
88
87
  - !ruby/object:Gem::Version
89
88
  version: '0'
90
- type: :development
89
+ name: bundler
91
90
  prerelease: false
91
+ type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
100
  - - ">="
102
101
  - !ruby/object:Gem::Version
103
102
  version: '0'
104
- type: :development
103
+ name: rake
105
104
  prerelease: false
105
+ type: :development
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
@@ -201,7 +201,7 @@ homepage: https://github.com/puppetlabs/razor-client
201
201
  licenses:
202
202
  - ASL2
203
203
  metadata: {}
204
- post_install_message:
204
+ post_install_message:
205
205
  rdoc_options: []
206
206
  require_paths:
207
207
  - lib
@@ -216,8 +216,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubygems_version: 3.0.3
220
- signing_key:
219
+ rubyforge_project:
220
+ rubygems_version: 2.6.6
221
+ signing_key:
221
222
  specification_version: 4
222
223
  summary: The client for everybody's favorite provisioning tool
223
224
  test_files: