Skip to content

Instantly share code, notes, and snippets.

@relrod
Created January 24, 2020 08:36
Show Gist options
  • Save relrod/6aa4a37e75e5053ca7e5ced594c6a655 to your computer and use it in GitHub Desktop.
Save relrod/6aa4a37e75e5053ca7e5ced594c6a655 to your computer and use it in GitHub Desktop.
Ansible test failures
=================================== FAILURES ===================================
______________________ test_install_collections_from_tar _______________________
[gw3] linux -- Python 3.5.7 /tmp/python-9mti748p-ansible/python
src = b'/home/pytest/.ansible/tmp/ansible-local-21819apkw49_v/tmpq71fp8sn/tmp_idp207w'
dst = b'/tmp/pytest-of-pytest/pytest-2/popen-gw3/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
copy_function = <function copy2 at 0x7fb17ce8f488>
def move(src, dst, copy_function=copy2):
"""Recursively move a file or directory to another location. This is
similar to the Unix "mv" command. Return the file or directory's
destination.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
If the destination already exists but is not a directory, it may be
overwritten depending on os.rename() semantics.
If the destination is on our current filesystem, then rename() is used.
Otherwise, src is copied to the destination and then removed. Symlinks are
recreated under the new name if os.rename() fails because of cross
filesystem renames.
The optional `copy_function` argument is a callable that will be used
to copy the source or it will be delegated to `copytree`.
By default, copy2() is used, but any function that supports the same
signature (like copy()) can be used.
A lot more could be done here... A look at a mv.c shows a lot of
the issues this implementation glosses over.
"""
real_dst = dst
if os.path.isdir(dst):
if _samefile(src, dst):
# We might be on a case insensitive filesystem,
# perform the rename anyway.
os.rename(src, dst)
return
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error("Destination path '%s' already exists" % real_dst)
try:
> os.rename(src, real_dst)
E OSError: [Errno 18] Invalid cross-device link: b'/home/pytest/.ansible/tmp/ansible-local-21819apkw49_v/tmpq71fp8sn/tmp_idp207w' -> b'/tmp/pytest-of-pytest/pytest-2/popen-gw3/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
/usr/lib/python3.5/shutil.py:544: OSError
During handling of the above exception, another exception occurred:
collection_artifact = (b'/tmp/pytest-of-pytest/pytest-2/popen-gw3/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections ...\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace-collection-0.1.0.tar.gz')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fb1684f64a8>
def test_install_collections_from_tar(collection_artifact, monkeypatch):
collection_path, collection_tar = collection_artifact
temp_path = os.path.split(collection_tar)[0]
shutil.rmtree(collection_path)
mock_display = MagicMock()
monkeypatch.setattr(Display, 'display', mock_display)
collection.install_collections([(to_text(collection_tar), '*', None,)], to_text(temp_path),
> [u'https://galaxy.ansible.com'], True, False, False, False, False)
test/units/galaxy/test_collection_install.py:649:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/ansible/galaxy/collection.py:443: in install_collections
collection.install(output_path, b_temp_path)
lib/ansible/galaxy/collection.py:176: in install
_extract_tar_file(collection_tar, 'MANIFEST.json', b_collection_path, b_temp_path)
lib/ansible/galaxy/collection.py:948: in _extract_tar_file
shutil.move(to_bytes(tmpfile_obj.name, errors='surrogate_or_strict'), b_dest_filepath)
/usr/lib/python3.5/shutil.py:558: in move
copy_function(src, real_dst)
/usr/lib/python3.5/shutil.py:258: in copy2
copystat(src, dst, follow_symlinks=follow_symlinks)
/usr/lib/python3.5/shutil.py:225: in copystat
_copyxattr(src, dst, follow_symlinks=follow)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src = b'/home/pytest/.ansible/tmp/ansible-local-21819apkw49_v/tmpq71fp8sn/tmp_idp207w'
dst = b'/tmp/pytest-of-pytest/pytest-2/popen-gw3/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
def _copyxattr(src, dst, *, follow_symlinks=True):
"""Copy extended filesystem attributes from `src` to `dst`.
Overwrite existing attributes.
If `follow_symlinks` is false, symlinks won't be followed.
"""
try:
names = os.listxattr(src, follow_symlinks=follow_symlinks)
except OSError as e:
if e.errno not in (errno.ENOTSUP, errno.ENODATA):
raise
return
for name in names:
try:
value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
> os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
E PermissionError: [Errno 13] Permission denied: b'/tmp/pytest-of-pytest/pytest-2/popen-gw3/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
/usr/lib/python3.5/shutil.py:165: PermissionError
---------------------------- Captured stdout setup -----------------------------
- Collection ansible_namespace.collection was created successfully
Created collection for ansible_namespace.collection at /tmp/pytest-of-pytest/pytest-2/popen-gw3/test-ÅÑŚÌβŁÈ Collections Input0/ansible_namespace-collection-0.1.0.tar.gz
____ test_install_collection_with_circular_dependency[collection_artifact0] ____
[gw2] linux -- Python 3.5.7 /tmp/python-9mti748p-ansible/python
src = b'/home/pytest/.ansible/tmp/ansible-local-21815hcqyyf05/tmpd2k6mvkk/tmpmwpgecgp'
dst = b'/tmp/pytest-of-pytest/pytest-2/popen-gw2/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
copy_function = <function copy2 at 0x7fd5a5fd3488>
def move(src, dst, copy_function=copy2):
"""Recursively move a file or directory to another location. This is
similar to the Unix "mv" command. Return the file or directory's
destination.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
If the destination already exists but is not a directory, it may be
overwritten depending on os.rename() semantics.
If the destination is on our current filesystem, then rename() is used.
Otherwise, src is copied to the destination and then removed. Symlinks are
recreated under the new name if os.rename() fails because of cross
filesystem renames.
The optional `copy_function` argument is a callable that will be used
to copy the source or it will be delegated to `copytree`.
By default, copy2() is used, but any function that supports the same
signature (like copy()) can be used.
A lot more could be done here... A look at a mv.c shows a lot of
the issues this implementation glosses over.
"""
real_dst = dst
if os.path.isdir(dst):
if _samefile(src, dst):
# We might be on a case insensitive filesystem,
# perform the rename anyway.
os.rename(src, dst)
return
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error("Destination path '%s' already exists" % real_dst)
try:
> os.rename(src, real_dst)
E OSError: [Errno 18] Invalid cross-device link: b'/home/pytest/.ansible/tmp/ansible-local-21815hcqyyf05/tmpd2k6mvkk/tmpmwpgecgp' -> b'/tmp/pytest-of-pytest/pytest-2/popen-gw2/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
/usr/lib/python3.5/shutil.py:544: OSError
During handling of the above exception, another exception occurred:
collection_artifact = (b'/tmp/pytest-of-pytest/pytest-2/popen-gw2/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections ...\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace-collection-0.1.0.tar.gz')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fd5917e69e8>
@pytest.mark.parametrize('collection_artifact', [
{'ansible_namespace.collection': '>=0.0.1'},
], indirect=True)
def test_install_collection_with_circular_dependency(collection_artifact, monkeypatch):
collection_path, collection_tar = collection_artifact
temp_path = os.path.split(collection_tar)[0]
shutil.rmtree(collection_path)
mock_display = MagicMock()
monkeypatch.setattr(Display, 'display', mock_display)
collection.install_collections([(to_text(collection_tar), '*', None,)], to_text(temp_path),
> [u'https://galaxy.ansible.com'], True, False, False, False, False)
test/units/galaxy/test_collection_install.py:712:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/ansible/galaxy/collection.py:443: in install_collections
collection.install(output_path, b_temp_path)
lib/ansible/galaxy/collection.py:176: in install
_extract_tar_file(collection_tar, 'MANIFEST.json', b_collection_path, b_temp_path)
lib/ansible/galaxy/collection.py:948: in _extract_tar_file
shutil.move(to_bytes(tmpfile_obj.name, errors='surrogate_or_strict'), b_dest_filepath)
/usr/lib/python3.5/shutil.py:558: in move
copy_function(src, real_dst)
/usr/lib/python3.5/shutil.py:258: in copy2
copystat(src, dst, follow_symlinks=follow_symlinks)
/usr/lib/python3.5/shutil.py:225: in copystat
_copyxattr(src, dst, follow_symlinks=follow)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src = b'/home/pytest/.ansible/tmp/ansible-local-21815hcqyyf05/tmpd2k6mvkk/tmpmwpgecgp'
dst = b'/tmp/pytest-of-pytest/pytest-2/popen-gw2/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
def _copyxattr(src, dst, *, follow_symlinks=True):
"""Copy extended filesystem attributes from `src` to `dst`.
Overwrite existing attributes.
If `follow_symlinks` is false, symlinks won't be followed.
"""
try:
names = os.listxattr(src, follow_symlinks=follow_symlinks)
except OSError as e:
if e.errno not in (errno.ENOTSUP, errno.ENODATA):
raise
return
for name in names:
try:
value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
> os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
E PermissionError: [Errno 13] Permission denied: b'/tmp/pytest-of-pytest/pytest-2/popen-gw2/test-\xc3\x85\xc3\x91\xc5\x9a\xc3\x8c\xce\xb2\xc5\x81\xc3\x88 Collections Input0/ansible_namespace/collection/MANIFEST.json'
/usr/lib/python3.5/shutil.py:165: PermissionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment