Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 910020 Details for
Bug 1092572
Puppet install distributors on big puppet repos become unavailable during the time it is getting "recreated"
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Proposed patch
bz1092572.patch (text/plain), 5.28 KB, created by
Petter Hassberg
on 2014-06-18 13:50:46 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Petter Hassberg
Created:
2014-06-18 13:50:46 UTC
Size:
5.28 KB
patch
obsolete
>diff --git a/pulp_puppet_plugins/pulp_puppet/plugins/distributors/installdistributor.py b/pulp_puppet_plugins/pulp_puppet/plugins/distributors/installdistributor.py >index 19bf97f..d0ed588 100644 >--- a/pulp_puppet_plugins/pulp_puppet/plugins/distributors/installdistributor.py >+++ b/pulp_puppet_plugins/pulp_puppet/plugins/distributors/installdistributor.py >@@ -17,7 +17,6 @@ import os > import shutil > import tarfile > import errno >-import tempfile > > from pulp.plugins.distributor import Distributor > from pulp.server.db.model.criteria import UnitAssociationCriteria >@@ -119,42 +118,33 @@ class PuppetModuleInstallDistributor(Distributor): > > # ensure the destination directory exists > try: >- temporarydestination = self._create_temporary_destination_directory(destination) >+ self._create_destination_directory(destination) > except OSError, e: > return publish_conduit.build_failure_report( > 'failed to create destination directory: %s' % str(e), > self.detail_report.report) > >+ # clear out pre-existing contents >+ try: >+ self._clear_destination_directory(destination) >+ except (IOError, OSError), e: >+ return publish_conduit.build_failure_report( >+ 'failed to clear destination directory: %s' % str(e), >+ self.detail_report.report) >+ > # actually publish > for unit in units: > try: > archive = tarfile.open(unit.storage_path) > try: >- archive.extractall(temporarydestination) >- self._rename_directory(unit, temporarydestination, archive.getnames()) >+ archive.extractall(destination) >+ self._rename_directory(unit, destination, archive.getnames()) > finally: > archive.close() > self.detail_report.success(unit.unit_key) > except (OSError, IOError, ValueError), e: > self.detail_report.error(unit.unit_key, str(e)) > >- >- # remove old directory if exists >- try: >- self._remove_destination_directory(destination) >- except (IOError, OSError), e: >- return publish_conduit.build_failure_report( >- 'failed to clear destination directory: %s' % str(e), >- self.detail_report.report) >- >- # rename the temporary dir to the destinationdir >- try: >- self._move_to_destination_directory(temporarydestination, destination) >- except (IOError, OSError), e: >- return publish_conduit.build_failure_report( >- 'failed to move temporary destination to destination directory: %s' % str(e), >- self.detail_report.report) >- > # return some kind of report > if self.detail_report.has_errors: > return publish_conduit.build_failure_report('failed', self.detail_report.report) >@@ -269,19 +259,21 @@ class PuppetModuleInstallDistributor(Distributor): > return True > > @staticmethod >- def _remove_destination_directory(destination): >+ def _clear_destination_directory(destination): > """ >- deletes the given destination >+ deletes every directory found in the given destination > > :param destination: absolute path to the destination where modules should > be installed > :type destination: str > """ >- if os.path.exists(destination): >- shutil.rmtree(destination) >+ for directory in os.listdir(destination): >+ path = os.path.join(destination, directory) >+ if os.path.isdir(path): >+ shutil.rmtree(path) > > @staticmethod >- def _create_temporary_destination_directory(destination, mode=0755): >+ def _create_destination_directory(destination, mode=0755): > """ > create the destination directory when it does not exist. > >@@ -290,42 +282,14 @@ class PuppetModuleInstallDistributor(Distributor): > :type destination: str > :param mode: the directory permissions > :type mode: int >- >- :return: absolute path to temporary created directory >- :rtype: str > """ >- basedir, moduledir = os.path.split(destination) >- > try: >- os.makedirs(basedir, mode) >+ os.makedirs(destination, mode) > except OSError, e: > if e.errno == errno.EEXIST and os.path.isdir(destination): > pass # ignored > else: > raise e >- try: >- temporarydestination = tempfile.mkdtemp(prefix=moduledir, dir=basedir) >- except OSError, e: >- raise e >- >- return temporarydestination >- >- @staticmethod >- def _move_to_destination_directory(temporarydestination, destination): >- """ >- move the temporary destination directory to the real destination. >- >- :param destination: absolute path to the destination where modules should >- be installed >- :type destination: str >- >- :param destination: absolute path to the temporary destination where >- the modules are >- :type destination: str >- >- >- """ >- os.rename(temporarydestination, destination) > > > class DetailReport(object):
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1092572
: 910020