mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-29 08:01:24 -07:00
Fix IndexError raised on galaxy-install
This patch fixes IndexError, that may be raised When trying to install a role with `ansible-galaxy` in case of access error to roles directory. Issue: ansible/galaxy#149
This commit is contained in:
parent
992f6d8bf4
commit
58e255c2d9
1 changed files with 4 additions and 4 deletions
|
@ -22,6 +22,7 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
import errno
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import tarfile
|
import tarfile
|
||||||
|
@ -325,11 +326,10 @@ class GalaxyRole(object):
|
||||||
installed = True
|
installed = True
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
error = True
|
error = True
|
||||||
if e[0] == 13 and len(self.paths) > 1:
|
if e.errno == errno.EACCES and len(self.paths) > 1:
|
||||||
current = self.paths.index(self.path)
|
current = self.paths.index(self.path)
|
||||||
nextidx = current + 1
|
if len(self.paths) > current:
|
||||||
if len(self.paths) >= current:
|
self.path = self.paths[current + 1]
|
||||||
self.path = self.paths[nextidx]
|
|
||||||
error = False
|
error = False
|
||||||
if error:
|
if error:
|
||||||
raise AnsibleError("Could not update files in %s: %s" % (self.path, str(e)))
|
raise AnsibleError("Could not update files in %s: %s" % (self.path, str(e)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue