integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java
public void callShellScriptInAdminPod(
      String successMarker, String scriptPathInPod, String... args)
      throws Exception {

    StringBuffer cmdKubectlSh = new StringBuffer("kubectl -n ");
    cmdKubectlSh
        .append(domainNS)
        .append(" exec -it ")
        .append(domainUid)
        .append("-")
        .append(adminServerName)
        .append(" -- bash -c 'chmod +x -R ")
        .append(scriptPathInPod)
        .append(" && sh ")
        .append(scriptPathInPod)
        .append(" ")
        .append(String.join(" ", args).toString())
        .append("'");

    LoggerHelper.getLocal().log(Level.INFO, "Command to exec script file: " + cmdKubectlSh);
    ExecResult result = ExecCommand.exec(cmdKubectlSh.toString());

    String resultStr =
        "Command= '"
            + cmdKubectlSh
            + "'"
            + ", exitValue="
            + result.exitValue()
            + ", stdout='"
            + result.stdout()
            + "'"
            + ", stderr='"
            + result.stderr()
            + "'";

    // Look for positive success marker.
    if (!resultStr.contains(successMarker)) {
      throw new RuntimeException("FAILURE: Success marker not found after executing script"
          + scriptPathInPod + " in admin pod - " + resultStr);
    }
  }
/**
   * Run the shell script in the admin pod.
   *
   * @param successMarker   output string from script that indicates success
   * @param scriptPathInPod - bash script path name in the pod
   * @param args            - optional args to add for script if needed
   * @throws Exception If shell script fails to execute
   */
Run the shell script in the admin pod.
@param successMarker   output string from script that indicates success
@param scriptPathInPod - bash script path name in the pod
@param args            - optional args to add for script if needed
@throws Exception If shell script fails to execute
Run the shell script in the admin pod . @param successMarker output string from script that indicates success @param scriptPathInPod - bash script path name in the pod @param args - optional args to add for script if needed @throws Exception If shell script fails to execute
public void callShellScriptInAdminPod(
      String successMarker, String scriptPathInPod, String... args)
      throws Exception {
    StringBuffer cmdKubectlSh = new StringBuffer("kubectl -n ");
    cmdKubectlSh
        .append(domainNS)
        .append(" exec -it ")
        .append(domainUid)
        .append("-")
        .append(adminServerName)
        .append(" -- bash -c 'chmod +x -R ")
        .append(scriptPathInPod)
        .append(" && sh ")
        .append(scriptPathInPod)
        .append(" ")
        .append(String.join(" ", args).toString())
        .append("'");
    LoggerHelper.getLocal().log(Level.INFO, "Command to exec script file: " + cmdKubectlSh);
    ExecResult result = ExecCommand.exec(cmdKubectlSh.toString());
    String resultStr =
        "Command= '"
            + cmdKubectlSh
            + "'"
            + ", exitValue="
            + result.exitValue()
            + ", stdout='"
            + result.stdout()
            + "'"
            + ", stderr='"
            + result.stderr()
            + "'";
    if (!resultStr.contains(successMarker)) {
      throw new RuntimeException("FAILURE: Success marker not found after executing script"
          + scriptPathInPod + " in admin pod - " + resultStr);
    }
  }
public void callShellScriptInAdminPod ( String successMarker , String scriptPathInPod , String ... args ) throws Exception { StringBuffer cmdKubectlSh = new StringBuffer ( "kubectl -n " ) ; cmdKubectlSh . append ( domainNS ) . append ( " exec -it " ) . append ( domainUid ) . append ( "-" ) . append ( adminServerName ) . append ( " -- bash -c 'chmod +x -R " ) . append ( scriptPathInPod ) . append ( " && sh " ) . append ( scriptPathInPod ) . append ( " " ) . append ( String . join ( " " , args ) . toString ( ) ) . append ( "'" ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Command to exec script file: " + cmdKubectlSh ) ; ExecResult result = ExecCommand . exec ( cmdKubectlSh . toString ( ) ) ; String resultStr = "Command= '" + cmdKubectlSh + "'" + ", exitValue=" + result . exitValue ( ) + ", stdout='" + result . stdout ( ) + "'" + ", stderr='" + result . stderr ( ) + "'" ; if ( ! resultStr . contains ( successMarker ) ) { throw new RuntimeException ( "FAILURE: Success marker not found after executing script" + scriptPathInPod + " in admin pod - " + resultStr ) ; } }
Run the shell script in the admin pod.
Run the shell script in the admin pod .
// Look for positive success marker.