Environment.assertAliveOp() in juju-1.17.0 incompatible with juju-1.16.*

Bug #1266748 reported by John A Meinel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Critical
Andrew Wilkins

Bug Description

The new code in AddOneMachine has:
 env, err := st.Environment()
 if err != nil {
  return nil, err
 } else if env.Life() != Alive {
  return nil, fmt.Errorf("environment is no longer alive")
 }
...
 ops = append(ops, env.assertAliveOp())
 if err := st.runTransaction(ops); err != nil {
  return nil, onAbort(err, fmt.Errorf("environment is no longer alive (aborted transaction)"))
 }

However, if you are connecting to a 1.16 environment, there is no Life attribute in the environment doc. Which means that the assertion op:
func (e *Environment) assertAliveOp() txn.Op {
 return txn.Op{
  C: e.st.environments.Name,
  Id: e.UUID(),
  Assert: isAliveDoc,
 }
}

fails. Because null != "0". So even though st.environment.Life() returns 0 == Alive, it isn't actually 0 in the database.

This is a compatibility regression for 1.17 vs a 1.16 environment (you can't add-machines to a 1.16 environment once my patch to support falling back is finished).

John A Meinel (jameinel)
summary: - Environments.Life() in juju-1.17.0 incompatible with juju-1.16.*
+ Environment.assertAliveOp() in juju-1.17.0 incompatible with juju-1.16.*
Revision history for this message
Andrew Wilkins (axwalk) wrote :

The assertion was originally !dead, which worked if the attribute didn't exist; this got broken during review changes. I'll see if I can whip up a unit test for this first.

Changed in juju-core:
status: Triaged → In Progress
Andrew Wilkins (axwalk)
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.