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
Check the snapshot belongs to stack when deleting and showing
stack's snapshot, and restoring from snapshot.
Change-Id: I8ce170b40b05ae17669524d75f80e06e39986673
Closes-Bug: #1437602
This patch removes the 'author' tag which now fails to pass PEP8 tests
and also adds some missing newlines in source files. These newly found
PEP8 errors are blocking us from merging code.
Change-Id: Ib5c4c043c1df5cd980e09d26d130150b2e6d64c2
Faultwrap exposes tracebacks in error messages when Oslo.messaging
cannot add a _remote suffix to the exception generated by the Heat
engine.
Change-Id: Iaf91dafacce1abe94fb10aa2ba380cafb6fc4a84
closes-bug: #1432726
Implementation of oslo.versionedobjects.
This commit consists basic mechanism and first objects.
This should be base of implementation versoning to other objects
Implements: blueprint versioned-objects
Co-Authored-By: ShaoHe Feng <shaohe.feng@intel.com>
Co-Authored-By: Grzegorz Grasza <grzegorz.grasza@intel.com>
Change-Id: I554162cf3681fe559c75f54c61c6f32c91f5c2f8
The oslo-incubator log modlule has been removed, so port to the oslo_log
library. Note this uses the new (non namespaced, e.g oslo.log) import
convention, we'll need to align other imports in a future commit.
Some import reordering was required due to pedantic H30[57] checks, and
the services have all been converted to initialize the oslo_log library
as this is done differently to the log.py in incubator.
Change-Id: Ib5a97123fe1b287bc531e42d7887c13ba6205628
If we have situation, when we must specify at
least one of two conflicted resources, and there
is no specified resource, we get StackValidationFailed
with error msg looks like 'Either resource_1 or
resource_2 must be specified'. There are a few places,
where this situation appears. So it will be reasonable
to add special exception for these situations.
Change-Id: Ib107eff4fe8030fdbb40aa267b9e2b394ff7a186
Current approach works correct when error raised in heat-engine,
but when oslo-messaging try to send this error to heat-api it calls
this Exception again without any arguments. So it leads to empty output
in message.
This patch adds kwargs properties for directly sending parameters to
parent class and storing them for substitution during re-call in
oslo-messanging.
Change-Id: I4e823206c3a88d27241532d9f393c07208af8b73
Closes-Bug: #1397002
Implements cancelling of stack update in progress, for any stack
regardless of disable_rollback status.
As a side-effect, a framework for sending arbitrary one-time signals from
outside into a task running as greenthread is added. ThreadgroupManager
holds references of greenlet events associated with a given stack now.
Implements blueprint cancel-update-stack (partial)
Change-Id: Ic929d42946cf28eeb2a7caea8bf908f492693c09
Non-HeatException, non-remote errors were getting their messages
truncated at the first newline and leaving incomplete error messages the
in json response. We can only be certain that remote errors raised
through oslo.messaging will conform to the "message + \n + stack_trace"
formula
Closes-Bug: #1358417
Change-Id: I785c6e41101960ea7ceb00c0733c49c2a8aa909f
Raise an appropriate exception, mapped to a 400 error for signals
to resources which cannot handle signals. In this case, the request
is inherently impossible to satisfy, because the plugin doesn't
support signals, so we should alert the user to this by saying it's
a bad request (rather than the current response which is a 500 error)
Change-Id: I8e47ee94e15309f378f62f2a9f6534a4eeddb389
Closes-Bug: #1346849
Move InvalidSchemaError to heat.common.exception and pass a keyword
argument so that it can be serialized properly.
Change-Id: Iada3273b2b0b129bc0125b68fecf1e0efc081611
Closes-Bug: #1336740
Move from oslo RPC to oslo.messaging.
Implements: blueprint oslo-messaging
Co-Authored-By: sdake@redhat.com
Change-Id: I2d222c248dd2cd405b8ec35c4c8198ed001fb69f
The file encoding line serves a dual purpose: it informs both Python
and Emacs about the file encoding.
PEP 263 explains that a file with non-ASCII characters must specify an
encoding. Without an encoding line, importing the file will raise a
SyntaxError.
The problem is now that while Python will accept both of
-*- encoding: <some-encoding> -*-
-*- coding: <some-encoding> -*-
and Emacs only accepts the latter since it looks for a file variable
named "coding", not "encoding". Since the Emacs specific "-*-" syntax
is already used, it seems right to use the correct variable for Emacs.
Change-Id: If5321ac2fad595c529aa3ec5f2852aa71458834b
After enhancements to Oslo Message class, re-enable lazy translation to
enable REST API responses to be translated to the requested user locale.
bp i18n-messages
Change-Id: I4be508858547029d454412746609fd380af415c1
This patch fixes all the missed and newly introduced violations of the H306
style checking rule and enables it in tox.
Change-Id: I5566e66421d5397c0103958f02ea38e6e3c68892
Implements: blueprint reduce-flake8-ignored-rules (partial)
There are a lot of files contain import logging which is used for
creating logger object. However in some files we only have definition of
logger without using him. In this patch all unused loggers and imports
are deleted.
Change-Id: Iedba6d40850cb050c5c25d9b8a6a1d7128fd4bee
Remove the serializers from heat.common.wsgi, so we break the
circular import which happens if you want to import
heat.api.aws.exceptions to do a determination based on exception
type, which is required to avoid the faultwrap exception disguise
which is not applicable to the CFN API.
Partial-Bug: #1291079
Change-Id: I7498d78f8ec6098b28fb183eaaa04aa81fced3eb
This patch adds validation to template parsing to detect any sections
that do not comply with allowed sections in a template. In the past,
there have been cases where small typos in section names (e.g.
'output' instead of 'outputs') did not get detected and caused issues
at a later point, i.e. by simply not showing any stack outputs.
The place where the template.validate() call has been added to the
parser code only affects new stacks and rejects invalid templates
with an error message. This does not affect stacks that are already
in the database (I did some tests to check this).
Change-Id: Ifed4207badeb364675c905224ba762a9d8eaedd9
Closes-Bug: #1297761
This allows non tenant-scoped list of stacks for the management api
blueprint. A user allowed by the policy stacks:global_index will be
able to make a call to "/:tenant_id/stacks?global_tenant=true" and get
all stacks in Heat, and not just the ones owned by the user,
effectively bypassing tenant scoping.
If the user is not authorized by the policy and they pass the
global_tenant param, the request will get denied by the policy enforcer
and 403 Forbidden is returned.
Co-Authored-By: Richard Lee <rblee88@gmail.com>
Implements: blueprint management-api
Change-Id: I973a7ad2726eb6d9c972d08abe15e241aa120ec3
This patch is one in a series to re-enable H306 style check rule
(imports are in alphabetical order). It touches API files.
Implements: blueprint reduce-flake8-ignored-rules (partial)
Change-Id: I81c7c79516ce1a17055c3b9c12a94312ed3d1940
Since multi-engine was merged, it is no longer possible to delete a
stack which is create/update IN_PROGRESS. This re-introduces that
ability.
If the current engine has an active stack lock, stop any active
threads, remove the lock, and delete the stack. If another engine has
the active stack lock, send an RPC command to the remote engine to stop
any active threads and remove the lock, and then delete the stack
locally. If no engines have the an active stack lock, acquire the lock
and delete the stack.
Closes-Bug: #1262012
Change-Id: I188e43ad88b98da7d1a08269189aaefa57c36df2
Now if the DB API raises a NotFound which propagates
to the REST response, the user will receive a 404.
This seems to be a better default behaviour than a 500,
and other behaviours can be handled by catching NotFound
in service.py
This change is needed for the SoftwareDeployment resource
to do our usual ignore-404-on-handle_delete behaviour.
Change-Id: If00c4de41dc24f462af0b32b29cd6d70f314f3bf
Implements a distributed stack lock using the database to avoid race
conditions when multiple engines are deployed.
Blueprint multiple-engines
Change-Id: If3c47dafcc5bc1b2188b7737205291bbab8bc231
Now the FaultWrapper middleware maps exceptions to webob ones using
a recursive method: if the exception itself is not in the error_map
dictionary, the method searches the first parent exception that has a
match in the same dictionary.
Without this change "any exception that subclasses an exception mapped
in FaultWrapper.error_map will raise an http 500 error instead of the
mapped http error. FaultWrapper should also map against all parent
types of an exception."
Two unit test were added: one to reproduce the bug and another to test
the fix when remote exceptions are handled.
Change-Id: I387e0acf35a4d6361494117218d5129f00d77eb7
Closes-Bug: #1232885
This adds support to the stacks index call for limit, sort_keys,
sort_dir, and marker query parameters, allowing users of the API to
retrieve a subset of stacks.
With this commit, stacks are also sorted by created_at DESC by default.
blueprint pagination
Change-Id: Ib20cfae183475ff42deda82168b8b9c8d043ecd0
This is a short term backout until it gets fixed.
This reverts commit c30530f126.
Closes-bug: #1250797
Change-Id: Ide1dc4a9d1469dee033e8bc08d8ab4da96f79fc0
Implements a distributed stack lock using the database to avoid race
conditions when multiple engines are deployed.
Blueprint multiple-engines
Change-Id: I7fba8808d8a4efbe7fd8fdff94fd9a53f3841c8b
This mostly fixes the accesses to .message, there is still the
translation that is using the .message.
Partial-bug: #1243883
Change-Id: I709f65e39c017d70eaca5d8f6d06e0227b67e816
Rather than having lots of specific exceptions that all pertain to request
limitation, we can just use the RequestLimitExceeded exception when applicable,
which can also simplify the handling of exception mapping in fault.py.
Change-Id: I61b1e59912087fad286e74c22af15ffe6382bb65
API services currently send the traceback to clients. While the client
hides it from user view, it is still present in the response, exposing
the service to details of the engine that administrators likely would
not like to have exposed.
Fixes bug #1210623
Change-Id: I554ba24b7ac9166e28a8a0a10f566ed9cfa03014
The OpenStackException.__str__ method returns
self._error_string which is actually a gettextutil.Message
object not a str.
str(o) will check the return type of o.__str__() and raise
TypeError if __str__ returns non-string object.
The fix will not go into oslo as OpenStackException is
about to be deprecated. And this patch is also the first
step to remove all the references to oslo exception.py.
Fixes bug #1208454
Change-Id: Ib6abe3517bcb1b34fc6a71e5c46ee3774e067f9a
This reverts commit faf984cbb5.
Multi-engine support is being re-designed to account for the use-case in
bug #1211276.
Fixes bug #1211276
Change-Id: Ief89dd6a9c5014752db8065037dd1dd03efe789e
Heat exceptions are serialized into JSON/XML responses by the fault app,
which is at the end of the WSGI pipeline. Some REST API errors however
are raised as HTTPExceptions, which are treated by WSGI as responses
ready to be sent back to the user, and they can't reach the fault app.
This patch set disguises HTTPExceptions raised by the wsgi.Resource so
they can reach the app that will serialize them just like all other
errors.
Fixes bug 1208620
Change-Id: Id98dbc1e3b208401be8f0119a6d72d4561a2221a
Raises an "Action in progress" error if an action is in progress when
another action is issued.
Fixes bug #1207032
Change-Id: I2b6fd92cfa4b93ac2531dd3d76bf2dfc01e58c50
Add support for doing language resolution for a request, based on the
Accept-Language HTTP header. Using the lazy gettext functionality, from
oslo gettextutils, it is possible to use the resolved language to
translate exception messages to the user requested language and
return that translation from the API.
The patch removes individually imported _() so they don't replace the
one installed service-wide.
Also, it adds the ability to fully re-create a remote error
with the same kwargs with which it was originally created, so that we
can translate it and show it to the user.
Partially implements bp user-locale-api.
Change-Id: I63edc8463836bfff257daa8a2c66ed5d3a444254
Add api endpoints for generating a template based
on a resource implementation.
blueprint resource-template
Change-Id: Iebebad70befd1df6cd8989538cbb61350a17bc23
add a wsgi middleware (faultwrap) that catches exceptions
and transform those exceptions into a parsable format
according to 'Content-Type' of the request.
Fixes bug 1158598
Implements blueprint exception-formatting
Change-Id: Iacdb8cc119b250ff1e39c99b7a7f66fd4c35e7d9