ruby_aem 1.0.15 → 1.0.16

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
  SHA1:
3
- metadata.gz: affd400287f2582c3628d74c27a1660dc40b8fcf
4
- data.tar.gz: 9e7aeccfb93cd83de25d8c479d8f63f8bec5f1d0
3
+ metadata.gz: e935c237f64320aeb8ddb56917048a6e417f9d9a
4
+ data.tar.gz: 7f91161aa63f00432bea5fc1b477ae2a0aef9fdb
5
5
  SHA512:
6
- metadata.gz: 24cb1caeb841b1d0e29354ae6ceca45f7101d22dbf6afdec2f55c4545b6c87440b798ffd2fff69baea4f7122486ba3b865e06c43e3c115f59d3d1975cd43d9b7
7
- data.tar.gz: 6c2e3cc1329ce0a65aff29b18a3c38fd02a9617f69e77d471ea9094cfcc21d319460b425c911c1e14b537bb3320ed086a1f43df6a98efa3c6a0a0e7abd3ea87d
6
+ metadata.gz: 106576e2b45a2364251f0dc22772ca086fa70c238ef5ebae9fcc3cc145ac08b638f83f63a54546b6cb2df7efcafc9ad16f9b648ec89fee43526e9e3c6694611c
7
+ data.tar.gz: 7ec45d83ea8e7513fa53f88080f6e1f22fd8e8b301eb04df10c85f8967033a6d7a1acb725069b7d8c7b697c2d257c5f5b5e341ee9bff7f18db53e8d5ca7839fb
data/conf/spec.yaml CHANGED
@@ -9,6 +9,18 @@ aem:
9
9
  200:
10
10
  handler: simple
11
11
  message: 'Login page retrieved'
12
+ get_aem_health_check:
13
+ api: custom
14
+ operation: getAemHealthCheck
15
+ params:
16
+ required:
17
+ optional:
18
+ tags: '%{tags}'
19
+ combinetagsor: '%{combine_tags_or}'
20
+ responses:
21
+ 200:
22
+ handler: json_aem_health_check
23
+ message: 'AEM health check retrieved'
12
24
  bundle:
13
25
  responses:
14
26
  404:
@@ -498,6 +510,22 @@ configproperty:
498
510
  201:
499
511
  handler: simple
500
512
  message: 'Set %{run_mode} %{config_node_name} config %{type} property %{name}=%{value}'
513
+ createaemhealthcheckservlet:
514
+ api: custom
515
+ operation: postConfigAemHealthCheckServlet
516
+ params:
517
+ required:
518
+ runmode: '%{run_mode}'
519
+ optional:
520
+ - bundles_ignored
521
+ - bundles_ignored_type_hint
522
+ responses:
523
+ 200:
524
+ handler: simple
525
+ message: 'Set %{run_mode} %{config_node_name} config %{type} property %{name}=%{value}'
526
+ 201:
527
+ handler: simple
528
+ message: 'Set %{run_mode} %{config_node_name} config %{type} property %{name}=%{value}'
501
529
  replicationagent:
502
530
  responses:
503
531
  404:
@@ -48,7 +48,7 @@ module RubyAem
48
48
  #
49
49
  # @param response HTTP response containing status_code, body, and headers
50
50
  # @param response_spec response specification as configured in conf/spec.yaml
51
- # @param call_params additional call_paramsrmation
51
+ # @param call_params additional call_params information
52
52
  # @return RubyAem::Result
53
53
  def Handlers.json_package_service(response, response_spec, call_params)
54
54
 
@@ -68,7 +68,7 @@ module RubyAem
68
68
  #
69
69
  # @param response HTTP response containing status_code, body, and headers
70
70
  # @param response_spec response specification as configured in conf/spec.yaml
71
- # @param call_params additional call_paramsrmation
71
+ # @param call_params additional call_params information
72
72
  # @return RubyAem::Result
73
73
  def Handlers.json_package_filter(response, response_spec, call_params)
74
74
 
@@ -89,5 +89,23 @@ module RubyAem
89
89
 
90
90
  end
91
91
 
