Package org.jclouds.cloudstack.domain

Examples of org.jclouds.cloudstack.domain.SshKeyPair


        activity.execute(execution);
        assertKeyPairWasImportedAsExpected();
    }

    private void assertKeyPairWasImportedAsExpected() throws IOException {
        SshKeyPair pair = context.getApi().getSSHKeyPairClient().getSSHKeyPair(KEYPAIR_NAME);
        assertThat(pair.getFingerprint()).isEqualTo(TEST_KEY_FINGERPRINT);
    }
View Full Code Here


    public void execute(CloudStackClient cloudStackClient, Pool pool, DelegateExecution execution) {
        String keyName = KeyPairs.formatNameFromBusinessKey(execution.getProcessBusinessKey());
        LOG.info("Creating admin access key pair as {}", keyName);
        SSHKeyPairClient sshKeyPairClient = cloudStackClient.getSSHKeyPairClient();
        try {
            SshKeyPair sshKeyPair = sshKeyPairClient.registerSSHKeyPair(keyName, pool.getAdminAccess().getPublicKey());
            LOG.info("Registered remote key with fingerprint {}", sshKeyPair.getFingerprint());
        } catch (IllegalStateException e) {
            LOG.warn("Key with name {} already exists", keyName);
            SshKeyPair key = sshKeyPairClient.getSSHKeyPair(keyName);
            if (key.getFingerprint().equals(SshKeys.fingerprintPublicKey(pool.getAdminAccess().getPublicKey()))) {
                LOG.info("Fingerprints match. Not updating admin access key pair.");
            } else {
                LOG.info("Fingerprint do not match. Replacing admin access key pair.");
                sshKeyPairClient.deleteSSHKeyPair(keyName);
                sshKeyPairClient.registerSSHKeyPair(keyName, pool.getAdminAccess().getPublicKey());
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.domain.SshKeyPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.