Add network-management version info on startup (#497)

* Add network-management version info on startup

Add version info to manifest file and print it out on network-managemnet
startup
This commit is contained in:
Katarzyna Streich 2018-03-01 17:09:59 +00:00 committed by GitHub
parent 351469b765
commit 8239c5d29f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -79,6 +79,9 @@ dependencies {
// Hibernate audit plugin // Hibernate audit plugin
compile "org.hibernate:hibernate-envers:5.2.11.Final" compile "org.hibernate:hibernate-envers:5.2.11.Final"
// Manifests: for reading stuff from the manifest file
compile "com.jcabi:jcabi-manifests:1.1"
testCompile project(':test-utils') testCompile project(':test-utils')
testCompile project(':node-driver') testCompile project(':node-driver')
@ -109,3 +112,10 @@ dependencies {
compile "org.bouncycastle:bcprov-jdk15on:${bouncycastle_version}" compile "org.bouncycastle:bcprov-jdk15on:${bouncycastle_version}"
compile "org.bouncycastle:bcpkix-jdk15on:${bouncycastle_version}" compile "org.bouncycastle:bcpkix-jdk15on:${bouncycastle_version}"
} }
jar {
classifier "ignore"
manifest {
attributes('Network-Management-Version': version)
}
}

View File

@ -12,6 +12,7 @@ import net.corda.nodeapi.internal.crypto.X509Utilities
import org.bouncycastle.pkcs.PKCS10CertificationRequest import org.bouncycastle.pkcs.PKCS10CertificationRequest
import java.time.Instant import java.time.Instant
import kotlin.concurrent.thread import kotlin.concurrent.thread
import com.jcabi.manifests.Manifests
data class NetworkMapStartParams(val signer: LocalSigner?, val updateNetworkParameters: NetworkParameters?, val config: NetworkMapConfig) data class NetworkMapStartParams(val signer: LocalSigner?, val updateNetworkParameters: NetworkParameters?, val config: NetworkMapConfig)
@ -41,10 +42,17 @@ class ApproveAllCertificateRequestStorage(private val delegate: CertificationReq
} }
} }
private fun logNetworkManagementVersion() {
if (Manifests.exists("Network-Management-Version")) {
println("Network Management Version: ${Manifests.read("Network-Management-Version")}")
}
}
fun main(args: Array<String>) { fun main(args: Array<String>) {
try { try {
parseParameters(*args).run { parseParameters(*args).run {
println("Starting in $mode mode") println("Starting in $mode mode")
logNetworkManagementVersion()
when (mode) { when (mode) {
Mode.ROOT_KEYGEN -> generateRootKeyPair( Mode.ROOT_KEYGEN -> generateRootKeyPair(
rootStorePath ?: throw IllegalArgumentException("The 'rootStorePath' parameter must be specified when generating keys!"), rootStorePath ?: throw IllegalArgumentException("The 'rootStorePath' parameter must be specified when generating keys!"),