kpm 0.6.3 → 0.6.4
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/lib/kpm/account.rb +7 -6
- data/lib/kpm/base_installer.rb +1 -1
- data/lib/kpm/database.rb +1 -1
- data/lib/kpm/installer.rb +3 -1
- data/lib/kpm/killbill_server_artifact.rb +2 -0
- data/lib/kpm/utils.rb +1 -1
- data/lib/kpm/version.rb +1 -1
- data/pom.xml +1 -1
- data/spec/kpm/unit_mysql/account_spec.rb +5 -7
- data/spec/kpm/unit_mysql/account_spec.yml +3 -1
- data/spec/spec_helper.rb +2 -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: d681ccb516730f4bf0cf48d27e479474f6fa6bec
|
4
|
+
data.tar.gz: d77e83aa18b676cd26f5485c640d6eacd506c86d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 597c2535cb5b1b59d506b4696e93d6b09f29f218dafaa55a62aae61d62bd3aa4bad8346b4b1a11ba55eb19ba547bdf0f06e8a6c4311d0914980e0808ee99b610
|
7
|
+
data.tar.gz: 025362e93a5479ccaf715ab24e0579172ffd708dd7fd99b6477488b1833495b0b219383ba5d3bab68484d759d7559276158e0a322bb7f3d6eae7560a18e634c3
|
data/lib/kpm/account.rb
CHANGED
@@ -99,7 +99,7 @@ module KPM
|
|
99
99
|
export_data = fetch_export_data(account_id)
|
100
100
|
export_file = export(export_data)
|
101
101
|
|
102
|
-
|
102
|
+
unless File.exist?(export_file)
|
103
103
|
raise Interrupt, 'Account id not found'
|
104
104
|
else
|
105
105
|
@logger.info "\e[32mData exported under #{export_file}\e[0m"
|
@@ -108,7 +108,7 @@ module KPM
|
|
108
108
|
export_file
|
109
109
|
end
|
110
110
|
|
111
|
-
def import_data(source_file,tenant_record_id, skip_payment_methods, round_trip_export_import = false, generate_record_id = false)
|
111
|
+
def import_data(source_file, tenant_record_id, skip_payment_methods, round_trip_export_import = false, generate_record_id = false)
|
112
112
|
|
113
113
|
@generate_record_id = generate_record_id
|
114
114
|
@tenant_record_id = tenant_record_id
|
@@ -118,7 +118,7 @@ module KPM
|
|
118
118
|
raise Interrupt, 'Need to specify a file'
|
119
119
|
end
|
120
120
|
|
121
|
-
|
121
|
+
unless File.exist?(source_file)
|
122
122
|
raise Interrupt, 'Need to specify a valid file'
|
123
123
|
end
|
124
124
|
|
@@ -219,7 +219,7 @@ module KPM
|
|
219
219
|
words = line.strip.split(" ")
|
220
220
|
|
221
221
|
if /--/.match(words[0])
|
222
|
-
|
222
|
+
unless table_name.nil?
|
223
223
|
if @generate_record_id
|
224
224
|
cols_names.shift
|
225
225
|
end
|
@@ -256,7 +256,7 @@ module KPM
|
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
|
-
|
259
|
+
unless error_importing_data
|
260
260
|
import(tables)
|
261
261
|
else
|
262
262
|
raise Interrupt, "Data on #{source_file} is invalid"
|
@@ -265,7 +265,8 @@ module KPM
|
|
265
265
|
end
|
266
266
|
|
267
267
|
def process_import_data(line, table_name, cols_names, skip_payment_methods, rows)
|
268
|
-
|
268
|
+
# to make sure that the last column is not omitted if is empty
|
269
|
+
cols = line.strip.split(@delimiter,line.count(@delimiter)+1)
|
269
270
|
|
270
271
|
if cols_names.size != cols.size
|
271
272
|
@logger.warn "\e[32mWARNING!!! On #{table_name} table there is a mismatch on column count[#{cols.size}] versus header count[#{cols_names.size}]\e[0m"
|
data/lib/kpm/base_installer.rb
CHANGED
@@ -222,7 +222,7 @@ module KPM
|
|
222
222
|
classifier = nil
|
223
223
|
|
224
224
|
version = specified_version
|
225
|
-
if version.nil?
|
225
|
+
if version.nil? || version == LATEST_VERSION
|
226
226
|
info = KPM::KillbillServerArtifact.info(kb_version || LATEST_VERSION, @nexus_config, @nexus_ssl_verify)
|
227
227
|
version = info['killbill-platform']
|
228
228
|
end
|
data/lib/kpm/database.rb
CHANGED
@@ -56,7 +56,7 @@ module KPM
|
|
56
56
|
|
57
57
|
def execute_insert_statement(table_name, query, qty_to_insert, table_data, record_id = nil)
|
58
58
|
|
59
|
-
|
59
|
+
unless record_id.nil?
|
60
60
|
query = "set #{record_id[:variable]}=#{record_id[:value]}; #{query}"
|
61
61
|
end
|
62
62
|
query = "SET autocommit=0; #{query} COMMIT;"
|
data/lib/kpm/installer.rb
CHANGED
@@ -51,13 +51,15 @@ module KPM
|
|
51
51
|
latest_stable_version = version if version > latest_stable_version
|
52
52
|
end
|
53
53
|
|
54
|
-
latest_stable_version
|
54
|
+
latest_stable_version.to_s
|
55
55
|
end
|
56
56
|
|
57
57
|
def initialize(raw_config, logger=nil)
|
58
58
|
@config = raw_config['killbill']
|
59
59
|
@kaui_config = raw_config['kaui']
|
60
60
|
|
61
|
+
@config['version'] = KPM::Installer.get_kb_latest_stable_version if !@config.nil? && (@config['version'].nil? || @config['version'] == 'LATEST')
|
62
|
+
|
61
63
|
if logger.nil?
|
62
64
|
logger = Logger.new(STDOUT)
|
63
65
|
logger.level = Logger::INFO
|
data/lib/kpm/utils.rb
CHANGED
@@ -67,7 +67,7 @@ module KPM
|
|
67
67
|
# this will remove SNAPSHOT and any dash that appear before it (ex --SNAPSHOT).
|
68
68
|
name = name.gsub(/((-+){,1}SNAPSHOT){,1}/,'')
|
69
69
|
last_dash = name.rindex('-')
|
70
|
-
name = name[0..last_dash]
|
70
|
+
name = name[0..last_dash] unless last_dash.nil?
|
71
71
|
else
|
72
72
|
name = name.gsub(ver,'')
|
73
73
|
end
|
data/lib/kpm/version.rb
CHANGED
data/pom.xml
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
<groupId>org.kill-bill.billing.installer</groupId>
|
27
27
|
<artifactId>kpm</artifactId>
|
28
28
|
<packaging>pom</packaging>
|
29
|
-
<version>0.6.
|
29
|
+
<version>0.6.4</version>
|
30
30
|
<name>KPM</name>
|
31
31
|
<url>http://github.com/killbill/killbill-cloud</url>
|
32
32
|
<description>KPM: the Kill Bill Package Manager</description>
|
@@ -5,8 +5,6 @@ describe KPM::Account do
|
|
5
5
|
shared_context 'account' do
|
6
6
|
include_context 'connection_setup'
|
7
7
|
|
8
|
-
let(:db_host) {'localhost'}
|
9
|
-
let(:db_port) {'3306'}
|
10
8
|
let(:account_class) { described_class.new(nil,[killbill_api_key,killbill_api_secrets],
|
11
9
|
[killbill_user, killbill_password],url,
|
12
10
|
db_name, [db_username, db_password],db_host,db_port,nil,logger)}
|
@@ -22,7 +20,7 @@ describe KPM::Account do
|
|
22
20
|
let(:cols_data) {dummy_data.split("\n")[1]}
|
23
21
|
let(:table_name) {dummy_data.split("\n")[0].split(" ")[1]}
|
24
22
|
let(:obfuscating_marker) {:email}
|
25
|
-
let(:mysql_cli) {"mysql
|
23
|
+
let(:mysql_cli) {"mysql --user=#{db_username} --password=#{db_password} --host=#{db_host} --port=#{db_port} "}
|
26
24
|
let(:test_ddl) {Dir["#{Dir.pwd}/**/account_test_ddl.sql"][0]}
|
27
25
|
|
28
26
|
end
|
@@ -393,7 +391,7 @@ describe KPM::Account do
|
|
393
391
|
end
|
394
392
|
|
395
393
|
def delete_statement(table_name,column_name,account_id)
|
396
|
-
response = `#{mysql_cli} -e "DELETE FROM #{table_name} WHERE #{column_name} = '#{account_id}'; SELECT ROW_COUNT();" 2>&1`
|
394
|
+
response = `#{mysql_cli} #{db_name} -e "DELETE FROM #{table_name} WHERE #{column_name} = '#{account_id}'; SELECT ROW_COUNT();" 2>&1`
|
397
395
|
response_msg = response.split("\n")
|
398
396
|
row_count_inserted = response_msg[response_msg.size - 1]
|
399
397
|
|
@@ -401,8 +399,8 @@ describe KPM::Account do
|
|
401
399
|
end
|
402
400
|
|
403
401
|
def create_test_schema
|
404
|
-
response =
|
405
|
-
response = `#{mysql_cli} < "#{test_ddl}" 2>&1`
|
402
|
+
response = `#{mysql_cli} -e "CREATE DATABASE IF NOT EXISTS #{db_name};"`
|
403
|
+
response = `#{mysql_cli} #{db_name} < "#{test_ddl}" 2>&1`
|
406
404
|
response_msg = response.split("\n")
|
407
405
|
used_database = response_msg[response_msg.size - 1]
|
408
406
|
|
@@ -410,7 +408,7 @@ describe KPM::Account do
|
|
410
408
|
end
|
411
409
|
|
412
410
|
def drop_test_schema
|
413
|
-
response =
|
411
|
+
response = `#{mysql_cli} -e "DROP DATABASE #{db_name};"`;
|
414
412
|
response
|
415
413
|
end
|
416
414
|
|
data/spec/spec_helper.rb
CHANGED
@@ -30,4 +30,6 @@ shared_context 'connection_setup' do
|
|
30
30
|
let(:db_name) {yml_file['database']['name']}
|
31
31
|
let(:db_username) {yml_file['database']['user']}
|
32
32
|
let(:db_password) {yml_file['database']['password']}
|
33
|
+
let(:db_host) {yml_file['database']['host']}
|
34
|
+
let(:db_port) {yml_file['database']['port']}
|
33
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|