Skip to content

Commit

Permalink
refactor: Address review comments on #100
Browse files Browse the repository at this point in the history
  • Loading branch information
jneo8 committed Sep 13, 2024
1 parent f00e1fe commit 360fd4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ jobs:
- name: external controller juju config
run: |
mkdir -p $HOME/.local/share/juju
# TODO: can we remove the base64 encoding?
echo ${{ secrets.JUJU_CONTROLLERS_YAML }} | base64 -d > $HOME/.local/share/juju/controllers.yaml
echo ${{ secrets.JUJU_ACCOUNTS_YAML }} | base64 -d > $HOME/.local/share/juju/accounts.yaml
Expand All @@ -95,7 +94,7 @@ jobs:

- name: install external controller required packages
run: |
sudo snap install charmcraft --channel 2.x/stable --classic
sudo snap install charmcraft --channel 3.x/stable --classic
sudo snap install juju --channel 3.4/stable --classic
sudo --preserve-env=http_proxy,https_proxy,no_proxy pip3 install tox
juju switch soleng-ci-ctrl-34
Expand Down
4 changes: 4 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ config:
The charmed-openstack-exporter snap is by default installed from the latest/stable channel.
This option allows the selection of a different channel.
In case the openStack-exporter resource has been attached, this option has no effect.
links:
documentation: https://discourse.charmhub.io/t/openstack-exporter-docs-index/13876
Expand All @@ -89,3 +91,5 @@ resources:
scraping. The snap resource on Charmhub is intended to be an empty file. The charm will
ignore an empty file resource and normally install the snap from the snap store, but a
custom snap can also be provided here if needed.
This resource has top priority when the install hook is triggered. The snap_channel option will have no effect.
8 changes: 2 additions & 6 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ def _write_cloud_config(self, data: dict[str, str]) -> None:
OS_CLIENT_CONFIG.parent.mkdir(parents=True, exist_ok=True)
OS_CLIENT_CONFIG_CACERT.write_text(self.config["ssl_ca"])

auth_url = "{protocol}://{hostname}:{port}/v3".format(
protocol=data["service_protocol"],
hostname=data["service_hostname"],
port=data["service_port"],
)
auth_url = f"{data['service_protocol']}://data['service_hostname']:{data['service_port']}/v3"
contents = {
"clouds": {
CLOUD_NAME: {
Expand Down Expand Up @@ -147,7 +143,7 @@ def get_resource(self) -> Optional[str]:
logger.debug("cannot fetch charm resource")
return None

if not os.path.getsize(snap_path) > 0:
if not os.path.getsize(snap_path):
logger.debug("resource is an empty file")
return None

Expand Down

0 comments on commit 360fd4a

Please sign in to comment.