github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/upgrades/steps122.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package upgrades
     5  
     6  import (
     7  	"github.com/juju/juju/state"
     8  )
     9  
    10  // stateStepsFor122 returns upgrade steps form Juju 1.22 that manipulate state directly.
    11  func stateStepsFor122() []Step {
    12  	return []Step{
    13  		&upgradeStep{
    14  			description: "prepend the environment UUID to the ID of all settings docs",
    15  			targets:     []Target{DatabaseMaster},
    16  			run: func(context Context) error {
    17  				return state.AddEnvUUIDToSettings(context.State())
    18  			},
    19  		},
    20  		&upgradeStep{
    21  			description: "prepend the environment UUID to the ID of all settingsRefs docs",
    22  			targets:     []Target{DatabaseMaster},
    23  			run: func(context Context) error {
    24  				return state.AddEnvUUIDToSettingsRefs(context.State())
    25  			},
    26  		},
    27  		&upgradeStep{
    28  			description: "prepend the environment UUID to the ID of all networks docs",
    29  			targets:     []Target{DatabaseMaster},
    30  			run: func(context Context) error {
    31  				return state.AddEnvUUIDToNetworks(context.State())
    32  			},
    33  		},
    34  		&upgradeStep{
    35  			description: "prepend the environment UUID to the ID of all requestedNetworks docs",
    36  			targets:     []Target{DatabaseMaster},
    37  			run: func(context Context) error {
    38  				return state.AddEnvUUIDToRequestedNetworks(context.State())
    39  			},
    40  		},
    41  		&upgradeStep{
    42  			description: "prepend the environment UUID to the ID of all networkInterfaces docs",
    43  			targets:     []Target{DatabaseMaster},
    44  			run: func(context Context) error {
    45  				return state.AddEnvUUIDToNetworkInterfaces(context.State())
    46  			},
    47  		}, &upgradeStep{
    48  			description: "prepend the environment UUID to the ID of all statuses docs",
    49  			targets:     []Target{DatabaseMaster},
    50  			run: func(context Context) error {
    51  				return state.AddEnvUUIDToStatuses(context.State())
    52  			},
    53  		}, &upgradeStep{
    54  			description: "prepend the environment UUID to the ID of all annotations docs",
    55  			targets:     []Target{DatabaseMaster},
    56  			run: func(context Context) error {
    57  				return state.AddEnvUUIDToAnnotations(context.State())
    58  			},
    59  		}, &upgradeStep{
    60  			description: "prepend the environment UUID to the ID of all constraints docs",
    61  			targets:     []Target{DatabaseMaster},
    62  			run: func(context Context) error {
    63  				return state.AddEnvUUIDToConstraints(context.State())
    64  			},
    65  		}, &upgradeStep{
    66  			description: "prepend the environment UUID to the ID of all meterStatus docs",
    67  			targets:     []Target{DatabaseMaster},
    68  			run: func(context Context) error {
    69  				return state.AddEnvUUIDToMeterStatus(context.State())
    70  			},
    71  		}, &upgradeStep{
    72  			description: "prepend the environment UUID to the ID of all openPorts docs",
    73  			targets:     []Target{DatabaseMaster},
    74  			run: func(context Context) error {
    75  				return state.AddEnvUUIDToOpenPorts(context.State())
    76  			},
    77  		}, &upgradeStep{
    78  			description: "fix environment UUID for minUnits docs",
    79  			targets:     []Target{DatabaseMaster},
    80  			run: func(context Context) error {
    81  				return state.FixMinUnitsEnvUUID(context.State())
    82  			},
    83  		}, &upgradeStep{
    84  			description: "fix sequence documents",
    85  			targets:     []Target{DatabaseMaster},
    86  			run: func(context Context) error {
    87  				return state.FixSequenceFields(context.State())
    88  			},
    89  		}, &upgradeStep{
    90  			description: "update system identity in state",
    91  			targets:     []Target{DatabaseMaster},
    92  			run:         ensureSystemSSHKeyRedux,
    93  		},
    94  		&upgradeStep{
    95  			description: "set AvailZone in instanceData",
    96  			targets:     []Target{DatabaseMaster},
    97  			run:         addAvaililityZoneToInstanceData,
    98  		},
    99  	}
   100  }
   101  
   102  // stepsFor122 returns upgrade steps form Juju 1.22 that only need the API.
   103  func stepsFor122() []Step {
   104  	return []Step{
   105  		&upgradeStep{
   106  			description: "update the authorized keys for the system identity",
   107  			targets:     []Target{DatabaseMaster},
   108  			run:         updateAuthorizedKeysForSystemIdentity,
   109  		},
   110  	}
   111  }