44 Commits

Author SHA1 Message Date
Hervé Beraud
77fdcf3e27 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: I538b5c2a9df4de66c9874e65247496e54c0522e8
2021-12-15 10:56:43 +00:00
Liam Young
7873b20126 Use chelper generate_ha_relation_data for ha rel
Use the generate_ha_relation_data helper from charmhelpers to
generate the data to send down the relation to the hacluster
charm.

This results in a few changes in behaviour:

1) The charm will no longer specify a nic name to bind the vip. This
   is because Pacemaker VIP resources are able to automatically
   detect and configure correct iface and netmask parameters based
   on local configuration of the unit.
2) The original iface named VIP resource will be stopped and deleted
   prior to the creation of the new short hash named VIP resource.

Change-Id: I50bddc990cb0182c8ba3a3d473fba2d60186322a
2018-12-03 13:04:34 +00:00
James Page
3451c1c498 Tidy ceph backend configuration
Drop generation of upstart override file and /etc/environment and
scrub any existing charm configuration in these locations from
an existing install.

These where required way back in the dawn of time when ceph support
was alpha/beta in cinder.

Provide backend specific configuration file path, allowing multiple
ceph clusters to be used with a single cinder application.

Change-Id: I7adba0d35fb7406afa40f047b79a9ab51a6a333d
Closes-Bug: 1769196
2018-05-10 11:51:04 +01:00
melissaml
44ea2653ae Change assert(Not)Equals to assert(Not)Equal
According to http://docs.python.org/2/library/unittest.html
assert(Not)Equals is a deprecated alias of assert(Not)Equal.

Change-Id: I242db7583487d735faba46ac76798cc06967adb6
Closes-Bug: #1329757
2017-09-13 16:54:19 +08:00
Edward Hope-Morley
7cf7985f12 Cleanup db initialisation notification code
This charm contains the origical implementaion of the
db initialisation code that ensures that a db init/migrate
is only performed once as and when needed and that
services are only restarted accordingly. This patch serves as
a cleanup to include fixes and improvements as landed in
the related neutron-api patch that is adopting the same
approach.

Change-Id: I20161c8676d775f4a935315796d6e6b5376ba13c
Related-Bug: 1708459
2017-08-23 17:14:26 +01:00
David Ames
3c91613af5 Network space aware address for cluster relation
Use the get_relation_ip function for selecting addresses for the
cluster relationship. Including overrides for the admin, internal,
and public config settings or extra bindings.

Partial-Bug: #1687439

Change-Id: I49f8039f069ba51a6eca58949106507d27af5302
2017-05-04 15:55:23 -07:00
David Ames
f5b4750c40 Avoid shared-db change when using access-network
When the percona-cluster charm sets an access-network but the default
unit-get address is not on that network extra shared-db relations get
executed. This is specifically a problem when running upgrades and
trying to avoid API downtime.

The root cause is that the access-network is not checked until the
SharedDBContext is consulted. But then db_joined function will
change it back to the wrong ip on subsequent runs.

This change adds a check for access-network on the relation during
the db_joined function and pushes IP selection off to
get_relation_ip.

Charm helpers sync to pull in changes to get_relation_ip.

Change-Id: I5a78e9dc07c92b54e99e62e00ef6fe505cfa2fdb
Partial-bug: #1677647
2017-04-26 15:20:41 -07:00
James Page
e02c7cae82 Re-license charm as Apache-2.0
All contributions to this charm where made under Canonical
copyright; switch to Apache-2.0 license as agreed so we
can move forward with official project status.

Change-Id: I6bf4c1a59778105d81a211b044817cf1041157a2
2016-06-28 12:09:16 +01:00
Liam Young
e33eb802c8 Charmhelper sync before 1604 testing
Change-Id: I87e827449ac2eaf8652979c5219ef43b60fbe7f7
2016-04-13 08:37:51 +00:00
Edward Hope-Morley
0bee8428f5 Add hardening support
Add charmhelpers.contrib.hardening and calls to install,
config-changed, upgrade-charm and update-status hooks. Also
add new config option to allow one or more hardening
modules to be applied at runtime.

