sharing: Simplify --is-public option

Use store_true with default=False to toggle public status based on whether
'--is-public' argument is passed or not.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati authored and James Valleroy committed 2019-07-22 17:56:50 -04:00
1 parent 9fc8c3604c
commit 654d69a389
3 files changed
+15 -13

No files matched your search

+4 -3
View File
@@ -43,8 +43,9 @@ def parse_arguments():
add_parser.add_argument('--path', required=True, help='Disk path to share')
add_parser.add_argument('--groups', nargs='*',
help='List of groups that can access the share')
add_parser.add_argument('--is-public', default=False, required=False,
help='1 if public share else 0')
add_parser.add_argument('--is-public', required=False, default=False,
action="store_true",
help='Allow public access to this share')
remove_parser = subparsers.add_parser('remove',
help='Remove an existing share')
@@ -94,7 +95,7 @@ def subcommand_add(arguments):
aug.set('$conf/Location[last()]/directive[last()]/arg',
'includes/freedombox-sharing.conf')
if is_public != "true":
if not is_public:
aug.set('$conf/Location[last()]/directive[last() + 1]', 'Include')
aug.set('$conf/Location[last()]/directive[last()]/arg',
'includes/freedombox-single-sign-on.conf')