Package org.jclouds.scriptbuilder.domain

Examples of org.jclouds.scriptbuilder.domain.StatementList


            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 (updateExistingGems) {
         statements.add(exec("gem update --no-rdoc --no-ri"));
      }

      return new StatementList(statements.build()).render(family);
   }
View Full Code Here

      }

      String strOptions = Joiner.on(' ').withKeyValueSeparator(" ").join(options.build());
      statements.add(Statements.exec(String.format("chef-solo %s", strOptions)));

      return new StatementList(statements.build()).render(family);
   }
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

      statements.add(exec("{md} " + sshDir));
      String idRsa = sshDir + "{fs}id_rsa";
      statements.add(exec("{rm} " + idRsa));
      statements.add(appendFile(idRsa, Splitter.on('\n').split(privateKey)));
      statements.add(exec("chmod 600 " + idRsa));
      return new StatementList(statements.build()).render(family);
   }
View Full Code Here

      Builder<Statement> statements = ImmutableList.builder();
      statements.add(exec("mkdir -p " + sshDir));
      String authorizedKeys = sshDir + "{fs}authorized_keys";
      statements.add(appendFile(authorizedKeys, Splitter.on('\n').split(Joiner.on("\n\n").join(publicKeys))));
      statements.add(exec("chmod 600 " + authorizedKeys));
      return new StatementList(statements.build()).render(family);
   }
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

      /**
       * @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.