From f1ca77023bf3fc98df26214d32360136b196e464 Mon Sep 17 00:00:00 2001 From: Tomas Cere Date: Wed, 3 Jun 2015 16:22:00 +0200 Subject: [PATCH] Remove commons-io dependency in netconf-ssh Remove the replacement of File separators in key path, windows can handle linux style paths, added a warning to config to use linux style paths. Change-Id: I01d07fa65cd11dcc321cbf4d6f5aac0792922309 Signed-off-by: Tomas Cere --- .../src/main/resources/etc/custom.properties | 1 + opendaylight/netconf/netconf-ssh/pom.xml | 4 ---- .../controller/netconf/ssh/osgi/NetconfSSHActivator.java | 6 +++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/karaf/opendaylight-karaf-resources/src/main/resources/etc/custom.properties b/karaf/opendaylight-karaf-resources/src/main/resources/etc/custom.properties index ab16bf8621..a21e20ee03 100644 --- a/karaf/opendaylight-karaf-resources/src/main/resources/etc/custom.properties +++ b/karaf/opendaylight-karaf-resources/src/main/resources/etc/custom.properties @@ -22,6 +22,7 @@ netconf.tcp.client.port=8383 netconf.ssh.address=0.0.0.0 netconf.ssh.port=1830 +# Use Linux style path netconf.ssh.pk.path = ./configuration/RSA.pk # Set security provider to BouncyCastle org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider diff --git a/opendaylight/netconf/netconf-ssh/pom.xml b/opendaylight/netconf/netconf-ssh/pom.xml index 6ee17e6cad..6bf305e7e4 100644 --- a/opendaylight/netconf/netconf-ssh/pom.xml +++ b/opendaylight/netconf/netconf-ssh/pom.xml @@ -27,10 +27,6 @@ ${project.groupId} netconf-impl - - - commons-io - commons-io org.opendaylight.controller diff --git a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java index 23c92e8648..fa87b73fad 100644 --- a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java +++ b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java @@ -19,7 +19,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; -import org.apache.commons.io.FilenameUtils; import org.apache.sshd.common.util.ThreadUtils; import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider; import org.opendaylight.controller.netconf.ssh.SshProxyServer; @@ -85,7 +84,7 @@ public class NetconfSSHActivator implements BundleActivator { private SshProxyServer startSSHServer(final BundleContext bundleContext) throws IOException { final Optional maybeSshSocketAddress = NetconfConfigUtil.extractNetconfServerAddress(bundleContext, InfixProp.ssh); - if (maybeSshSocketAddress.isPresent() == false) { + if (!maybeSshSocketAddress.isPresent()) { LOG.trace("SSH bridge not configured"); return null; } @@ -97,7 +96,8 @@ public class NetconfSSHActivator implements BundleActivator { authProviderTracker = new AuthProviderTracker(bundleContext); - final String path = FilenameUtils.separatorsToSystem(NetconfConfigUtil.getPrivateKeyPath(bundleContext)); + final String path = NetconfConfigUtil.getPrivateKeyPath(bundleContext); + checkState(!Strings.isNullOrEmpty(path), "Path to ssh private key is blank. Reconfigure %s", NetconfConfigUtil.getPrivateKeyKey()); -- 2.36.6