flydata 0.2.15 → 0.2.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: f6cd04787878b2914745754010d02ec5f9abafae
4
- data.tar.gz: dc7750c6a4cc5d5891cade50d5b3f8d2fd67ad6c
3
+ metadata.gz: d79c609aea9b48dabaf04f5bb1e45d702bb1ccd8
4
+ data.tar.gz: bf30492871ede7150012351b0092af04c273315f
5
5
  SHA512:
6
- metadata.gz: c4dfb4894039ef88f6763a618151a714d3bdc02d7373c35d4ad3791f9f91fd33d959a435e1b4f50dc711ba1587bd8396dcb2b8b5b496e97200c1557cf919634d
7
- data.tar.gz: 661851497f9b3b7e5c842a1e0341e3ce79b9040b2f29d53c229c0bd084e2895fed080be86e00ea4b9212d8c8fce62cfbfecf88078309c68226ea5450f6b17e8e
6
+ metadata.gz: a271b10b00eb8897e51853b74d9ea19cde03f89457dbc38709e9c2a6f889de75680c76f963a67cd3cf2f822f72203d216f59bd60f8e384e9b329b78a2941a89f
7
+ data.tar.gz: d9985f166994b103fff6a10a7e842f67d03aebd4104c3c758ad3b64a8b849993f6ea580502bb7830a9a72caf1bc3029b6afa851684854708d406c61922c38768
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.15
1
+ 0.2.16
data/flydata.gemspec CHANGED
@@ -2,16 +2,14 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: flydata 0.2.15 ruby lib
6
5
 
7
6
  Gem::Specification.new do |s|
8
7
  s.name = "flydata"
9
- s.version = "0.2.15"
8
+ s.version = "0.2.16"
10
9
 
11
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
11
  s.authors = ["Koichi Fujikawa", "Masashi Miyazaki", "Matthew Luu", "Mak Inada", "Sriram NS"]
14
- s.date = "2014-11-18"
12
+ s.date = "2014-11-19"
15
13
  s.description = "FlyData Agent"
16
14
  s.email = "sysadmin@flydata.com"
17
15
  s.executables = ["fdmysqldump", "flydata", "serverinfo"]
@@ -124,7 +122,8 @@ Gem::Specification.new do |s|
124
122
  ]
125
123
  s.homepage = "http://flydata.com/"
126
124
  s.licenses = ["All right reserved."]
127
- s.rubygems_version = "2.2.2"
125
+ s.require_paths = ["lib"]
126
+ s.rubygems_version = "2.0.14"
128
127
  s.summary = "FlyData Agent"
129
128
 
130
129
  if s.respond_to? :specification_version then
@@ -214,7 +214,7 @@ module Flydata
214
214
  puts message unless message.nil? || message.empty?
215
215
  end
216
216
 
217
- DDL_DUMP_CMD_TEMPLATE = "mysqldump --protocol=tcp -d -h %s -P %s -u %s %s %s %s"
217
+ DDL_DUMP_CMD_TEMPLATE = "MYSQL_PWD=\"%s\" mysqldump --protocol=tcp -d -h %s -P %s -u %s %s %s"
218
218
  def do_generate_table_ddl(de)
219
219
  if `which mysqldump`.empty?
220
220
  raise "mysqldump is not installed. mysqldump is required to run the command"
@@ -226,10 +226,10 @@ module Flydata
226
226
 
227
227
  mp = de['mysql_data_entry_preference']
228
228
  params = []
229
+ params << mp['password']
229
230
  if !mp['host'].empty? then params << mp['host'] else raise "MySQL `host` is neither defined in the data entry nor the local config file" end
230
231
  params << (mp['port'] or '3306')
231
232
  if !mp['username'].empty? then params << mp['username'] else raise "MySQL `username` is neither defined in the data entry nor the local config file" end
232
- params << (mp['password'].to_s.empty? ? "" : "-p#{mp['password']}")
233
233
  if !mp['database'].empty? then params << mp['database'] else raise "`database` is neither defined in the data entry nor the local config file" end
234
234
  if !mp['tables'].empty? then params << mp['tables'].gsub(/,/, ' ') else raise "`tables` (or `tables_append_only`) is neither defined in the data entry nor the local config file" end
235
235
 
@@ -110,8 +110,7 @@ module Flydata
110
110
  end
111
111
 
112
112
  def check_mysql_protocol_tcp_compat
113
- query = "mysql -u #{@db_opts[:username]} -h #{@db_opts[:host]} -P #{@db_opts[:port]} #{@db_opts[:database]} -e \"SHOW GRANTS;\" --protocol=tcp"
114
- query << " -p#{@db_opts[:password]}" unless @db_opts[:password].to_s.empty?
113
+ query = "MYSQL_PWD=\"#{@db_opts[:password]}\" mysql -u #{@db_opts[:username]} -h #{@db_opts[:host]} -P #{@db_opts[:port]} #{@db_opts[:database]} -e \"SHOW GRANTS;\" --protocol=tcp"
115
114
 
116
115
  Open3.popen3(query) do |stdin, stdout, stderr|
117
116
  stdin.close
@@ -38,17 +38,16 @@ module Flydata
38
38
 
39
39
  class MysqlDumpGenerator
40
40
  # host, port, username, password, database, tables
41
- MYSQL_DUMP_CMD_TEMPLATE = "mysqldump --protocol=tcp -h %s -P %s -u%s %s --skip-lock-tables --single-transaction --hex-blob %s %s %s"
41
+ MYSQL_DUMP_CMD_TEMPLATE = "MYSQL_PWD=\"%s\" mysqldump --default-character-set=utf8 --protocol=tcp -h %s -P %s -u%s --skip-lock-tables --single-transaction --hex-blob %s %s %s"
42
42
  EXTRA_MYSQLDUMP_PARAMS = ""
