-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to the plugin.py file to include the plugin remove_jar feature #116
Open
nanaessuman
wants to merge
1
commit into
prestodb:master
Choose a base branch
from
nanaessuman:master
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,14 @@ | |
from prestoadmin.util.base_config import requires_config | ||
from prestoadmin.util.constants import REMOTE_PLUGIN_DIR | ||
|
||
__all__ = ['add_jar'] | ||
__all__ = ['add_jar', 'remove_jar'] | ||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def write(local_path, remote_dir): | ||
sudo("mkdir -p " + remote_dir) | ||
put(local_path, remote_dir, use_sudo=True) | ||
|
||
|
||
@task | ||
@requires_config(StandaloneConfig) | ||
def add_jar(local_path, plugin_name, plugin_dir=REMOTE_PLUGIN_DIR): | ||
|
@@ -47,3 +46,15 @@ def add_jar(local_path, plugin_name, plugin_dir=REMOTE_PLUGIN_DIR): | |
""" | ||
_LOGGER.info('deploying jars on %s' % env.host) | ||
write(local_path, os.path.join(plugin_dir, plugin_name)) | ||
|
||
def remove_jar(local_path, plugin_name): | ||
""" | ||
Remove jar for the specified plugin to the plugin directory. | ||
|
||
Parameters: | ||
local_path - Local path to the jar to be removed | ||
plugin_name - Name of the plugin subdirectory to deploy jars to | ||
|
||
""" | ||
_LOGGER.info('removing jar on %s' % env.host) | ||
os.remove(os.path.join(local_path, plugin_name)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will only remove the jar from the local system the presto-admin is running on. To remove it from all of the presto nodes you should use a fabric command something like. path = os.path.join(plugin_dir, plugin_name) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For remove jar, there is no local path. The command should take the plugin name to remove and optionally the remote path to the plugin directory to allow for non-default configurations.
def remove_jar(plugin_name, plugin_dir=REMOTE_PLUGIN_DIR)