Merge pull request #1106 from groks/crypttab-strip-fix

Fix bug #1105 - incorrect use of lstrip()
This commit is contained in:
Toshio Kuratomi 2015-10-14 07:48:33 -07:00
commit 96af56d750

7
system/crypttab.py Normal file → Executable file
View file

@ -29,7 +29,7 @@ options:
name: name:
description: description:
- Name of the encrypted block device as it appears in the C(/etc/crypttab) file, or - Name of the encrypted block device as it appears in the C(/etc/crypttab) file, or
optionaly prefixed with C(/dev/mapper), as it appears in the filesystem. I(/dev/mapper) optionaly prefixed with C(/dev/mapper/), as it appears in the filesystem. I(/dev/mapper/)
will be stripped from I(name). will be stripped from I(name).
required: true required: true
default: null default: null
@ -96,12 +96,15 @@ def main():
supports_check_mode = True supports_check_mode = True
) )
name = module.params['name'].lstrip('/dev/mapper')
backing_device = module.params['backing_device'] backing_device = module.params['backing_device']
password = module.params['password'] password = module.params['password']
opts = module.params['opts'] opts = module.params['opts']
state = module.params['state'] state = module.params['state']
path = module.params['path'] path = module.params['path']
name = module.params['name']
if name.startswith('/dev/mapper/'):
name = name[len('/dev/mapper/'):]
if state != 'absent' and backing_device is None and password is None and opts is None: if state != 'absent' and backing_device is None and password is None and opts is None:
module.fail_json(msg="expected one or more of 'backing_device', 'password' or 'opts'", module.fail_json(msg="expected one or more of 'backing_device', 'password' or 'opts'",