ruby_aem 1.3.3 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f303b354d0690fed55e2662645fa0a850c4a9339
4
- data.tar.gz: 9078d5a5d90cc0bf23b86d2fc733a5eeebab6c98
3
+ metadata.gz: c092ee28f6083d9e3d033e1b56f52bd949606db3
4
+ data.tar.gz: 3c4441408e7b1fe71005c9d4467ee187448eb8a5
5
5
  SHA512:
6
- metadata.gz: 574e2f1b7d63003e9297512e981ba63de9aa3b6d6c734f47d068dc84dba95b8e84cc6ed9b776d2a12ab2e9b5b8f252b1a68dbe564708c9b35b814937d39c5482
7
- data.tar.gz: d8e2bb24520e5e43fcd13121d198200f05de01bac3b5778983185a6a8cf1921db0fff8c10a357fdea2e918adca269ead86558fca706fd0c4c45f0d055047cf4b
6
+ metadata.gz: 1befff3fd95f9fa2c7ede3907b75bd8a58ae46ba6544d452afe44247876ef390ce77571de647affc367b6ba5fd195fcbe8ec2025d150c130040e9387eeb59240
7
+ data.tar.gz: df25f0909f4e50af2b6667f793b7d28ab50f5a84af0be8cfcc952c97c8e550d2b26ce994ae97e2fce66b4663ba4b33d64957ce57a02bcdd61998c2663a883ae3
data/conf/spec.yaml CHANGED
@@ -31,6 +31,15 @@ aem:
31
31
  200:
32
32
  handler: json_agents
33
33
  message: 'Retrieved agents on %{run_mode}'
34
+ get_install_status:
35
+ api: crx
36
+ operation: getInstallStatus
37
+ params:
38
+ required:
39
+ responses:
40
+ 200:
41
+ handler: simple
42
+ message: 'Install status retrieved successfully'
34
43
  bundle:
35
44
  responses:
36
45
  404:
@@ -56,7 +56,7 @@ module RubyAem
56
56
 
57
57
  params = []
58
58
  required_params = action_spec['params']['required'] || {}
59
- required_params.each { |_key, value|
59
+ required_params.each_value { |value|
60
60
  params.push(value % call_params)
61
61
  }
62
62
  params.push({})
@@ -66,7 +66,7 @@ module RubyAem
66
66
  json = JSON.parse(response.body)
67
67
 
68
68
  filter = []
69
- json.each do |key, _value|
69
+ json.each_key do |key|
70
70
  filter.push(json[key]['root']) unless json[key]['root'].nil?
71
71
  end
72
72
 
@@ -103,7 +103,7 @@ module RubyAem
103
103
  json = JSON.parse(response.body)
104
104
 
105
105
  agent_names = []
106
- json.each do |key, _value|
106
+ json.each_key do |key|
107
107
  if (!key.start_with? 'jcr:') && (!key.start_with? 'rep:')
108
108
  agent_names.push(key)
109
109
  end
@@ -148,6 +148,56 @@ module RubyAem
148
148
  @call_params[:run_mode] = run_mode
149
149
  @client.call(self.class, __callee__.to_s, @call_params)
150
150
  end
151
+
152
+ # Retrieve AEM install status.
153
+ #
154
+ # @return RubyAem::Result
155
+ def get_install_status
156
+ @client.call(self.class, __callee__.to_s, @call_params)
157
+ end
158
+
159
+ # Retrieve AEM install status with retries until its status is finished
160
+ #
161
+ # @param opts optional parameters:
162
+ # - _retries: retries library's options (http://www.rubydoc.info/gems/retries/0.0.5#Usage), restricted to max_trie, base_sleep_seconds, max_sleep_seconds
163
+ # @return RubyAem::Result
164
+ def get_install_status_wait_until_finished(
165
+ opts = {
166
+ _retries: {
167
+ max_tries: 30,
168
+ base_sleep_seconds: 2,
169
+ max_sleep_seconds: 2
170
+ }
171
+ }
172
+ )
173
+ opts[:_retries] ||= {}
174
+ opts[:_retries][:max_tries] ||= 30
175
+ opts[:_retries][:base_sleep_seconds] ||= 2
176
+ opts[:_retries][:max_sleep_seconds] ||= 2
177
+
178
+ # ensure integer retries setting (Puppet 3 passes numeric string)
179
+ opts[:_retries][:max_tries] = opts[:_retries][:max_tries].to_i
180
+ opts[:_retries][:base_sleep_seconds] = opts[:_retries][:base_sleep_seconds].to_i
181
+ opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
182
+
183
+ result = nil
184
+ with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
185
+ begin
186
+ result = get_install_status
187
+ item_count = result.response.body.status.item_count
188
+ if result.response.body.status.finished == true && item_count.zero?
189
+ puts format('Retrieve AEM install status attempt #%d: %s and finished', retries_count, result.message)
190
+ else
191
+ puts format('Retrieve AEM install status attempt #%d: %s but not finished yet, still installing %d package(s)', retries_count, result.message, item_count)
192
+ raise StandardError.new(result.message)
193
+ end
194
+ rescue RubyAem::Error => err
195
+ puts format('Retrieve AEM install status attempt #%d: %s', retries_count, err.message)
196
+ raise StandardError.new(err.message)
197
+ end
198
+ }
199
+ result
200
+ end
151
201
  end
152
202
  end
153
203
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_aem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shine Solutions
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-21 00:00:00.000000000 Z
12
+ date: 2017-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.0
54
+ version: 1.2.0
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.0
61
+ version: 1.2.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec
64
64
  requirement: !ruby/object:Gem::Requirement