Define and handle ignore_certs correctly. Preserve search term order. Tweak to Galaxy docsite.
parent
f1c72ff8f5
commit
342dee0023
|
@ -41,7 +41,7 @@ The most obvious use of the ansible-galaxy command is downloading roles from `th
|
||||||
$ ansible-galaxy install username.rolename
|
$ ansible-galaxy install username.rolename
|
||||||
|
|
||||||
roles_path
|
roles_path
|
||||||
===============
|
==========
|
||||||
|
|
||||||
You can specify a particular directory where you want the downloaded roles to be placed::
|
You can specify a particular directory where you want the downloaded roles to be placed::
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ class GalaxyCLI(CLI):
|
||||||
if self.action in ("import","info","init","install","login","search","setup","delete"):
|
if self.action in ("import","info","init","install","login","search","setup","delete"):
|
||||||
self.parser.add_option('-s', '--server', dest='api_server', default=C.GALAXY_SERVER,
|
self.parser.add_option('-s', '--server', dest='api_server', default=C.GALAXY_SERVER,
|
||||||
help='The API server destination')
|
help='The API server destination')
|
||||||
self.parser.add_option('-c', '--ignore-certs', action='store_false', dest='validate_certs', default=True,
|
self.parser.add_option('-c', '--ignore-certs', action='store_true', dest='ignore_certs', default=False,
|
||||||
help='Ignore SSL certificate validation errors.')
|
help='Ignore SSL certificate validation errors.')
|
||||||
|
|
||||||
if self.action in ("init","install"):
|
if self.action in ("init","install"):
|
||||||
|
@ -505,7 +505,7 @@ class GalaxyCLI(CLI):
|
||||||
terms = []
|
terms = []
|
||||||
for i in range(len(self.args)):
|
for i in range(len(self.args)):
|
||||||
terms.append(self.args.pop())
|
terms.append(self.args.pop())
|
||||||
search = '+'.join(terms)
|
search = '+'.join(terms[::-1])
|
||||||
|
|
||||||
if not search and not self.options.platforms and not self.options.tags and not self.options.author:
|
if not search and not self.options.platforms and not self.options.tags and not self.options.author:
|
||||||
raise AnsibleError("Invalid query. At least one search term, platform, galaxy tag or author must be provided.")
|
raise AnsibleError("Invalid query. At least one search term, platform, galaxy tag or author must be provided.")
|
||||||
|
@ -520,9 +520,9 @@ class GalaxyCLI(CLI):
|
||||||
data = ''
|
data = ''
|
||||||
|
|
||||||
if response['count'] > page_size:
|
if response['count'] > page_size:
|
||||||
data += ("Found %d roles matching your search. Showing first %s.\n" % (response['count'], page_size))
|
data += ("\nFound %d roles matching your search. Showing first %s.\n" % (response['count'], page_size))
|
||||||
else:
|
else:
|
||||||
data += ("Found %d roles matching your search:\n" % response['count'])
|
data += ("\nFound %d roles matching your search:\n" % response['count'])
|
||||||
|
|
||||||
max_len = []
|
max_len = []
|
||||||
for role in response['results']:
|
for role in response['results']:
|
||||||
|
|
|
@ -48,16 +48,15 @@ class GalaxyAPI(object):
|
||||||
SUPPORTED_VERSIONS = ['v1']
|
SUPPORTED_VERSIONS = ['v1']
|
||||||
|
|
||||||
def __init__(self, galaxy):
|
def __init__(self, galaxy):
|
||||||
|
|
||||||
self.galaxy = galaxy
|
self.galaxy = galaxy
|
||||||
self.token = GalaxyToken()
|
self.token = GalaxyToken()
|
||||||
self._api_server = C.GALAXY_SERVER
|
self._api_server = C.GALAXY_SERVER
|
||||||
self._validate_certs = C.GALAXY_IGNORE_CERTS
|
self._validate_certs = not C.GALAXY_IGNORE_CERTS
|
||||||
|
|
||||||
# set validate_certs
|
# set validate_certs
|
||||||
if galaxy.options.validate_certs == False:
|
if galaxy.options.ignore_certs:
|
||||||
self._validate_certs = False
|
self._validate_certs = False
|
||||||
display.vvv('Check for valid certs: %s' % self._validate_certs)
|
display.vvv('Validate TLS certificates: %s' % self._validate_certs)
|
||||||
|
|
||||||
# set the API server
|
# set the API server
|
||||||
if galaxy.options.api_server != C.GALAXY_SERVER:
|
if galaxy.options.api_server != C.GALAXY_SERVER:
|
||||||
|
@ -65,14 +64,13 @@ class GalaxyAPI(object):
|
||||||
display.vvv("Connecting to galaxy_server: %s" % self._api_server)
|
display.vvv("Connecting to galaxy_server: %s" % self._api_server)
|
||||||
|
|
||||||
server_version = self.get_server_api_version()
|
server_version = self.get_server_api_version()
|
||||||
|
if not server_version in self.SUPPORTED_VERSIONS:
|
||||||
if server_version in self.SUPPORTED_VERSIONS:
|
|
||||||
self.baseurl = '%s/api/%s' % (self._api_server, server_version)
|
|
||||||
self.version = server_version # for future use
|
|
||||||
display.vvv("Base API: %s" % self.baseurl)
|
|
||||||
else:
|
|
||||||
raise AnsibleError("Unsupported Galaxy server API version: %s" % server_version)
|
raise AnsibleError("Unsupported Galaxy server API version: %s" % server_version)
|
||||||
|
|
||||||
|
self.baseurl = '%s/api/%s' % (self._api_server, server_version)
|
||||||
|
self.version = server_version # for future use
|
||||||
|
display.vvv("Base API: %s" % self.baseurl)
|
||||||
|
|
||||||
def __auth_header(self):
|
def __auth_header(self):
|
||||||
token = self.token.get()
|
token = self.token.get()
|
||||||
if token is None:
|
if token is None:
|
||||||
|
|
Loading…
Reference in New Issue