Browse Source

Enable Keystone v3

The interface was not collecting all keystone v3 information passed
along the relation. This change adds the keystone v3 authentication
settings.

Avoid stestr failures due to lack of unit tests.

Change-Id: If7dfd6ec0c6b4e88497c372a37c9be9844845e70
master
David Ames 1 year ago
parent
commit
23b7635be7
4 changed files with 30 additions and 5 deletions
  1. 1
    0
      .gitignore
  2. 4
    0
      .gitreview
  3. 21
    2
      requires.py
  4. 4
    3
      tox.ini

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+.tox

+ 4
- 0
.gitreview View File

@@ -0,0 +1,4 @@
1
+[gerrit]
2
+host=review.openstack.org
3
+port=29418
4
+project=openstack/charm-interface-keystone-admin

+ 21
- 2
requires.py View File

@@ -45,18 +45,37 @@ class KeystoneRequires(RelationBase):
45 45
              u'service_username': u'admin',
46 46
              u'service_tenant_name': u'Admin',
47 47
              u'service_region': u'RegionOne'}
48
+       keystone v3 also provides
49
+            {api_version: "3"
50
+            service_project_domain_name: admin_domain
51
+            service_project_name: admin
52
+            service_protocol: http
53
+            service_region: RegionOne
54
+            service_user_domain_name: admin_domain}
48 55
         """
49 56
         convs = self.conversations()
50 57
         if len(convs) > 0:
51 58
             conv = convs[0]
52
-            return {
59
+            id_admin_data = {
53 60
                 'service_hostname': conv.get_remote('service_hostname'),
54 61
                 'service_port': conv.get_remote('service_port'),
55 62
                 'service_username': conv.get_remote('service_username'),
56 63
                 'service_password': conv.get_remote('service_password'),
57 64
                 'service_tenant_name': conv.get_remote('service_tenant_name'),
58
-                'service_region': conv.get_remote('service_region')
65
+                'service_region': conv.get_remote('service_region'),
59 66
             }
67
+            if conv.get_remote('api_version', u'2') > u'2':
68
+                id_admin_data['api_version'] = (
69
+                    conv.get_remote('api_version', u'2'))
70
+                id_admin_data['service_user_domain_name'] = (
71
+                    conv.get_remote('service_user_domain_name'))
72
+                id_admin_data['service_project_domain_name'] = (
73
+                    conv.get_remote('service_project_domain_name'))
74
+                id_admin_data['service_project_name'] = (
75
+                    conv.get_remote('service_project_name'))
76
+                id_admin_data['service_protocol'] = (
77
+                    conv.get_remote('service_protocol'))
78
+            return id_admin_data
60 79
         else:
61 80
             return {}
62 81
 

+ 4
- 3
tox.ini View File

@@ -1,5 +1,5 @@
1 1
 [tox]
2
-envlist = lint,py27
2
+envlist = pep8,py27
3 3
 skipsdist = True
4 4
 
5 5
 [testenv]
@@ -7,13 +7,14 @@ setenv = VIRTUAL_ENV={envdir}
7 7
          PYTHONHASHSEED=0
8 8
 install_command =
9 9
   pip install --allow-unverified python-apt {opts} {packages}
10
-commands = ostestr {posargs}
10
+whitelist_externals = true
11
+commands = true
11 12
 
12 13
 [testenv:py27]
13 14
 basepython = python2.7
14 15
 deps = -r{toxinidir}/test-requirements.txt
15 16
 
16
-[testenv:lint]
17
+[testenv:pep8]
17 18
 basepython = python2.7
18 19
 deps = -r{toxinidir}/test-requirements.txt
19 20
 commands = flake8 {posargs}

Loading…
Cancel
Save