It can no longer be assumed that a template string is in JSON format.
Change-Id: Id43b82a25e62f7c7868c1c51556c5bde94e7b132
from heat.api.aws import utils as api_utils
from heat.common import wsgi
from heat.engine import rpcapi as engine_rpcapi
+from heat.engine import format
import heat.engine.api as engine_api
from heat.engine import identifier
return exception.HeatMissingParameterError(detail=msg)
try:
- stack = json.loads(templ)
+ stack = format.parse_to_template(templ)
except ValueError:
msg = _("The Template must be a JSON document.")
return exception.HeatInvalidParameterValueError(detail=msg)
Example:
- >>> template = Template(json.load(template_path))
+ >>> template = Template(format.parse_to_template(template_path))
>>> parameters = Parameters('stack', template, {'KeyName': 'my_key'})
>>> resolve_static_data(template, parameters, {'Ref': 'KeyName'})
'my_key'
# License for the specific language governing permissions and limitations
# under the License.
-import json
-
from heat.common import exception
from heat.engine.resources import stack
-
+from heat.engine import format
from heat.openstack.common import log as logging
logger = logging.getLogger(__file__)
return p
def handle_create(self):
- templ = json.loads(mysql_template)
+ templ = format.parse_to_template(mysql_template)
self.create_with_template(templ)
def FnGetAtt(self, key):
# License for the specific language governing permissions and limitations
# under the License.
-import json
-
from heat.common import exception
+from heat.engine import format
from heat.engine.resources import stack
from novaclient.exceptions import NotFound
return '%s%s%s%s\n' % (gl, frontend, backend, '\n'.join(servers))
def handle_create(self):
- templ = json.loads(lb_template)
+ templ = format.parse_to_template(lb_template)
if self.properties['Instances']:
md = templ['Resources']['LB_instance']['Metadata']
save it to the db.
rely on the cfn-hup to reconfigure HAProxy
'''
- templ = json.loads(lb_template)
+ templ = format.parse_to_template(lb_template)
cfg = self._haproxy_config(templ, inst_list)
md = self.nested()['LB_instance'].metadata
import json
from heat.common import exception
+from heat.engine import format
from heat.engine.resources import resource
from heat.engine import parser
def handle_create(self):
response = urllib2.urlopen(self.properties[PROP_TEMPLATE_URL])
- template = json.load(response)
+ template = format.parse_to_template(response)
self.create_with_template(template)