Browse Source

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
changes/61/534661/4
rabi 4 years ago
parent
commit
5bd856627a
  1. 3
      heat/common/config.py
  2. 25
      heat/engine/clients/os/heat_plugin.py
  3. 15
      heat/engine/clients/os/nova.py
  4. 20
      heat/tests/clients/test_clients.py
  5. 7
      heat/tests/clients/test_nova_client.py
  6. 1
      install.sh

3
heat/common/config.py

@ -47,6 +47,9 @@ service_opts = [
help=_('URL of the Heat waitcondition server.')),
cfg.StrOpt('heat_watch_server_url',
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.')),
cfg.StrOpt('instance_connection_is_secure',
default="0",

25
heat/engine/clients/os/heat_plugin.py

@ -12,8 +12,6 @@
# under the License.
from oslo_config import cfg
import six
from six.moves import urllib
from heatclient import client as hc
from heatclient import exc
@ -90,28 +88,5 @@ class HeatClientPlugin(client_plugin.ClientPlugin):
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):
return self._get_client_option(CLIENT_NAME, 'insecure')

15
heat/engine/clients/os/nova.py

@ -395,21 +395,13 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
if is_cfntools:
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()
attachments.append((cfn_md_url,
'cfn-metadata-server', 'x-cfninitdata'))
# 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)
cw_url = urlparse.urlparse(watch_url)
is_secure = cfg.CONF.instance_connection_is_secure
vcerts = cfg.CONF.instance_connection_https_validate_certificates
boto_cfg = "\n".join(["[Boto]",
@ -418,10 +410,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
"https_validate_certificates = %s" % vcerts,
"cfn_region_name = heat",
"cfn_region_endpoint = %s" %
cfn_url.hostname,
"cloudwatch_region_name = heat",
"cloudwatch_region_endpoint = %s" %
cw_url.hostname])
cfn_url.hostname])
attachments.append((boto_cfg,
'cfn-boto-cfg', 'x-cfninitdata'))

20
heat/tests/clients/test_clients.py

@ -100,26 +100,6 @@ class ClientsTest(common.HeatTestCase):
obj = self._client_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):
obj = self._client_cfn_url()
self.assertEqual("http://0.0.0.0:8000/v1/",

7
heat/tests/clients/test_nova_client.py

@ -363,8 +363,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
"""Tests the build_userdata function."""
cfg.CONF.set_override('heat_metadata_server_url',
'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_https_validate_certificates', False)
@ -374,7 +372,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
self.assertIn("Content-Type: text/part-handler;", data)
self.assertIn("Content-Type: text/x-cfninitdata;", 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("[Boto]", data)
@ -382,8 +379,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
"""Don't add a custom instance user when not requested."""
cfg.CONF.set_override('heat_metadata_server_url',
'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)
self.assertNotIn('user: ', data)
self.assertNotIn('useradd', data)
@ -393,8 +388,6 @@ class NovaClientPluginUserdataTest(NovaClientPluginTestCase):
"""Add a custom instance user."""
cfg.CONF.set_override('heat_metadata_server_url',
'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')
self.assertIn('user: ', data)
self.assertIn('useradd', data)

1
install.sh

@ -77,7 +77,6 @@ basic_configuration() {
BRIDGE_IP=127.0.0.1
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
then

Loading…
Cancel
Save