def SetUp(self): self.preserved_state_metadata = [ config_utils.MakePreservedStateMetadataMapEntry(self.messages, key='key-BAR', value='value BAR'), config_utils.MakePreservedStateMetadataMapEntry(self.messages, key='key-foo', value='value foo'), ]
def testSimpleCase(self): disk_source = self.project_uri + '/zones/us-central2-a/disks/foo-2' preserved_state_disks = [ config_utils.MakePreservedStateDiskMapEntry( self.messages, 'foo', disk_source, 'READ_ONLY', 'on-permanent-instance-deletion'), ] preserved_state_metadata = [ config_utils.MakePreservedStateMetadataMapEntry(self.messages, key='key-BAR', value='new value'), ] self._ExpectListManagedInstances() self._ExpectListPerInstanceConfigs() self._ExpectUpdatePerInstanceConfigs( preserved_state_disks=preserved_state_disks, preserved_state_metadata=preserved_state_metadata) self._ExpectPollingOperation() self._ExpectGetInstanceGroupManager() self._ExpectApplyUpdatesToInstances('restart') self._ExpectPollingOperation('apply') self._ExpectGetInstanceGroupManager() self.Run(""" compute instance-groups managed instance-configs update group-1 --region us-central2 --instance foo --stateful-disk device-name=foo,source={project_uri}/zones/us-central2-a/disks/foo-2,mode=ro,auto-delete=on-permanent-instance-deletion --remove-stateful-disks baz --stateful-metadata "key-BAR=new value" --remove-stateful-metadata key-foo --instance-update-minimal-action restart """.format(project_uri=self.project_uri))
def SetUp(self): self._preserved_state_disk_1 = config_utils.MakePreservedStateDiskMapEntry( self.messages, 'foo', (self.project_uri + '/zones/us-central2-a/disks/foo'), 'READ_WRITE') self._preserved_state_disk_2 = config_utils.MakePreservedStateDiskMapEntry( self.messages, 'baz', (self.project_uri + '/zones/us-central2-a/disks/baz'), 'READ_ONLY') self.preserved_state_metadata = [ config_utils.MakePreservedStateMetadataMapEntry(self.messages, key='key-BAR', value='value BAR'), config_utils.MakePreservedStateMetadataMapEntry(self.messages, key='key-foo', value='value foo'), ]