Commit Graph

8042 Commits

Author SHA1 Message Date
Zuul 42a0e28288 Merge "Allow more options to limit number of resources" 2024-03-08 05:33:48 +00:00
Zuul 9da45ab44b Merge "Deprecate resources for inactive services" 2024-03-07 03:53:51 +00:00
Zuul 24c5a14114 Merge "Remove logic for cloud-init < 0.6.0" 2024-02-20 09:01:25 +00:00
Zuul c2f8834656 Merge "Use zoneinfo instead of pytz if available" 2024-02-20 09:01:22 +00:00
Zuul dd7319e373 Merge "Stop unnecessary usage of 'self'" 2024-01-31 18:22:13 +00:00
Zuul aad16e9684 Merge "Fix inconsistent naming in db api" 2024-01-31 18:22:10 +00:00
Zuul b674962603 Merge "common: Replace deprecated importlib API (2/2)" 2024-01-29 07:32:45 +00:00
Stephen Finucane d48a6a2170 common: Replace deprecated importlib API (2/2)
Resolve the following deprecation warning:

  DeprecationWarning: the load_module() method is deprecated and slated
  for removal in Python 3.12; use exec_module() instead

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I403289d5df2143872503fc246a993cb19ebba68e
2024-01-29 01:06:14 +09:00
Takashi Kajinami 19bcbc0390 Remove logic for cloud-init < 0.6.0
cloud-init was released on 2011-01-27. It may be reasonable to assume
that no one is using older versions.

Change-Id: I8f6d3ed0aadd00e76710308fec7d3a1b1d5bb0e9
2024-01-29 01:05:22 +09:00
Takashi Kajinami 84ca8a18e0 Use zoneinfo instead of pytz if available
The zoneinfo module was introduced in Python 3.9. We can use that
built-in module instead of the 3rd party library (pytz).

This is based on change I1f88bdadc68bfa726eac1da1c5824c1ed352ad98 in
oslo.utils.

Change-Id: I539120a6bfb850b0c4e384e51caa021761a4f6b8
2024-01-27 19:23:00 +09:00
lujiefsi 7d86fc6d84 Allow more options to limit number of resources
This commit adds the configuration options related to resource limits
in the Heat project. The `max_software_configs_per_tenant`,
`max_software_deployments_per_tenant`, and `max_snapshots_per_stack`
options have been added to control the maximum limits for software
configs, software deployments, stack snapshots.

Story: 2011006
Task: 49401
Change-Id: If33a1c6f3eb9e93f586931bc5c05104439c92bf9
2024-01-26 22:22:11 +00:00
Takashi Kajinami 13ec108b0d Fix inconsistent naming in db api
Snapshot.get_all does not return all snapshots of the project but
returns all snapshots associated with a single stack, so its name
should contain _by_stack for consistency.

Change-Id: Ic6b93b7cfc84793077672b3f1052f03519e4c5a1
2024-01-27 07:21:46 +09:00
Zuul 0676041be8 Merge "Bump hacking" 2024-01-26 12:59:35 +00:00
Takashi Kajinami a9507c1db4 Stop unnecessary usage of 'self'
Objects used only within the single test does not need to be part of
the TestCase instance of that test.

Change-Id: I05c0877315e6e4897e8b097d5df3e81b60022870
2024-01-24 11:51:23 +09:00
James Page ec0729a79d
tests: Fix unit tests using has_calls
has_calls is not the correct method for asserting a list of calls
has occured during testing.  Use assert_has_calls instead.

This also revealed an issue in the expected signature for one
of the mock calls in the test_software_config module.

Change-Id: Ib01ee79f49525f6d0ba7915108ef92c338a8f393
2024-01-22 13:55:10 +00:00
Takashi Kajinami 895d8645ad Deprecate resources for inactive services
Monasca, Sahara and Senlin were marked inactive during this cycle and
will not be part of the 2024.1 release. Because these projects are not
maintained in a consistent way, we deprecate resources for these
services.

We aim to remove these in the 2024.2 release.

Change-Id: Iab377ebc2569a4a5a81f736a1dfe9f406135f5d3
2024-01-22 21:03:39 +09:00
Takashi Kajinami 813f229a08 Bump hacking
hacking 3.0.x is too old.

Also fix failures detected by the new hacking version.

Change-Id: Ifccbbf2ff7b0824d2079937526d3eee1c536349b
2024-01-18 19:04:37 +09:00
Zuul 2df46d4c59 Merge "Clear implementations for neutron LBaaS v2" 2024-01-09 04:50:09 +00:00
Takashi Kajinami f5e5aaed8e Remove deprecated wrappertask decorator
The wrappertask decorator was deprecated some cycles ago[1]. This is
internal implementation so could be even removed directly.

[1] 2c58017a14

Change-Id: I0f2e25971201e2a01b3e86bd859e8a4bdb98d371
2023-12-27 09:06:33 +09:00
Zuul 28334a3a2b Merge "Loadbalancer id is required in listener creation API" 2023-12-19 06:19:50 +00:00
Zuul 41e61b84f2 Merge "Remove deprecated internal rpc function" 2023-12-16 18:34:15 +00:00
Takashi Kajinami 6155e68f9a Remove deprecated internal rpc function
It was deprecated 6 years ago[1] and is no longer used.

