github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/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 charm docs",
    15  			targets:     []Target{DatabaseMaster},
    16  			run: func(context Context) error {
    17  				return state.AddEnvUUIDToCharms(context.State())
    18  			},
    19  		},
    20  		&upgradeStep{
    21  			description: "prepend the environment UUID to the ID of all settings docs",
    22  			targets:     []Target{DatabaseMaster},
    23  			run: func(context Context) error {
    24  				return state.AddEnvUUIDToSettings(context.State())
    25  			},
    26  		},
    27  		&upgradeStep{
    28  			description: "prepend the environment UUID to the ID of all settingsRefs docs",
    29  			targets:     []Target{DatabaseMaster},
    30  			run: func(context Context) error {
    31  				return state.AddEnvUUIDToSettingsRefs(context.State())
    32  			},
    33  		},
    34  		&upgradeStep{
    35  			description: "prepend the environment UUID to the ID of all networks docs",
    36  			targets:     []Target{DatabaseMaster},
    37  			run: func(context Context) error {
    38  				return state.AddEnvUUIDToNetworks(context.State())
    39  			},
    40  		},
    41  		&upgradeStep{
    42  			description: "prepend the environment UUID to the ID of all requestedNetworks docs",
    43  			targets:     []Target{DatabaseMaster},
    44  			run: func(context Context) error {
    45  				return state.AddEnvUUIDToRequestedNetworks(context.State())
    46  			},
    47  		},
    48  		&upgradeStep{
    49  			description: "prepend the environment UUID to the ID of all networkInterfaces docs",
    50  			targets:     []Target{DatabaseMaster},
    51  			run: func(context Context) error {
    52  				return state.AddEnvUUIDToNetworkInterfaces(context.State())
    53  			},
    54  		}, &upgradeStep{
    55  			description: "prepend the environment UUID to the ID of all statuses docs",
    56  			targets:     []Target{DatabaseMaster},
    57  			run: func(context Context) error {
    58  				return state.AddEnvUUIDToStatuses(context.State())
    59  			},
    60  		}, &upgradeStep{
    61  			description: "prepend the environment UUID to the ID of all annotations docs",
    62  			targets:     []Target{DatabaseMaster},
    63  			run: func(context Context) error {
    64  				return state.AddEnvUUIDToAnnotations(context.State())
    65  			},
    66  		}, &upgradeStep{
    67  			description: "prepend the environment UUID to the ID of all constraints docs",
    68  			targets:     []Target{DatabaseMaster},
    69  			run: func(context Context) error {
    70  				return state.AddEnvUUIDToConstraints(context.State())
    71  			},
    72  		}, &upgradeStep{
    73  			description: "prepend the environment UUID to the ID of all meterStatus docs",
    74  			targets:     []Target{DatabaseMaster},
    75  			run: func(context Context) error {
    76  				return state.AddEnvUUIDToMeterStatus(context.State())
    77  			},
    78  		}, &upgradeStep{
    79  			description: "prepend the environment UUID to the ID of all openPorts docs",
    80  			targets:     []Target{DatabaseMaster},
    81  			run: func(context Context) error {
    82  				return state.AddEnvUUIDToOpenPorts(context.State())
    83  			},
    84  		}, &upgradeStep{
    85  			description: "fix environment UUID for minUnits docs",
    86  			targets:     []Target{DatabaseMaster},
    87  			run: func(context Context) error {
    88  				return state.FixMinUnitsEnvUUID(context.State())
    89  			},
    90  		}, &upgradeStep{
    91  			description: "fix sequence documents",
    92  			targets:     []Target{DatabaseMaster},
    93  			run: func(context Context) error {
    94  				return state.FixSequenceFields(context.State())
    95  			},
    96  		}, &upgradeStep{
    97  			description: "update system identity in state",
    98  			targets:     []Target{DatabaseMaster},
    99  			run:         ensureSystemSSHKeyRedux,
   100  		},
   101  		&upgradeStep{
   102  			description: "set AvailZone in instanceData",
   103  			targets:     []Target{DatabaseMaster},
   104  			run:         addAvaililityZoneToInstanceData,
   105  		},
   106  	}
   107  }
   108  
   109  // stepsFor122 returns upgrade steps form Juju 1.22 that only need the API.
   110  func stepsFor122() []Step {
   111  	return []Step{
   112  		&upgradeStep{
   113  			description: "update the authorized keys for the system identity",
   114  			targets:     []Target{DatabaseMaster},
   115  			run:         updateAuthorizedKeysForSystemIdentity,
   116  		},
   117  	}
   118  }