The abstract base classes previously defined in 'collections' were moved
to 'collections.abc' in 3.3. The aliases will be removed in 3.10.
Preempt this change now with a simple find-replace:
$ ag -l 'collections.($TYPES)' | \
xargs sed -i 's/\(collections\)\.\($TYPES\)/\1.abc.\2/g'
Where $TYPES is the list of moved ABCs from [1].
[1] https://docs.python.org/3/library/collections.abc.html
Change-Id: Ia282479bb1d466bd2189ebb21b51d91e89b9581e
Signed-off-by: Stephen Finucane <stephenfin@redhat.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 4 of a serie of 28 patches
Change-Id: I871c2dad10abc35790e730c7c4c5272f499b7623
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 3 of a serie of 28 patches
Change-Id: If6e66839c128dde5fb80d90155dedb598da8d53b
We always check that a properties schema is valid at the time that it is
created. Do the same for the attributes schema. This will catch programming
errors in the writing of Resource plugins.
Change-Id: I8119aec30b83f1f9e711013a60a828ae4a8337c7
Story: #2003915
Previously, all caching of attribute values was done via the Attributes
object. However, some resource types override Resource.get_attribute() to
do custom handling of the trailing attribute path or dynamic attribute
names, and in these cases the resulting values were not cached (since they
don't go through the Attributes object).
This patch adds a caching step for these resources:
* OS::Senlin::Cluster
* OS::Heat::ResourceChain
* OS::Heat::ResourceGroup
* OS::Heat::AutoscalingGroup
* OS::Heat::SoftwareDeployment
* OS::Heat::SoftwareDeploymentGroup
* TemplateResource
* AWS::CloudFormation::Stack
Change-Id: I07ac22cc4370a79bd8712e2431fa3272115bc0eb
Co-Authored-By: Crag Wolfe <cwolfe@redhat.com>
Partial-Bug: #1660831
This code was never used for anything, as the rest of the patch series
never landed and was abandoned.
This reverts commit 15e52ff5e9.
Change-Id: I7d1a22753e8de1d3adf127c14516ebd667513bfa
Store resource attributes that may be cached in the DB, saving the
cost of re-resolving them later. This works for most resources,
specifically those that do not override the get_attribute() method.
Change-Id: I71f8aa431a60457326167b8c82adc03ca750eda6
Partial-Bug: #1660831
To generate its NodeData, a Resource must know which of its attributes
other parts of the template have dependencies on, which it determines by
asking the intrinsic functions in the template. Currently, the get_attr
function when used with no arguments depends on all of the attributes of
the resource (except 'show'), and it obtains this list from the Resource
itself (via the attributes_schema). This presents a chicken-and-egg problem
if we want to give Functions access only to a ResourceProxy based on the
NodeData.
Resolve this by returning a constant sentinel value (indicating that all
attributes are required) to the Resource, which can determine for itself
what attributes it has.
Change-Id: If209b589278fe1facb06e157fe76209fdd42a8a2
Partially-Implements: blueprint stack-definition
This defines clearly the API through which Template/Function plugins
may access data about the stack. That allows us to ensure that we don't
accidentally access data in a highly inefficient manner, and third-party
plugin developers to have confidence that the interface they're using is
stable and won't change without a multi-cycle deprecation process with
ample warning.
Change-Id: I7a67700685770d6d5b9c811e72a8b21221400092
Partially-Implements: blueprint stack-definition
When generating a template to act as a facade for an existing resource
type, include an OS::stack_id output so that doing get_resource on the
facade resource will return the physical ID of the inner resource.
Change-Id: I257e9cc2eefd2cb8153e94cd05b21fed4b03c6c7
Hidden properties and attributes shouldn't be presented
in output of "heat resource-type-template".
Closes-Bug: #1601921
Change-Id: I7d20cd4119b9001094f7b503c7c0940f93287f6e
If we use unicode as resource name or parameter,
we are likely to encounter unicode problems.
This patch aims to fix unicode problems, and
there are several things to be clear:
1. For the class wrap with six.python_2_unicode_compatible, in
python2 their original __str__ function will map to __unicode__,
and new __str__ function comes from __unicode__.encode.
So we should always return unicode in __str__() if wrap
with python_2_unicode_compatible.
2. python_2_unicode_compatible will not handle __repr__,
__repr__ should return str in all versions of python.
Co-Authored-By: Ethan Lynn <xjunlin@cn.ibm.com>
Closes-Bug: #1524194
Change-Id: Ib4af43d153e0edf9d66308bf8e7b93a3be501d2e
Some resources (software deployment, template resources, etc)
doesn't have static attribute scheme. So when we are trying
to output attributes for such resources the output always
returns None or null. So the patch support this functionality
with the new type of attributes: dynamic scheme attributes.
They allow to resolve dynamic attributes for resource outputs
and fetch such info as nested stack attrs or
software deployment outputs.
The next patch will enable usage of dynamic scheme attributes
for heat resource.
Change-Id: I474addad0bbfe16aa5c562f2d6025c52f175dd4f
Partial-Bug: #1470675
attribute_schema of Resource class sometimes used directly without
creating instance. It allowed to situation, when attribute_schema is not
updated by base attribute.
This patch adds base_attributes_schema dictionary for these cases.
Also added same approach for resource_facade and updated tests.
Closes-Bug: #1481020
Change-Id: I104dae2fa3f3394195c1fd9bbed1902a9e4ba31f
Join method expects list, but six.itervalues(self._attributes) returns
a Attribute instance, so we should use own __iter__ method for building
list of values.
Closes-Bug: #1473974
Change-Id: I7c5d4a5a8d0142156c3416347940b9e90ed8df5c
After commit I0f33afe9fac835da9041ff48695bb8cd18660383
some attributes have Bollean type which is missed in
the attributes schema.
Change-Id: I309c5a02b86dc2c8567bd8dfb43f10b31e89dcf8
Add type field to the schema of the heat resources.
Also added Integer type to attributes schema.
Change-Id: Icd09f28a29a52be1904f76887a37c7f17786c4a6
Implements: blueprint add-type-in-attributes-schema
Fix warning error message in unittests log, which was added in patch
Ie881a1bdb88f4bcb1c03c037bcedf2a328d5d41c:
"heat/engine/attributes.py:80: SyntaxWarning: assertion is always true,
perhaps remove parentheses?"
Change-Id: I165d3a1f4e281debd8afb390520f18fc59084b87
This change is a part of changes discussed here:
https://etherpad.openstack.org/p/YVR-heat-liberty-deprecation
- Removed deprecation warning
- Removed hook for old attribute schema
- Re-factored test for type property of attribute schema
Change-Id: Ie48754943386755224a4e19d87bbd083b1b91d1b
Add data type for the attributes. This will help
1) validating the attibute against its type
2) resource-schema api will show the attribute type
3) template authors will know what type of value to
expect making indexing and mapping easier
4) generating docs for the attribute type
Implements: blueprint add-type-in-attributes-schema
Change-Id: Ifc92c57ec1ddd2ab5f810587a1d33e762308dd8a
Currently heat supports to create CFN template based on
the given resource type. And this patch adds an option
to allow user to specify template type to generate(support
HOT template at the same time).
blueprint support-to-generate-hot-templates
Change-Id: I55cfb9b0f87e638350f2f6367fb399d772fff7e1
* Use six.moves.reduce
* Update numliteral from 0L to 0
* Use open() instead of file()
* Use rich comparison methods instead of cmp()
partial blueprint heat-python34-support
Change-Id: I9ffd85645563192b5d6124f8dbb71c24245eefc4
For python3 compatible, using six.string_types instead of
basestring(). six.string_types represent basestring in
python2 and str in python3.
Change-Id: Ib4ba3d164f782601944023b99d6cc1ee2763ee85
Since i18n.install() is deprecated, remove it from heat codes and
import i18n._() to where it needed.
blueprint oslo-i18n
Change-Id: Icefada18b5a33112b425cd90d31d3a6a5f06188a
Move the code to select particular keys/indices from an attribute value out
of the get_attr intrinsic functions and into the attributes module as a
separate function.
Change-Id: I16135159027cc52e8da74a4b5863fc8a8595d582
The default caching mode cache_local will return the previously
resolved value if it is available.
Whenever any resource changes state, all resource attribute caches
are cleared just in case the state change has side-effects in
other resources.
The caching mode cache_none performs no caching, and is chosen
for attributes which are one of the following:
* Derived from any resource's metadata, resource data or resource_id
* An API call which returns a secret
Caching currently only exists for the duration of the parser.Stack
object, but there is future potential for a caching mode which
caches attributes spanning multiple requests.
Closes-Bug: #1321970
Change-Id: I01bf2983b726f0e81a2b8d5be94627353bdeb406
There is last patch to migrate on new attribute Schema.
The main changes are:
- Deprecation warning was added in from_attribute function.
If attribute have old format, it will be converted to new schema format
and Deprecation warning will be raised.
- Translation to new Schema was added in function schema_from_outputs.
- All generic resources have been changed and use new Schema class now.
- Some others tests have been fixed and use new Schema class now.
Change-Id: Icf92f2d275a86a13c656b0e74b725a442db3e532
Closes-Bug: #1307319
This patch introduces simple schema class for attributes.
There are two options avaliable for this schema:
- description
- support status
It gives ability for adding support status for each attribute.
Change-Id: I46cbf776f315cbe6414005cbee65da1cefdc5f7d
Closes-Bug: #1305584
In addition to using TemplateResource as a means to override another Resource
implementation, this allows template authors to specify a template url
as the Type of resource directly. This allows a user to define new Resource
implementations in addition to overriding existing ones via Environments.
implements blueprint provider-resource
Change-Id: I11cf94dc062fcce0e4ff08765696447fc2411a7f
Similar to properties, adds attribute_schema and attributes members to
Resources in order to facilitate document generation and template
provider stubs for resources.
Change-Id: I5e207360816fbc685c66db68a7fab8afad11bf10
Implements: blueprint attributes-schema