Merge ~cjwatson/rutabaga:charm-remove-resource into rutabaga:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 9e51c77fe9371e429f9be3aa1915a4774de3448f
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/rutabaga:charm-remove-resource
Merge into: rutabaga:master
Diff against target: 82 lines (+5/-22)
4 files modified
charm/Makefile (+2/-9)
charm/bundle.yaml.in (+2/-2)
charm/rutabaga/lib/charms/rutabaga.py (+1/-6)
charm/rutabaga/metadata.yaml (+0/-5)
Reviewer Review Type Date Requested Status
Simone Pelosi Approve
Review via email: mp+440892@code.launchpad.net

Commit message

charm: Drop resource from rutabaga charm

Description of the change

This was only ever for local development convenience, and it's usually much easier to just fetch the resource from Swift. Now that we're trying to upload the charm to Charmhub, having a resource attached to it is an active impediment, because Charmhub doesn't have a good way to deal with optional resources; so just drop it.

To post a comment you must log in.
Revision history for this message
Simone Pelosi (pelpsi) wrote :

LGMT!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/Makefile b/charm/Makefile
2index 553f2fa..df03454 100644
3--- a/charm/Makefile
4+++ b/charm/Makefile
5@@ -7,8 +7,6 @@ export CHARM_INTERFACES_DIR := $(TMPDIR)/deps/interface
6 CHARM_WHEELS_DIR := $(TMPDIR)/deps/charm-wheels
7
8 BUILD_LABEL = $(shell git rev-parse HEAD)
9-TARBALL = $(APP_NAME).tar.gz
10-ASSET = ../build/$(BUILD_LABEL)/$(TARBALL)
11
12 CHARMS := \
13 rutabaga \
14@@ -65,15 +63,10 @@ bundle.yaml: bundle.yaml.in tmp/admin-api-secret
15 -e "s/%ADMIN_API_SECRET%/$$(cat tmp/admin-api-secret)/g" \
16 bundle.yaml.in >bundle.yaml
17
18-deploy: build payload bundle.yaml
19+deploy: build bundle.yaml
20 @echo "Deploying $(APP_NAME)..."
21 @juju deploy ./bundle.yaml
22
23-payload: $(ASSET)
24-$(ASSET):
25- @echo "Building asset for $(BUILD_LABEL)..."
26- @$(MAKE) -C .. build-tarball
27-
28 clean:
29 @find . -name \*.pyc -delete
30 @find . -depth -name '__pycache__' -exec rm -rf '{}' \;
31@@ -122,4 +115,4 @@ setup-jenkaas:
32 sudo snap install --classic charm
33
34 .PHONY: $(foreach charm,$(CHARMS),build-$(charm))
35-.PHONY: all build clean deploy lint payload publish setup-jenkaas
36+.PHONY: all build clean deploy lint publish setup-jenkaas
37diff --git a/charm/bundle.yaml.in b/charm/bundle.yaml.in
38index dbe2664..c6d31e6 100644
39--- a/charm/bundle.yaml.in
40+++ b/charm/bundle.yaml.in
41@@ -33,8 +33,8 @@ applications:
42 admin_api_secret: "%ADMIN_API_SECRET%"
43 build_label: "%BUILD_LABEL%"
44 nagios_context: lp-devel-builder-proxy
45- resources:
46- rutabaga: "../build/%BUILD_LABEL%/rutabaga.tar.gz"
47+ swift_container_name: "rutabaga-builds"
48+ swift_storage_url: "https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_1f1e18e10e564f7f81e345b5e4edbf6f"
49 rutabaga-auth-helper:
50 charm: ./dist/rutabaga-auth-helper
51 relations:
52diff --git a/charm/rutabaga/lib/charms/rutabaga.py b/charm/rutabaga/lib/charms/rutabaga.py
53index 1271e7d..b9b27d8 100644
54--- a/charm/rutabaga/lib/charms/rutabaga.py
55+++ b/charm/rutabaga/lib/charms/rutabaga.py
56@@ -183,12 +183,7 @@ def install_payload():
57 os.path.join('rutabaga-builds-{}'.format(series), object_name),
58 archive_path, container=swift_container, **swift_creds)
59 else:
60- resource_path = hookenv.resource_get('rutabaga')
61- if resource_path and os.path.getsize(resource_path):
62- with open(resource_path, 'rb') as resource:
63- host.write_file(archive_path, resource.read(), perms=0o644)
64- else:
65- raise PayloadError('No build available, so cannot deploy code')
66+ raise PayloadError('No build available, so cannot deploy code')
67
68 # Unpack source
69 target_dir = os.path.join(payloads_dir(), desired_build_label)
70diff --git a/charm/rutabaga/metadata.yaml b/charm/rutabaga/metadata.yaml
71index 3f316f9..7a4589a 100644
72--- a/charm/rutabaga/metadata.yaml
73+++ b/charm/rutabaga/metadata.yaml
74@@ -23,8 +23,3 @@ provides:
75 requires:
76 squid:
77 interface: http
78-resources:
79- rutabaga:
80- type: file
81- filename: rutabaga.tar.gz
82- description: Rutabaga code

Subscribers

People subscribed via source and target branches