Commit Graph

16 Commits

Author SHA1 Message Date
Samuel Walladge cb7fdb3527 Support ldap anonymous binding
We can support this simply by allowing ldap-user and ldap-password
configuration options to be optional.

Closes-Bug: #1762587

Co-authored-by: Vern Hart <vern.hart@canonical.com>

Change-Id: I2668d90a58aac9d103240dc67061612358a67150
2022-07-01 10:47:18 +09:30
Hervé Beraud f721b78c22 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: I107cabe4608950da02ef2b89e811791ad912cf7e
2021-12-15 09:47:59 +00:00
Frode Nordahl c9fa02a6d5
Enable registration of packages with principal charm
For principal - subordinate plugin type relations where the
principal Python payload imports code from packages managed by a
subordinate, upgrades can be problematic.

This change will allow a subordinate charm that have opted into the
feature to inform its principal about all implemented release -
packages combinations ahead of time. With this information in place
the principal can do the upgrade in one operation without risk of
charm relation RPC type processing at a critical moment.

Depends-On: https://review.opendev.org/c/openstack/charms.openstack/+/781487
Depends-On: https://review.opendev.org/c/openstack/charm-layer-openstack/+/781624
Depends-On: https://review.opendev.org/c/openstack/charm-interface-keystone-domain-backend/+/781658
Closes-Bug: #1806111
Change-Id: Ib3239690286dc902eb247edec96b8dca7bf5bee4
2021-03-19 17:49:51 +01:00
Hemanth Nakkina 65bb510b51 Explicitly define ldap configurations
Add new options to keystone-ldap charm to explicitly specify
necessary ldap configuration values. The default values for
the new configuration parameters introduced in this patch are
empty so the default upstream keystone ldap config options are
used when undeclared.

If the same LDAP config options are specified in
ldap-config-flags and the respective charm config
option, then the value from the charm config option
will be used.

Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/458
Change-Id: Ib269e74c7d313d9c6d09da29661dd279995dffe4
Closes-Bug: #1832765
2020-11-16 17:46:22 -03:00
Hervé Beraud b61abe5e66 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I93c0482b258fb379ce144363e8ebe7fc816ddd2b
2020-06-02 19:55:02 +02:00
David Ames 4163fdcbee Enable Rocky and python3
When the primary keystone is deployed with rocky and python3 the charm
fails to install the correct python3 packages and use the correct
clients.

Note: A related bug #1798184, will cause the tests to fail. A complete
Rocky python3 solution is dependent on #1798184 being resolved.

Change-Id: I42d8a5bfff3200d18e7bad0bd29edf12aa6a05c7
Closes-Bug: #1806111
2019-03-20 12:22:45 -04:00
David Ames 22399caea9 Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu
series.

Depends-On: If42efab93dca85137d8758cae4f2e8baab75ae72
Change-Id: I0d2f2eec25c8753a4d6d0f7dffdbb54a6b35ebe1
2018-10-17 23:24:02 +00:00
Dmitrii Shcherbakov 5d644391ad add support for ldaps and starttls via config opts
* Both ldaps and ldap + StartTLS require a CA certificate configuration
option;
* use_tls option should only be used for StartTLS and will result in an
error if used with a URL that starts with ldaps;
* if a certificate is specified then LDAP backend server's certificate
validation is considered mandatory ("demand" option).

Depends-On: Ied4b6ed64354e3de3c78e6ac809666ee9ae29d1a
Change-Id: I659683ffec91560ebbd77969840c27e3d7048689
Closes-Bug: #1728155
2018-02-06 20:56:18 +03:00
Dmitrii Shcherbakov b5fe0ef6c9 refactor keystone-ldap
* replace singletons with provide_charm_instance (in the code and tests)
* select an openstack release based on keystone package due to the lack
of openstack-origin from the principal layer (this is a subordinate, see
https://git.io/vNTyx)
* use reactive triggers to drop config.complete (new configuration
completeness) and config.rendered (non-stale config is rendered) on
config.changed
* do not check config completeness on every event - only when config has
actually changed
* remove the domain configuration file when relation with keystone is
removed (service restart should be performed on the keystone charm side)
* replace path_hash with file_hash (path_hash returns a new dict)
* modify unit tests to reflect the changes

Change-Id: Ied4b6ed64354e3de3c78e6ac809666ee9ae29d1a
Closes-Bug: #1741661
2018-02-06 20:55:57 +03:00
Edward Hope-Morley 47bb457447 Ensure config changes are applied
Currently any config changes post-deployment are
ignored once the domain name is set. This patch
ensures that any changes are registered and applied.

Change-Id: Id37db3c74d3712bc96c3f8ed6a04c907e4d18bc5
Closes-Bug: #1712972
2018-01-03 17:38:20 +00:00
David Ames a780e72d81 Mock snap_install_requested in unit tests
Unit test for layered charms fail due to the new snap support.
snap_install_requested must be mocked out.

Change-Id: Id2e10f436300813a6c223ef4148cd82bd6f46ba5
Closes-Bug: #1722587
2017-10-12 14:49:44 +00:00
Alex Kavanagh 2ba3850521 Add guard state around configure_domain_name()
This change adds a guard state around the configure_domain_name()
function so that it only gets called ONCE when the relation connects.

This is to prevent restarting keystone everytime the update-status
hook runs on this charm.

Change-Id: I85d14ddb97e78be966f0cc8dbbcea312599d7327
2017-07-11 11:43:02 +01:00
David Ames 7a1d9eb3f8 Enable Zesty-Ocata Amulet Tests
- Turn on Zesty-Ocata Amulet test definitions.
- Standardize test-requirements.txt
- Sync charm helpers for various fixes

Change-Id: Id3cbb8944e559ddb57dd249274572d264183f56f
2017-06-08 17:35:17 +00:00
James Page 5e09fcbd10 Add unit tests 2017-01-30 11:56:35 +00:00
James Page db2a30579d Add unit testing for reactive handlers 2017-01-27 17:39:29 +00:00
James Page e83c2f07e5 Initial baseline of charm 2017-01-27 14:31:20 +00:00