github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/cmd/juju/block/unblock.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package block 5 6 import ( 7 "fmt" 8 9 "github.com/juju/cmd" 10 ) 11 12 // UnblockCommand removes the block from desired operation. 13 type UnblockCommand struct { 14 ProtectionCommand 15 } 16 17 var ( 18 // unblockDocEnding unblock doc ending 19 unblockDocEnding = ` 20 21 Examples: 22 To allow the environment to be destroyed: 23 juju unblock destroy-environment 24 25 To allow the machines, services, units and relations to be removed: 26 juju unblock remove-object 27 28 To allow changes to the environment: 29 juju unblock all-changes 30 31 See Also: 32 juju help block 33 ` 34 // blockDoc formatted block doc 35 unblockDoc = fmt.Sprintf(blockBaseDoc, "unblocked", unblockDocEnding) 36 ) 37 38 // Info provides information about command. 39 // Satisfying Command interface. 40 func (c *UnblockCommand) Info() *cmd.Info { 41 return &cmd.Info{ 42 Name: "unblock", 43 Args: blockArgsFmt, 44 Purpose: "unblock an operation that would alter a running environment", 45 Doc: unblockDoc, 46 } 47 } 48 49 // Init initializes the command. 50 // Satisfying Command interface. 51 func (c *UnblockCommand) Init(args []string) error { 52 return c.assignValidOperation("unblock", args) 53 } 54 55 // Run unblocks previously blocked commands. 56 // Satisfying Command interface. 57 func (c *UnblockCommand) Run(_ *cmd.Context) error { 58 return c.setBlockEnvironmentVariable(false) 59 }