Commit Graph

64 Commits

Author SHA1 Message Date
Stephen Finucane 9ba72bbc18 cmd: Deprecate heat-manage migrate_properties_data command
Well, we actually remove it but keep the entry point to avoid breaking
scripts. This has been around since 2016 and anyone that hasn't upgraded
now ain't upgrading.

This is one less set of APIs to worry about when removing the use of
autocommit.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I43051b3ca6e292f1164d750b04d7a440012b2ef5
2023-10-13 00:45:07 +09:00
Stephen Finucane 43a5f3984e db: Remove layer of indirection
We don't have another ORM to content with here. Simplify
'heat.db.sqlalchemy' to 'heat.db'.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Id1db6c0ff126859f436c6c9b1187c250f38ebb62
2023-03-25 12:02:27 +09:00
Stephen Finucane 64621053c2 db: Migrate to alembic
This is significantly easier than Cinder, Nova etc. as Heat hasn't had
any database migrations in multiple cycles, meaning we don't need to
worry about having to apply any older sqlalchemy-migrate migrations
before switching to alembic. Instead, we simply need to determine we're
upgrading a deployment that was previously using sqlalchemy-migrate,
upgrading a deployment that has already migrated to alembic, or
deploying a new deployment, adjusting accordingly.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I808af9cb21ba21808209b1daddac7426f4cad310
2023-03-25 12:00:35 +09:00
Ghanshyam Mann 157f358057 [goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to do two things:

1. Change the default value of '[oslo_policy] policy_file''
config option from 'policy.json' to 'policy.yaml' with
upgrade checks.

2. Deprecate the JSON formatted policy file on the project side
via warning in doc and releasenotes.

Also replace policy.json to policy.yaml ref from doc and code.

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: I1aa12bcd2638390f25d57ce8abeeec248121dc02
2021-06-17 01:35:45 +08:00
Corey Bryant 8fd17214a9 Monkey patch original current_thread _active
Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Change-Id: I0540923755ac3969b584eeba2e19c037a7f2c261
Story: 2007614
2020-05-04 13:19:21 -04:00
Marc Methot 156f276665 Logging Consistency
A simple matter of having log lines fit
with all the others. It will now match the
ambiguous standard.

Also change comments inline to alias with log fixes.

Change-Id: I4a2ed6134f70c2965811f75ccb6ab8221fa0e960
Story: #2007319
Task: 38830
2020-04-27 06:34:31 +00:00
Hervé Beraud bb02b2b5f1 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 2 of a serie of 28 patches

Change-Id: I2795dee87f0e27b64820686acfc614ac2ba19a4f
2020-04-22 12:23:44 +02:00
Andreas Jaeger 57eb87149f Fix hacking warnings
Fix some warnings found by hacking and enable them again.

Change-Id: Ia09de4d0fda752a009b9246b4e6d485601cd9562
2020-04-16 06:43:27 +00:00
Zuul 38eb2e5389 Merge "fix logger names" 2019-10-07 19:30:55 +00:00
Zuul 77fdf8a4b7 Merge "change import order" 2019-09-26 06:45:08 +00:00
whoami-rajat ba4e54589d Add heat-status upgrade check command framework
This adds basic framework for heat-status upgrade
check commands. For now it has only "check_placeholder"
check implemented.
Real checks can be added to this tool in the future.

Change-Id: I83629184b49a6cf91928df702db23156433d99f6
Story: 2003657
Task: 26131
2018-10-22 14:19:36 +00:00
rabi 9c421a6725 Remove unnecessary shebangs from service scripts
These are just python files.

Also removes internal .gitignore in heat_integrationtests

Change-Id: Ibea3253cd89f905e61b655861274c61ab48a7ea0
2018-08-01 10:53:51 +05:30
rabi abfec544d7 Don't allow nested or stacks in FAILED state to be migrated
Stack and its nested stacks should be in *_COMPLETE state for
it to be migrated. Also, we should not allow migration of a
nested stack.

This also changes stack_get_all_by_owner_id() to not select the
backup stacks. This seems to be used only in convergence code
path and migrate_convergence_1().

Change-Id: Icd54465d0c593557a12d853ddee4ee8ce6483499
Closes-Bug: #1767962
Story: #1767962
Task: #17363
2018-05-11 11:06:23 +05:30
Matthew Edmonds 12fb92ce87 fix logger names
Most files are using getLogger(__name__) so that logging statements
are associated with the file they came from, but there are several
places where this practice has not been followed. This changes to
use __name__ consistently for most code. Per review comments,
commands and wsgi apps are instead updated to use the command/app
name.

Change-Id: Ic2594b88dd818df5486800e4759848d43edc24d1
2018-03-20 13:29:15 +00:00
rabi 8db1b3ea41 Remove stack watch service
This removes the rpc api and related code.

Change-Id: Ib89bcc3ff6a542f49467e2ad6c7e2a716a0dc2b4
Partial-Bug: #1743707
2018-01-28 09:35:05 +05:30
rabi 6d55417f80 Remove CloudWatch API
This patch removes the API, the next set of patches in the
series would remove stack watch service and related
WatchRule implementation.

Change-Id: I8b0472be862907298c8da51f435b5d8b19610ec3
Partial-Bug: #1743707
2018-01-28 09:11:17 +05:30
chenjiao 635fbcec0c change import order
Alphabetically order your imports by the full module path.
Organize your imports according to the Import order template and
Real-world Import Order Examples below.

{{stdlib imports in human alphabetical order}}
\n
{{third-party lib imports in human alphabetical order}}
\n
{{project imports in human alphabetical order}}
\n
{{begin your code}}

Change-Id: Ie3a9f1dd36272f5512f719f4db8a219015c99fec
2018-01-18 17:01:38 +08:00
ricolin 3bb0b8b4e4 Enable mutable config in Heat
New releases of oslo.config support a 'mutable' parameter to Opts.
This is only respected when the new method mutate_config_files is
called instead of reload_config_files. Heat delegates making this call
to oslo.service, so how do we switch?
Icec3e664f3fe72614e373b2938e8dee53cf8bc5e allows services to tell
oslo.service they want mutate_config_files to be called by passing a
parameter, which this patch does.

This allows Heat to benefit from
I1e7a69de169cc85f4c09954b2f46ce2da7106d90, where the 'debug' option
(owned by oslo.log) is made mutable. We should be able to turn debug
logging on and off by changing the config and sending SIGHUP.

Part of bp:mutable-config

Change-Id: I885f5e088440d3d8b6fb3506506598d7667e7083
2017-05-17 05:25:56 +00:00
liyi 8f10215ffd Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Ieec8028305099422e1b0f8fc84bc90c9ca6c694f
2017-03-25 17:11:50 +08:00
Crag Wolfe 98505288b2 Add heat-manage subcommand to migrate legacy prop. data
Add a subcommand to heat-manage to migrate resource and events
properties data from the legacy db locations to the new. I.e., migrate
properties data out of the legacy columns in the resource and event
tables into the recently added resource_properties_data table. No
attempt at de-duplication between resources and events is made for the
migration: a new row is created in resource_properties_data for every
row that has legacy properties data in the resource or event tables.

Change-Id: I364d509c357539d1929eb2e40704e60049469ea2
2017-01-31 13:45:52 -08:00
rabi 0a66b7750f Sanitize newly added heat-manage command
This changes newly added heat-manage command for migrating
non-convergence stacks to convergence, to use '_' like other
commands. Also updates doc with the command.

Change-Id: I2ea5beb1c71cf51dceee7df6af6a6827d920c179
2016-12-23 12:25:03 +00:00
Thomas Herve 84067dba88 Remove db.api wrapper
The db.api module provides a useless indirection to the only
implementation we ever had, sqlalchemy. Let's use that directly instead
of the wrapper.

Change-Id: I80353cfed801b95571523515fd3228eae45c96ae
2016-12-13 09:40:29 +01:00
Crag Wolfe 882a640f18 Refactor purge_deleted, operate on batches of stacks
Avoid large sql "in" clauses by operating on smaller batches of stacks
at a time.

To avoid transaction overhead and contention on the resource table,
the first deletions occur outside of a transaction (are
autocommitted). This is OK because the purge is re-rentrant -- we
won't lose any stack_id's to delete if something goes wrong before the
conn.begin() block. That is, we will not orphan any rows if the purge
is run multiple times where an error occurs.

Change-Id: I9edf0558ed54820842193560e323df6501411d1d
2016-11-28 20:13:35 -08:00
Dan Prince 1486289a75 heat-all: all-in-one heat launcher
This patch implements a new heat-all command that can be used
to launch a single process version of the configured heat services.
The end user can control which services are launched by setting
'enabled_services' in the heat config file:

[heat_all]
  enabled_services = api,engine

One use case for this launcher would be to launch a single process heat
using rpc_backend = fake, connection=sqlite://heat.db, to have access
to a minimal all in one Heat API/Engine for TripleO undercloud
deployments via Heat templates.

Change-Id: Ic35bdc455fe1397ac575522af0c8fca96dd95676
2016-10-13 11:49:15 -04:00
shizhihui f34a7bb0d8 Trivial:Standardize the output format of 'help' in some files
In some files,it is possible that we import '_'from heat.commom.i18n.
For more information:

[1]http://docs.openstack.org/developer/oslo.i18n/usage.html

Change-Id: I545b9e51111a9c9c542e3089bef1490a3ba3a40b
2016-09-21 14:12:27 +08:00
Oleksii Chuprykov 68944d2230 Migrate stacks from legacy to convergence engine
Run `heat-manage migrate-convergence-1 <stack_id>` to migrate
legacy stack to convergence engine.

Heat engine is used for doing migration i.e. migration can't
be done offline.

Change-Id: Ie7c2498b37937438f16d154b154b3a6ecbf9ff74
Implements-bp: convergence-migrate-stack
2016-08-22 10:40:29 +03:00
Ala Rezmerita 61836dbf42 Purge deleted stacks for specific project
Add project-id argument to heat-manage purge_deleted command in order
to be able to hard delete DB entries for a specific project.

Change-Id: Ifffe5657a40ce97db9d059ff1516b8e1eb801132
Implements: bp heat-manage-purge-deleted-tenant
2016-07-20 17:02:12 +00:00
yuyafei add4dc3b08 Replace raw_input with input to make PY3 compatible
The raw_input() raises NameError: name 'raw_input' is not defined in python3.
This patch fixes it by replacing raw_input with input to make PY3 compatible.

Change-Id: I50aad3161893250dab1d60af4569bb65d7edef5a
Closes-Bug: #1595827
2016-06-28 00:44:23 +00:00
Jenkins 869249a495 Merge "Add --verbose-update-params option to heat-manage" 2016-05-17 22:12:49 +00:00
Jason Dunsmore 59084fa24e Add --verbose-update-params option to heat-manage
In case the "heat-manage update-params" utility hangs in the middle of
a run, it is useful to know the exact raw_template or resource that
was being processed. Verbose logging of each raw_template or resource
that is being processed will aid in debugging and checking for corrupt
data (if the heat-manage process has to be killed).

Change-Id: Ic552bdaf234c7b9a6a76c345aab816a171b404ab
2016-05-04 13:12:41 -05:00
Thomas Herve 7977f9f2f3 Add command to reset one stack status
Adds a new heat-manage reset_stack_status to recover from specific
crashes that leaves resources in progress. It removes resource hooks and
stack locks as well.

Closes-Bug: #1561214
Change-Id: I70fa5857c959bc5f1424d562ff8b7740331b5328
2016-04-15 10:00:26 +02:00
Michael Krotscheck 59ccb2f751 Moved CORS middleware configuration into oslo-config-generator
The default values needed for heat's implementation of cors
middleware have been moved from paste.ini into the configuration
hooks provided by oslo.config. Furthermore, these values have been
added to the default configuration parsing. This ensures
that if a value remains unset in heat.conf, it will be set
to use sane defaults, and that an operator modifying the
configuration file will be presented with a default set of
necessary sane headers.

Change-Id: Ie3791007b33788829417ce508a3c719ae626bbce
Closes-Bug: 1551836
2016-03-14 08:19:29 -07:00
Steve Baker adb2121795 Make minimum default num_engine_workers>=4
Downstream test environments are frequently having failing stacks with
error messages like:

  MessagingTimeout: resources[0]: Timed out waiting for a reply to
  message ID ...

These environments generally have 1 or 2 cores, so only spawn one or two
engine workers. This deadlocks with stacks that have many nested stacks
due to engine->engine RPC calls.

Even our own functional tests don't work reliably with less than 4
workers, and the workaround has been to set that explicitly in
pre_test_hook.sh.

This change sets the default minimum number of workers to 4, but still
matches workers to cores for larger servers.

This change also moves the default evaluation to heat.cmd.engine so that
generated configuration doesn't get a inappropriate default value.

Change-Id: Iae6b3956bad414406d901bb2213c9ec230ff4304
Closes-Bug: #1526045
2016-01-11 13:32:51 +13:00
Jenkins 4b53e073a2 Merge "Stop ignore skipped crypt_operation option" 2015-12-15 14:13:31 +00:00
Jenkins fb54b8d602 Merge "Remove unused argument 'current_version'" 2015-12-15 13:08:00 +00:00
Kanagaraj Manickam 6ef46af6b4 heat-manage resource_data_list
During the troubleshooting of issues, admin needs to
decrypt the values stored in the resource_data table.
This patch addes below command to address this need.

heat-manage resource_data_list <resource_id>

Closes-bug: #1524295

Change-Id: I5bb814c0873f58b3968f312c96bcabcd3024085d
2015-12-15 04:37:35 +00:00
Sergey Kraynev d915471db1 Stop ignore skipped crypt_operation option
Previously we used "nargs='?'" parameter for 'crypt_operation' option.
It leads to situation, when we execute this command without any result
or error.
Now when user will try to execute this command he will get message, that
should specify 'crypt_operation' option.

Note, that we used same parameters for other heat-manage commands.
However, it can be used, because if user will not provide these options,
then commands will be executed with default values (sometimes it's None).
All these default values are expected in utility functions or db
functions.

Also comments were added for clarification commands and their arguments.

Change-Id: I561bc7fc83e6d845c9b59d85c59650e640001190
2015-12-10 18:33:53 +00:00
Sergey Kraynev a77739b46b Remove unused argument 'current_version'
db_sync command has two positional arguments, but in code we use only
one. Also original db_sync command for db API get only one parameter
"version".

Change-Id: I65732b16fbdc093ad2c7a3a521c3b75ae7183585
2015-12-10 11:57:58 -05:00
Peter Razumovsky 4e0510ffe6 Fix [H405] pep rule in heat/cmd
Implements bp docstring-improvements

Change-Id: I6600d0ac4825c97da486b50f9695d0075b3f16ce
2015-09-24 16:22:25 +03:00
Sirushti Murugesan 0649787f1d Fix file permissions
Remove the executable bit

Change-Id: I81220d3222e6a6e27f074489f607158581851a6b
2015-09-23 01:30:46 +05:30
Ethan Lynn d6b618be55 Add command to clean dead engine from service list
Add command 'service clean' to remove dead engines
from service list.

Closes-Bug: #1495374
Change-Id: I644eee717f8e76ab9d5d7d6847442740ea201e6b
2015-09-14 16:59:18 +08:00
Sirushti Murugesan 063f80ffdf Add console_scripts entry points for all heat services
As a follow-up to Ibfd54e7b1bae700e4fb49a32e5bf7c00d1f104d9,
moving all the scripts from bin/ to setuptools entry points.

The devstack change is here: Iffb6d09bfef593d854b38e68200ae6039c4727e7

partial blueprint upgrade-tests

Change-Id: Ic8f5b8dc85098de752bbf673c4b15c06fdc4162a
2015-09-03 02:03:59 +00:00
Jason Dunsmore bafd884419 Add doc about db being offline to encryption utility
The utility wasn't designed to be run while live stacks are being
updated.

Change-Id: I89e5152ad32ea22a38da7ae410c47e1e7a8551a9
2015-07-20 10:05:46 -05:00
Vijendar Komalla 654032459c Support for encrypt/decrypt parameters in heat-manage
Adding support to encrypt/decrypt parameters through heat-manage
command.

Change-Id: I2cd7b8837156ebe892d591f48ad2b1c6ecca5f9d
Implements: blueprint encrypt-hidden-parameters
Co-Authored-By: Jason Dunsmore <jasondunsmore@gmail.com>
2015-06-05 12:06:59 -05:00
Sergey Kraynev e5f952e4b5 Use Service objects instead of db_api
Fix missed place for migration from db_api to Service object.

Change-Id: I1d733d0a1bd13ab860860e4497771c46e7d2118b
2015-03-23 06:38:21 -04:00
Jens Rosenboom a99fe6a760 Make import of oslo libraries namespaceless
See https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages

Closes-Bug: 1423174
Change-Id: I48680ce6e7ce91005c147ab4388203946171d433
2015-02-18 22:54:10 +01:00
Steven Hardy 70112c103a Move logging to use oslo_log library
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
2015-02-17 09:23:34 +00:00
Kanagaraj Manickam 65134b8d99 heat-manage service list
Adds required REST API, Db model and engine service
changes for reporting the heat engine service status.

Change-Id: I3ef29c1efd2015d62eec1033ed3a8c9f42e7a6e2
Implements: blueprint heat-manage-service-list
"DocImpact"
2015-02-02 13:05:46 +05:30
Ethan Lynn 11c1b62052 Remove deprecated function i18n.install('heat')
Since i18n.install() is deprecated, remove it from heat codes and
import i18n._() to where it needed.

blueprint oslo-i18n
Change-Id: Icefada18b5a33112b425cd90d31d3a6a5f06188a
2014-10-13 10:31:28 +08:00
Andrey Kurilin cfcbc994d3 Sync latest oslo.db code
Common db code was updated in oslo. The most important thing is that
engine instances don't stored anymore in oslo.db - ce69e7f.
This patch moves methods `get_engine` and `get_session` to module
`heat.db.sqalchemy.api`.

Latest commit in oslo related to db module:
2fd457bf2ccbeb2b84ffb204778b6417cd5405ba

Change-Id: Iaa2e9ba26e824c678c698914170e3dffbf1c5c95
2014-04-11 10:48:46 +03:00