Skip to content

Commit

Permalink
Respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-w-shaw committed Aug 21, 2023
1 parent 3cd5b8b commit ad82229
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
4 changes: 4 additions & 0 deletions cmd/juju/application/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
50 changes: 23 additions & 27 deletions cmd/juju/application/bundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -460,89 +460,85 @@ 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"
wordpress:
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"
wordpress:
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"
Expand All @@ -556,8 +552,8 @@ applications:
- "1"
machines:
"0":
series: xenial
base: ubuntu@16.04
series: focal
base: ubuntu@20.04
"1":
series: jammy
relations:
Expand All @@ -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"
Expand All @@ -589,8 +585,8 @@ applications:
- "1"
machines:
"0":
series: xenial
base: ubuntu@16.04
series: focal
base: ubuntu@20.04
"1":
series: jammy
relations:
Expand Down

0 comments on commit ad82229

Please sign in to comment.