Please take into account that this script requires admin credentials. It also offers a @--dry-run@ flag that will report what changes are required without applying them, so it can be reviewed by an administrator.
+Also, take into consideration that this example script does case-sensitive matching on labels.
+
{% codeblock as python %}
{% include 'vocabulary_migrate_py' %}
{% endcodeblock %}
\ No newline at end of file
#!/usr/bin/env python
-{% comment %}
-Copyright (C) The Arvados Authors. All rights reserved.
-
-SPDX-License-Identifier: CC-BY-SA-3.0
-{% endcomment %}
+#
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: CC-BY-SA-3.0
import argparse
import copy
opts = argparse.ArgumentParser(add_help=False)
opts.add_argument('--vocabulary-file', type=str, metavar='PATH', default=None,
- help="""
+ required=True, help="""
Use vocabulary definition file at PATH for migration decisions.
""")
opts.add_argument('--dry-run', action='store_true', default=False,
args = arg_parser.parse_args(arguments)
if args.debug:
logger.setLevel(logging.DEBUG)
- if args.vocabulary_file is None:
- arg_parser.error('Please specify the vocabulary file with --vocabulary-file')
- elif not os.path.isfile(args.vocabulary_file):
+ if not os.path.isfile(args.vocabulary_file):
arg_parser.error("{} doesn't exist or isn't a file.".format(args.vocabulary_file))
return args
for resource in [arv.collections(), arv.groups()]:
objs = arvados.util.list_all(
resource.list,
+ order=['created_at'],
select=['uuid', 'properties'],
filters=[['properties', 'exists', key_label]]
)