Skip to content

Commit

Permalink
Updating the example opensearch snapshot help command with --P arg
Browse files Browse the repository at this point in the history
Signed-off-by: Manasvini B Suryanarayana <manasvis@amazon.com>
  • Loading branch information
manasvinibs committed Nov 8, 2022
1 parent 694731a commit a5c8db6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
5 changes: 3 additions & 2 deletions packages/osd-opensearch/src/cli_commands/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ exports.help = (defaults = {}) => {
-E Additional key=value settings to pass to OpenSearch
--download-only Download the snapshot but don't actually start it
--ssl Sets up SSL on OpenSearch
--P OpenSearch plugin artifact URL to install it on the cluster.
--P OpenSearch plugin artifact URL to install it on the cluster. We should use the flag multiple times
to install multiple plugins on the cluster snapshot.
Example:
opensearch snapshot --version 5.6.8 -E cluster.name=test -E path.data=/tmp/opensearch-data
opensearch snapshot --version 2.2.0 -E cluster.name=test -E path.data=/tmp/opensearch-data --P org.opensearch.plugin:alerting:2.2.0.0
`;
};

Expand Down
17 changes: 6 additions & 11 deletions packages/osd-opensearch/src/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,14 @@ exports.Cluster = class Cluster {
* @param {Array|string} opensearchPlugins Array or string of opensearch plugin(s) artifact url
*/
async installOpensearchPlugin(installPath, opensearchPluginsPath) {
this._log.info(chalk.bold(`Downloading Opensearch plugin on the cluster snapshot`));
this._log.info(chalk.bold(`Downloading Opensearch plugin(s) on the cluster snapshot`));
this._log.indent(4);
opensearchPluginsPath =
typeof opensearchPluginsPath === 'string' ? [opensearchPluginsPath] : opensearchPluginsPath;
// Run opensearch-plugin tool script to download openSearch plugin artifacts
if (Array.isArray(opensearchPluginsPath)) {
for (const pluginPath of opensearchPluginsPath) {
this._log.info(`Installing OpenSearch Plugin from the path: ${pluginPath}`);
await execa(OPENSEARCH_PLUGIN, [`install`, `--batch`, pluginPath], { cwd: installPath });
}
} else if (typeof opensearchPluginsPath === 'string') {
this._log.info(`Installing OpenSearch Plugin from the path: ${opensearchPluginsPath}`);
await execa(OPENSEARCH_PLUGIN, [`install`, `--batch`, opensearchPluginsPath], {
cwd: installPath,
});
for (const pluginPath of opensearchPluginsPath) {
this._log.info(`Installing OpenSearch Plugin from the path: ${pluginPath}`);
await execa(OPENSEARCH_PLUGIN, [`install`, `--batch`, pluginPath], { cwd: installPath });
}
this._log.info(`Plugin download complete`);
this._log.indent(-4);
Expand Down

0 comments on commit a5c8db6

Please sign in to comment.