Tabnine Logo
SshEffectorTasks.put
Code IndexAdd Tabnine to your IDE (free)

How to use
put
method
in
org.apache.brooklyn.core.effector.ssh.SshEffectorTasks

Best Java code snippets using org.apache.brooklyn.core.effector.ssh.SshEffectorTasks.put (Showing top 8 results out of 315)

origin: org.apache.brooklyn/brooklyn-software-base

  public static TaskFactory<?> buildChefFile(String runDirectory, String chefDirectory, String phase, Iterable<? extends String> runList,
      Map<String, Object> optionalAttributes) {
    // TODO if it's server, try knife first
    // TODO configure add'l properties
    String phaseRb = 
      "root = "
      + "'"+runDirectory+"'" 
      // recommended alternate to runDir is the following, but it is not available in some rubies
      //+ File.absolute_path(File.dirname(__FILE__))"+
      + "\n"+
      "file_cache_path root\n"+
//            "cookbook_path root + '/cookbooks'\n";
      "cookbook_path '"+chefDirectory+"'\n";

    Map<String,Object> phaseJsonMap = MutableMap.of();
    if (optionalAttributes!=null)
      phaseJsonMap.putAll(optionalAttributes);
    if (runList!=null)
      phaseJsonMap.put("run_list", ImmutableList.copyOf(runList));
    Gson json = new GsonBuilder().create();
    String phaseJson = json.toJson(phaseJsonMap);

    return Tasks.sequential("build chef files for "+phase,
          SshEffectorTasks.put(Urls.mergePaths(runDirectory)+"/"+phase+".rb").contents(phaseRb).createDirectory(),
          SshEffectorTasks.put(Urls.mergePaths(runDirectory)+"/"+phase+".json").contents(phaseJson));
  }

origin: org.apache.brooklyn/brooklyn-software-cm-chef

  public static TaskFactory<?> buildChefFile(String runDirectory, String chefDirectory, String phase, Iterable<? extends String> runList,
      Map<String, Object> optionalAttributes) {
    // TODO if it's server, try knife first
    // TODO configure add'l properties
    String phaseRb = 
      "root = "
      + "'"+runDirectory+"'" 
      // recommended alternate to runDir is the following, but it is not available in some rubies
      //+ File.absolute_path(File.dirname(__FILE__))"+
      + "\n"+
      "file_cache_path root\n"+
//            "cookbook_path root + '/cookbooks'\n";
      "cookbook_path '"+chefDirectory+"'\n";

    Map<String,Object> phaseJsonMap = MutableMap.of();
    if (optionalAttributes!=null)
      phaseJsonMap.putAll(optionalAttributes);
    if (runList!=null)
      phaseJsonMap.put("run_list", ImmutableList.copyOf(runList));
    Gson json = new GsonBuilder().create();
    String phaseJson = json.toJson(phaseJsonMap);

    return Tasks.sequential("build chef files for "+phase,
          SshEffectorTasks.put(Urls.mergePaths(runDirectory)+"/"+phase+".rb").contents(phaseRb).createDirectory(),
          SshEffectorTasks.put(Urls.mergePaths(runDirectory)+"/"+phase+".json").contents(phaseJson));
  }

origin: org.apache.brooklyn/brooklyn-core

@Test(groups="Integration")
public void testSshPut() throws IOException {
  String fn = Urls.mergePaths(tempDir.getPath(), "f1");
  SshPutTaskWrapper t = submit(SshEffectorTasks.put(fn).contents("hello world"));
  t.block();
  Assert.assertEquals(FileUtils.readFileToString(new File(fn)), "hello world");
  // and make sure this doesn't throw
  Assert.assertTrue(t.isDone());
  Assert.assertTrue(t.isSuccessful());
  Assert.assertEquals(t.get(), null);
  Assert.assertEquals(t.getExitCode(), (Integer)0);
}
origin: org.apache.brooklyn/brooklyn-software-database

@Override
public ProcessTaskWrapper<Integer> executeScriptAsync(String commands) {
  String filename = "mariadb-commands-"+Identifiers.makeRandomId(8);
  DynamicTasks.queue(SshEffectorTasks.put(Urls.mergePaths(getRunDir(), filename)).contents(commands).summary("copying datastore script to execute "+filename));
  return executeScriptFromInstalledFileAsync(filename);
}
origin: io.brooklyn.ambari/brooklyn-ambari

