コード例 #1
0
  /**
   * Update the nodes resources file from a specific URL, with BASIC authentication as provided or
   * as defined in the URL's userInfo section.
   *
   * @param providerURL URL to retrieve resources file definition
   * @param username username or null
   * @param password or null
   * @param nodesResourceFilePath path of the destination file
   * @throws com.dtolabs.rundeck.core.common.UpdateUtils.UpdateException if an error occurs during
   *     the update process
   */
  @Override
  public void updateNodesResourceFileFromUrl(
      final String providerURL,
      final String username,
      final String password,
      final String nodesResourceFilePath)
      throws UpdateUtils.UpdateException {
    if (!validateResourceProviderURL(providerURL)) {
      throw new UpdateUtils.UpdateException("providerURL is not allowed: " + providerURL);
    }

    UpdateUtils.updateFileFromUrl(
        providerURL, nodesResourceFilePath, username, password, URLFileUpdater.factory());
    logger.debug("Updated nodes resources file: " + nodesResourceFilePath);
  }
コード例 #2
0
 /**
  * Update the resources file from a source file
  *
  * @param source the source file
  * @throws UpdateUtils.UpdateException if an error occurs while trying to update the resources
  *     file
  */
 public void updateNodesResourceFile(final File source, final String nodesResourceFilePath)
     throws UpdateUtils.UpdateException {
   UpdateUtils.updateFileFromFile(source, nodesResourceFilePath);
   logger.debug("Updated nodes resources file: " + nodesResourceFilePath);
 }