Merging master into branch.

This commit is contained in:
Renan DelValle 2018-06-22 11:45:43 -07:00
commit 2f88701c9c
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
4 changed files with 27 additions and 4 deletions

View file

@ -1,11 +1,14 @@
<!--
-----------------------------------------
## Please read instructions below ##
Before submitting, please make sure you run a vagrant box running Aurora with the latest version shown in .auroraversion and run go test from the project root.
To run an Aurora Vagrant image, follow the instructions here:
http://aurora.apache.org/documentation/latest/getting-started/vagrant/
## Answer the following questions: ##
-->
* Have you run goformat on the project before submitting?
* Have you run go test on the project before submitting? Do all tests pass?

View file

@ -12,8 +12,10 @@ library has been tested.
* [Using the sample client](docs/using-the-sample-client.md)
* [Leveraging the library](docs/leveraging-the-library.md)
## To Do
* Create or import a custom transport that uses https://github.com/jmcvetta/napping to improve efficiency
## Projects using gorealis
* [australis](https://github.com/rdelval/australis)
## Contributions
Contributions are always welcome. Please raise an issue so that the contribution may be discussed before it's made.
Contributions are always welcome. Please raise an issue to discuss a contribution before it is made.

View file

@ -30,6 +30,8 @@ import (
)
var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string
var caCertsPath string
var clientKey, clientCert string
var CONNECTION_TIMEOUT = 20000
@ -45,6 +47,9 @@ func init() {
flag.StringVar(&zkUrl, "zkurl", "", "zookeeper url")
flag.StringVar(&hostList, "hostList", "", "Comma separated list of hosts to operate on")
flag.StringVar(&role, "role", "", "owner role to use")
flag.StringVar(&caCertsPath, "caCertsPath", "", "Path to CA certs on local machine.")
flag.StringVar(&clientCert, "clientCert", "", "Client certificate to use to connect to Aurora.")
flag.StringVar(&clientKey, "clientKey", "", "Client private key to use to connect to Aurora.")
flag.Parse()
@ -100,6 +105,14 @@ func main() {
clientOptions = append(clientOptions, realis.SchedulerUrl(url))
}
if caCertsPath != "" {
clientOptions = append(clientOptions, realis.Certspath(caCertsPath))
}
if clientKey != "" && clientCert != "" {
clientOptions = append(clientOptions, realis.ClientCerts(clientKey, clientCert))
}
r, err = realis.NewRealisClient(clientOptions...)
if err != nil {
fmt.Println(err)

View file

@ -266,6 +266,11 @@ func NewRealisClient(options ...ClientOption) (Realis, error) {
config.logger.Println("Number of options applied to config: ", len(options))
// Set a logger if debug has been set to true but no logger has been set
if config.logger == nil && config.debug {
config.logger = log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)
}
//Set default Transport to JSON if needed.
if !config.jsonTransport && !config.binTransport {
config.jsonTransport = true