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: Id266a937b37507a1cef05ac34e33a80265581ad1
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Co-Authored-By: zhurong <aaronzhu1121@gmail.com>
Various components defines different options for the client sessions.
Standardize them with the help of keystonauth1 lib.
Change-Id: I2f791caaf230a58b8426d1c1d6e1eb4316a85a28
This replaces the deprecated (in python 3.2) unittest.TestCase
method assertRaisesRegexp() with assertRaisesRegex()
Change-Id: Ie329779dbfe39ec9674f9a999a27d927311b7e7b
The kwarg ``enforce_type`` should be removed from oslo.config's
``set_override`` function, used throughout unit tests, because it's
currently deprecated and will soon be removed [0], as ``enforce_type``
currently has default value of ``True`` [1].
This patch also removes instances of ``CONF.set_override`` and
``CONF.clear_override`` from unit tests that inherit from
``base.MuranoTestCase`` which already provides a wrapper around
this functionality: ``override_config`` which also calls
``CONF.clear_override`` via ``self.addCleanup``.
[0] Can be seen in any unit test logs
[1] https://github.com/openstack/oslo.config/blob/master/oslo_config/cfg.py#L2625
Change-Id: I6146ea2363e594fd000d8ecda8c2130145723ffe
Closes-Bug: #1690886
Improve asynchronous push mode of HeatStack:
- Use spawn_after instead of spawn_after_local. Otherwise the data is never
pushed if the initiated thread were to exit
- Cancel background thread instead of killing it. Cancel cancels the thread
only if it hasn't started yet instead of killing it somewhere in the middle.
- Add post-execution cleanup to guarantee that async data push happens
before the execution session end
- Make Instance destruction use async push to speed up the destruction
in case when there are many servers and to test the HeatStack async mode
Closes-Bug: #1643702
Change-Id: I11d157844cb1d973d2cac62c2e6d67d047f75164
This patch adds new feature - async HeatStack::push
If HeatStack::push is called with flag async=True,
template will be pushed in separate greenthread with
1 sec delay. If push operation is not finished and next
push is called, thread will be killed and next push
will be scheduled.
Change-Id: I8aea5a88fdf964b8ed0436f7d692dac50caf854b
In theory using destruction dependencies one can obtain a new
reference to an object that is about to be destroyed. In this
case any attempt to call a method on such object should result
in exception being raised. This guarantees that the nothing can
be done on the object after its .destroy method was executed.
Also because the HeatStack instance is owned by the CloudRegion
it is going to be destroyed prior to it. But CloudRegion needs
to call $stack.delete() in its .destroy method and this will cause
error. As a solution HeatStack made not to be owned by the
region and instead be an independent object with destruction
dependency on it which guarantees that it will be destroyed
after the CloudRegion.
Targets-blueprint: dependency-driven-resource-deallocation
Change-Id: I5650ea672d5f121be69669f27dd5f513fbdd5c44
The Environment class got two additional properties:
region - name of the region where environment should be deployed. If
null then home region is used.
regionConfigs - config property (taken from class config) that specifies
region parameters. It is a dictionary of a form regionName -> regionSettings.
Currently the only setting available is a agentRabbitMq that is itself
a dictionary containing the same options as [rabbitmq] section of murano.conf
Thus the configuration file io.murano.Environment.yaml may look like:
regionConfigs:
RegionOne:
agentRabbitMq:
host: rabbitMqHostName
port: 5672
login: murano
password: murano
virtual_host: /
ssl: false
ca_certs: null
Implements Blueprint: assign-environment-to-region
Change-Id: I3c84c96f8eeae738f83ed7b3691be38100b30e1d
* Single universal ClientManager class was dropped in favor of
of individual in-context methods to create OS clients without
ClientManager restrictions.
* Environment class was renamed to ExecutionSession to avoid
common confusion with io.murano.Environment
* execution_session_local module was introduced to simplify
keep of per-execution session (per-deployment) data. This
is similar to thread-locals with the difference that there can
be many threads in single session.
* All OS-clients related code was migrated to keystone client
sessions and API v3 (except for GLARE and Mistral that doesn't
support sessions). This increases performance and solves
authentication problems that could be caused by token expiration
even with trusts enabled.
* [DEFAULT]/home_region setting was introduced instead of
[murano]/region_for_services to configure what region
should be used by the clients by default (where Murano API
resides). All client factories respect this setting.
Change-Id: If02c7e5d7d39574d0621e0e8dc27d1f501a31984
Method CONF.set_override to change config option's
value with designated value in unit test, but never check if the
designated vaule is valid. Each config option has a type like StrOpt,
BoolOpt, etc. StrOpt with parameter choices only allows values in set
of choices. In short, each config option has limitation for type
and value. In production code, oslo.conf can ensure user's input is
valid, but in unit test, test methods can pass if we use method
CONF.set_override without parameter enforce_type=True even we pass wrong
type or wrong value to config option. This commit makes sure calling
method CONF.set_override with enforce_type=True and fixes violations.
Note: We can't set enforce_type=True by default in oslo.config now, it
may break all project's unit test. We can switch enforce_type=True by
default when all project fix violations like this commit.
Related-Bug: #1517839
Change-Id: Ia9f6b8a04290f93699fc1f613ce0e841f040d4ae
Heat provides tagging fuctionality for stacks, now tagging is
possible for stacks generated via murano also. To implement it,
added new config parameter `stack_tags` with default value 'murano'
and tagged heat stacks created during environment deployment with
`stack_tags` parameter's value.
Change-Id: Ib3f4027b78616c02cf3bbb210578df23d7e536d3
Implements: blueprint tag-murano-heat-stacks
With this change MuranoPackage becomes first-class DSL citizen.
Packages have version, runtime_version (that is specified
in Format attribute of the manifest file) and a list of classes.
Previously engine used to have package loader which had most
of "load" functionality and class loader that mostly acted as an
adapter from package loader to interface that DSL used to
get classes. Now class loader is gone and is replaced with
package loader at the DSL level. Package loader is responsible
for loading packages by either package or class name (as it was
before) plus semantic_version spec (for example ">=1.2,<2.0").
Package loader can now keep track of several versions of the same
package.
Also packages now have requirements with version specs.
All class names that are encountered in application code are
looked up within requirements only. As a consequence
packages that use other packages without referencing
them explicitly will become broken. An exception from this rule
is core library which is referenced automatically.
Partially implements: blueprint murano-versioning
Change-Id: I8789ba45b6210e71bf4977a766f82b66d2a2d270
Enable the user to choose one environment from all environment files
located in the package under /Resources/HotEnvironments to be deployed
with the heat template as part of a Murano environment.
Partially implements: blueprint add-support-for-heat-environments-and-files
Change-Id: Id14fea94854221ba92b3eb09189c211c3d10d82f
* Code migrated to yaql 1.0.0
* New MuranoPL object initialization
* Lots of refactoring
See referenced specs for more information
Implements: blueprint migrate-to-yaql-vnext
Implements: blueprint object-construction
Depends-on: I7f314634ab5f08a521e51082d5c84dffca4b0b5c
Closes-Bug: #1454264
Change-Id: I740a4f83c76d8b56a1da585a739d770ef823a524
Sends all files under /Resources/HotFiles to Heat when deploying
a Murano environment, while keeping the format Heat expects
Partially implements: blueprint add-support-for-heat-environments-and-files
Change-Id: Id7574642b8e09a7f659e4d9576a95f9f6efd8792
Adds ability to have per-class configuration and special properties
with usage "Config". Such properties get their values from config
(if it is present) rather than from object model.
Config files can also modify defaults for other property types.
Config files are stored in special folder that is configured in
[engine] section of Murano config file under class_configs key.
Config files must me named using %FQ class name%.json or
%FQ class name%.yaml pattern and contain dictionary of a form
propertyName -> propertyValue
Change-Id: I0f45fa7064183f5605c5ef393b5b00e8c8ae2bda
Implements: blueprint class-configs
Instead of using user's auth token (which can expire) for interactions with
other services engine creates Keystone trust that impersonate user and
create new tokens on demand.
Heat stack is created on deployment start using token rather than trust so that
Heat could establish trust of its own (trusts cannot be chained).
New behavior is disabled by default and can be enabled using [engine]/use_trusts = True in murano.conf.
With trusts enabled engine will not work with Heat prior to Juno.
For Heat stacks with deferred actions or long deployment time to work it is also required to turn on trusts in Heat itself.
This can be done via [DEFAULT]/deferred_auth_method=trusts in heat.conf and ensuring that current user
has heat_stack_owner role (or any other that is in [DEFAULT]/trusts_delegated_roles=trusts in heat.conf)
Change-Id: Ic9f3f956ddb6ff2a300a08056ee841cf3c0db870
Implements: blueprint auth-for-long-running-requests
Adds error status reason text to exception message that is raised
when Heat stack create/update fails
Also disables stack rollback for consistency (otherwise if error happens during
stack creation it silently disappears and no reason provided)
Change-Id: Ia4366cba486e9ce4c5ae35ecb3e042bbf5f7ef3d
Closes-Bug: #1369722
* H202 assertRaises Exception too broad
* H402 one line docstring needs punctuation
* H404 multi line docstring should start without a leading new line
Change-Id: I2f662b8b97d14daa501620c8237bf93bd2251243
Now, functional tests would be located in murano/tests folder
Group all unit tests to the corresponding folder under tests
Run only unit tests in Opentack gate
Change-Id: I5ebea265fd7cdef7e77a47eedae40d23f91638d0
Partly-Closes-Bug: #1349383