Andrew Bogott has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/345638 )
Change subject: dns-floating-ip-updater.py: Use keystone api v3
......................................................................
dns-floating-ip-updater.py: Use keystone api v3
This will allow us to use novaobserver creds rather than novaadmin.
The v2 api doesn't properly observer policy.json and rejects novaobserver
for things that should be permitted.
Bug: T158650
Change-Id: I4720394615ec233b34a5aba8edb34d5762aa915d
---
M modules/role/files/labs/dns-floating-ip-updater.py
1 file changed, 14 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/38/345638/1
diff --git a/modules/role/files/labs/dns-floating-ip-updater.py
b/modules/role/files/labs/dns-floating-ip-updater.py
old mode 100644
new mode 100755
index 799e9c8..653dd7c
--- a/modules/role/files/labs/dns-floating-ip-updater.py
+++ b/modules/role/files/labs/dns-floating-ip-updater.py
@@ -4,9 +4,9 @@
import re
import yaml
-import keystoneclient.session as keystonesession
-import keystoneclient.auth.identity.v2 as keystoneauth
-import keystoneclient.client as keystoneclient
+from keystoneclient.auth.identity import generic
+from keystoneclient import session as keystone_session
+from keystoneclient.v3 import client as keystone_client
import novaclient.client as novaclient
import designateclient.v2.client as designateclient
@@ -37,25 +37,27 @@
def getKeystoneSession(config, project):
- return keystonesession.Session(auth=keystoneauth.Password(
+ auth = generic.Password(
auth_url=config['nova_api_url'],
username=config['username'],
password=config['password'],
- tenant_name=project
- ))
+ user_domain_name='Default',
+ project_domain_name='Default',
+ project_name=project)
-keystone_admin_session = getKeystoneSession(config,
config['admin_project_name'])
-keystone_client = keystoneclient.Client(
- session=keystone_admin_session,
- endpoint=config['nova_api_url']
-)
+ return keystone_session.Session(auth=auth)
+
+
+observer_session = getKeystoneSession(config, config['admin_project_name'])
+keystone_client = keystone_client.Client(
+ session=observer_session, interface='public',
connect_retries=5)
keystone_sessions = {}
project_main_zone_ids = {}
public_addrs = {}
existing_As = []
# Go through every tenant
-for tenant in keystone_client.tenants.list():
+for tenant in keystone_client.projects.list():
keystone_sessions[tenant.name] = getKeystoneSession(config, tenant.name)
server_addresses = {}
--
To view, visit https://gerrit.wikimedia.org/r/345638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4720394615ec233b34a5aba8edb34d5762aa915d
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits