From ad82229c1377747901759ded57d3e792492d20a0 Mon Sep 17 00:00:00 2001 From: Jack Shaw Date: Mon, 21 Aug 2023 11:55:26 +0100 Subject: [PATCH] Respond to comments --- cmd/juju/application/bundle/bundle.go | 4 ++ cmd/juju/application/bundle/bundle_test.go | 50 ++++++++++------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/cmd/juju/application/bundle/bundle.go b/cmd/juju/application/bundle/bundle.go index 113ab2ed9dc..5ff52085f5c 100644 --- a/cmd/juju/application/bundle/bundle.go +++ b/cmd/juju/application/bundle/bundle.go @@ -330,6 +330,10 @@ func verifyBundle(data *charm.BundleData, bundleDir string, verifyConstraints fu return err } + // This method cannot be included within data.Verify because + // to verify corresponding series and base match we need to be + // able to compare them. The charm package, however, treats bases + // and series generically and is unable to do this. if err := verifyMixedSeriesBasesMatch(data); err != nil { return errors.Trace(err) } diff --git a/cmd/juju/application/bundle/bundle_test.go b/cmd/juju/application/bundle/bundle_test.go index e42db9a575e..22960f6d8af 100644 --- a/cmd/juju/application/bundle/bundle_test.go +++ b/cmd/juju/application/bundle/bundle_test.go @@ -445,13 +445,13 @@ func (m stringSliceMatcher) String() string { } const unsupportedConstraintBundle = ` -default-base: ubuntu@18.04 +default-base: ubuntu@22.04 applications: mysql: charm: ch:mysql revision: 42 channel: stable - base: ubuntu@16.04 + base: ubuntu@20.04 num_units: 1 constraints: image-id=ubuntu-bf2 to: @@ -460,28 +460,28 @@ applications: charm: ch:wordpress channel: stable revision: 47 - base: ubuntu@16.04 + base: ubuntu@20.04 num_units: 1 to: - "1" machines: "0": - base: ubuntu@16.04 + base: ubuntu@20.04 "1": - base: ubuntu@16.04 + base: ubuntu@20.04 relations: - - wordpress:db - mysql:db ` const wordpressBundle = ` -default-base: ubuntu@18.04 +default-base: ubuntu@22.04 applications: mysql: charm: ch:mysql revision: 42 channel: stable - base: ubuntu@16.04 + base: ubuntu@20.04 num_units: 1 to: - "0" @@ -489,28 +489,27 @@ applications: charm: ch:wordpress channel: stable revision: 47 - base: ubuntu@16.04 + base: ubuntu@20.04 num_units: 1 to: - "1" machines: "0": - base: ubuntu@16.04 + base: ubuntu@20.04 "1": - base: ubuntu@16.04 + base: ubuntu@20.04 relations: - - wordpress:db - mysql:db ` const typoBundle = ` -sries: bionic +sries: jammy applications: mysql: charm: ch:mysql revision: 42 channel: stable - series: xenial num_units: 1 to: - "0" @@ -518,31 +517,28 @@ applications: charm: ch:wordpress channel: stable revision: 47 - series: xenial num_units: 1 to: - "1" machines: "0": - series: xenial constrai: arch=arm64 "1": - series: xenial relations: - - wordpress:db - mysql:db ` const mixedSeriesBaseBundle = ` -series: bionic -default-base: ubuntu@18.04 +series: jammy +default-base: ubuntu@22.04 applications: mysql: charm: ch:mysql revision: 42 channel: stable - series: xenial - base: ubuntu@16.04 + series: focal + base: ubuntu@20.04 num_units: 1 to: - "0" @@ -556,8 +552,8 @@ applications: - "1" machines: "0": - series: xenial - base: ubuntu@16.04 + series: focal + base: ubuntu@20.04 "1": series: jammy relations: @@ -566,15 +562,15 @@ relations: ` const mixedSeriesBaseBundleMismatch = ` -series: bionic -default-base: ubuntu@18.04 +series: jammy +default-base: ubuntu@22.04 applications: mysql: charm: ch:mysql revision: 42 channel: stable - series: xenial - base: ubuntu@16.04 + series: focal + base: ubuntu@20.04 num_units: 1 to: - "0" @@ -589,8 +585,8 @@ applications: - "1" machines: "0": - series: xenial - base: ubuntu@16.04 + series: focal + base: ubuntu@20.04 "1": series: jammy relations: