Created
May 5, 2020 21:56
-
-
Save knikolla/e21633fcf3331298325edfd113a0c117 to your computer and use it in GitHub Desktop.
Finds and replaces a term in OpenStack endpoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script finds and replaces a term in the urls of endpoints. | |
# This is useful because you cannot install Devstack with a | |
# hostname or domain name, so devstack gets installed with an ip | |
# and then the script replaces that with a hostname. | |
import openstack | |
openstack.enable_logging(debug=False) | |
cloud = openstack.connect(cloud='devstack') | |
search = "http://10.0.0.27" | |
replace = "http://devstack" | |
endpoints = cloud.list_endpoints() | |
for endpoint in endpoints: | |
url = endpoint['url'].replace(search, replace) | |
cloud.update_endpoint(endpoint['id'], url=url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment