Examples of SshKey


Examples of org.platformlayer.ops.helpers.SshKey

        // File publicKeyFile = new File(adminSshDir, "id_rsa.pub");
        // File authorizedKeys = new File(adminSshDir, "authorized_keys");

        String privateKeyData = rootTarget.readTextFile(privateKeyFile);

        SshKey adminSshKey = new SshKey(null, adminUser, KeyPairUtils.deserialize(privateKeyData));

        return machine.getTarget(adminSshKey);
    }
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

                log.warn("Server instance not found: " + gitServer);
                failed = true;
                continue;
            }

            SshKey sshKey = service.getSshKey();
            OpsTarget rootTarget = machine.getTarget(sshKey);

            OpsTarget adminTarget = getAdminTarget(rootTarget, machine);
            doOperation(adminTarget, operation);
        }
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

    }

    public void doOperation(Managed<MemcachedService> managed) throws OpsException, IOException {
        String key = managed.getConductorId();

        SshKey sshKey = service.getSshKey();

        Tag tag = new Tag(Tag.CONDUCTOR_ID, key);

        DiskImageRecipe recipe = imageFactory.loadDiskImageResource(getClass(), "DiskImageRecipe.xml");
        String securityGroup = service.getSecurityGroupName();

        // TODO: This needs to be configurable. Use tags?
        int minimumMemoryMb = 2048;
        Managed<PersistentInstance> foundPersistentInstance = persistentInstances.getOrCreate(tag, recipe, managed.getModel().dnsName, sshKey.getName(), securityGroup, minimumMemoryMb);

        OpenstackComputeMachine machine = persistentInstances.getMachine(foundPersistentInstance);
        // KeyPair sshKey = sshKeys.getOrCreate(sshKeyName);
        // OpsTarget target = machine.getTarget(sshKey);
        //
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

  ServiceContext service;

  @Handler
  public void handler(RawTarget rawTarget) throws OpsException, IOException {
    OpaqueMachine machine = new OpaqueMachine(NetworkPoint.forPublicHostname(rawTarget.host));
    SshKey serviceSshKey = service.getSshKey();
    OpsTarget target = machine.getTarget(serviceSshKey);

    // TODO: We have a bootstrapping problem here!!
    PublicKey sshPublicKey = service.getSshKey().getKeyPair().getPublic();
    SshAuthorizedKey.ensureSshAuthorization(target, "root", sshPublicKey);
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

      } else {
        server = computeClient.ensureHasPublicIp(server);

        machine = new GoogleComputeMachine(computeClient, cloud, server);

        SshKey sshKey = service.getSshKey();
        target = machine.getTarget(GoogleComputeClient.USER_NAME, sshKey.getKeyPair());

        // We need to use sudo while we set up root access
        ((SshOpsTarget) target).setEnsureRunningAsRoot(true);
      }
    }
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

      // DNS service!)
      PlatformLayerKey machineKey = machine.getKey();
      platformLayer.addTag(item.getKey(), Tag.INSTANCE_KEY.build(machineKey));
    }

    SshKey sshKey = service.getSshKey();
    if (machine != null) {
      if (OpsContext.isDelete()) {
        target = null;
        machine = null;
      } else {
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

    recursion.pushChildScope(InstanceBase.class, instance);
    recursion.pushChildScope(OpsTarget.class, target);
  }

  private PersistentInstance buildPersistentInstanceTemplate() throws OpsException {
    SshKey sshKey = service.getSshKey();
    String securityGroup = service.getSecurityGroupName();
    DiskImageRecipe recipeTemplate = diskImageRecipe.get();
    if (recipeTemplate.getKey() == null) {
      // TODO: Something nicer than a UUID
      String recipeId = UUID.randomUUID().toString();
      recipeTemplate.setKey(PlatformLayerKey.fromId(recipeId));
    }

    DiskImageRecipe recipe = imageFactory.getOrCreateRecipe(recipeTemplate);

    PersistentInstance persistentInstanceTemplate = new PersistentInstance();

    persistentInstanceTemplate.setDnsName(dnsName);
    persistentInstanceTemplate.setSshPublicKey(SshKeys.serialize(sshKey.getKeyPair().getPublic()));
    persistentInstanceTemplate.setSecurityGroup(securityGroup);
    persistentInstanceTemplate.setMinimumRam(minimumMemoryMb);
    persistentInstanceTemplate.setCloud(cloud);
    persistentInstanceTemplate.setHostPolicy(hostPolicy);
    persistentInstanceTemplate.setRecipe(recipe.getKey());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.