← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/rutabaga:charm-remove-resource into rutabaga:master.

Commit message:
charm: Drop resource from rutabaga charm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/rutabaga/+git/rutabaga/+merge/440892

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.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/rutabaga:charm-remove-resource into rutabaga:master.
diff --git a/charm/Makefile b/charm/Makefile
index 553f2fa..df03454 100644
--- a/charm/Makefile
+++ b/charm/Makefile
@@ -7,8 +7,6 @@ export CHARM_INTERFACES_DIR := $(TMPDIR)/deps/interface
 CHARM_WHEELS_DIR := $(TMPDIR)/deps/charm-wheels
 
 BUILD_LABEL = $(shell git rev-parse HEAD)
-TARBALL = $(APP_NAME).tar.gz
-ASSET = ../build/$(BUILD_LABEL)/$(TARBALL)
 
 CHARMS := \
 	rutabaga \
@@ -65,15 +63,10 @@ bundle.yaml: bundle.yaml.in tmp/admin-api-secret
 		-e "s/%ADMIN_API_SECRET%/$$(cat tmp/admin-api-secret)/g" \
 		bundle.yaml.in >bundle.yaml
 
-deploy: build payload bundle.yaml
+deploy: build bundle.yaml
 	@echo "Deploying $(APP_NAME)..."
 	@juju deploy ./bundle.yaml
 
-payload: $(ASSET)
-$(ASSET):
-	@echo "Building asset for $(BUILD_LABEL)..."
-	@$(MAKE) -C .. build-tarball
-
 clean:
 	@find . -name \*.pyc -delete
 	@find . -depth -name '__pycache__' -exec rm -rf '{}' \;
@@ -122,4 +115,4 @@ setup-jenkaas:
 	sudo snap install --classic charm
 
 .PHONY: $(foreach charm,$(CHARMS),build-$(charm))
-.PHONY: all build clean deploy lint payload publish setup-jenkaas
+.PHONY: all build clean deploy lint publish setup-jenkaas
diff --git a/charm/bundle.yaml.in b/charm/bundle.yaml.in
index dbe2664..c6d31e6 100644
--- a/charm/bundle.yaml.in
+++ b/charm/bundle.yaml.in
@@ -33,8 +33,8 @@ applications:
       admin_api_secret: "%ADMIN_API_SECRET%"
       build_label: "%BUILD_LABEL%"
       nagios_context: lp-devel-builder-proxy
-    resources:
-      rutabaga: "../build/%BUILD_LABEL%/rutabaga.tar.gz"
+      swift_container_name: "rutabaga-builds"
+      swift_storage_url: "https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_1f1e18e10e564f7f81e345b5e4edbf6f";
   rutabaga-auth-helper:
     charm: ./dist/rutabaga-auth-helper
 relations:
diff --git a/charm/rutabaga/lib/charms/rutabaga.py b/charm/rutabaga/lib/charms/rutabaga.py
index 1271e7d..b9b27d8 100644
--- a/charm/rutabaga/lib/charms/rutabaga.py
+++ b/charm/rutabaga/lib/charms/rutabaga.py
@@ -183,12 +183,7 @@ def install_payload():
                 os.path.join('rutabaga-builds-{}'.format(series), object_name),
                 archive_path, container=swift_container, **swift_creds)
         else:
-            resource_path = hookenv.resource_get('rutabaga')
-            if resource_path and os.path.getsize(resource_path):
-                with open(resource_path, 'rb') as resource:
-                    host.write_file(archive_path, resource.read(), perms=0o644)
-            else:
-                raise PayloadError('No build available, so cannot deploy code')
+            raise PayloadError('No build available, so cannot deploy code')
 
         # Unpack source
         target_dir = os.path.join(payloads_dir(), desired_build_label)
diff --git a/charm/rutabaga/metadata.yaml b/charm/rutabaga/metadata.yaml
index 3f316f9..7a4589a 100644
--- a/charm/rutabaga/metadata.yaml
+++ b/charm/rutabaga/metadata.yaml
@@ -23,8 +23,3 @@ provides:
 requires:
   squid:
     interface: http
-resources:
-  rutabaga:
-    type: file
-    filename: rutabaga.tar.gz
-    description: Rutabaga code