Application Delivery Management
Application Modernization & Connectivity
CyberRes
IT Operations Management
#!/usr/bin/env python
# On ZCM 11 SP4 onwards, make sure to run this routine after starting
# the zman shell. It is *much* quicker
# Jon Gerdes, Blueloop Ltd 19 Aug 2015
import subprocess
# Create a list of lists with the bundle name and path in the first item of each list
bundles = []
rawbundles = subprocess.Popen(['zman', 'bl', '--terse', '-r'], stdout=subprocess.PIPE)
for s in iter(rawbundles.stdout.readline, ''):
l = s.split("|")
try:
if l[1] == "Bundle":
bundles.append([l[3].strip() '/' l[0].strip()])
except IndexError:
pass
bundles.sort()
# Now get the assignments for each bundle and fill them in the corresponding list
i = 0
n = len(bundles)
while i < n:
bundlename = bundles[i][0]
rawassign = subprocess.Popen(['zman', 'blas', bundlename, '--terse', '--typefilter=user'], stdout=subprocess.PIPE)
for s in iter(rawassign.stdout.readline, ''):
l = s.split("|")
try:
if l[1] == "Folder" or l[1] == "User Group" or l[1] == "User":
bundles[i].extend([l[3].strip() '/' l[0].strip()])
except IndexError:
pass
# Output bundle name followed by assignments (if any)
j = 1
m = len(bundles[i])
print bundlename
# Only run if there are actually any assignments
if m > 1:
while j < m:
print " " bundles[i][j]
j = 1
i = 1
print "Number of bundles = " str(n)
zman asc zcm_admin_account
zman ssas
sudo ./bundle-assignments.py
sudo ./bundle-assignments.py | tee bundle-assignments.lst