aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Fontaine <julien.fontaine@bell.ca>2020-08-25 16:12:24 -0400
committerJulien Fontaine <julien.fontaine@bell.ca>2020-08-25 16:12:24 -0400
commite0da7c94aedc038c76d17c1d4a904c7b12ba3c5b (patch)
tree29b9ef43958e1566f31223c1508857c42aaa6b71
parenta6defbafb46a5db6b3bf633d1a9c32f503060f55 (diff)
CommandResult info appears in CDS logs by default
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
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt6
3 files changed, 13 insertions, 2 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
index c7d5105b4..cc323adb3 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
@@ -1,6 +1,8 @@
/*
* 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
@@ -21,6 +23,7 @@ open class SshClientProperties {
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() {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt
index ee7a7dead..a7702d4fb 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/SshPropertiesDSL.kt
@@ -1,6 +1,8 @@
/*
* 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
@@ -94,6 +96,10 @@ open class SshClientPropertiesAssignmentBuilder : PropertiesAssignmentBuilder()
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() {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
index 2885d6528..a3c730039 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
@@ -1,7 +1,7 @@
/*
* 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.
@@ -118,7 +118,9 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
}
val commandResult = CommandResult(command, deviceOutput, isSuccessful)
- log.info("Command Response: ({}) $newLine", commandResult)
+ if (basicAuthSshClientProperties.logging) {
+ log.info("Command Response: ({}) $newLine", commandResult)
+ }
return commandResult
}