treat roles_path as the list it is for galaxy list
This commit is contained in:
parent
2452bd2135
commit
a59478f4f4
1 changed files with 17 additions and 16 deletions
|
@ -485,22 +485,23 @@ class GalaxyCLI(CLI):
|
||||||
else:
|
else:
|
||||||
# show all valid roles in the roles_path directory
|
# show all valid roles in the roles_path directory
|
||||||
roles_path = self.get_opt('roles_path')
|
roles_path = self.get_opt('roles_path')
|
||||||
roles_path = os.path.expanduser(roles_path)
|
for path in roles_path:
|
||||||
if not os.path.exists(roles_path):
|
role_path = os.path.expanduser(path)
|
||||||
raise AnsibleOptionsError("- the path %s does not exist. Please specify a valid path with --roles-path" % roles_path)
|
if not os.path.exists(role_path):
|
||||||
elif not os.path.isdir(roles_path):
|
raise AnsibleOptionsError("- the path %s does not exist. Please specify a valid path with --roles-path" % roles_path)
|
||||||
raise AnsibleOptionsError("- %s exists, but it is not a directory. Please specify a valid path with --roles-path" % roles_path)
|
elif not os.path.isdir(role_path):
|
||||||
path_files = os.listdir(roles_path)
|
raise AnsibleOptionsError("- %s exists, but it is not a directory. Please specify a valid path with --roles-path" % roles_path)
|
||||||
for path_file in path_files:
|
path_files = os.listdir(role_path)
|
||||||
gr = GalaxyRole(self.galaxy, path_file)
|
for path_file in path_files:
|
||||||
if gr.metadata:
|
gr = GalaxyRole(self.galaxy, path_file)
|
||||||
install_info = gr.install_info
|
if gr.metadata:
|
||||||
version = None
|
install_info = gr.install_info
|
||||||
if install_info:
|
version = None
|
||||||
version = install_info.get("version", None)
|
if install_info:
|
||||||
if not version:
|
version = install_info.get("version", None)
|
||||||
version = "(unknown version)"
|
if not version:
|
||||||
display.display("- %s, %s" % (path_file, version))
|
version = "(unknown version)"
|
||||||
|
display.display("- %s, %s" % (path_file, version))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def execute_search(self):
|
def execute_search(self):
|
||||||
|
|
Loading…
Reference in a new issue