Moves the exception from inside the engine code
to the common code so that we can use it in the
API fault middleware.
Change-Id: I017b95153c358829501f6a5740918cdb005fb32f
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I8f764e9ba46a4e2055be61eb0fe97d155ab1c70e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Six is in use to help us to keep support for python 2.7.
Since the ussuri cycle we decide to remove the python 2.7
support so we can go ahead and also remove six usage from
the python code.
Review process and help
-----------------------
Removing six introduce a lot of changes and an huge amount of modified files
To simplify reviews we decided to split changes into several patches to avoid
painful reviews and avoid mistakes.
To review this patch you can use the six documentation [1] to obtain help and
understand choices.
Additional informations
-----------------------
Changes related to 'six.b(data)' [2]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
six.b [2] encode the given datas in latin-1 in python3 so I did the same
things in this patch.
Latin-1 is equal to iso-8859-1 [3].
This encoding is the default encoding [4] of certain descriptive HTTP
headers.
I suggest to keep latin-1 for the moment and to move to another encoding
in a follow-up patch if needed to move to most powerful encoding (utf8).
HTML4 support utf8 charset and utf8 is the default charset for HTML5 [5].
Note that this commit message is autogenerated and not necesserly contains
changes related to 'six.b'
[1] https://six.readthedocs.io/
[2] https://six.readthedocs.io/#six.b
[3] https://docs.python.org/3/library/codecs.html#standard-encodings
[4] https://www.w3schools.com/charsets/ref_html_8859.asp
[5] https://www.w3schools.com/html/html_charset.asp
Patch 28 of a serie of 28 patches
six fully removed now!
Thank you six for the rendered services!
Change-Id: If44ee4b565cc9390fa0422fba4dda080b4f90b98
Ensure that if the user provides non-ASCII descriptions or e.g. allowed
values in a template, that we can print them correctly wherever they
appear in API output (such as in error messages). Also allow all default
error messages to be localised.
Change-Id: Id2c309a33634b35a4f1f8b7ddf252db22bc46625
Story: #2003096
Task: 23188
We don't need to maintain a list of versions supported in nova client
plugin. Supporting a latest microversion means supporting all
versions earlier.
Change-Id: I5df1ccd3ebf47b0772c903dbae0613b4f8041634
Story; #1764757
Task: 17358
Raise a proper error when something wrong is passed in a depends_on
field.
Change-Id: I9d27cc48a7f4c050fcc89ab5d07b19329d228955
Story: 2002544
Task: 22103
This refactors the building of schema from parameter validation to use a
new method (which doesn't keep stacks in memory), and use that new
method for providing proper schema for resource group when the size is
0.
Change-Id: Id3020e8f3fd94e2cef413d5eb9de9d1cd16ddeaa
Closes-Bug: #1751074
Closes-Bug: #1626025
We used to validate intrinsic functions in the ResourceDefinition by just
passing it to function.validate(). That worked when it also acted as a
CloudFormation template snippet but, since that behaviour was removed by
2c6fc7bcd6, that call now does nothing. This
replaces it with a validate() method on the ResourceDefinition itself.
This also improves path reporting for validation errors in deletion or
update policies.
Change-Id: I58c788002136ddf9bded309366e2072823b3ac77
Closes-Bug: #1732798
This is to enable preview of the merged environment
without merging the environment on the client side.
Related-Bug: #1635409
Change-Id: I7ec3af729a65164230153021f438bf226cc5e858
In some scenarios, it is required to categorize the parameter.
Associating tags with the parameter, it is will be easy to
categorize the parameter and add simple validations to users.
This patch introduces a new attribute 'tags' with the parameters,
which is a list of strings.
Change-Id: I20fc95d606b0b8a08d3b46bf33f4860bff49c74f
We ought to iterate over the dependency list in the validate_template call,
to check for any circular dependencies. This check was removed by
d12cbe7959 in order to avoid trying to
calculate implicit dependencies added by resource plugins (as e.g. many
Neutron resources do) at a time when we don't have sufficient data to do a
good job of it anyway.
However, the previous patch d12cbe7959 split
apart the calculation of explicit and implicit dependencies, so we can
easily do this while still checking for circular references in the
explicit dependencies. This patch splits the dependency calculation into
two phases - the first using only data available from the template, and the
second querying the resources for implicit dependencies.
Use strict_validate = False as the criterion for when to avoid calculating
implicit dependencies, since this corresponds exactly to when we don't have
enough data to do so.
Change-Id: I21c63dcc8d1cad20dbc237b472670753779b0ff8
Closes-bug: #1691575
When we choose only validate resource template, and external resource
id was set, we should consider that external resource template is
valid (since we only required `external_id` from that resource
template format). So the result of this validate will be None
(template validate passed).
Closes-Bug: #1702977
Change-Id: I8b33c957a7185a0f52356f412b13609ba1a7b469
To be able to handle parameter defaults properly, we need to load all
possible templates when merging the environments, to generate an
approximate schema.
Closes-Bug: #1669571
Change-Id: Idab781d3e6af92990c357a727aa60ec0aa8f5f05
ParameterGroups is added only for the parent stack and all
the nested stack are missing this information. Added
ParameterGroups for all the nested stack also, if present.
Change-Id: I032144733bde916f8de8644121b9fb1ef29baef2
Check if image_identifier can be image UUID before calling glance-api.
This could save some time if image name is supplied.
Change-Id: Ied531f35d723a818ab3387582a53a2a96dfb7668
In heat, some unit tests still use mox3,
which will make the test speed more slower,
so I decide to remove it.
The file: heat/tests/test_validate.py
Change-Id: I5ca027d3d47ba072039eb5874b87de7703bdb0a4
Rather than passing around an explicit flag to say whether a Stack object
should parse its outputs during initialisation, just parse them the first
time they are actually needed.
Change-Id: I4b8a84883902261592fbfe8d5d5b1892702a3d03
This is only working more or less by coincidence at the moment, so add
tests to ensure that it doesn't get broken by future changes.
Change-Id: I9d78d2b4f8adcd0ba9d6929c62e3975688498aaa
Now error with a path to the problem part of template will be
raised while parsing template. It affects both resource
definitions and outputs parsing. Note, that during parsing of
template we only instantiate the function objects, but doesn't
make any function validation. The function validation still
doesn't return any path with error. This will be fixed in the
other patch.
Change-Id: Ic5b960e79a54e88087803bc092f614911d7e995a
Now if extension is not available, user gets
message 'Service endpoint not in service catalog'
which is incorrect. Patch corrects this behavior
and adds improved messages with more info.
Change-Id: I9b6c0d2921519590ef105be35e31db29cd1e3ecc
It enhance the validate_template to ignore the given
set of errors while the template is validated.
implements blueprint heat-template-validate-improvements
Change-Id: Id6d85664ae576b6a5d18dbbe84ddf0122fbfaa40
Use get interface and custom find functions to look for
images by id/name. Find interface is now implemented in
the client plugin itslef, as glanceclient v2 does not
support it. Once it's implemented in galnceclient v2,
we can leverage images.find interface directly.
This also leverges openstack.common.apicient.exceptions.
Change-Id: Ibf85495b9d5533c759c4e63284806f11e6e45413
Currently the validation code for template-validate is different to
that used for create/preview/update, which can lead to inconsistent
results as the implementations have diverged.
So instead align more closely with the actual validation, which
should also enable easier validation of nested stacks which is
currently not possible.
Change-Id: Ibf93a170ab381a42a46ea414c3b134cbe0c3f232
Closes-Bug: #1467573
Currently we redefine the value of Default when a user value is
provided, which means the data returned doesn't match the schema
defined in the template. Instead always return the actual default
and add a "Value" key that contains the user value, if provided.
Change-Id: If4ed0b733d4e61c84167063c36cdcb234b001136
Closes-Bug: #1497310
When validate_template() method is called with unavailable resource type,
it will fails the template validation.
Change-Id: Id141b7e63d7a58fade8a29d0dd5c6a1f9c847f5e
Closes-Bug: #1473025
* use hashlib.algorithms_available in PY3 and hashlib.algorithms in PY2
* use e.args[0] instead of six.text_type(e) which will otherwise
result in the unicode literal being flattened.
* add stubs to prevent actual API calls in tests.
* constraint the test template to help in more accurate testing which
otherwise results in iterating through other unnecessary items.
partial blueprint heat-python34-support
Change-Id: I7480555330161cf6f197c83f3245685511284307
This produces a nested exception like:
'ValueError: resources.nested.resources.my_server: it is broken, sorry'
This re-uses the path mechanism that StackValidationFailed exception
uses.
Change-Id: Id5204c15ee96784e04522ab3c5a8e66900f9a1d3
Closes-bug: 1459837
There are too many **NotFound exception classes defined
in exception.py. This patch will define a general notfound
exception: EntityNotFound. And will use it instead of
ImageNotFound exception.
Change-Id: I2a09637be97905548b29673273e8579c69d42d52
Closes-Bug: #1461343
This fix adds validation to raise error when the parameter_groups
is not a list and parameters in a parameter_group is not a list.
Change-Id: I35cdca9ce07522b5dbcfcf02d2c30393a4c15d1f
Partial-Bug: #1454559
Use unittest2.assertWarnsRegex() for making sure we generate the
required warnings.
Use WarningsCapture to not print the other repeated warns to the
console.
Change-Id: I7223f8956394208eaf2eb8a1d651ba1425128bc9
Classes in parser.py are already split to stack.py and
template.py, it's not recommended to import it.
Closes-Bug: #1442011
Change-Id: Ia8cc0ca07e7926fe8b7d9f5c89b39053a799e689
In some cases, there is no information about resource and
section, where Property error raised. This patch improves
StackValidationFailed msg, so this msg look like "Property
error : resource_name.section_name.key_name: error_msg", where
section_name is section, where Property error raised, e.g.
'update_policy'.
Change-Id: Iab2a6acdec254b39983de420ab03f994cff48d89
Closes-bug: #1358512
When we moved parameters from the stack table to the template table
we did it in a "flexible" way, but this led to some difficult to
diagnose problems. So this patch totally removes "env" as an argument
to the Stack class to make absolutely sure that we are doing this
correctly. I came across these bugs when rebasing decouple-nested.
- env was not getting passed into instance group make_templates()
- template deepcopy was not working correctly (causing some problems
when deleting backup stacks)
Change-Id: I85cfb01c68ff5a44e2ff4f6e446870efb7205933
We should check resource attributes' types in validate method
for preventing stack creation with incorrect resources. So
this patch splits resource_definitions() methods on
validate_resource_definitions() and resource_definitions()
methods and add validate_resource_definitions() to Stack.validate
method.
Change-Id: I16b35fc105154d9391f64285e90c396537fe3bb7
Partial-bug: #1397969
Use parentheses instead of backslash for line continuation.
Plus, usage of escaped quotes in long strings is avoided where it makes
sense.
Change-Id: If2e78012b85a4430c6f03f65784cac2d032cf116