-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Plugin installation/Uninstalltion Base classes
- Loading branch information
Showing
5 changed files
with
93 additions
and
24 deletions.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import logging | ||
|
||
from .base import Base | ||
|
||
|
||
class Plugin(Base): | ||
def __init__(self, client): | ||
super(Plugin, self).__init__(client) | ||
self.client = client | ||
self.logger = logging.getLogger(__name__) | ||
|
||
def health_check_plugin(self): | ||
""" | ||
:return: | ||
""" | ||
path = "/healthz" | ||
r = self.client.GET(path) | ||
return r | ||
|
||
def get_plugins(self): | ||
""" | ||
:return: | ||
""" | ||
path = "/plugins?embedded=0" | ||
r = self.client.GET(path) | ||
return r | ||
|
||
def install_plugins(self, pluginId, version): | ||
""" | ||
: return: | ||
""" | ||
try: | ||
path = "/plugins/%s/install" % pluginId | ||
r = self.client.POST(path, json={"version": version}) | ||
return r | ||
except Exception as ex: | ||
self.logger.info("Skipped installing %s and err = %s", pluginId, ex) | ||
return None | ||
|
||
def uninstall_plugins(self, pluginId): | ||
""" | ||
: return: | ||
""" | ||
try: | ||
path = "/plugins/%s/uninstall" % pluginId | ||
r = self.client.POST(path) | ||
return r | ||
except Exception as ex: | ||
self.logger.info("Skipped uninstalling %s and error = %s", pluginId, ex) | ||
return None | ||
|
||
def get_plugin_metrics(self, pluginId): | ||
try: | ||
path = "/plugins/%s/metrics" % pluginId | ||
r = self.client.GET(path) | ||
return r | ||
except Exception as ex: | ||
self.logger.info("Got error in fetching metrics for plugin %s and error = %s", pluginId, ex) | ||
return None | ||