summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve <yo@groks.org>2015-10-14 12:13:57 +0100
committerSteve <yo@groks.org>2015-10-14 12:13:57 +0100
commitc5924aff74481a35f5109b8df689a22946ab8d5f (patch)
tree8ad3a2246a2a735a87002baaaf935ea39118540b
parent15480e3d04f586645516b42863e2c05f55239488 (diff)
downloadansible-modules-extras-c5924aff74481a35f5109b8df689a22946ab8d5f.tar.gz
Fix bug #1105 - incorrect use of lstrip()
Remove only the literal prefix '/dev/mapper/' - not any of the characters in '/dev/mapper/' - from the name param of the crypttab module.
-rwxr-xr-x[-rw-r--r--]system/crypttab.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/system/crypttab.py b/system/crypttab.py
index 44d9f859..2a8cdc9d 100644..100755
--- a/system/crypttab.py
+++ b/system/crypttab.py
@@ -29,7 +29,7 @@ options:
name:
description:
- 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).
required: true
default: null
@@ -96,12 +96,15 @@ def main():
supports_check_mode = True
)
- name = module.params['name'].lstrip('/dev/mapper')
backing_device = module.params['backing_device']
password = module.params['password']
opts = module.params['opts']
state = module.params['state']
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:
module.fail_json(msg="expected one or more of 'backing_device', 'password' or 'opts'",