Пример #1
0
 def update_execute_migration_code():
     # type: () -> None
     """
     Run some migration code after an update has been done
     :return: None
     :rtype: NoneType
     """
     with file_mutex('post_update'):
         SDMUpdateController.execute_migration_code()
Пример #2
0
 def update(package_name):
     # type: (str) -> None
     """
     Install the specified package
     :param package_name: Name of the package to update
     :type package_name: str
     :return: None
     :rtype: NoneType
     """
     with file_mutex('package_update'):
         SDMUpdateController.update(package_name=package_name)
Пример #3
0
 def restart_services(request_data):
     # type: (dict) -> None
     """
     Restart services
     :param request_data: Data about the request (given by the decorator)
     :type request_data: dict
     :return: None
     :rtype: NoneType
     """
     with file_mutex('package_update'):
         SDMUpdateController.restart_services(service_names=json.loads(
             request_data.get('service_names', [])))
Пример #4
0
 def execute_update(status):
     """
     This call is required when framework has old code and SDM has been updated (as off 30 Nov 2016)
     Old code tries to initiate update providing a status, while new code no longer requires this status
     :param status: Unused
     :type status: str
     """
     _ = status
     with file_mutex('package_update'):
         SDMUpdateController.update(package_name='alba')
         SDMUpdateController.update(package_name='openvstorage-sdm')
         return {'status': 'done'}
Пример #5
0
 def execute_update(status):
     # type: (str) -> str
     """
     This call is required when framework has old code and SDM has been updated (as off 30 Nov 2016)
     Old code tries to initiate update providing a status, while new code no longer requires this status
     :param status: Unused
     :type status: str
     :return: The status of the ongoing update
     :rtype: str
     """
     _ = status
     with file_mutex('package_update'):
         SDMUpdateController.update(package_name='alba')
         SDMUpdateController.update(package_name='openvstorage-sdm')
         return 'done'
Пример #6
0
 def get_package_information_new():
     """
     Retrieve update information
     This call is used by the new framework code (as off 30 Nov 2016)
     In case framework has new code, but SDM runs old code, the asdmanager.py plugin will adjust the old format to the new format
     """
     with file_mutex('package_update'):
         API._logger.info('Locking in place for package update')
         return SDMUpdateController.get_package_information()
Пример #7
0
 def update_installed_version_package(package_name):
     # type: (str) -> str
     """
     Retrieve the currently installed package version
     :param package_name: Name of the package to retrieve the version for
     :type package_name: str
     :return: Version of the currently installed package
     :rtype: str
     """
     return SDMUpdateController.get_installed_version_for_package(
         package_name=package_name)
Пример #8
0
 def get_package_information_new():
     # type: () -> dict
     """
     Retrieve update information
     This call is used by the new framework code (as off 30 Nov 2016)
     In case framework has new code, but SDM runs old code, the asdmanager.py plugin will adjust the old format to the new format
     :return: Installed and candidate for install version for all SDM related packages
     :rtype: dict
     """
     with file_mutex('package_update'):
         API._logger.info('Locking in place for package update')
         return SDMUpdateController.get_package_information()
Пример #9
0
 def get_package_information_old():
     """
     Retrieve update information
     This call is required when framework has old code and SDM has been updated (as off 30 Nov 2016)
     Old code tries to call /update/information and expects data formatted in the old style
     """
     return_value = {'version': '', 'installed': ''}
     with file_mutex('package_update'):
         API._logger.info('Locking in place for package update')
         update_info = SDMUpdateController.get_package_information().get('alba', {})
         if 'openvstorage-sdm' in update_info:
             return_value['version'] = update_info['openvstorage-sdm']['candidate']
             return_value['installed'] = update_info['openvstorage-sdm']['installed']
         elif 'alba' in update_info:
             return_value['version'] = update_info['alba']['candidate']
             return_value['installed'] = update_info['alba']['installed']
     return return_value
Пример #10
0
 def get_package_information_old():
     # type: () -> dict
     """
     Retrieve update information
     This call is required when framework has old code and SDM has been updated (as off 30 Nov 2016)
     Old code tries to call /update/information and expects data formatted in the old style
     :return: Installed and candidate for install version for all SDM related packages
     :rtype: dict
     """
     return_value = {'version': '', 'installed': ''}
     with file_mutex('package_update'):
         API._logger.info('Locking in place for package update')
         update_info = SDMUpdateController.get_package_information().get(
             'alba', {})
         if 'openvstorage-sdm' in update_info:
             return_value['version'] = update_info['openvstorage-sdm'][
                 'candidate']
             return_value['installed'] = update_info['openvstorage-sdm'][
                 'installed']
         elif 'alba' in update_info:
             return_value['version'] = update_info['alba']['candidate']
             return_value['installed'] = update_info['alba']['installed']
     return return_value
Пример #11
0
 def restart_services():
     """ Restart services """
     with file_mutex('package_update'):
         return SDMUpdateController.restart_services()
Пример #12
0
 def update(package_name):
     """
     Install the specified package
     """
     with file_mutex('package_update'):
         return SDMUpdateController.update(package_name=package_name)