← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/turnip:charm-drop-resources into turnip:master

 

Colin Watson has proposed merging ~cjwatson/turnip:charm-drop-resources into turnip:master.

Commit message:
charm: Drop resources

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

These were 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 upgrade to a version of the turnip-base layer that drops the resource declaration, and remove the associated build machinery.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/turnip:charm-drop-resources into turnip:master.
diff --git a/charm/Makefile b/charm/Makefile
index 860567f..1b22ae7 100644
--- a/charm/Makefile
+++ b/charm/Makefile
@@ -10,8 +10,6 @@ export INTERFACE_PATH := $(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 := \
 	turnip-pack-backend \
@@ -80,18 +78,13 @@ bundle.yaml: bundle.yaml.in tmp/git.launchpad.test.crt tmp/ssh-host-key
 	     -e "s/%PUBLIC_SSH_KEY%/$$(base64 -w 0 <tmp/ssh-host-key.pub)/g" \
 	     bundle.yaml.in >bundle.yaml
 
-deploy: build payload bundle.yaml
+deploy: build bundle.yaml
 	@echo "Deploying $(APP_NAME)..."
 	@juju deploy ./bundle.yaml
 	@echo "You will need to point these to a Launchpad/turnipcake deployment:"
 	@echo "  - authentication_endpoint (turnip-pack-frontend-ssh)"
 	@echo "  - virtinfo_endpoint (turnip-pack-{backend,virt,frontend-http})"
 
-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 '{}' \;
@@ -140,4 +133,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 55c04e6..e048ae9 100644
--- a/charm/bundle.yaml.in
+++ b/charm/bundle.yaml.in
@@ -33,24 +33,18 @@ applications:
     num_units: 1
     options:
       build_label: "%BUILD_LABEL%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
   turnip-pack-virt:
     charm: ./dist/turnip-pack-virt
     num_units: 1
     to: [turnip-pack-backend]
     options:
       build_label: "%BUILD_LABEL%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
   turnip-pack-frontend-git:
     charm: ./dist/turnip-pack-frontend-git
     num_units: 1
     to: [turnip-pack-backend]
     options:
       build_label: "%BUILD_LABEL%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
   turnip-pack-frontend-ssh:
     charm: ./dist/turnip-pack-frontend-ssh
     num_units: 1
@@ -59,32 +53,24 @@ applications:
       build_label: "%BUILD_LABEL%"
       private_ssh_key: "%PRIVATE_SSH_KEY%"
       public_ssh_key: "%PUBLIC_SSH_KEY%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
   turnip-pack-frontend-http:
     charm: ./dist/turnip-pack-frontend-http
     num_units: 1
     to: [turnip-pack-backend]
     options:
       build_label: "%BUILD_LABEL%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
   turnip-api:
     charm: ./dist/turnip-api
     num_units: 1
     to: [turnip-pack-backend]
     options:
       build_label: "%BUILD_LABEL%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
   turnip-celery:
     charm: ./dist/turnip-celery
     num_units: 1
     to: [turnip-pack-backend]
     options:
       build_label: "%BUILD_LABEL%"
-    resources:
-      turnip: "../build/%BUILD_LABEL%/turnip.tar.gz"
 relations:
   - ["haproxy", "turnip-pack-backend"]
   - ["haproxy", "turnip-pack-virt:turnip-pack-backend"]
diff --git a/charm/layer/turnip-base/lib/charms/turnip/base.py b/charm/layer/turnip-base/lib/charms/turnip/base.py
index 68cf88f..55f55bb 100644
--- a/charm/layer/turnip-base/lib/charms/turnip/base.py
+++ b/charm/layer/turnip-base/lib/charms/turnip/base.py
@@ -212,12 +212,7 @@ def install_payload():
                 os.path.join('turnip-builds', object_name), archive_path,
                 container=swift_container, **swift_creds)
         else:
-            resource_path = hookenv.resource_get('turnip')
-            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/layer/turnip-base/metadata.yaml b/charm/layer/turnip-base/metadata.yaml
deleted file mode 100644
index 4913e81..0000000
--- a/charm/layer/turnip-base/metadata.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-resources:
-  turnip:
-    type: file
-    filename: turnip.tar.gz
-    description: Turnip code
diff --git a/charm/turnip-api/charmcraft.yaml b/charm/turnip-api/charmcraft.yaml
index 60744e5..26d38c9 100644
--- a/charm/turnip-api/charmcraft.yaml
+++ b/charm/turnip-api/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump
diff --git a/charm/turnip-celery/charmcraft.yaml b/charm/turnip-celery/charmcraft.yaml
index e19dd1a..62dd958 100644
--- a/charm/turnip-celery/charmcraft.yaml
+++ b/charm/turnip-celery/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump
diff --git a/charm/turnip-pack-backend/charmcraft.yaml b/charm/turnip-pack-backend/charmcraft.yaml
index 7a23c6e..efa254a 100644
--- a/charm/turnip-pack-backend/charmcraft.yaml
+++ b/charm/turnip-pack-backend/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump
diff --git a/charm/turnip-pack-frontend-git/charmcraft.yaml b/charm/turnip-pack-frontend-git/charmcraft.yaml
index f828ef1..4065f84 100644
--- a/charm/turnip-pack-frontend-git/charmcraft.yaml
+++ b/charm/turnip-pack-frontend-git/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump
diff --git a/charm/turnip-pack-frontend-http/charmcraft.yaml b/charm/turnip-pack-frontend-http/charmcraft.yaml
index cbd7539..8539202 100644
--- a/charm/turnip-pack-frontend-http/charmcraft.yaml
+++ b/charm/turnip-pack-frontend-http/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump
diff --git a/charm/turnip-pack-frontend-ssh/charmcraft.yaml b/charm/turnip-pack-frontend-ssh/charmcraft.yaml
index a07ec9d..a0abc5f 100644
--- a/charm/turnip-pack-frontend-ssh/charmcraft.yaml
+++ b/charm/turnip-pack-frontend-ssh/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump
diff --git a/charm/turnip-pack-virt/charmcraft.yaml b/charm/turnip-pack-virt/charmcraft.yaml
index cdfc656..7fc55c6 100644
--- a/charm/turnip-pack-virt/charmcraft.yaml
+++ b/charm/turnip-pack-virt/charmcraft.yaml
@@ -117,7 +117,7 @@ parts:
       - "-layers"
   launchpad-layers:
     source: https://git.launchpad.net/launchpad-layers
-    source-commit: "010076b94e548088d1501a77eefaa93d142db983"
+    source-commit: "f80d86736c1f0e470aaa83d5bb20836b0a8a3c2e"
     source-submodules: []
     source-type: git
     plugin: dump