Commit Graph

7 Commits

Author SHA1 Message Date
ramishra ceef7869e0 Don't load all resources for policy check
We only need the resource types for the check. Let's
avoid loading all resources.

Change-Id: Iaf5650b2ae972064292cfe0d17f98b5635c51bad
2022-11-15 09:35:38 +05:30
Hervé Beraud 5fa48d67a2 Remove six and python 2.7 full support
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 13 of a serie of 28 patches

Change-Id: I09aa3b7ddd93087c3f92c76c893c609cb9473842
2020-04-23 14:49:12 +02:00
Zane Bitter 3c13cb82a6 Cache dep_attrs for all resources in definitions
When the dep_attrs function was written, it was used only in convergence
after checking a single resource. However, now we also use it to generate
data for the ResourceProxy objects, which is often done for all resources
simultaneously. That means doing O(n^2) dep_attrs() calls, which can really
slow things down when there is a large number of resources with complex
properties (or metadata).

This change adds an all_dep_attrs() call, which runs as fast as dep_attrs()
on everything except get_attr functions and their arguments, but only needs
to be called once instead of once per resource. (The get_attr function can
in future override the default implementation of all_dep_attrs() to be as
efficient as dep_attrs() as well.) The resulting data is cached in the
ResourceDefinition or OutputDefinition so that subsequent calls to their
get_attr() methods with different (or the same) resource names will use the
existing data.

Change-Id: If95f4c04b841519ce3d7492211f2696588c0ed48
Partially-Implements: blueprint stack-definition
Closes-Bug: #1684272
2017-07-21 10:44:51 -04:00
Zane Bitter 82721f8865 Add Output definitions to StackDefinition
Change-Id: I8356980d8687b2f1ffb4abe198adec8e70f00f69
Partially-Implements: blueprint stack-definition
2017-07-21 10:30:34 -04:00
Zane Bitter 666930d195 Update NodeData in legacy path
In convergence stacks, we obtain the NodeData for the resources the current
resource depends on from the RPC message triggering the resource check. For
the legacy path, this change updates the NodeData in the StackDefinition
after each resource is created or updated.

This means that the legacy and convergence paths will be able to access
data about other resources in essentially the same way.

Change-Id: I61c61745d864de99b0127f4103a6c3a83379c516
Partially-Implements: blueprint stack-definition
2017-04-05 12:39:46 -04:00
Zane Bitter 2cf7af7deb Use a StackDefinition to store the stack definition
Group the data currently available in the Stack class into a
StackDefinition and proxy requests for it.

Change-Id: I7c3be2f02fb8bc030dff80f21e99f33db22f42a1
Partially-Implements: blueprint stack-definition
2017-02-24 10:19:21 -05:00
Zane Bitter 903a5106e8 Add a StackDefinition class
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
2017-02-24 10:19:21 -05:00