Repository: cassandra Updated Branches: refs/heads/trunk 98cf63431 -> d6528a7eb
Clean up string handling in powershell launch, check for JMX_PORT env var Patch by jmckenzie; reviewed by pthompson for CASSANDRA-8423 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6e7a2231 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6e7a2231 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6e7a2231 Branch: refs/heads/trunk Commit: 6e7a22317537ba5026b00374af4e50f055e9c4eb Parents: b7a0cd9 Author: Joshua McKenzie <[email protected]> Authored: Fri Dec 5 14:19:28 2014 -0600 Committer: Joshua McKenzie <[email protected]> Committed: Fri Dec 5 14:19:28 2014 -0600 ---------------------------------------------------------------------- bin/cassandra.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6e7a2231/bin/cassandra.ps1 ---------------------------------------------------------------------- diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1 index 3884fa5..80049ee 100644 --- a/bin/cassandra.ps1 +++ b/bin/cassandra.ps1 @@ -269,6 +269,7 @@ $env:JAVA_BIN WARNING! Failed to write pidfile to $pidfile. stop-server.bat and startup protection will not be available. "@ + echo $_.Exception.Message exit 1 } @@ -292,8 +293,8 @@ Function VerifyPortsAreAvailable $toMatch = @("storage_port:","ssl_storage_port:","native_transport_port:","rpc_port") $yaml = Get-Content "$env:CASSANDRA_CONF\cassandra.yaml" - $listenAddress = "unknown" - $rpcAddress = "unknown" + $listenAddress = "" + $rpcAddress = "" foreach ($line in $yaml) { if ($line -match "^listen_address:") @@ -307,14 +308,14 @@ Function VerifyPortsAreAvailable $rpcAddress = $args[1] -replace " ", "" } } - if ($listenAddress -eq "unknown") + if ([string]::IsNullOrEmpty($listenAddress)) { - echo "Failed to parse listen_address from cassandra.yaml to check open ports. Aborting startup." + Write-Error "Failed to parse listen_address from cassandra.yaml to check open ports. Aborting startup." Exit } - if ($rpcAddress -eq "unknown") + if ([string]::IsNullOrEmpty($rpcAddress)) { - echo "Failed to parse rpc_address from cassandra.yaml to check open ports. Aborting startup." + Write-Error "Failed to parse rpc_address from cassandra.yaml to check open ports. Aborting startup." Exit } @@ -335,6 +336,11 @@ Function VerifyPortsAreAvailable } } } + if ([string]::IsNullOrEmpty($env:JMX_PORT)) + { + Write-Error "No JMX_PORT is set in environment. Aborting startup." + Exit + } CheckPort $listenAddress "jmx_port: $env:JMX_PORT" }
