Add config property to enable/disable logging of the command result.
Now command result logs aren't printed by default.
Issue-ID: CCSDK-2693
Signed-off-by: Julien Fontaine <julien.fontaine@bell.ca>
Change-Id: I5107ed6acc150875264a65bf1c64962ff26cfd78
/*
* Copyright © 2019 IBM.
*
+ * Modifications Copyright © 2020 IBM, Bell Canada.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
lateinit var host: String
var port: Int = 22
var connectionTimeOut: Long = 3000
+ var logging: Boolean = false // print command result in cds logs
}
open class BasicAuthSshClientProperties : SshClientProperties() {
/*
* Copyright © 2018-2019 AT&T Intellectual Property.
*
+ * Modifications Copyright © 2020 Bell Canada.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
fun host(host: String) = host(host.asJsonPrimitive())
fun host(host: JsonNode) = property(SshClientProperties::host.name, host)
+
+ fun logging(logging: Boolean) = logging(logging.asJsonPrimitive())
+
+ fun logging(logging: JsonNode) = property(SshClientProperties::logging.name, logging)
}
class BasicAuthSshClientPropertiesAssignmentBuilder : SshClientPropertiesAssignmentBuilder() {
/*
* Copyright © 2019 IBM.
*
- * Modifications Copyright © 2018-2019 IBM, Bell Canada
+ * Modifications Copyright © 2018-2020 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
val commandResult = CommandResult(command, deviceOutput, isSuccessful)
- log.info("Command Response: ({}) $newLine", commandResult)
+ if (basicAuthSshClientProperties.logging) {
+ log.info("Command Response: ({}) $newLine", commandResult)
+ }
return commandResult
}