Examples of RunScriptOptions


Examples of org.jclouds.compute.options.RunScriptOptions

   private void executeSimpleCommand(
         final NodeMetadata instance, final String googleUserName, final String sshPrivateKey) {
      Statement script = Statements.exec("ls -l /");

      // Set up credentials.
      RunScriptOptions options = overrideLoginCredentials((new LoginCredentials.Builder())
            .user(googleUserName)
            .privateKey(sshPrivateKey)
            .build())
          .blockOnComplete(true)
          .runAsRoot(false);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      String script = new ScriptBuilder()
            .addStatement(exec("sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config"))
            .addStatement(exec("service ssh restart"))
            .render(OsFamily.UNIX);

      RunScriptOptions options = RunScriptOptions.Builder
            .blockOnPort(22, 10)
            .blockOnComplete(true);

      computeService.runScriptOnNode(node.getId(), script, options);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

               .addStatement(exec("apt-get -q -y update"))
               .addStatement(exec("apt-get -q -y install apache2"))
               .addStatement(exec("echo '" + message + "' > /var/www/index.html"))
               .render(OsFamily.UNIX);

         RunScriptOptions options = RunScriptOptions.Builder.blockOnComplete(true);

         computeService.runScriptOnNode(nodeMetadata.getId(), script, options);

         System.out.format("    Login: ssh %s@%s%n", nodeMetadata.getCredentials().getUser(), publicAddress);
         System.out.format("    Password: %s%n", nodeMetadata.getCredentials().getOptionalPassword().get());
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      String script = new ScriptBuilder()
            .addStatement(exec("mkfs -t ext4 /dev/xvdd"))
            .addStatement(exec("mount /dev/xvdd /mnt"))
            .render(OsFamily.UNIX);

      RunScriptOptions options = RunScriptOptions.Builder
            .blockOnComplete(true)
            .overrideLoginPassword(PASSWORD);

      ExecResponse response = computeService.runScriptOnNode(node.getId(), script, options);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

   private void unmountVolume(VolumeAttachment volumeAttachment) {
      System.out.format("Unmount Volume%n");

      String script = new ScriptBuilder().addStatement(exec("umount /mnt")).render(OsFamily.UNIX);

      RunScriptOptions options = RunScriptOptions.Builder
            .overrideLoginUser(ROOT)
            .overrideLoginPassword(PASSWORD)
            .blockOnComplete(true);

      ZoneAndId zoneAndId = ZoneAndId.fromZoneAndId(ZONE, volumeAttachment.getServerId());
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      replay(sshClient);

      RunScriptOnNodeAsInitScriptUsingSsh testMe = new RunScriptOnNodeAsInitScriptUsingSsh(Functions
               .forMap(ImmutableMap.of(node, sshClient)), eventBus, InitScriptConfigurationForTasks.create()
               .appendIncrementingNumberToAnonymousTaskNames(), node, command, new RunScriptOptions());

      testMe.call();
   }
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      sshClient.disconnect();
      replay(sshClient);

      RunScriptOnNodeAsInitScriptUsingSsh testMe = new RunScriptOnNodeAsInitScriptUsingSsh(Functions
               .forMap(ImmutableMap.of(node, sshClient)), eventBus, InitScriptConfigurationForTasks.create()
               .appendIncrementingNumberToAnonymousTaskNames(), node, command, new RunScriptOptions());

      assertEquals(testMe.getInitFile(), "/tmp/init-jclouds-script-0");
      assertEquals(testMe.getNode(), node);
      assertEquals(testMe.getStatement(), init);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      sshClient.disconnect();
      replay(sshClient);

      RunScriptOnNodeAsInitScriptUsingSsh testMe = new RunScriptOnNodeAsInitScriptUsingSsh(Functions
               .forMap(ImmutableMap.of(node, sshClient)), eventBus, InitScriptConfigurationForTasks.create()
               .appendIncrementingNumberToAnonymousTaskNames(), node, command, new RunScriptOptions());

      assertEquals(testMe.getInitFile(), "/tmp/init-jclouds-script-0");
      assertEquals(testMe.getNode(), node);
      assertEquals(testMe.getStatement(), init);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      sshClient.disconnect();
      replay(sshClient);

      RunScriptOnNodeAsInitScriptUsingSsh testMe = new RunScriptOnNodeAsInitScriptUsingSsh(Functions
               .forMap(ImmutableMap.of(node, sshClient)), eventBus, InitScriptConfigurationForTasks.create()
               .appendIncrementingNumberToAnonymousTaskNames(), node, command, new RunScriptOptions().runAsRoot(false));

      assertEquals(testMe.getInitFile(), "/tmp/init-jclouds-script-0");
      assertEquals(testMe.getNode(), node);
      assertEquals(testMe.getStatement(), init);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

@Singleton
public class DefaultCredentialsFromImageOrOverridingCredentials implements Function<Template, LoginCredentials> {

   @Override
   public LoginCredentials apply(Template template) {
      RunScriptOptions options = template.getOptions();
      LoginCredentials defaultCreds = template.getImage().getDefaultCredentials();
      return overrideDefaultCredentialsWithOptionsIfPresent(defaultCreds, options);
   }
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.