Remove use of heat_watch_server_url
This deprecates the config option for removal and removes all its usage. Change-Id: If7dce02d1432d95cb1c9a3c6120e1c1287196836 Partial-Bug: #1743707
This commit is contained in:
parent
6d55417f80
commit
5bd856627a
@ -47,6 +47,9 @@ service_opts = [
|
|||||||
help=_('URL of the Heat waitcondition server.')),
|
help=_('URL of the Heat waitcondition server.')),
|
||||||
cfg.StrOpt('heat_watch_server_url',
|
cfg.StrOpt('heat_watch_server_url',
|
||||||
default="",
|
default="",
|
||||||
|
deprecated_for_removal=True,
|
||||||
|
deprecated_reason='Heat CloudWatch Service has been removed.',
|
||||||
|
deprecated_since='10.0.0',
|
||||||
help=_('URL of the Heat CloudWatch server.')),
|
help=_('URL of the Heat CloudWatch server.')),
|
||||||
cfg.StrOpt('instance_connection_is_secure',
|
cfg.StrOpt('instance_connection_is_secure',
|
||||||
default="0",
|
default="0",
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import six
|
|
||||||
from six.moves import urllib
|
|
||||||
|
|
||||||
from heatclient import client as hc
|
from heatclient import client as hc
|
||||||
from heatclient import exc
|
from heatclient import exc
|
||||||
@ -90,28 +88,5 @@ class HeatClientPlugin(client_plugin.ClientPlugin):
|
|||||||
config_url += '/'
|
config_url += '/'
|
||||||
return config_url
|
return config_url
|
||||||
|
|
||||||
def get_watch_server_url(self):
|
|
||||||
cfn_url = self.get_heat_cfn_url()
|
|
||||||
parsed_url = urllib.parse.urlparse(cfn_url)
|
|
||||||
host = parsed_url.hostname
|
|
||||||
port = parsed_url.port
|
|
||||||
# For ipv6 we need to include the host in brackets
|
|
||||||
if parsed_url.netloc.startswith('['):
|
|
||||||
host = "[%s]" % host
|
|
||||||
# The old url model, like http://localhost:port/v1
|
|
||||||
if port:
|
|
||||||
watch_api_port = (
|
|
||||||
six.text_type(cfg.CONF.heat_api_cloudwatch.bind_port))
|
|
||||||
replaced_netloc = ':'.join([host, str(watch_api_port)])
|
|
||||||
parsed_url = parsed_url._replace(netloc=replaced_netloc)
|
|
||||||
# The uwsgi url mode, like http://ip/heat-api-cfn/v1
|
|
||||||
else:
|
|
||||||
paths = parsed_url.path.split('/')
|
|
||||||
paths[1] = 'heat-api-cloudwatch'
|
|
||||||
replaced_paths = '/'.join(paths)
|
|
||||||
parsed_url = parsed_url._replace(path=replaced_paths)
|
|
||||||
|
|
||||||
return urllib.parse.urlunparse(parsed_url)
|
|
||||||
|
|
||||||
def get_insecure_option(self):
|
def get_insecure_option(self):
|
||||||
return self._get_client_option(CLIENT_NAME, 'insecure')
|
return self._get_client_option(CLIENT_NAME, 'insecure')
|
||||||
|
@ -395,21 +395,13 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||||||
|
|
||||||
if is_cfntools:
|
if is_cfntools:
|
||||||
heat_client_plugin = self.context.clients.client_plugin('heat')
|
heat_client_plugin = self.context.clients.client_plugin('heat')
|
||||||
watch_url = cfg.CONF.heat_watch_server_url
|
|
||||||
if not watch_url:
|
|
||||||
watch_url = heat_client_plugin.get_watch_server_url()
|
|
||||||
|
|
||||||
attachments.append((watch_url,
|
|
||||||
'cfn-watch-server', 'x-cfninitdata'))
|
|
||||||
|
|
||||||
cfn_md_url = heat_client_plugin.get_cfn_metadata_server_url()
|
cfn_md_url = heat_client_plugin.get_cfn_metadata_server_url()
|
||||||
attachments.append((cfn_md_url,
|
attachments.append((cfn_md_url,
|
||||||
'cfn-metadata-server', 'x-cfninitdata'))
|
'cfn-metadata-server', 'x-cfninitdata'))
|
||||||
|
|
||||||
# Create a boto config which the cfntools on the host use to know
|
# Create a boto config which the cfntools on the host use to know
|
||||||
# where the cfn and cw API's are to be accessed
|
# where the cfn API is to be accessed
|
||||||
cfn_url = urlparse.urlparse(cfn_md_url)
|
cfn_url = urlparse.urlparse(cfn_md_url)
|
||||||
cw_url = urlparse.urlparse(watch_url)
|
|
||||||
is_secure = cfg.CONF.instance_connection_is_secure
|
is_secure = cfg.CONF.instance_connection_is_secure
|
||||||
vcerts = cfg.CONF.instance_connection_https_validate_certificates
|
vcerts = cfg.CONF.instance_connection_https_validate_certificates
|
||||||
boto_cfg = "\n".join(["[Boto]",
|
boto_cfg = "\n".join(["[Boto]",
|
||||||
@ -418,10 +410,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||||||
"https_validate_certificates = %s" % vcerts,
|
"https_validate_certificates = %s" % vcerts,
|
||||||
"cfn_region_name = heat",
|
"cfn_region_name = heat",
|
||||||
"cfn_region_endpoint = %s" %
|
"cfn_region_endpoint = %s" %
|
||||||
cfn_url.hostname,
|
cfn_url.hostname])
|
||||||
"cloudwatch_region_name = heat",
|
|
||||||
"cloudwatch_region_endpoint = %s" %
|
|
||||||
cw_url.hostname])
|
|
||||||
attachments.append((boto_cfg,
|
attachments.append((boto_cfg,
|
||||||
'cfn-boto-cfg', 'x-cfninitdata'))
|
'cfn-boto-cfg', 'x-cfninitdata'))
|
||||||
|
|
||||||
|
@ -100,26 +100,6 @@ class ClientsTest(common.HeatTestCase):
|
|||||||
obj = self._client_cfn_url()
|
obj = self._client_cfn_url()
|
||||||
self.assertEqual("http://0.0.0.0:8000/v1/", obj.get_heat_cfn_url())
|
self.assertEqual("http://0.0.0.0:8000/v1/", obj.get_heat_cfn_url())
|
||||||
|
|
||||||
def test_clients_get_watch_server_url(self):
|
|
||||||
obj = self._client_cfn_url()
|
|
||||||
self.assertEqual("http://0.0.0.0:8003/v1/",
|
|
||||||
obj.get_watch_server_url())
|
|
||||||
|
|
||||||
def test_clients_get_watch_server_url_ipv6(self):
|
|
||||||
obj = self._client_cfn_url(use_ipv6=True)
|
|
||||||
self.assertEqual("http://[::1]:8003/v1/",
|
|
||||||
obj.get_watch_server_url())
|
|
||||||
|
|
||||||
def test_clients_get_watch_server_url_use_uwsgi_ipv6(self):
|
|
||||||
obj = self._client_cfn_url(use_uwsgi=True, use_ipv6=True)
|
|
||||||
self.assertEqual("http://[::1]/heat-api-cloudwatch/v1/",
|
|
||||||
obj.get_watch_server_url())
|
|
||||||
|
|
||||||
def test_clients_get_watch_server_url_use_uwsgi(self):
|
|
||||||
obj = self._client_cfn_url(use_uwsgi=True)
|
|
||||||
self.assertEqual("http://0.0.0.0/heat-api-cloudwatch/v1/",
|
|
||||||
obj.get_watch_server_url())
|
|
||||||
|
|
||||||
def test_clients_get_heat_cfn_metadata_url(self):
|
def test_clients_get_heat_cfn_metadata_url(self):
|
||||||
obj = self._client_cfn_url()
|
obj = self._client_cfn_url()
|
||||||
self.assertEqual("http://0.0.0.0:8000/v1/",
|
self.assertEqual("http://0.0.0.0:8000/v1/",
|
||||||
|
@ -363,8 +363,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
|
|||||||
"""Tests the build_userdata function."""
|
"""Tests the build_userdata function."""
|
||||||
cfg.CONF.set_override('heat_metadata_server_url',
|
cfg.CONF.set_override('heat_metadata_server_url',
|
||||||
'http://server.test:123')
|
'http://server.test:123')
|
||||||
cfg.CONF.set_override('heat_watch_server_url',
|
|
||||||
'http://server.test:345')
|
|
||||||
cfg.CONF.set_override('instance_connection_is_secure', False)
|
cfg.CONF.set_override('instance_connection_is_secure', False)
|
||||||
cfg.CONF.set_override(
|
cfg.CONF.set_override(
|
||||||
'instance_connection_https_validate_certificates', False)
|
'instance_connection_https_validate_certificates', False)
|
||||||
@ -374,7 +372,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
|
|||||||
self.assertIn("Content-Type: text/part-handler;", data)
|
self.assertIn("Content-Type: text/part-handler;", data)
|
||||||
self.assertIn("Content-Type: text/x-cfninitdata;", data)
|
self.assertIn("Content-Type: text/x-cfninitdata;", data)
|
||||||
self.assertIn("Content-Type: text/x-shellscript;", data)
|
self.assertIn("Content-Type: text/x-shellscript;", data)
|
||||||
self.assertIn("http://server.test:345", data)
|
|
||||||
self.assertIn("http://server.test:123", data)
|
self.assertIn("http://server.test:123", data)
|
||||||
self.assertIn("[Boto]", data)
|
self.assertIn("[Boto]", data)
|
||||||
|
|
||||||
@ -382,8 +379,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
|
|||||||
"""Don't add a custom instance user when not requested."""
|
"""Don't add a custom instance user when not requested."""
|
||||||
cfg.CONF.set_override('heat_metadata_server_url',
|
cfg.CONF.set_override('heat_metadata_server_url',
|
||||||
'http://server.test:123')
|
'http://server.test:123')
|
||||||
cfg.CONF.set_override('heat_watch_server_url',
|
|
||||||
'http://server.test:345')
|
|
||||||
data = self.nova_plugin.build_userdata({}, instance_user=None)
|
data = self.nova_plugin.build_userdata({}, instance_user=None)
|
||||||
self.assertNotIn('user: ', data)
|
self.assertNotIn('user: ', data)
|
||||||
self.assertNotIn('useradd', data)
|
self.assertNotIn('useradd', data)
|
||||||
@ -393,8 +388,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
|
|||||||
"""Add a custom instance user."""
|
"""Add a custom instance user."""
|
||||||
cfg.CONF.set_override('heat_metadata_server_url',
|
cfg.CONF.set_override('heat_metadata_server_url',
|
||||||
'http://server.test:123')
|
'http://server.test:123')
|
||||||
cfg.CONF.set_override('heat_watch_server_url',
|
|
||||||
'http://server.test:345')
|
|
||||||
data = self.nova_plugin.build_userdata({}, instance_user='ec2-user')
|
data = self.nova_plugin.build_userdata({}, instance_user='ec2-user')
|
||||||
self.assertIn('user: ', data)
|
self.assertIn('user: ', data)
|
||||||
self.assertIn('useradd', data)
|
self.assertIn('useradd', data)
|
||||||
|
@ -77,7 +77,6 @@ basic_configuration() {
|
|||||||
|
|
||||||
BRIDGE_IP=127.0.0.1
|
BRIDGE_IP=127.0.0.1
|
||||||
iniset $target DEFAULT heat_metadata_server_url "http://${BRIDGE_IP}:8000/"
|
iniset $target DEFAULT heat_metadata_server_url "http://${BRIDGE_IP}:8000/"
|
||||||
iniset $target DEFAULT heat_watch_server_url "http://${BRIDGE_IP}:8003/"
|
|
||||||
|
|
||||||
if detect_rabbit
|
if detect_rabbit
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user