[1] e2b614c529

Change-Id: I0905b1901429f2475784e4752889b83e6567f4ef
2023-12-15 06:07:40 +00:00
Zuul fc94b3e49a Merge "common: Replace deprecated importlib APIs (1/2)" 2023-12-15 05:56:38 +00:00
Zuul a120c750c8 Merge "Hide OS::Glance::Image" 2023-12-15 05:56:36 +00:00
Takashi Kajinami 87a8cbe4ac Clear implementations for neutron LBaaS v2
LBaaS v2 was retired a while ago and now the related resources are all
hidden. Thus we can remove all implementation to reduce dependency on
python-neutronclient which is deprecated.

Story: 2010678
Task: 47761
Change-Id: I4de6cb353bc3699d124ea55666c87e4efd7e4350
2023-12-13 22:07:02 +09:00
Zuul 93700aa365 Merge "Clear implementations for neutron LBaaS v1" 2023-12-13 04:10:35 +00:00
Zuul b207d54612 Merge "Enable new defaults and scope checks by default" 2023-12-04 09:13:22 +00:00
Takashi Kajinami 01349f3793 Hide OS::Glance::Image
This resource requires Glance v1 API which was already removed[1][2].
It was deprecated some time ago so we can hide it now.

[1] 3dde3204d5c1b5323dba2d7b7607e69bcc58bbb2
[2] 30680961994b36ed12713c0f106b661535ce41c6

Change-Id: Ifbefdbc032c0b1ac538d68b41f13d0547b793ba5
2023-12-01 14:57:04 +09:00
liyi a749ed1e6b Loadbalancer id is required in listener creation API
The loadbalancer property of Octavia::Listener resource has been
optional but this is not aligned with Octavia's API and causes
a strange failure when a user creates a pool without the property.

This makes the property required to enforce the same requirements as
one made by Octavia's API.

Story: 1748389
Task: 17347
Change-Id: Ib8af29c3d45d5ffbbb21c216429ef38d0d273d05
2023-11-27 11:07:15 +09:00
Zuul 1aade657ad Merge "Add OS::Aodh::PrometheusAlarm resource" 2023-11-10 00:24:21 +00:00
Takashi Kajinami 6d13e93a37 Enable new defaults and scope checks by default
Based on the agreed steps to implement the SRBAC community goal, this
enables the new policy defaults and scope checks by default.

Change-Id: I315893150549d1174c3270c37c031e6a519f9a28
2023-10-24 13:18:40 +09:00
Stephen Finucane 559e840053 common: Replace deprecated importlib APIs (1/2)
Resolve the following deprecation warning:

   DeprecationWarning: find_module() is deprecated and slated for
   removal in Python 3.12; use find_spec() instead

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I88005c694b94d249bce53f46df67b51c7e01adae
2023-10-16 17:24:23 +09:00
Stephen Finucane 4d882edc30 db: Use raw connection to enable foreign keys
SQLAlchemy 2.0 wraps mostly everything in transactions, which limits our
ability to do this easily on a non-global basis. Use the raw connection
[1] instead.

[1] https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.execute

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic2bbf59550e965769c6b64f3e5eeec9783c6b290
2023-10-12 15:46:39 +00:00
Stephen Finucane 9b754a019e db: Don't rely on branched connections
We were previously calling 'connect()' on the 'connectable' object in
'run_migrations_online', regardless of whether it was an 'Engine' or
'Connection' object. This worked because, as noted in an inline comment,
"when connectable is already a Connection object, calling 'connect()'
gives us a *branched connection*." This is no longer the case. From the
SQLAlchemy docs [1]:

  The Connection object does not support "branching", which was a
  pattern by which a sub "connection" would be used that refers to this
  connection as a parent.

Update our code to reflect this change, using the newly updated example
from the SQLAlchemy cookbook doc [2] as inspiration.

[1] https://docs.sqlalchemy.org/en/14/core/future.html#sqlalchemy.future.Connection
[2] https://alembic.sqlalchemy.org/en/latest/cookbook.html#connection-sharing

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Id41ae6d3fa3f343efdb727aae9bdef8ad2a098fd
2023-10-12 15:46:28 +00:00
Stephen Finucane bb6b5ed5c7 db: Migrate to enginefacade pattern
This also gets us away from autocommit, i.e. the last outstanding item
in our preparation for SQLAlchemy 2.x.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I95c5e5d6b33e73a1df2bf036df44aa2e06cc9640
2023-10-12 15:46:21 +00:00
Stephen Finucane 879bc37bb0 db: Remove use of 'transaction' helper
Make sure we avoid nested sessions going forward.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ia171bb823f5302fb3a6b2f6f88f7295f97254759
2023-10-12 15:46:13 +00:00
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 a9634d3f45 db: Remove use of subtransactions
This turned out to be easier done that I expected.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ie50b4bd212c758ec41c82be145290024910099a0
2023-10-13 00:41:37 +09:00
Martin Mágr f8a44f4904 Add OS::Aodh::PrometheusAlarm resource
This patch adds support for Aodh alarms of type Prometheus.