Change-Id: I69c132b95290faa2cf14accb5e024f98b5aa9c6b
2016-03-31 10:43:24 +01:00
James Page
4f0f555499 Make sure that RESTART_MAP is patched consistently 2015-09-14 14:56:38 +01:00
James Page
1074bee48f Tidy lint 2015-09-14 14:40:59 +01:00
James Page
b29bd74674 Use context helpers throughout 2015-09-14 14:39:00 +01:00
Corey Bryant
f3e423dec2 Fix unit test 2015-06-19 16:29:55 +00:00
James Page
5d0844e2bc Add support for leader-election 2015-06-09 10:57:24 +01:00
Edward Hope-Morley
619ce06579 [hopem,r=]
Ensure services are restarted after db initialised.

Closes-Bug: 1457267
2015-05-22 12:31:45 -07:00
Liam Young
7f8e97d407 Fix unit_tests 2015-03-10 09:06:37 +00:00
Liam Young
6bb29ed23f Fix unit tests 2015-01-22 16:51:07 +00:00
James Page
14850386c3 Rebase on next 2015-01-13 14:36:44 +00:00
James Page
aa223cb7a0 Tidy lint 2014-11-12 09:25:46 +00:00
James Page
0bdf93d156 Re-use old config option names to help with upgrades 2014-11-12 09:22:45 +00:00
James Page
8ad169ed04 Provide fallback configuration options for VIP if no IP addresses are bound to the VIP interface 2014-11-12 09:12:13 +00:00
Edward Hope-Morley
18b7bebcc2 [hopem,r=]
Implemeted Ceph broker support for ceph-client
relation.
2014-11-07 15:47:00 +01:00
James Page
d3b6038871 Rebase and resync 2014-10-01 23:07:44 +01:00
James Page
cf20f3109e [xianghui,dosaboy,r=james-page,t=gema] Add IPv6 support using prefer-ipv6 flag 2014-10-01 21:42:34 +01:00
Hui Xiang
64e3275a9f Refactor codes. 2014-09-30 13:27:55 +08:00
James Page
795eddd5dd Resync helpers, deal with HTTPS+HA multibackends in haproxy 2014-09-29 10:07:57 +01:00
James Page
de56e49cab Resync trunk helpers.
Drop eligible leader checks for cluster and identity relations; setting
this data is always a good idea so that a consistent set of data is
presented to keystone.
2014-09-26 11:01:31 +01:00
Hui Xiang
c73850922f Fix unit error by sync charmers. 2014-09-19 20:55:12 +08:00
Hui Xiang
bb3c01589d Integrate all IPv6 check into setup_ipv6() 2014-09-18 20:47:52 +08:00
Hui Xiang
100fb15c42 Fix unit tests error and revert format ipv6. 2014-09-18 15:21:25 +08:00
James Page
a507186b89 Update unit test for previous commit to ensure no regressions 2014-09-04 10:51:54 +01:00
James Page
a39798db95 Use new IP helpers for endpoint registration 2014-07-03 10:57:07 +01:00
James Page
c2e92b7d71 [tribaal,r=james-page,t=james-page]
Resync helpers to pickup fixes for apt lock races and better block device detection and handling.
2014-05-21 10:57:23 +01:00
James Page
bc1fac4e23 Add tests for configure_lvm_storage 2014-04-07 14:09:04 +01:00
James Page
bfbf3eaa09 [yolanda] Add support for postgresql
Refactor templates to use includes.
2014-03-31 12:11:01 +01:00
James Page
19e77b0ae5 [yolanda.robla,r=james-page] Manage ceph configuration file using alternatives to support container co-installability. 2014-03-13 15:50:49 +00:00
Ante Karamatic
bf8847cee9 Fix unit tests 2014-02-17 13:06:39 +01:00
yolanda.robla@canonical.com
4c256f7b86 moving ceph.conf to /var/lib/charm/{}/ceph.conf 2014-02-12 11:55:14 +01:00
yolanda.robla@canonical.com
c37fda20d2 fixed lint, tests 2014-01-15 16:30:21 +01:00
James Page
673662114e Fixup use of assert_called() 2013-10-20 11:31:12 -07:00
James Page
284a1f9483 Fixup use of assert_not_called 2013-10-20 10:44:45 -07:00
James Page
b1e99b7e88 Improve unit testing coverage 2013-10-19 17:58:37 +01:00
Adam Gandelman
fb49349776 Merging python-redux and havana work. 2013-10-17 14:48:08 -07:00