Package org.jclouds.scriptbuilder.domain

Examples of org.jclouds.scriptbuilder.domain.StatementList


      TemplateOptionsToStatementWithoutPublicKey function = new TemplateOptionsToStatementWithoutPublicKey();
      Statement statement = function.apply(options);

      assertTrue(statement instanceof StatementList);
      StatementList statements = (StatementList) statement;

      assertEquals(statements.size(), 2);
      assertEquals(statements.get(0).render(OsFamily.UNIX), "uptime\n");
      assertTrue(statements.get(1) instanceof InstallRSAPrivateKey);
   }
View Full Code Here


            .updateExistingGems(bootstrapProperties.updateGems()) //
            .build();

      Statement installChef = InstallChefGems.builder().version(bootstrapProperties.chefVersion().orNull()).build();

      return new StatementList(InstallRuby.builder().build(), installRubyGems, installChef);
   }
View Full Code Here

      ImmutableList<Statement> bootstrap = builder.build();
      if (!bootstrap.isEmpty()) {
         if (options.getTaskName() == null && !(options.getRunScript() instanceof InitScript)) {
            options.nameTask("bootstrap");
         }
         return bootstrap.size() == 1 ? bootstrap.get(0) : new StatementList(bootstrap);
      }

      return null;
   }
View Full Code Here

      if (family == OsFamily.WINDOWS)
         throw new UnsupportedOperationException("windows not yet implemented");
      Builder<Statement> statements = ImmutableList.builder();
      statements.add(createOrOverwriteFile(sudoers, ImmutableSet.of("root ALL = (ALL) ALL", "%wheel ALL = (ALL) NOPASSWD:ALL")));
      statements.add(exec("chmod 0440 " + sudoers));
      return new StatementList(statements.build()).render(family);
   }
View Full Code Here

            statements.add(new AuthorizeRSAPublicKeys(sshDir, authorizeRSAPublicKeys));
         if (installRSAPrivateKey != null)
            statements.add(new InstallRSAPrivateKey(sshDir, installRSAPrivateKey));
      }
      statements.add(Statements.exec(String.format("chown -R %s %s", login, homeDir)));
      return new StatementList(statements.build()).render(family);
   }
View Full Code Here

         // the sha512 line breaks in both awk and sed during an inline
         // expansion. unfortunately, we have to save a temp file. In this case,
         // somewhat avoiding collisions by naming the file .user, conceding it
         // isn't using any locks to prevent overlapping changes
         Statement replaceShadowFile = exec(format("test -f %2$s.%1$s && mv %2$s.%1$s %2$s", login, shadowFile));
         return new StatementList(ImmutableList.of(replaceEntryInTempFile, replaceShadowFile)).render(family);
      } catch (Exception e) {
         propagate(e);
         return null;
      }
   }
View Full Code Here

      if (config.shouldLockSsh())
         statements.add(lockSshd());
      if (config.shouldResetLoginPassword()) {
         statements.add(resetLoginUserPasswordTo(config.getCryptFunction(), config.getLoginPassword()));
      }
      return new StatementList(statements.build()).render(family);
   }
View Full Code Here

                            .cookbookPath("/var/chef/cookbooks") //
                            .runlist(RunList.builder().recipes(recipeList).build()) //
                            .build());

                    // Build the statement that will perform all the operations above
                    StatementList bootstrap = new StatementList(bootstrapBuilder.build());

                    // Run the script in the nodes of the group
                    runScriptOnGroup(compute, login, groupName, bootstrap);
                    break;
                case CHEF:
View Full Code Here

   public static ScriptBuilder makeInitScriptStatement(String instanceName, String instanceHome, String logDir,
         Map<String, String> exports, StatementList init, StatementList run) {
      Map<String, String> defaultExports = ImmutableMap.of("INSTANCE_NAME", instanceName, "INSTANCE_HOME", instanceHome,
            "LOG_DIR", logDir);
      String exitStatusFile = format("%s/rc", logDir);
      run = new StatementList(ImmutableList.<Statement> builder().add(interpret("rm -f " + exitStatusFile))
            .add(interpret(format("trap 'echo $?>%s' 0 1 2 3 15", exitStatusFile))).addAll(run.delegate()).build());

      CreateRunScript createRunScript = createRunScript(instanceName,
            concat(exports.keySet(), defaultExports.keySet()), "{varl}INSTANCE_HOME{varr}", run);
View Full Code Here

      /**
       * @see InitScript#getRun()
       */
      public Builder run(Statement run) {
         this.run = new StatementList(checkNotNull(run, "run"));
         return this;
      }
View Full Code Here

TOP

Related Classes of org.jclouds.scriptbuilder.domain.StatementList

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.