Skip to content

Commit

Permalink
Merge 2.7 into develop and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleasa committed Apr 30, 2020
2 parents 805e104 + 73057f4 commit 05265c4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
6 changes: 5 additions & 1 deletion acceptancetests/deploy_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,11 @@ def runtime_context(self, addable_machines):
with self.client.ignore_soft_deadline():
self.client.list_controllers()
self.client.list_models()
for m_client in self.client.iter_model_clients():

# Only show status for models the backend is tracking.
# This prevents errors attempting to retrieve status for
# models that have been issued a destroy command.
for m_client in self.client._backend.added_models:
m_client.show_status()
finally:
with self.client.ignore_soft_deadline():
Expand Down
4 changes: 1 addition & 3 deletions core/constraints/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ func ParseWithAliases(args ...string) (cons Value, aliases map[string]string, er
val = currentValue
if canonical, ok := rawAliases[currentName]; ok {
aliases[currentName] = canonical
name = canonical
}
} else if name != "" {
val += " " + currentValue
Expand Down Expand Up @@ -601,9 +602,6 @@ func (v *Value) setCpuPower(str string) (err error) {
}

func (v *Value) setInstanceType(str string) error {
if v.InstanceType != nil {
return errors.Errorf("already set")
}
v.InstanceType = &str
return nil
}
Expand Down
15 changes: 15 additions & 0 deletions core/constraints/constraints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ var parseConstraintsTests = []struct {
}, {
summary: "instance type empty",
args: []string{"instance-type="},
}, {
summary: "instance type with spaces",
args: []string{"instance-type=something with spaces"},
},

// "virt-type" in detail.
Expand Down Expand Up @@ -475,6 +478,18 @@ func (s *ConstraintsSuite) TestMerge(c *gc.C) {
c.Assert(merged, jc.DeepEquals, constraints.Value{})
}

func (s *ConstraintsSuite) TestParseZoneWithSpaces(c *gc.C) {
con := constraints.MustParse(
"arch=amd64 instance-type=with spaces cores=1",
)
c.Assert(con.Arch, gc.Not(gc.IsNil))
c.Assert(con.InstanceType, gc.Not(gc.IsNil))
c.Assert(con.CpuCores, gc.Not(gc.IsNil))
c.Check(*con.Arch, gc.Equals, "amd64")
c.Check(*con.InstanceType, gc.Equals, "with spaces")
c.Check(*con.CpuCores, gc.Equals, uint64(1))
}

func (s *ConstraintsSuite) TestParseMissingTagsAndSpaces(c *gc.C) {
con := constraints.MustParse("arch=amd64 mem=4G cores=1 root-disk=8G")
c.Check(con.Tags, gc.IsNil)
Expand Down
2 changes: 1 addition & 1 deletion state/machine_linklayerdevices.go
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ func (m *Machine) GetNetworkInfoForSpaces(spaces set.Strings) map[string]Machine
// when we have subnets populated for all providers.
if r, ok := results[corenetwork.AlphaSpaceId]; !ok && spaces.Contains(corenetwork.AlphaSpaceId) {
if privateLinkLayerAddress != nil {
r.NetworkInfos, err = addAddressToResult(r.NetworkInfos, privateLinkLayerAddress)
r.NetworkInfos, _ = addAddressToResult(r.NetworkInfos, privateLinkLayerAddress)
} else {
r.NetworkInfos = []network.NetworkInfo{{
Addresses: []network.InterfaceAddress{{
Expand Down
8 changes: 4 additions & 4 deletions worker/uniter/runner/jujuc/relation-set.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ func (c *RelationSetCommand) Run(ctx *cmd.Context) (err error) {
}
var settings Settings
if c.Application {
isLeader, err := c.ctx.IsLeader()
if err != nil {
return errors.Annotate(err, "cannot determine leadership status")
isLeader, lErr := c.ctx.IsLeader()
if lErr != nil {
return errors.Annotate(lErr, "cannot determine leadership status")
} else if isLeader == false {
return errors.Annotate(err, "cannot write relation settings")
return errors.Errorf("cannot write relation settings")
}
settings, err = r.ApplicationSettings()
if err != nil {
Expand Down

0 comments on commit 05265c4

Please sign in to comment.