Support --os-cacert

* Rename --ca-file to --os-cacert (--ca-file deprecated for
  backward compatibility)
* Add cacert to keystoneclient initialization to verify the
  keystone server certificate

This aligns glanceclient with keystoneclient for option naming
and the use of TLS for the keystone auth connection.  It does not
change the use of TLS/SSL for the glance connection.

Change-Id: If8b05655aea5f3c62612d77bf947dd790f77eddf
This commit is contained in:
Dean Troyer
2012-12-07 11:21:11 -06:00
committed by Brian Waldon
parent 2500e69b22
commit 4781da7007
3 changed files with 30 additions and 22 deletions
+12 -12
View File
@@ -33,12 +33,12 @@ class TestVerifiedHTTPSConnection(unittest.TestCase):
"""
key_file = os.path.join(TEST_VAR_DIR, 'privatekey.key')
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
ca_file = os.path.join(TEST_VAR_DIR, 'ca.crt')
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
try:
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
key_file=key_file,
cert_file=cert_file,
ca_file=ca_file)
cacert=cacert)
except exc.SSLConfigurationError:
self.fail('Failed to init VerifiedHTTPSConnection.')
@@ -47,11 +47,11 @@ class TestVerifiedHTTPSConnection(unittest.TestCase):
Test VerifiedHTTPSConnection: absense of SSL key file.
"""
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
ca_file = os.path.join(TEST_VAR_DIR, 'ca.crt')
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
try:
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
cert_file=cert_file,
ca_file=ca_file)
cacert=cacert)
self.fail('Failed to raise assertion.')
except exc.SSLConfigurationError:
pass
@@ -61,11 +61,11 @@ class TestVerifiedHTTPSConnection(unittest.TestCase):
Test VerifiedHTTPSConnection: absense of SSL cert file.
"""
key_file = os.path.join(TEST_VAR_DIR, 'privatekey.key')
ca_file = os.path.join(TEST_VAR_DIR, 'ca.crt')
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
try:
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
key_file=key_file,
ca_file=ca_file)
cacert=cacert)
except:
self.fail('Failed to init VerifiedHTTPSConnection.')
@@ -75,11 +75,11 @@ class TestVerifiedHTTPSConnection(unittest.TestCase):
"""
key_file = os.path.join(TEST_VAR_DIR, 'badkey.key')
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
ca_file = os.path.join(TEST_VAR_DIR, 'ca.crt')
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
try:
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
cert_file=cert_file,
ca_file=ca_file)
cacert=cacert)
self.fail('Failed to raise assertion.')
except exc.SSLConfigurationError:
pass
@@ -90,11 +90,11 @@ class TestVerifiedHTTPSConnection(unittest.TestCase):
"""
key_file = os.path.join(TEST_VAR_DIR, 'privatekey.key')
cert_file = os.path.join(TEST_VAR_DIR, 'badcert.crt')
ca_file = os.path.join(TEST_VAR_DIR, 'ca.crt')
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
try:
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
cert_file=cert_file,
ca_file=ca_file)
cacert=cacert)
self.fail('Failed to raise assertion.')
except exc.SSLConfigurationError:
pass
@@ -105,11 +105,11 @@ class TestVerifiedHTTPSConnection(unittest.TestCase):
"""
key_file = os.path.join(TEST_VAR_DIR, 'privatekey.key')
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
ca_file = os.path.join(TEST_VAR_DIR, 'badca.crt')
cacert = os.path.join(TEST_VAR_DIR, 'badca.crt')
try:
conn = http.VerifiedHTTPSConnection('127.0.0.1', 0,
cert_file=cert_file,
ca_file=ca_file)
cacert=cacert)
self.fail('Failed to raise assertion.')
except exc.SSLConfigurationError:
pass