"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "magnum/drivers/heat/template_def.py" between
magnum-8.0.0.tar.gz and magnum-8.1.0.tar.gz

About: OpenStack Magnum makes container orchestration engines such as Docker and Kubernetes available as first class resources in OpenStack.
The "Stein" series (latest release).

template_def.py  (magnum-8.0.0):template_def.py  (magnum-8.1.0)
skipping to change at line 19 skipping to change at line 19
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import abc import abc
import ast import ast
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
import re
import requests import requests
import six import six
from six.moves.urllib import parse as urlparse
from magnum.common import clients from magnum.common import clients
from magnum.common import exception from magnum.common import exception
from magnum.common import keystone from magnum.common import keystone
from magnum.common import utils from magnum.common import utils
import magnum.conf import magnum.conf
from requests import exceptions as req_exceptions from requests import exceptions as req_exceptions
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
skipping to change at line 305 skipping to change at line 303
value = node_value.get('value', None) value = node_value.get('value', None)
if value is None: if value is None:
raise exception.InvalidClusterDiscoveryURL( raise exception.InvalidClusterDiscoveryURL(
discovery_url=discovery_url) discovery_url=discovery_url)
elif int(value) != expect_size: elif int(value) != expect_size:
raise exception.InvalidClusterSize( raise exception.InvalidClusterSize(
expect_size=expect_size, expect_size=expect_size,
size=int(value), size=int(value),
discovery_url=discovery_url) discovery_url=discovery_url)
def get_proxies(self, url, cluster_template): def get_discovery_url(self, cluster):
proxies = dict()
if cluster_template is None:
return proxies
hostname = urlparse.urlparse(url).netloc.partition(":")[0]
if hasattr(cluster_template, 'no_proxy') and \
cluster_template.no_proxy and \
(cluster_template.no_proxy == '*' or
re.search('\\b%s\\b' % re.escape(hostname),
cluster_template.no_proxy, re.I)):
LOG.debug('Bypass proxy, because discovery hostname is listed in'
' cluster template no_proxy variable')
else:
if hasattr(cluster_template, 'http_proxy'):
proxies['http'] = cluster_template.http_proxy
if hasattr(cluster_template, 'https_proxy'):
proxies['https'] = cluster_template.https_proxy
return proxies
def get_discovery_url(self, cluster, cluster_template=None):
if hasattr(cluster, 'discovery_url') and cluster.discovery_url: if hasattr(cluster, 'discovery_url') and cluster.discovery_url:
if getattr(cluster, 'master_count', None) is not None: if getattr(cluster, 'master_count', None) is not None:
self.validate_discovery_url(cluster.discovery_url, self.validate_discovery_url(cluster.discovery_url,
cluster.master_count) cluster.master_count)
else: else:
self.validate_discovery_url(cluster.discovery_url, 1) self.validate_discovery_url(cluster.discovery_url, 1)
discovery_url = cluster.discovery_url discovery_url = cluster.discovery_url
else: else:
discovery_endpoint = ( discovery_endpoint = (
CONF.cluster.etcd_discovery_service_endpoint_format % CONF.cluster.etcd_discovery_service_endpoint_format %
{'size': cluster.master_count}) {'size': cluster.master_count})
try: try:
proxies = self.get_proxies(discovery_endpoint, discovery_request = requests.get(discovery_endpoint)
cluster_template)
discovery_request = requests.get(discovery_endpoint,
proxies=proxies)
if discovery_request.status_code != requests.codes.ok: if discovery_request.status_code != requests.codes.ok:
raise exception.GetDiscoveryUrlFailed( raise exception.GetDiscoveryUrlFailed(
discovery_endpoint=discovery_endpoint) discovery_endpoint=discovery_endpoint)
discovery_url = discovery_request.text discovery_url = discovery_request.text
except req_exceptions.RequestException as err: except req_exceptions.RequestException as err:
LOG.error(err) LOG.error(err)
raise exception.GetDiscoveryUrlFailed( raise exception.GetDiscoveryUrlFailed(
discovery_endpoint=discovery_endpoint) discovery_endpoint=discovery_endpoint)
if not discovery_url: if not discovery_url:
raise exception.InvalidDiscoveryURL( raise exception.InvalidDiscoveryURL(
 End of changes. 4 change blocks. 
26 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)