irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

generate_iadmin_commands_for_41_to_42_upgrade.py
Go to the documentation of this file.
1 #!/env/python
2 
3 # This script is designed to be run on a newly upgraded (from 4.1.x to 4.2.x)
4 # Catalog Provider before upgrading the Catalog Consumers in the same Zone from 4.1.x.
5 #
6 # This script makes no changes to the iRODS iCAT itself.
7 #
8 # This script generates two sets of iadmin commands to be run on the Catalog Provider.
9 #
10 # This script is not required, but provides additional assurance that no
11 # resources will be deleted due to any confusion associated with the
12 # packaged preremove.sh script included in 4.1 (including and up to 4.1.12).
13 
14 import socket
15 import subprocess
16 
17 # GATHER - get the resources and their hostname values from the catalog
18 resources = {}
19 cmd = ['iquest','%s %s',"select RESC_NAME, RESC_LOC where RESC_NAME != 'bundleResc'"]
20 process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=None)
21 output = process.communicate()
22 for line in output[0].splitlines():
23  name, host = line.split()
24  resources[name] = host
25 
26 # BEFORE - temporarily swap resource hostnames to provider's hostname
27 myhost = socket.gethostname()
28 print('# Run these on the catalog provider BEFORE upgrading all catalog consumers')
29 for r in resources:
30  print('iadmin modresc {0} host {1}'.format(r, myhost))
31 
32 # AFTER - swap resource hostnames back to their original values
33 print('')
34 print('# Run these on the catalog provider AFTER upgrading all catalog consumers')
35 for k,v in resources.items():
36  print('iadmin modresc {0} host {1}'.format(k, v))
37