Skip to content

Commit

Permalink
Merge pull request #21 from jihyungSong/master
Browse files Browse the repository at this point in the history
Add upgrade_mode in get_plugin_metadata
  • Loading branch information
jihyungSong authored Jun 11, 2023
2 parents 3feb55a + acf3e52 commit 3c0361f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 9 additions & 1 deletion src/spaceone/plugin/service/plugin_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def get_plugin_endpoint(self, params: dict):
'domain_id': 'str'
}
"""
if params.get('upgrade_mode') == 'MANUAL' and params.get('version') is None:
raise ERROR_REQUIRED_PARAMETER(key='version')

params.update({'version': self._get_plugin_version(params)})
return self._get_plugin_endpoint(params)

Expand All @@ -48,13 +51,18 @@ def get_plugin_metadata(self, params: dict):
params(dict) {
'plugin_id': 'str',
'version': 'str',
'upgrade_mode': 'str',
'options': 'dict',
'domain_id': 'str'
}
"""
plugin_id = params['plugin_id']
domain_id = params['domain_id']

if params.get('upgrade_mode') == 'MANUAL' and params.get('version') is None:
raise ERROR_REQUIRED_PARAMETER(key='version')

params.update({'version': self._get_plugin_version(params)})
plugin_endpoint_info = self._get_plugin_endpoint(params)
api_class = self._get_plugin_api_class(plugin_id, domain_id)
init_response = self.plugin_mgr.init_plugin(plugin_endpoint_info.get('endpoint'), api_class, {}, domain_id)
Expand Down Expand Up @@ -234,7 +242,7 @@ def _check_plugin(self, plugin_id, version, domain_id):
@transaction(append_meta={'authorization.scope': 'SYSTEM'})
@check_required(['plugin_id', 'version', 'supervisor_id', 'domain_id'])
def notify_failure(self, param: dict):
self.domain_id = param['domain_id']
domain_id = param['domain_id']

# since supervisor_id exists, don't need to know domain_id
# plugin_vo = self.plugin_mgr.mark_failure(param['supervisor_id'], param['plugin_id'], param['version'])
Expand Down
5 changes: 0 additions & 5 deletions src/spaceone/plugin/service/supervisor_service.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import logging
from datetime import datetime, timedelta

from spaceone.core.error import *
from spaceone.core.service import *
from spaceone.core import utils
# from spaceone.plugin.model import Supervisor, SupervisorRef
from spaceone.plugin.error import *
from spaceone.plugin.manager.plugin_manager import *
from spaceone.plugin.manager.supervisor_manager import *
from spaceone.plugin.manager.identity_manager import *

_LOGGER = logging.getLogger(__name__)

Expand Down

0 comments on commit 3c0361f

Please sign in to comment.