ruby_aem 3.7.0 → 3.8.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 +4 -4
- data/conf/gem.yaml +1 -1
- data/lib/ruby_aem/resources/ssl.rb +72 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25e7edffa5c553d72473f08ca4e6ed7c9da856ea
|
4
|
+
data.tar.gz: ce2f8e0bfb47609012a4d88c86d72b5f3156d514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f42fc2cbd77cacb92037e10ed9bab8006165a89783b71399dac02f3a3fe3efddcbe40fb7a9b7aa37fe1ca0e5647294af7aa56520d5e0e41967b4aff7bdbd623
|
7
|
+
data.tar.gz: 3994a1a156167b4707eb6bed1d0cc8d88643b87c40ee7da609bf9e0fb772f21962bd68a299ae32c6f15154c1be3d90393ddd23fed81c827c32a8569de3d42e97
|
data/conf/gem.yaml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version: 3.
|
1
|
+
version: 3.8.0
|
@@ -71,6 +71,78 @@ module RubyAem
|
|
71
71
|
def get
|
72
72
|
@client.call(self.class, __callee__.to_s, @call_params)
|
73
73
|
end
|
74
|
+
|
75
|
+
# Check if SSL is enabled via Granite
|
76
|
+
#
|
77
|
+
# @return RubyAem::Result
|
78
|
+
def is_enabled
|
79
|
+
get_ssl = get
|
80
|
+
|
81
|
+
response = get_ssl.response
|
82
|
+
ssl_properties = response.body.properties
|
83
|
+
ssl_enabled = ssl_properties.com_adobe_granite_jetty_ssl_port.is_set
|
84
|
+
ssl_port = ssl_properties.com_adobe_granite_jetty_ssl_port.value
|
85
|
+
|
86
|
+
message = if ssl_enabled.eql?(true)
|
87
|
+
"HTTPS has been configured on port #{ssl_port}"
|
88
|
+
else
|
89
|
+
'HTTPS is not configured'
|
90
|
+
end
|
91
|
+
|
92
|
+
result = RubyAem::Result.new(message, response)
|
93
|
+
result.data = ssl_enabled
|
94
|
+
|
95
|
+
result
|
96
|
+
end
|
97
|
+
|
98
|
+
# Enable SSL via granite and wait until SSL was enabled
|
99
|
+
#
|
100
|
+
# @param opts hash of the following values:
|
101
|
+
# - keystore_password: Authorizable Keystore password for system-user ssl-service. keystore will be created if it doesn't exist.
|
102
|
+
# - truststore_password: AEM Global Truststore password. Truststore will be created if it doesn't exist.
|
103
|
+
# - https_hostname: Hostname for enabling HTTPS listener matching the certificate's common name.
|
104
|
+
# - https_port: Port to listen on for HTTPS requests.
|
105
|
+
# - certificate_file_path: Path to the HTTPS public certificate file.
|
106
|
+
# - privatekey_file_path: Path to the HTTPS Private Key file.
|
107
|
+
# - _retries: retries library's options (http://www.rubydoc.info/gems/retries/0.0.5#Usage), restricted to max_tries, base_sleep_seconds, max_sleep_seconds
|
108
|
+
# @return RubyAem::Result
|
109
|
+
def enable_wait_until_ready(
|
110
|
+
opts = {
|
111
|
+
force: true,
|
112
|
+
_retries: {
|
113
|
+
max_tries: 30,
|
114
|
+
base_sleep_seconds: 2,
|
115
|
+
max_sleep_seconds: 2
|
116
|
+
}
|
117
|
+
}
|
118
|
+
)
|
119
|
+
opts[:_retries] ||= {}
|
120
|
+
opts[:_retries][:max_tries] ||= 30
|
121
|
+
opts[:_retries][:base_sleep_seconds] ||= 2
|
122
|
+
opts[:_retries][:max_sleep_seconds] ||= 2
|
123
|
+
|
124
|
+
# ensure integer retries setting (Puppet 3 passes numeric string)
|
125
|
+
opts[:_retries][:max_tries] = opts[:_retries][:max_tries].to_i
|
126
|
+
opts[:_retries][:base_sleep_seconds] = opts[:_retries][:base_sleep_seconds].to_i
|
127
|
+
opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
|
128
|
+
|
129
|
+
# The AEM Granite API to enable SSl is unstable and in some cases it response with response code 0.
|
130
|
+
# This is because the HTTP service is getting restarted during the process of enabling SSL via Granite.
|
131
|
+
# To not end with an error we have to rescue this behaviour and verify afterwards if SSL was enabled.
|
132
|
+
begin
|
133
|
+
result = enable(**opts)
|
134
|
+
rescue RubyAem::Error => e
|
135
|
+
raise StandardError.new(result) unless e.result.response.status_code.zero?
|
136
|
+
|
137
|
+
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|
|
138
|
+
result = is_enabled
|
139
|
+
message = 'SSL could not be configured or connection timeout please try again.'
|
140
|
+
puts format('SSL Enable check #%<retries_count>d: %<check_result_data>s - %<check_result_message>s', retries_count: retries_count, check_result_data: result.data, check_result_message: result.message)
|
141
|
+
raise StandardError.new(message) if result.data == false
|
142
|
+
}
|
143
|
+
end
|
144
|
+
result
|
145
|
+
end
|
74
146
|
end
|
75
147
|
end
|
76
148
|
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: 3.
|
4
|
+
version: 3.8.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: 2020-
|
12
|
+
date: 2020-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: retries
|