92
+ # Handle AEM Health Check Servlet JSON payload.
93
+ #
94
+ # @param response HTTP response containing status_code, body, and headers
95
+ # @param response_spec response specification as configured in conf/spec.yaml
96
+ # @param call_params additional call_params information
97
+ # @return RubyAem::Result
98
+ def Handlers.json_aem_health_check(response, response_spec, call_params)
99
+
100
+ json = JSON.parse(response.body)
101
+
102
+ message = response_spec['message'] % call_params
103
+
104
+ result = RubyAem::Result.new(message, response)
105
+ result.data = json['results']
106
+ result
107
+
108
+ end
109
+
92
110
  end
93
111
  end
@@ -39,8 +39,23 @@ module RubyAem
39
39
  @client.call(self.class, __callee__.to_s, @call_params)
40
40
  end
41
41
 
42
+ # Retrieve AEM Health Check.
43
+ # This is a custom API and requires
44
+ # https://github.com/shinesolutions/aem-healthcheck
45
+ # to be installed.
46
+ #
47
+ # @param tags comma separated tags
48
+ # @param combine_tags_or
49
+ # @return RubyAem::Result
50
+ def get_aem_health_check(tags, combine_tags_or)
51
+
52
+ @call_params[:tags] = tags
53
+ @call_params[:combine_tags_or] = combine_tags_or
54
+
55
+ @client.call(self.class, __callee__.to_s, @call_params)
56
+ end
57
+
42
58
  # Retrieve AEM login page with retries until it is successful.
43
- # This is handy for waiting for AEM to start or restart Jetty.
44
59
  #
45
60
  # @param opts optional parameters:
46
61
  # - _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
@@ -81,6 +96,54 @@ module RubyAem
81
96
  result
82
97
  end
83
98
 
99
+ # Retrieve AEM health check with retries until its status is OK.
100
+ #
101
+ # @param opts optional parameters:
102
+ # - _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
103
+ # @return RubyAem::Result
104
+ def get_aem_health_check_wait_until_ok(tags, combine_tags_or,
105
+ opts = {
106
+ _retries: {
107
+ max_tries: 30,
108
+ base_sleep_seconds: 2,
109
+ max_sleep_seconds: 2
110
+ }
111
+ })
112
+ opts[:_retries] ||= {}
113
+ opts[:_retries][:max_tries] ||= 30
114
+ opts[:_retries][:base_sleep_seconds] ||= 2
115
+ opts[:_retries][:max_sleep_seconds] ||= 2
116
+
117
+ # ensure integer retries setting (Puppet 3 passes numeric string)
118
+ opts[:_retries][:max_tries] = opts[:_retries][:max_tries].to_i
119
+ opts[:_retries][:base_sleep_seconds] = opts[:_retries][:base_sleep_seconds].to_i
120
+ opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
121
+
122
+ result = nil
123
+ 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|
124
+ begin
125
+ result = get_aem_health_check(tags, combine_tags_or)
126
+ is_ok = true;
127
+ result.data.each { |check|
128
+ if check['status'] != 'OK'
129
+ is_ok = false
130
+ break
131
+ end
132
+ }
133
+ if is_ok == false
134
+ puts 'Retrieve AEM Health Check attempt #%d: %s but not ok yet' % [retries_count, result.message]
135
+ raise StandardError.new(result.message)
136
+ else
137
+ puts 'Retrieve AEM Health Check attempt #%d: %s and ok' % [retries_count, result.message]
138
+ end
139
+ rescue RubyAem::Error => err
140
+ puts 'Retrieve AEM Health Check attempt #%d: %s' % [retries_count, err.message]
141
+ raise StandardError.new(err.message)
142
+ end
143
+ }
144
+ result
145
+ end
146
+
84
147
  end
85
148
  end
86
149
  end
@@ -64,6 +64,8 @@ module RubyAem
64
64
  'Apache Sling DavEx Servlet'
65
65
  when 'com.shinesolutions.aem.passwordreset.Activator'
66
66
  'AEM Password Reset Activator'
67
+ when 'com.shinesolutions.healthcheck.hc.impl.ActiveBundleHealthCheck'
68
+ 'AEM Health Check Servlet'
67
69
  else
68
70
  nil
69
71
  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.0.15
4
+ version: 1.0.16
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-04-04 00:00:00.000000000 Z
12
+ date: 2017-04-11 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: 0.9.11
54
+ version: 0.9.12
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: 0.9.11
61
+ version: 0.9.12
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec
64
64
  requirement: !ruby/object:Gem::Requirement