Ejemplo n.º 1
0
 def create_plugin(supported_platform=None,
                   distribution=None,
                   distribution_release=None):
     mock_data = {k: 'stub' for k in models.Plugin.fields}
     if supported_platform:
         mock_data['supported_platform'] = supported_platform
     if distribution:
         mock_data['distribution'] = distribution
     if distribution_release:
         mock_data['distribution_release'] = distribution_release
     return models.Plugin(**mock_data)
Ejemplo n.º 2
0
 def create_plugin(supported_platform=None,
                   distribution=None,
                   distribution_release=None):
     mock_data = {k: 'stub' for k in models.Plugin.resource_fields}
     mock_data.pop('tenant_name')
     mock_data.pop('created_by')
     if supported_platform:
         mock_data['supported_platform'] = supported_platform
     if distribution:
         mock_data['distribution'] = distribution
     if distribution_release:
         mock_data['distribution_release'] = distribution_release
     return models.Plugin(**mock_data)
Ejemplo n.º 3
0
 def create_plugin(supported_platform=None,
                   distribution=None,
                   distribution_release=None):
     # don't attempt to set read-only properties
     fields_to_skip = [
         'resource_availability',  # deprecated, proxies to .visibility
     ]
     mock_data = {k: 'stub' for k in models.Plugin.resource_fields
                  if k not in fields_to_skip}
     mock_data.pop('tenant_name')
     mock_data.pop('created_by')
     if supported_platform:
         mock_data['supported_platform'] = supported_platform
     if distribution:
         mock_data['distribution'] = distribution
     if distribution_release:
         mock_data['distribution_release'] = distribution_release
     return models.Plugin(**mock_data)
Ejemplo n.º 4
0
 def _create_plugin_from_archive(self, plugin_id, archive_path):
     plugin = self._load_plugin_package_json(archive_path)
     build_props = plugin.get('build_server_os_properties')
     now = utils.get_formatted_timestamp()
     return models.Plugin(
         id=plugin_id,
         package_name=plugin.get('package_name'),
         package_version=plugin.get('package_version'),
         archive_name=plugin.get('archive_name'),
         package_source=plugin.get('package_source'),
         supported_platform=plugin.get('supported_platform'),
         distribution=build_props.get('distribution'),
         distribution_version=build_props.get('distribution_version'),
         distribution_release=build_props.get('distribution_release'),
         wheels=plugin.get('wheels'),
         excluded_wheels=plugin.get('excluded_wheels'),
         supported_py_versions=plugin.get('supported_python_versions'),
         uploaded_at=now)
Ejemplo n.º 5
0
 def _restore_plugins(self):
     for line in open(self._plugins_path, 'r'):
         elem = json.loads(line)
         plugin = models.Plugin(**elem['_source'])
         self._storage_manager.put(plugin)