def toggle(device, partition, flag):
 _validate_device(device)
 try:
  int(partition)
 except Exception:
  raise CommandExecutionError('Invalid partition number passed to partition.toggle')
 if (flag not in set(['bios_grub', 'legacy_boot', 'boot', 'lba', 'root', 'swap', 'hidden', 'raid', 'LVM', 'PALO', 'PREP', 'DIAG'])):
  raise CommandExecutionError('Invalid flag passed to partition.toggle')
 cmd = 'parted -m -s {0} toggle {1} {2}'.format(device, partition, flag)
 out = __salt__['cmd.run'](cmd).splitlines()
 return out

def toggle ( device , partition , flag ) : _validate_device ( device ) try : int ( partition ) except Exception : raise CommandExecutionError ( 'Invalid partition number passed to partition.toggle' ) if ( flag not in set ( [ 'bios_grub' , 'legacy_boot' , 'boot' , 'lba' , 'root' , 'swap' , 'hidden' , 'raid' , 'LVM' , 'PALO' , 'PREP' , 'DIAG' ] ) ) : raise CommandExecutionError ( 'Invalid flag passed to partition.toggle' ) cmd = 'parted -m -s {0} toggle {1} {2}' . format ( device , partition , flag ) out = __salt__ [ 'cmd.run' ] ( cmd ) . splitlines ( ) return out
toggle the state of <flag> on <partition> .