canonical / cloudstats

GNU General Public License v3.0
1 stars 2 forks source link

Incorrect types in config.yaml #9

Open agileshaw opened 1 year ago

agileshaw commented 1 year ago

Charm creates an invalid config for the snap. Traceback:

Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: Traceback (most recent call last): Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/bin/cloudstats-exporter", line 33, in Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: sys.exit(load_entry_point('cloudstats==0.1', 'console_scripts', 'cloudstats-exporter')()) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/cloudstats/exporter.py", line 52, in main Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: daemon = StatsExporterDaemon(sys.argv[1:]) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/cloudstats/exporter.py", line 21, in init Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: self.openstack = self.setup_openstack() Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/cloudstats/exporter.py", line 36, in setup_openstack Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: return OpenstackStats(registry=self._registry) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/cloudstats/opensdk.py", line 22, in init Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: self.connection = self._get_connection() Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/cloudstats/opensdk.py", line 42, in _get_connection Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: identity_api_version=self.config["identity_api_version"].get(int), Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/confuse/core.py", line 351, in get Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: return templates.as_template(template).value(self, template) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/confuse/templates.py", line 59, in value Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: return self.convert(value, view) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/confuse/templates.py", line 114, in convert Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: self.fail(u'must be a number', view, True) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: File "/snap/cloudstats/x2/lib/python3.6/site-packages/confuse/templates.py", line 94, in fail Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: raise exc_class(u'{0}: {1}'.format(view.name, message)) Oct 1 13:41:22 juju-7df8cc-21-lxd-7 cloudstats.cloudstats-exporter[12385]: confuse.exceptions.ConfigTypeError: openstack.identity_api_version: must be a number

The snaps cloudstats.opensdk.OpenstackStats._get_connection() method expects integers for auth_version and identity_api_version but the charm configures them as strings:

root@juju-7df8cc-21-lxd-7:KDC1:/# cat /var/snap/cloudstats/common/config.yaml ... openstack: auth_url: "https://keystone-internal.openstack-kdc-1.lmig.com:5000/v3" password: "sikkrit" username: "admin" auth_type: "password" user_domain_name: "admin_domain" project_domain_name: "admin_domain" region_name: "Liberty_Mutual_KDC1" project_name: "admin" auth_version: "3" identity_api_version: "3" ...

This could simply be a templateing issue -- the charms templates/config.yaml puts quotes around those params.


Imported from Launchpad using lp2gh.