Remove Fabric monkey patching code

We need to remove old hack since it's not needed in Fabric 1.9.1 and
higher.

Change-Id: I695afed31a2ff42129f4137ae721a008f09153e3
Closes-Bug: #1358265
This commit is contained in:
Igor Kalnitsky 2014-11-05 19:25:40 +02:00
parent 3c08c212b0
commit f8c4d6df89
4 changed files with 20 additions and 74 deletions

View File

@ -12,48 +12,25 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import os.path
import setuptools
requires = [
'Fabric>=1.7.0'
]
name = 'shotgun'
version = '6.0.0'
def recursive_data_files(spec_data_files):
result = []
for dstdir, srcdir in spec_data_files:
for topdir, dirs, files in os.walk(srcdir):
for f in files:
result.append((os.path.join(dstdir, topdir),
[os.path.join(topdir, f)]))
return result
if __name__ == "__main__":
setuptools.setup(
name=name,
version=version,
description='Shotgun package',
long_description="""Shotgun is diagnostic snapshot generator""",
classifiers=[
"Development Status :: 4 - Beta",
"Programming Language :: Python",
],
author='Mirantis Inc.',
author_email='product@mirantis.com',
url='http://mirantis.com',
keywords='shotgun mirantis',
packages=setuptools.find_packages(),
zip_safe=False,
install_requires=requires,
include_package_data=True,
entry_points={
'console_scripts': [
'shotgun = shotgun.cli:main']})
setuptools.setup(
name='shotgun',
version='6.0.0',
description='Shotgun package',
long_description='Shotgun is diagnostic snapshot generator',
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python'],
author='Mirantis Inc.',
author_email='product@mirantis.com',
url='http://mirantis.com',
keywords='shotgun mirantis',
packages=setuptools.find_packages(),
zip_safe=False,
install_requires=[
'Fabric >= 1.10.0'],
entry_points={
'console_scripts': [
'shotgun = shotgun.cli:main']})

View File

@ -27,11 +27,6 @@ import fabric.api
from shotgun.utils import execute
from shotgun.utils import is_local
# please look at utils.fabric_monkey_patch docstring
# for more information
from shotgun import utils
utils.fabric_monkey_patch()
logger = logging.getLogger(__name__)

View File

@ -77,28 +77,3 @@ def execute(command, to_filename=None):
process[-2].stdout.close()
stdout, stderr = process[-1].communicate()
return (process[-1].returncode, stdout, stderr)
def fabric_monkey_patch():
"""Current Fabric incorrectly checks for a directory, because it uses
lstat() which returns False in case of symlink to a directory.
The issue occurs when shotgun wants to download a directory that contains
a symlink to another directory. For example, we have
/var/log/remote -> /var/log/docker-logs/remote
The fix was proposed to fabric master branch:
https://github.com/fabric/fabric/pull/1147
"""
from fabric.sftp import SFTP
import stat
def isdir(self, path):
try:
return stat.S_ISDIR(self.ftp.stat(path).st_mode)
except IOError:
return False
SFTP.isdir = isdir

View File

@ -7,8 +7,7 @@ envlist = py26,py27,pep8
usedevelop = True
install_command = pip install --allow-external -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
deps = -r{toxinidir}/test-requirements.txt
commands =
python setup.py testr --slowest --testr-args='{posargs:}'