kpm 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kpm.gemspec +0 -1
- data/lib/kpm.rb +4 -1
- data/lib/kpm/base_artifact.rb +24 -8
- data/lib/kpm/base_installer.rb +35 -3
- data/lib/kpm/diagnostic_file.rb +187 -0
- data/lib/kpm/installer.rb +10 -3
- data/lib/kpm/kaui_artifact.rb +1 -1
- data/lib/kpm/killbill_plugin_artifact.rb +1 -1
- data/lib/kpm/killbill_server_artifact.rb +1 -1
- data/lib/kpm/nexus_helper/actions.rb +34 -0
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +188 -0
- data/lib/kpm/nexus_helper/nexus_facade.rb +20 -0
- data/lib/kpm/plugins_directory.yml +6 -1
- data/lib/kpm/system.rb +80 -53
- data/lib/kpm/system_helpers/cpu_information.rb +72 -0
- data/lib/kpm/system_helpers/disk_space_information.rb +84 -0
- data/lib/kpm/system_helpers/entropy_available.rb +52 -0
- data/lib/kpm/system_helpers/memory_information.rb +71 -0
- data/lib/kpm/system_helpers/os_information.rb +66 -0
- data/lib/kpm/system_helpers/system_proxy.rb +28 -0
- data/lib/kpm/tasks.rb +101 -2
- data/lib/kpm/trace_logger.rb +70 -0
- data/lib/kpm/utils.rb +42 -0
- data/lib/kpm/version.rb +1 -1
- data/pom.xml +1 -1
- data/spec/kpm/remote/base_artifact_spec.rb +20 -0
- data/spec/kpm/remote/base_installer_spec.rb +15 -0
- data/spec/kpm/remote/installer_spec.rb +10 -2
- data/spec/kpm/remote/migrations_spec.rb +1 -1
- data/spec/kpm/remote/nexus_facade_spec.rb +60 -0
- data/spec/spec_helper.rb +1 -0
- metadata +14 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a60374d9426b71862a9dc7deba1f6b196af27ea
|
4
|
+
data.tar.gz: 3e72b27242ce530e18eea45961f361ec70e73b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07dd7d2ad53197d3cca095c6c7a4cdc92e14bd7182d0da960611f43b229539b06723a46534b14fd660d8ef1cb9a476a9c4f24c4f54c1a9241bfca29d64d43e9b
|
7
|
+
data.tar.gz: 9223ffad42ddadc56feb517b085ff9f1454bf57c12e56e2dd2bc4f43cb64ebc9ebb835f30f37f2ca5c9f950e961c09d0fc0cb199970b5ecd245517ec86083097
|
data/kpm.gemspec
CHANGED
@@ -40,7 +40,6 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.rdoc_options << '--exclude' << '.'
|
41
41
|
|
42
42
|
s.add_dependency 'highline', '~> 1.6.21'
|
43
|
-
s.add_dependency 'nexus_cli', '~> 4.1.0'
|
44
43
|
s.add_dependency 'thor', '~> 0.19.1'
|
45
44
|
s.add_dependency 'rubyzip', '~>1.2.0'
|
46
45
|
s.add_dependency 'killbill-client', '~> 1.0'
|
data/lib/kpm.rb
CHANGED
@@ -20,7 +20,10 @@ module KPM
|
|
20
20
|
autoload :System, 'kpm/system'
|
21
21
|
autoload :Account, 'kpm/account'
|
22
22
|
autoload :Database, 'kpm/database'
|
23
|
-
autoload :TenantConfig, 'kpm/tenant_config
|
23
|
+
autoload :TenantConfig, 'kpm/tenant_config'
|
24
|
+
autoload :DiagnosticFile, 'kpm/diagnostic_file'
|
25
|
+
autoload :NexusFacade, 'kpm/nexus_helper/nexus_facade'
|
26
|
+
autoload :TraceLogger, 'kpm/trace_logger'
|
24
27
|
|
25
28
|
class << self
|
26
29
|
def root
|
data/lib/kpm/base_artifact.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'digest/sha1'
|
2
|
-
require 'nexus_cli'
|
3
2
|
require 'rexml/document'
|
4
3
|
|
5
4
|
module KPM
|
@@ -44,8 +43,8 @@ module KPM
|
|
44
43
|
pull_from_fs_and_put_in_place(logger, file_path, destination_path)
|
45
44
|
end
|
46
45
|
|
47
|
-
def nexus_remote(overrides={}, ssl_verify=true)
|
48
|
-
nexus_remote ||=
|
46
|
+
def nexus_remote(overrides={}, ssl_verify=true, logger=nil)
|
47
|
+
nexus_remote ||= KPM::NexusFacade::RemoteFactory.create(nexus_defaults.merge(overrides || {}), ssl_verify, logger)
|
49
48
|
end
|
50
49
|
|
51
50
|
def nexus_defaults
|
@@ -102,6 +101,7 @@ module KPM
|
|
102
101
|
logger.info " Starting download of #{coordinates} to #{tmp_destination_dir}"
|
103
102
|
|
104
103
|
downloaded_artifact_info = pull_and_verify(logger, artifact_info[:sha1], coordinates, tmp_destination_dir, sha1_file, verify_sha1, overrides, ssl_verify)
|
104
|
+
remove_old_default_bundles(coordinate_map,artifact_info,downloaded_artifact_info)
|
105
105
|
if artifact_info[:is_tgz]
|
106
106
|
artifact_info[:bundle_dir] = Utils.unpack_tgz(downloaded_artifact_info[:file_path], artifact_info[:dir_name], skip_top_dir)
|
107
107
|
FileUtils.rm downloaded_artifact_info[:file_path]
|
@@ -172,10 +172,10 @@ module KPM
|
|
172
172
|
|
173
173
|
coordinates = KPM::Coordinates.build_coordinates(coordinate_map)
|
174
174
|
begin
|
175
|
-
nexus_info = nexus_remote(overrides, ssl_verify).get_artifact_info(coordinates)
|
176
|
-
rescue
|
177
|
-
raise
|
178
|
-
rescue
|
175
|
+
nexus_info = nexus_remote(overrides, ssl_verify, logger).get_artifact_info(coordinates)
|
176
|
+
rescue KPM::NexusFacade::ArtifactMalformedException => e
|
177
|
+
raise StandardError.new("Invalid coordinates #{coordinate_map}")
|
178
|
+
rescue StandardError => e
|
179
179
|
logger.warn("Unable to retrieve coordinates #{coordinate_map}")
|
180
180
|
raise e
|
181
181
|
end
|
@@ -219,7 +219,7 @@ module KPM
|
|
219
219
|
end
|
220
220
|
|
221
221
|
def pull_and_verify(logger, remote_sha1, coordinates, destination_dir, sha1_file, verify_sha1, overrides={}, ssl_verify=true)
|
222
|
-
info = nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination_dir)
|
222
|
+
info = nexus_remote(overrides, ssl_verify, logger).pull_artifact(coordinates, destination_dir)
|
223
223
|
|
224
224
|
# Always verify sha1 and if incorrect either throw or log when we are asked to bypass sha1 verification
|
225
225
|
verified = verify(logger, coordinates, info[:file_path], remote_sha1)
|
@@ -274,6 +274,22 @@ module KPM
|
|
274
274
|
# Probably a directory
|
275
275
|
true
|
276
276
|
end
|
277
|
+
|
278
|
+
def remove_old_default_bundles(coordinate_map, artifact_info, downloaded_artifact_info)
|
279
|
+
return unless coordinate_map[:artifact_id] == 'killbill-platform-osgi-bundles-defaultbundles'
|
280
|
+
|
281
|
+
downloaded_default_bundles = Utils.peek_tgz_file_names(downloaded_artifact_info[:file_path])
|
282
|
+
existing_default_bundles = Dir.glob("#{artifact_info[:dir_name]}/*")
|
283
|
+
|
284
|
+
existing_default_bundles.each do |bundle|
|
285
|
+
bundle_name = Utils.get_plugin_name_from_file_path(bundle)
|
286
|
+
is_downloaded = downloaded_default_bundles.index {|file_name| file_name.include? bundle_name}
|
287
|
+
unless is_downloaded.nil?
|
288
|
+
FileUtils.remove(bundle)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
end
|
277
293
|
end
|
278
294
|
end
|
279
295
|
end
|
data/lib/kpm/base_installer.rb
CHANGED
@@ -12,6 +12,7 @@ module KPM
|
|
12
12
|
@logger = logger
|
13
13
|
@nexus_config = nexus_config
|
14
14
|
@nexus_ssl_verify = nexus_ssl_verify
|
15
|
+
@trace_logger = KPM::TraceLogger.new
|
15
16
|
end
|
16
17
|
|
17
18
|
def install_killbill_server(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, bundles_dir=nil, force_download=false, verify_sha1=true)
|
@@ -24,8 +25,13 @@ module KPM
|
|
24
25
|
bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
|
25
26
|
sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
|
26
27
|
|
28
|
+
if version == LATEST_VERSION
|
29
|
+
latest_stable_version = KPM::Installer.get_kb_latest_stable_version
|
30
|
+
version = latest_stable_version unless latest_stable_version.nil?
|
31
|
+
end
|
32
|
+
|
27
33
|
@logger.debug("Installing Kill Bill server: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} webapp_path=#{webapp_path}")
|
28
|
-
KPM::KillbillServerArtifact.pull(@logger,
|
34
|
+
artifact_info = KPM::KillbillServerArtifact.pull(@logger,
|
29
35
|
group_id,
|
30
36
|
artifact_id,
|
31
37
|
packaging,
|
@@ -37,6 +43,10 @@ module KPM
|
|
37
43
|
verify_sha1,
|
38
44
|
@nexus_config,
|
39
45
|
@nexus_ssl_verify)
|
46
|
+
# store trace info to be returned as JSON by the KPM::Installer.install method
|
47
|
+
@trace_logger.add('killbill',
|
48
|
+
artifact_info.merge({'status'=> (artifact_info[:skipped] ? 'UP_TO_DATE': 'INSTALLED'),
|
49
|
+
:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier}))
|
40
50
|
end
|
41
51
|
|
42
52
|
def install_kaui(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, bundles_dir=nil, force_download=false, verify_sha1=true)
|
@@ -50,7 +60,7 @@ module KPM
|
|
50
60
|
sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
|
51
61
|
|
52
62
|
@logger.debug("Installing Kaui: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} webapp_path=#{webapp_path}")
|
53
|
-
KPM::KauiArtifact.pull(@logger,
|
63
|
+
artifact_info = KPM::KauiArtifact.pull(@logger,
|
54
64
|
group_id,
|
55
65
|
artifact_id,
|
56
66
|
packaging,
|
@@ -62,6 +72,12 @@ module KPM
|
|
62
72
|
verify_sha1,
|
63
73
|
@nexus_config,
|
64
74
|
@nexus_ssl_verify)
|
75
|
+
# store trace info to be returned as JSON by the KPM::Installer.install method
|
76
|
+
@trace_logger.add('kaui',
|
77
|
+
artifact_info.merge({'status'=> (artifact_info[:skipped] ? 'UP_TO_DATE': 'INSTALLED'),
|
78
|
+
:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier}))
|
79
|
+
|
80
|
+
|
65
81
|
end
|
66
82
|
|
67
83
|
def install_plugin(plugin_key, raw_kb_version=nil, specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, bundles_dir=nil, specified_type=nil, force_download=false, verify_sha1=true, verify_jruby_jar=false)
|
@@ -138,6 +154,10 @@ module KPM
|
|
138
154
|
verify_sha1,
|
139
155
|
@nexus_config,
|
140
156
|
@nexus_ssl_verify)
|
157
|
+
# store trace info to be returned as JSON by the KPM::Installer.install method
|
158
|
+
@trace_logger.add('plugins', plugin_key,
|
159
|
+
artifact_info.merge({'status'=> (artifact_info[:skipped] ? 'UP_TO_DATE': 'INSTALLED'),
|
160
|
+
:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier}))
|
141
161
|
|
142
162
|
# Update with resolved version
|
143
163
|
coordinate_map[:version] = artifact_info[:version]
|
@@ -154,8 +174,12 @@ module KPM
|
|
154
174
|
bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
|
155
175
|
plugins_dir = bundles_dir.join('plugins')
|
156
176
|
|
177
|
+
if version.nil?
|
178
|
+
version = Utils.get_version_from_file_path(file_path)
|
179
|
+
end
|
180
|
+
|
157
181
|
if type.to_s == 'java'
|
158
|
-
plugin_name = name.nil? ?
|
182
|
+
plugin_name = name.nil? ? Utils.get_plugin_name_from_file_path(file_path) : name
|
159
183
|
destination = plugins_dir.join('java').join(plugin_name).join(version)
|
160
184
|
else
|
161
185
|
destination = plugins_dir.join('ruby')
|
@@ -168,6 +192,10 @@ module KPM
|
|
168
192
|
|
169
193
|
update_plugin_identifier(plugins_dir, plugin_key, type.to_s, nil, artifact_info)
|
170
194
|
|
195
|
+
# store trace info to be returned as JSON by the KPM::Installer.install method
|
196
|
+
@trace_logger.add('plugins', plugin_key,
|
197
|
+
artifact_info.merge({'status'=>'INSTALLED'}))
|
198
|
+
|
171
199
|
artifact_info
|
172
200
|
end
|
173
201
|
|
@@ -218,6 +246,10 @@ module KPM
|
|
218
246
|
@nexus_config,
|
219
247
|
@nexus_ssl_verify)
|
220
248
|
|
249
|
+
@trace_logger.add('default_bundles',
|
250
|
+
info.merge({'status'=> (info[:skipped] ? 'UP_TO_DATE': 'INSTALLED'),
|
251
|
+
:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier}))
|
252
|
+
|
221
253
|
# The special JRuby bundle needs to be called jruby.jar
|
222
254
|
# TODO .first - code smell
|
223
255
|
unless info[:skipped]
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'zip'
|
4
|
+
require 'json'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
|
9
|
+
module KPM
|
10
|
+
|
11
|
+
class DiagnosticFile
|
12
|
+
|
13
|
+
# Temporary directory
|
14
|
+
TMP_DIR_PREFIX = 'killbill-diagnostics-'
|
15
|
+
TMP_DIR = Dir.mktmpdir(TMP_DIR_PREFIX)
|
16
|
+
TMP_LOGS_DIR = TMP_DIR + File::Separator + 'logs'
|
17
|
+
|
18
|
+
TENANT_FILE = 'tenant_config.data'
|
19
|
+
SYSTEM_FILE = 'system_configuration.data'
|
20
|
+
ACCOUNT_FILE = 'account.data'
|
21
|
+
|
22
|
+
TODAY_DATE = Date.today.strftime('%m-%d-%y')
|
23
|
+
ZIP_FILE = 'killbill-diagnostics-' + TODAY_DATE + '.zip'
|
24
|
+
ZIP_LOG_FILE = 'logs.zip'
|
25
|
+
|
26
|
+
def initialize(config_file = nil, killbill_api_credentials = nil, killbill_credentials = nil, killbill_url = nil,
|
27
|
+
database_name = nil, database_credentials = nil, database_host = nil, kaui_web_path = nil,
|
28
|
+
killbill_web_path = nil, logger = nil)
|
29
|
+
@killbill_api_credentials = killbill_api_credentials
|
30
|
+
@killbill_credentials = killbill_credentials
|
31
|
+
@killbill_url = killbill_url
|
32
|
+
@database_name = database_name
|
33
|
+
@database_credentials = database_credentials
|
34
|
+
@database_host = database_host
|
35
|
+
@config_file = config_file
|
36
|
+
@kaui_web_path = kaui_web_path;
|
37
|
+
@killbill_web_path = killbill_web_path;
|
38
|
+
@logger = logger
|
39
|
+
@original_logger_level = logger.level;
|
40
|
+
@catalina_base = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def export_data(account_id = nil, log_dir = nil)
|
44
|
+
set_config(@config_file)
|
45
|
+
|
46
|
+
tenant_export_file = get_tenant_config
|
47
|
+
system_export_file = get_system_config
|
48
|
+
account_export_file = get_account_data(account_id) unless account_id.nil?
|
49
|
+
log_files = get_log_files(log_dir)
|
50
|
+
|
51
|
+
if File.exist?(system_export_file) && File.exist?(tenant_export_file)
|
52
|
+
|
53
|
+
|
54
|
+
zip_file_name = TMP_DIR + File::Separator + ZIP_FILE
|
55
|
+
|
56
|
+
Zip::File.open(zip_file_name, Zip::File::CREATE) do |zipFile|
|
57
|
+
|
58
|
+
zipFile.add(TENANT_FILE, tenant_export_file)
|
59
|
+
zipFile.add(SYSTEM_FILE, system_export_file)
|
60
|
+
zipFile.add(ACCOUNT_FILE, account_export_file) unless account_id.nil?
|
61
|
+
zipFile.add(ZIP_LOG_FILE, log_files)
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
@logger.info "\e[32mDiagnostic data exported under #{zip_file_name} \e[0m"
|
66
|
+
|
67
|
+
else
|
68
|
+
raise Interrupt, 'Account id or configuration file not found'
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
# Private methods
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def get_tenant_config
|
78
|
+
|
79
|
+
@logger.info 'Retrieving tenant configuration'
|
80
|
+
# this suppress the message of where it put the account file, this is to avoid confusion
|
81
|
+
@logger.level = Logger::WARN
|
82
|
+
|
83
|
+
@killbill_api_credentials ||= [get_config('killbill', 'api_key'), get_config('killbill','api_secret')] unless @config_file.nil?
|
84
|
+
@killbill_credentials ||= [get_config('killbill', 'user'), get_config('killbill','password')] unless @config_file.nil?
|
85
|
+
@killbill_url ||= 'http://' + get_config('killbill', 'host').to_s + ':' + get_config('killbill','port').to_s unless @config_file.nil?
|
86
|
+
|
87
|
+
tenant_config = KPM::TenantConfig.new(@killbill_api_credentials,
|
88
|
+
@killbill_credentials, @killbill_url, @logger)
|
89
|
+
export_file = tenant_config.export
|
90
|
+
|
91
|
+
final = TMP_DIR + File::Separator + TENANT_FILE
|
92
|
+
FileUtils.move(export_file, final)
|
93
|
+
@logger.level = @original_logger_level
|
94
|
+
|
95
|
+
final
|
96
|
+
end
|
97
|
+
|
98
|
+
def get_system_config
|
99
|
+
|
100
|
+
@logger.info 'Retrieving system configuration'
|
101
|
+
system = KPM::System.new
|
102
|
+
export_data = system.information(nil, true, @config_file, @kaui_web_path, @killbill_web_path)
|
103
|
+
|
104
|
+
get_system_catalina_base(export_data)
|
105
|
+
|
106
|
+
export_file = TMP_DIR + File::SEPARATOR + SYSTEM_FILE
|
107
|
+
File.open(export_file, 'w') { |io| io.puts export_data }
|
108
|
+
export_file
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
def get_account_data(account_id)
|
113
|
+
|
114
|
+
@logger.info 'Retrieving account data for id: ' + account_id
|
115
|
+
# this suppress the message of where it put the account file, this is to avoid confusion
|
116
|
+
@logger.level = Logger::WARN
|
117
|
+
|
118
|
+
account = KPM::Account.new(@config_file, @killbill_api_credentials, @killbill_credentials,
|
119
|
+
@killbill_url, @database_name,
|
120
|
+
@database_credentials,@database_host,nil, @logger)
|
121
|
+
export_file = account.export_data(account_id)
|
122
|
+
|
123
|
+
final = TMP_DIR + File::Separator + ACCOUNT_FILE
|
124
|
+
FileUtils.move(export_file, final)
|
125
|
+
@logger.level = @original_logger_level
|
126
|
+
final
|
127
|
+
end
|
128
|
+
|
129
|
+
def get_log_files(log_dir)
|
130
|
+
|
131
|
+
@logger.info 'Collecting log files'
|
132
|
+
log_base = log_dir || (@catalina_base + File::Separator + 'logs')
|
133
|
+
log_items = Dir.glob(log_base + File::Separator + '*')
|
134
|
+
|
135
|
+
zip_file_name = TMP_DIR + File::Separator + ZIP_LOG_FILE
|
136
|
+
|
137
|
+
Zip::File.open(zip_file_name, Zip::File::CREATE) do |zipFile|
|
138
|
+
|
139
|
+
log_items.each do |file|
|
140
|
+
name = file.split('/').last
|
141
|
+
zipFile.add(name, file)
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
zip_file_name
|
147
|
+
end
|
148
|
+
|
149
|
+
# Helpers
|
150
|
+
|
151
|
+
def get_system_catalina_base(export_data)
|
152
|
+
system_json = JSON.parse(export_data)
|
153
|
+
@catalina_base = system_json['java_system_information']['catalina.base']['value']
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
# Utils
|
158
|
+
|
159
|
+
def get_config(parent, child)
|
160
|
+
item = nil;
|
161
|
+
|
162
|
+
if not @config.nil?
|
163
|
+
|
164
|
+
config_parent = @config[parent]
|
165
|
+
|
166
|
+
if not config_parent.nil?
|
167
|
+
item =config_parent[child]
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
item
|
173
|
+
end
|
174
|
+
|
175
|
+
def set_config(config_file = nil)
|
176
|
+
@config = nil
|
177
|
+
|
178
|
+
if not config_file.nil?
|
179
|
+
if not Dir[config_file][0].nil?
|
180
|
+
@config = YAML::load_file(config_file)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
data/lib/kpm/installer.rb
CHANGED
@@ -16,6 +16,13 @@ module KPM
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.build_default_config(all_kb_versions=nil)
|
19
|
+
latest_stable_version = get_kb_latest_stable_version(all_kb_versions)
|
20
|
+
|
21
|
+
# Note: we assume no unstable version of Kaui is published today
|
22
|
+
{'killbill' => {'version' => latest_stable_version.to_s, 'plugins' => {'ruby' => [{'name' => 'kpm'}]}}, 'kaui' => {'version' => 'LATEST'}}
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.get_kb_latest_stable_version(all_kb_versions=nil)
|
19
26
|
all_kb_versions ||= KillbillServerArtifact.versions(KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
|
20
27
|
KillbillServerArtifact::KILLBILL_PACKAGING,
|
21
28
|
KillbillServerArtifact::KILLBILL_CLASSIFIER,
|
@@ -32,8 +39,7 @@ module KPM
|
|
32
39
|
latest_stable_version = version if version > latest_stable_version
|
33
40
|
end
|
34
41
|
|
35
|
-
|
36
|
-
{'killbill' => {'version' => latest_stable_version.to_s, 'plugins' => {'ruby' => [{'name' => 'kpm'}]}}, 'kaui' => {'version' => 'LATEST'}}
|
42
|
+
latest_stable_version
|
37
43
|
end
|
38
44
|
|
39
45
|
def initialize(raw_config, logger=nil)
|
@@ -75,7 +81,8 @@ module KPM
|
|
75
81
|
install_kaui(@kaui_config['group_id'], @kaui_config['artifact_id'], @kaui_config['packaging'], @kaui_config['classifier'], @kaui_config['version'], @kaui_config['webapp_path'], bundles_dir, force_download, verify_sha1)
|
76
82
|
end
|
77
83
|
|
78
|
-
help
|
84
|
+
@trace_logger.add('help',help)
|
85
|
+
@trace_logger.to_json
|
79
86
|
end
|
80
87
|
|
81
88
|
private
|
data/lib/kpm/kaui_artifact.rb
CHANGED
@@ -11,7 +11,7 @@ module KPM
|
|
11
11
|
coordinates = KPM::Coordinates.build_coordinates(coordinate_map)
|
12
12
|
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
13
13
|
versions = SortedSet.new
|
14
|
-
response.elements.each('
|
14
|
+
response.elements.each('searchNGResponse/data/artifact/version') { |element| versions << element.text }
|
15
15
|
versions
|
16
16
|
end
|
17
17
|
end
|
@@ -16,7 +16,7 @@ module KPM
|
|
16
16
|
|
17
17
|
[[:java, KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID], [:ruby, KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID]].each do |type_and_group_id|
|
18
18
|
response = REXML::Document.new nexus.search_for_artifacts(type_and_group_id[1])
|
19
|
-
response.elements.each('
|
19
|
+
response.elements.each('searchNGResponse/data/artifact') do |element|
|
20
20
|
artifact_id = element.elements['artifactId'].text
|
21
21
|
plugins[type_and_group_id[0]][artifact_id] ||= SortedSet.new
|
22
22
|
plugins[type_and_group_id[0]][artifact_id] << element.elements['version'].text
|
@@ -9,7 +9,7 @@ module KPM
|
|
9
9
|
coordinates = KPM::Coordinates.build_coordinates(coordinate_map)
|
10
10
|
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
11
11
|
versions = SortedSet.new
|
12
|
-
response.elements.each('
|
12
|
+
response.elements.each('searchNGResponse/data/artifact/version') { |element| versions << element.text }
|
13
13
|
versions
|
14
14
|
end
|
15
15
|
|