43
43
  def initialize(conf)
44
- password = conf['password'].to_s.empty? ? "" : "-p#{conf['password']}"
45
44
  tables = if conf['tables']
46
45
  conf['tables'].split(',').join(' ')
47
46
  else
48
47
  ''
49
48
  end
50
49
  @dump_cmd = MYSQL_DUMP_CMD_TEMPLATE %
51
- [conf['host'], conf['port'], conf['username'], password, self.class::EXTRA_MYSQLDUMP_PARAMS, conf['database'], tables]
50
+ [conf['password'], conf['host'], conf['port'], conf['username'], self.class::EXTRA_MYSQLDUMP_PARAMS, conf['database'], tables]
52
51
  @db_opts = [:host, :port, :username, :password, :database].inject({}) {|h, sym| h[sym] = conf[sym.to_s]; h}
53
52
  end
54
53
  def dump(file_path)
@@ -56,7 +56,7 @@ module Flydata
56
56
  context 'with full options' do
57
57
  it 'issues mysqldump command with expected parameters' do
58
58
  expect(Open3).to receive(:popen3).with(
59
- 'mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi -pwelcome sync_test table1 table2')
59
+ 'MYSQL_PWD="welcome" mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi sync_test table1 table2')
60
60
  subject.send(:do_generate_table_ddl, default_data_entry)
61
61
  end
62
62
  end
@@ -78,7 +78,7 @@ module Flydata
78
78
  end
79
79
  it "uses the default port" do
80
80
  expect(Open3).to receive(:popen3).with(
81
- 'mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi -pwelcome sync_test table1 table2')
81
+ 'MYSQL_PWD="welcome" mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi sync_test table1 table2')
82
82
  subject.send(:do_generate_table_ddl, default_data_entry)
83
83
  end
84
84
  end
@@ -88,7 +88,7 @@ module Flydata
88
88
  end
89
89
  it "uses the specified port" do
90
90
  expect(Open3).to receive(:popen3).with(
91
- 'mysqldump --protocol=tcp -d -h localhost -P 1234 -u masashi -pwelcome sync_test table1 table2')
91
+ 'MYSQL_PWD="welcome" mysqldump --protocol=tcp -d -h localhost -P 1234 -u masashi sync_test table1 table2')
92
92
  subject.send(:do_generate_table_ddl, default_data_entry)
93
93
  end
94
94
  end
@@ -108,9 +108,20 @@ module Flydata
108
108
  before do
109
109
  default_data_entry['mysql_data_entry_preference'].delete('password')
110
110
  end
111
- it "call mysqldump without -p option" do
111
+ it "call mysqldump without MYSQL_PW set" do
112
112
  expect(Open3).to receive(:popen3).with(
113
- 'mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi sync_test table1 table2')
113
+ 'MYSQL_PWD="" mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi sync_test table1 table2')
114
+ subject.send(:do_generate_table_ddl, default_data_entry)
115
+ end
116
+ end
117
+ context 'with password containing symbols' do
118
+ before do
119
+ default_data_entry['mysql_data_entry_preference'].delete('password')
120
+ default_data_entry['mysql_data_entry_preference']['password']="welcome&!@^@#^"
121
+ end
122
+ it "call mysqldump with MYSQL_PW set with correct symbols" do
123
+ expect(Open3).to receive(:popen3).with(
124
+ 'MYSQL_PWD="welcome&!@^@#^" mysqldump --protocol=tcp -d -h localhost -P 3306 -u masashi sync_test table1 table2')
114
125
  subject.send(:do_generate_table_ddl, default_data_entry)
115
126
  end
116
127
  end
@@ -19,7 +19,7 @@ module Flydata
19
19
  describe '#initialize' do
20
20
  context 'with password' do
21
21
  subject { default_dump_generator.instance_variable_get(:@dump_cmd) }
22
- it { is_expected.to eq('mysqldump --protocol=tcp -h localhost -P 3306 -uadmin -ppass --skip-lock-tables ' +
22
+ it { is_expected.to eq('MYSQL_PWD="pass" mysqldump --default-character-set=utf8 --protocol=tcp -h localhost -P 3306 -uadmin --skip-lock-tables ' +
23
23
  '--single-transaction --hex-blob --flush-logs --master-data=2 dev users groups') }
24
24
  end
25
25
  context 'without password' do
@@ -27,7 +27,7 @@ module Flydata
27
27
  MysqlDumpGeneratorMasterData.new(default_conf.merge({'password' => ''}))
28
28
  end
29
29
  subject { dump_generator.instance_variable_get(:@dump_cmd) }
30
- it { is_expected.to eq('mysqldump --protocol=tcp -h localhost -P 3306 -uadmin --skip-lock-tables ' +
30
+ it { is_expected.to eq('MYSQL_PWD="" mysqldump --default-character-set=utf8 --protocol=tcp -h localhost -P 3306 -uadmin --skip-lock-tables ' +
31
31
  '--single-transaction --hex-blob --flush-logs --master-data=2 dev users groups') }
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flydata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Fujikawa
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-11-18 00:00:00.000000000 Z
15
+ date: 2014-11-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rest-client
@@ -524,7 +524,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
524
524
  version: '0'
525
525
  requirements: []
526
526
  rubyforge_project:
527
- rubygems_version: 2.2.2
527
+ rubygems_version: 2.0.14
528
528
  signing_key:
529
529
  specification_version: 4
530
530
  summary: FlyData Agent