Example #1
0
    def main(conninfo, credentials, args):
        sys.stderr.write(
            'Warning: nfs_mod_share is deprecated. See nfs_mod_export.\n')

        # Get existing share
        share_info = {}
        share_info, share_info['if_match'] = \
            nfs.nfs_list_share(conninfo, credentials, args.id)

        # Modify share
        share_info['id_'] = share_info['id']
        share_info['allow_fs_path_create'] = args.create_fs_path
        del share_info['id']
        if args.export_path is not None:
            share_info['export_path'] = args.export_path
        if args.fs_path is not None:
            share_info['fs_path'] = args.fs_path
        if args.description is not None:
            share_info['description'] = args.description

        # Overwrite the NFS restrictions from JSON file.
        if args.restrictions:
            share_info['restrictions'] = parse_nfs_restrictions_file(
                conninfo, credentials, args.restrictions)
        elif args.no_restrictions:
            # Modify the share's restrictions to be the default ones (no
            # restrictions).
            share_info['restrictions'] = [NFSRestriction.create_default()]
        else:
            # If no restrictions were specified and the user didn't set the
            # --no-restrictions flag, let's preserve the ones that
            # were originally set for this share. However, we need to re-pack
            # them to be of type "NFSRestriction", in order to keep the REST
            # client consistent.
            share_info['restrictions'] = \
                [NFSRestriction(r) for r in share_info['restrictions']]

        print nfs.nfs_modify_share(conninfo, credentials, **share_info)
Example #2
0
    def main(conninfo, credentials, args):
        # Get existing share
        share_info = {}
        share_info, share_info['if_match'] = \
            nfs.nfs_list_share(conninfo, credentials, args.id)

        # Modify share
        share_info['id_'] = share_info['id']
        share_info['allow_fs_path_create'] = args.create_fs_path
        del share_info['id']
        if args.export_path is not None:
            share_info['export_path'] = args.export_path
        if args.fs_path is not None:
            share_info['fs_path'] = args.fs_path
        if args.description is not None:
            share_info['description'] = args.description

        # Overwrite the NFS restrictions from JSON file.
        if args.restrictions:
            share_info['restrictions'] = parse_nfs_restrictions_file(
                conninfo, credentials, args.restrictions)
        elif args.no_restrictions:
            # Modify the share's restrictions to be the default ones (no
            # restrictions).
            share_info['restrictions'] = [NFSRestriction.create_default()]
        else:
            # If no restrictions were specified and the user didn't set the
            # --no-restrictions flag, let's preserve the ones that
            # were originally set for this share. However, we need to re-pack
            # them to be of type "NFSRestriction", in order to keep the REST
            # client consistent.
            share_info['restrictions'] = \
                [NFSRestriction(r) for r in share_info['restrictions']]

        print nfs.nfs_modify_share(conninfo, credentials,
            **share_info)
Example #3
0
 def main(conninfo, credentials, args):
     print nfs.nfs_list_share(conninfo, credentials, args.id)
Example #4
0
 def main(conninfo, credentials, args):
     sys.stderr.write(
         'Warning: nfs_list_share is deprecated. See nfs_get_export.\n')
     print nfs.nfs_list_share(conninfo, credentials, args.id)