Skip to content

Commit

Permalink
Merge pull request #16 from vinted/fix/additional_arguments_for_vt_ar…
Browse files Browse the repository at this point in the history
…tefacts

Fix/incompatible command arguments for artifacts
  • Loading branch information
DeathBorn authored Feb 19, 2020
2 parents 4af1bc2 + d231c08 commit 36b18e8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Initial release.
# 4.1.0

- [CHANGE] Added support for 041757f (2020-01-30) release

# 4.2.0

- [CHANGE] Fix incompatible command arguments for artifacts (2020-02-19) release
2 changes: 1 addition & 1 deletion libraries/base_artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BaseArtifact < VitessBaseService

def execute_command
env = vitess_environment
cmd = "#{bin_location} -alsologtostderr=1 #{vt_topo_args} #{new_resource.command}"
cmd = "#{bin_location} -alsologtostderr=1 #{new_resource.command}"
run_once_cache_file = ::File.join(
Chef::Config[:file_cache_path],
"vitess_run_once_#{Digest::MD5.hexdigest(new_resource.command)}"
Expand Down
8 changes: 0 additions & 8 deletions libraries/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,6 @@ def vt_bin_path
@vt_bin_path ||= ::File.join(new_resource.vtroot, 'bin')
end

def vt_topo_args
@vt_topo_args ||= %W(
-topo_implementation #{new_resource.topo_implementation}
-topo_global_server_address #{new_resource.topo_global_server_address}
-topo_global_root #{new_resource.topo_global_root}
).join(' ')
end

def vt_config_path
@vt_config_path ||= ::File.join(new_resource.vtroot, 'config')
end
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
issues_url 'https://github.com/vinted/chef-vitess/issues'
source_url 'https://github.com/vinted/chef-vitess'
chef_version '>= 12.1' if respond_to?(:chef_version)
version '4.1.0'
version '4.2.0'

supports 'redhat'
supports 'centos'
Expand Down
14 changes: 14 additions & 0 deletions test/integration/cookbooks/test-vitess/recipes/cluster.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cell = 'zone1'
topo_cell_root = "/vitess/#{cell}"
topo_implementation = node['vitess']['topo_implementation']
topo_global_server_address = node['vitess']['topo_global_server_address']
topo_global_root = node['vitess']['topo_global_root']
topo_cell_server_address = node['vitess']['topo_global_server_address']
init_keyspace = 'commerce'

Expand All @@ -9,6 +11,9 @@
vtctl_artifact 'AddCellInfo' do
command %W[
-alsologtostderr=1
-topo_implementation #{topo_implementation}
-topo_global_server_address #{topo_global_server_address}
-topo_global_root #{topo_global_root}
AddCellInfo -root #{topo_cell_root} -server_address #{topo_cell_server_address} #{cell}
].join(' ')
end
Expand Down Expand Up @@ -89,6 +94,9 @@
vtctl_artifact 'InitShardMaster' do
command %W[
-alsologtostderr=1
-topo_implementation #{topo_implementation}
-topo_global_server_address #{topo_global_server_address}
-topo_global_root #{topo_global_root}
InitShardMaster -force #{init_keyspace}/0 #{cell}-#{uids.last}
].join(' ')
end
Expand All @@ -107,13 +115,19 @@
vtctl_artifact 'ApplySchema -sql-file' do
command %W[
-alsologtostderr=1
-topo_implementation #{topo_implementation}
-topo_global_server_address #{topo_global_server_address}
-topo_global_root #{topo_global_root}
ApplySchema -sql-file /root/create_commerce_schema.sql #{init_keyspace}
].join(' ')
end

vtctl_artifact 'ApplyVSchema -vschema_file' do
command %W[
-alsologtostderr=1
-topo_implementation #{topo_implementation}
-topo_global_server_address #{topo_global_server_address}
-topo_global_root #{topo_global_root}
ApplyVSchema -vschema_file /root/vschema_commerce_initial.json #{init_keyspace}
].join(' ')
end
Expand Down
6 changes: 5 additions & 1 deletion test/integration/cookbooks/test-vitess/recipes/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

vtctl_shell 'ApplySchema -sql-file' do
command %W[
ApplySchema -sql-file /root/create_commerce_schema.sql #{init_keyspace}
ApplySchema
-topo_implementation #{node['vitess']['topo_implementation']}
-topo_global_server_address #{node['vitess']['topo_global_server_address']}
-topo_global_root #{node['vitess']['topo_global_root']}
-sql-file /root/create_commerce_schema.sql #{init_keyspace}
].join(' ')
environment 'KITCHEN' => 1
file_prefix 'ApplySchema'
Expand Down

0 comments on commit 36b18e8

Please sign in to comment.