Depends-On: I72e124cca4398b78f7ed12e1db3f66bdbfcb196e
Change-Id: I5bb7c4d9086715fc22c0f7abc36d9bbfc88a60c9
2023-10-03 11:25:27 +00:00
Stephen Finucane e1184e96db tests: Add missing oslo.messaging config fixture
Some tests were failing if run by themselves.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic797e8648283605940be9d0889c38641f34e86e7
2023-09-15 20:22:30 +01:00
Zuul 346f1d7611 Merge "Isolate project scope and system scope" 2023-09-15 09:35:43 +00:00
Ekaterina Chernova 7860e7acbc Handle FK error when creating/updating software deployments
Software deployments have FK constraints on software configs.
This change ensures the DBReferenceError caused by the constraints is
properly caught. With this change now heat returns 400 Bad Response,
instead of 500 Internal Server Error when a user tries to create
a software deployment with a non-existing software config.

Also, the stack_user_project_id field is defined as 64-chars-long
string in DB model, so we should ensure that the input value is shorter
than 65 chars. Otherwise it also results in DB error.

Story: 2010001
Task: 45098
Change-Id: I03274dc0cffa226140eb720458cce81e8b5ce187
2023-09-13 15:26:11 +09:00
Takashi Kajinami 185f28a3b4 Isolate project scope and system scope
This change updates the default policies implemented in Heat, to follow
the updated guideline[1] to implement SRBAC.

The main change is that system users are no longer allowed to perform
any operations about project-level resources like stacks, while project
admin(*1) is still allowed to perform operations about project-level
resources BEYOND project (like getting stacks for all projects by list
stacks API).

[1] https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html#direction-change

This also adds the test cases to validate reader role which was almost
implemented in heat.

(*1)
If Keystone has an admin project defined, Heat checks an additional
requirement that request context is scoped by that admin project.

Change-Id: I943b3c1ce021cc05445b73fbc342b8386cf5bf6a
2023-06-28 18:38:59 +09:00
Stephen Finucane 1331c650b0 db: Don't rely on autocommit behavior
Resolve the following RemovedIn20Warning warning:

  The current statement is being autocommitted using implicit
  autocommit, which will be removed in SQLAlchemy 2.0. Use the .begin()
  method of Engine or Connection in order to use an explicit transaction
  for DML and DDL statements.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ibe7503002be9f7cdf13259379ebbf6e9c329a028
2023-06-19 10:56:19 +01:00
Stephen Finucane 591d0ba1be db: Replace use of strings in join, defer operations
Resolve the following RemovedIn20Warning warnings:

  Using strings to indicate column or relationship paths in loader
  options is deprecated and will be removed in SQLAlchemy 2.0. Please
  use the class-bound attribute directly.

  Using strings to indicate relationship names in Query.join() is
  deprecated and will be removed in SQLAlchemy 2.0. Please use the
  class-bound attribute directly.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I81a506281a0cece77cad41c5290e41fa3d7ef246
2023-06-19 10:45:58 +01:00
Stephen Finucane 6f61fa05c5 db: Remove use of 'bind' arguments
Resolve the following RemovedIn20Warning warnings:

  The MetaData.bind argument is deprecated and will be removed in
  SQLAlchemy 2.0.

  The ``bind`` argument for schema methods that invoke SQL against an
  engine or connection will be required in SQLAlchemy 2.0.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Idcd26c539f6c46dac245e6a445e64a0bf1596379
2023-06-19 10:45:58 +01:00
Stephen Finucane 304a433b64 db: Update 'select()' calls
Resolve the following sqlalchemy.exc.RemovedIn20Warning warning:

  The legacy calling style of select() is deprecated and will be removed
  in SQLAlchemy 2.0.  Please use the new calling style described at
  select().

For more information, refer to http://sqlalche.me/e/b8d9.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Id64999a7aa6081a5b1f2ac12674204bd02f2c012
2023-06-19 10:45:58 +01:00
Stephen Finucane 60e86b721e db: Replace use of 'autoload' parameter
Resolve the following RemovedIn20Warning warnings:

  The autoload parameter is deprecated and will be removed in version
  2.0.  Please use the autoload_with parameter, passing an engine or
  connection.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I2a626bd60ecc824d9328d08e582d78d5cb568f5a
2023-06-19 10:45:58 +01:00
Stephen Finucane 15f5e3f08a db: Remove use of Query.get() method
Actually, not really. We just remove the warning. Apparently it's not
used here.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ie6c45772247850d40b0cf4b135e5a3028b1758af
2023-06-19 10:45:58 +01:00
Stephen Finucane 9d2cc71975 db: Replace use of Engine.execute() method
Resolve the following RemovedIn20Warning warning:

  The Engine.execute() method is considered legacy as of the 1.x
  series of SQLAlchemy and will be removed in 2.0.

This one is pretty simple.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Iec56e6bff476ae9b68a4821be9cc93e3af84a325
2023-06-19 10:45:58 +01:00