Alon Bar-Lev has uploaded a new change for review. Change subject: packaging: setup: remove the distro-rpm/image_upload ......................................................................
packaging: setup: remove the distro-rpm/image_upload the files handled by the image_upload are rhel specific are not rpm specific and should be moved to designated downstream. Change-Id: I27aaf92d3f994bf2add2382b905ef813bc611cd0 Signed-off-by: Alon Bar-Lev <[email protected]> --- M packaging/setup/plugins/ovirt-engine-setup/distro-rpm/__init__.py D packaging/setup/plugins/ovirt-engine-setup/distro-rpm/image_upload.py 2 files changed, 0 insertions(+), 152 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/18639/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/__init__.py b/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/__init__.py index 61b7e5f..49b4be4 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/__init__.py +++ b/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/__init__.py @@ -23,13 +23,11 @@ from otopi import util from . import packages -from . import image_upload @util.export def createPlugins(context): packages.Plugin(context=context) - image_upload.Plugin(context=context) # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/image_upload.py b/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/image_upload.py deleted file mode 100644 index 517072f..0000000 --- a/packaging/setup/plugins/ovirt-engine-setup/distro-rpm/image_upload.py +++ /dev/null @@ -1,150 +0,0 @@ -# -# ovirt-engine-setup -- ovirt engine setup -# Copyright (C) 2013 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -""" -ISO image uploader plugin. -""" - -import datetime -import os -import shutil -import gettext -_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup') - -from otopi import util -from otopi import plugin - -from ovirt_engine_setup import util as osetuputil -from ovirt_engine_setup import constants as osetupcons - - [email protected] -class Plugin(plugin.PluginBase): - """ - ISO image uploader plugin. - """ - def __init__(self, context): - super(Plugin, self).__init__(context=context) - self._enabled = False - self._fileList = [] - - @plugin.event( - stage=plugin.Stages.STAGE_INIT, - ) - def _init(self): - self._fileList = [ - os.path.join( - osetupcons.FileLocations.VIRTIO_WIN_DIR, - 'virtio-win_x86.vfd', - ), - os.path.join( - osetupcons.FileLocations.VIRTIO_WIN_DIR, - 'virtio-win_amd64.vfd', - ), - os.path.join( - osetupcons.FileLocations.VIRTIO_WIN_DIR, - 'virtio-win.iso', - ), - os.path.join( - osetupcons.FileLocations.RHEV_GUEST_TOOLS_DIR, - 'rhev-tools-setup.iso', - ), - ] - - @plugin.event( - stage=plugin.Stages.STAGE_VALIDATION, - ) - def _validation(self): - if not self.environment[osetupcons.CoreEnv.DEVELOPER_MODE]: - if self.environment[osetupcons.SystemEnv.NFS_CONFIG_ENABLED]: - for filename in self._fileList: - if os.path.exists(filename): - self._enabled = True - - @plugin.event( - stage=plugin.Stages.STAGE_MISC, - condition=lambda self: self._enabled, - after=( - osetupcons.Stages.CONFIG_ISO_DOMAIN_AVAILABLE, - ), - ) - def _misc(self): - """ - Load files (iso, vfd) from existing rpms to the NFS ISO domain - TODO: use engine-iso-uploader when it will support local destinations - """ - uninstall_files = [] - self.environment[ - osetupcons.CoreEnv.REGISTER_UNINSTALL_GROUPS - ].createGroup( - group='iso_images', - description='Uploaded ISO images', - optional=True - ).addFiles( - group='iso_images', - fileList=uninstall_files, - ) - - targetDir = self.environment[ - osetupcons.ConfigEnv.ISO_DOMAIN_STORAGE_DIR - ] - - # Iterate the list and copy all the files. - for filename in self._fileList: - if os.path.exists(filename): - try: - targetFile = os.path.join( - targetDir, - os.path.basename(filename) - ) - if os.path.exists(targetFile): - shutil.move( - targetFile, - '%s.%s' % ( - targetFile, - datetime.datetime.now().strftime( - '%Y%m%d%H%M%S' - ) - ) - ) - shutil.copyfile(filename, targetFile) - uninstall_files.append(targetFile) - os.chmod(targetFile, 0o644) - os.chown( - targetFile, - osetuputil.getUid( - self.environment[osetupcons.SystemEnv.USER_VDSM] - ), - osetuputil.getGid( - self.environment[osetupcons.SystemEnv.GROUP_KVM] - ) - ) - except (OSError, shutil.Error) as e: - self.logger.warning( - _( - "Cannot copy '{filename}' to iso domain " - "'{directory}', error: {error}" - ).format( - filename=filename, - directory=targetDir, - error=str(e) - ) - ) - - -# vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/18639 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I27aaf92d3f994bf2add2382b905ef813bc611cd0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
