From 40e3825af21322d216c6a365eff2140b933bd30f Mon Sep 17 00:00:00 2001 From: Rob Szkutak Date: Fri, 19 Aug 2016 21:34:46 -0500 Subject: [PATCH] Fix custom username and password selection for edge case. Add support for mlcp and corb user properly --- deploy/default.properties | 12 +++++++++- deploy/lib/server_config.rb | 44 ++++++++++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/deploy/default.properties b/deploy/default.properties index 319d950e..e51b41ee 100755 --- a/deploy/default.properties +++ b/deploy/default.properties @@ -67,13 +67,23 @@ password=admin # bootstrap-user= # bootstrap-password= - # # Username/password used for deployment operations if specified # # deploy-user= # deploy-password= +# +# Username/password used for mlcp if specified +# +# mlcp-user= +# mlcp-password= + +# +# Username/password used for corb if specified +# +# corb-user= +# corb-password= # # Your Application's name diff --git a/deploy/lib/server_config.rb b/deploy/lib/server_config.rb index b3aa81b0..f5b481a0 100644 --- a/deploy/lib/server_config.rb +++ b/deploy/lib/server_config.rb @@ -517,7 +517,11 @@ def execute_query(query, properties = {}) def restart @ml_username = @properties['ml.bootstrap-user'] || @properties['ml.user'] - @ml_password = @properties['ml.bootstrap-password'] || @properties['ml.password'] + if @ml_username == @properties['ml.bootstrap-user'] + @ml_password = @properties['ml.bootstrap-password'] + else + @ml_password = @properties['ml.password'] + end group = nil ARGV.each do |arg| @@ -635,7 +639,11 @@ def bootstrap raise ExitException.new("Bootstrap requires the target environment's hostname to be defined") unless @hostname.present? @ml_username = @properties['ml.bootstrap-user'] || @properties['ml.user'] - @ml_password = @properties['ml.bootstrap-password'] || @properties['ml.password'] + if @ml_username == @properties['ml.bootstrap-user'] + @ml_password = @properties['ml.bootstrap-password'] + else + @ml_password = @properties['ml.password'] + end internals = find_arg(['--replicate-internals']) if internals @@ -736,7 +744,11 @@ def bootstrap def wipe @ml_username = @properties['ml.bootstrap-user'] || @properties['ml.user'] - @ml_password = @properties['ml.bootstrap-password'] || @properties['ml.password'] + if @ml_username == @properties['ml.bootstrap-user'] + @ml_password = @properties['ml.bootstrap-password'] + else + @ml_password = @properties['ml.password'] + end if @environment != "local" expected_response = %Q{I WANT TO WIPE #{@environment.upcase}} @@ -928,7 +940,11 @@ def validate_install def deploy @ml_username = @properties['ml.deploy-user'] || @properties['ml.user'] - @ml_password = @properties['ml.deploy-password'] || @properties['ml.password'] + if @ml_username == @properties['ml.deploy-user'] + @ml_password = @properties['ml.deploy-password'] + else + @ml_password = @properties['ml.password'] + end what = ARGV.shift raise HelpException.new("deploy", "Missing WHAT") unless what @@ -1148,6 +1164,13 @@ def xqsync end def corb + @ml_username = @properties['ml.corb-user'] || @properties['ml.user'] + if @ml_username == @properties['ml.corb-user'] + @ml_password = @properties['ml.corb-password'] + else + @ml_password = @properties['ml.password'] + end + password_prompt encoded_password = url_encode(@ml_password) connection_string = %Q{xcc://#{@properties['ml.user']}:#{encoded_password}@#{@properties['ml.server']}:#{@properties['ml.xcc-port']}/#{@properties['ml.content-db']}} @@ -1239,7 +1262,12 @@ def mlcp end @ml_username = @properties['ml.mlcp-user'] || @properties['ml.user'] - @ml_password = @properties['ml.mlcp-password'] || @ml_password + if @ml_username == @properties['ml.mlcp-user'] + @ml_password = @properties['ml.mlcp-password'] + else + @ml_password = @properties['ml.password'] + end + if ARGV.length > 0 password_prompt connection_string = %Q{ -username #{@ml_username} -password #{@ml_password} -host #{@properties['ml.server']} -port #{@properties['ml.xcc-port']}} @@ -1413,7 +1441,11 @@ def settings def deploy_triggers @ml_username = @properties['ml.deploy-user'] || @properties['ml.user'] - @ml_password = @properties['ml.deploy-password'] || @properties['ml.password'] + if @ml_username == @properties['ml.deploy-user'] + @ml_password = @properties['ml.deploy-password'] + else + @ml_password = @properties['ml.password'] + end logger.info "Deploying Triggers" if !@properties["ml.triggers-db"]