@Override
public void customizeService() {
  DynamicTasks.queue(
      SshEffectorTasks.put("/tmp/" + getServiceScriptFileName())
              .contents(TemplateProcessor.processTemplateContents(
                  ResourceUtils.create().getResourceAsString(config().get(CustomService.SERVICE_SCRIPT_TEMPLATE_URL)),
                  this,
                  ImmutableMap.<String,String>of())),
      SshEffectorTasks.put("/tmp/" + getMetaInfoXmlFileName())
              .contents(TemplateProcessor.processTemplateContents(
                  ResourceUtils.create().getResourceAsString(config().get(CustomService.SERVICE_METAINFO_TEMPLATE_URL)),
                  this,
                  ImmutableMap.<String,String>of())),
      SshEffectorTasks.ssh(
          sudo(format("mkdir -p %s", getServiceDirectory())),
          sudo(format("mv /tmp/%s %s", getMetaInfoXmlFileName(), getServiceDirectory())),
          sudo(format("mkdir -p %s", getServiceScriptDirectory())),
          sudo(format("mv /tmp/%s %s/",getServiceScriptFileName(), getServiceScriptDirectory())),
          sudo(format("mkdir -p %s", getServiceConfigDirectory()))));
  Map<String, ?> serviceConf = getConfig(CustomService.CUSTOM_SERVICE_CONF);
  for (Entry<String, ?> entry: serviceConf.entrySet()) {
    DynamicTasks.queue(
        SshEffectorTasks.put("/tmp/" + getServicePropertyFileName(entry.getKey()))
                .contents(prepareServiceConfigurationXmlContent(entry.getKey(), (Map) entry.getValue())),
        SshEffectorTasks.ssh(
            sudo(format("mv %s %s/", "/tmp/" + getServicePropertyFileName(entry.getKey()), getServiceConfigDirectory()))));
  }
  DynamicTasks.waitForLast();
}
origin: org.apache.brooklyn/brooklyn-software-database

@Override
public ProcessTaskWrapper<Integer> executeScriptAsync(String commands) {
  String filename = "mysql-commands-"+Identifiers.makeRandomId(8);
  DynamicTasks.queue(SshEffectorTasks.put(Urls.mergePaths(getRunDir(), filename)).contents(commands).summary("copying datastore script to execute "+filename));
  return executeScriptFromInstalledFileAsync(filename);
}
origin: org.apache.brooklyn/brooklyn-software-base

@Override
protected String startProcessesAtMachine(Supplier<MachineLocation> machineS) {
  DynamicTasks.queue(
      SshEffectorTasks.ssh(
        "mkdir "+dir(entity),
        "cd "+dir(entity),
        BashCommands.downloadToStdout(downloadUrl(entity, isLocalhost(machineS)))+" | tar xvz"
      ).summary("download mysql").returning(SshTasks.returningStdoutLoggingInfo(log, true)));
  if (isLinux(machineS)) {
    DynamicTasks.queue(SshEffectorTasks.ssh(BashCommands.installPackage("libaio1")));
  }
  DynamicTasks.queue(
      SshEffectorTasks.put(".my.cnf")
        .contents(String.format("[mysqld]\nbasedir=%s/%s\n", dir(entity), installDir(entity, isLocalhost(machineS)))),
      SshEffectorTasks.ssh(
        "cd "+dir(entity)+"/*",
        "./scripts/mysql_install_db",
        "./support-files/mysql.server start > out.log 2> err.log < /dev/null"
      ).summary("setup and run mysql").returning(SshTasks.returningStdoutLoggingInfo(log, true)));
  return "submitted start";
}
@Override
origin: org.apache.brooklyn/brooklyn-software-database

String contents = processTemplate(configUrl);
DynamicTasks.queue(
  SshEffectorTasks.put("/tmp/postgresql.conf").contents(contents),
  SshEffectorTasks.ssh(sudoAsUser("postgres", "cp /tmp/postgresql.conf " + getDataDir() + "/postgresql.conf")));
String contents = processTemplate(authConfigUrl);
DynamicTasks.queue(
  SshEffectorTasks.put("/tmp/pg_hba.conf").contents(contents),
  SshEffectorTasks.ssh(sudoAsUser("postgres", "cp /tmp/pg_hba.conf " + getDataDir() + "/pg_hba.conf")));
org.apache.brooklyn.core.effector.sshSshEffectorTasksput

Popular methods of SshEffectorTasks

  • ssh
  • isPidFromFileRunning
    as #codePidFromFileRunning(String) but returning boolean
  • codePidRunning
    task which returns 0 if pid is running
  • isPidRunning
    as #codePidRunning(Integer) but returning boolean
  • codePidFromFileRunning
    task which returns 0 if pid in the given file is running; method accepts wildcards so long as they m
  • getSshFlags
    extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKey
  • requirePidRunning
    task which fails if the given PID is not running
  • fetch
  • requirePidFromFileRunning
    task which fails if the pid in the given file is not running (or if there is no such PID file); meth

Popular in Java

  • Creating JSON documents from java classes using gson
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now