Merge branch '20978-instance-types'
[arvados.git] / doc / _includes / _admin_update_collection_property_py.liquid
1 #!/usr/bin/env python3
2 {% comment %}
3 Copyright (C) The Arvados Authors. All rights reserved.
4
5 SPDX-License-Identifier: CC-BY-SA-3.0
6 {% endcomment %}
7 import arvados
8 import arvados.util as util
9
10 old_uuid = 'zzzzz-tpzed-xxxxxxxxxxxxxxx'
11 new_uuid = 'zzzzz-tpzed-yyyyyyyyyyyyyyy'
12
13 api = arvados.api()
14 filters = [['properties.responsible_person_uuid', '=', '{}'.format(old_uuid)]]
15 cols = util.list_all(api.collections().list, filters=filters, select=['uuid', 'properties'])
16
17 print('Found {} collections'.format(len(cols)))
18 for c in cols:
19     print('Updating collection {}'.format(c['uuid']))
20     props = c['properties']
21     props['responsible_person_uuid'] = new_uuid
22     api.collections().update(uuid=c['uuid'], body={'properties': props}).execute()