comparison silvermirror/unify.py @ 21:da4848140985

OBO
author Jeff Hammel <k0scist@gmail.com>
date Thu, 16 Jan 2014 13:12:32 -0800
parents 5c5edfb827b7
children 4f1e45a8656c
comparison
equal deleted inserted replaced
20:5c5edfb827b7 21:da4848140985
110 directory = os.path.realpath(value['directory']) + os.sep 110 directory = os.path.realpath(value['directory']) + os.sep
111 if (cwd + os.sep).startswith(directory): 111 if (cwd + os.sep).startswith(directory):
112 resources = { key: value } 112 resources = { key: value }
113 break 113 break
114 if test: 114 if test:
115 log("Resources:\n%s") 115 log("Resources:\n")
116 pprint(resources) 116 pprint(resources)
117 117
118 ### choose reflector backend 118 ### choose reflector backend
119 reflectors = dict([(i.name, i.load()) for i in iter_entry_points('silvermirror.reflectors')]) 119 reflectors = dict([(i.name, i.load()) for i in iter_entry_points('silvermirror.reflectors')])
120 reflector = reflectors['unison']() # only one right now 120 reflector = reflectors['unison']() # only one right now
122 ### sync with hosts 122 ### sync with hosts
123 os.chdir(conf['main']['basedir']) 123 os.chdir(conf['main']['basedir'])
124 for index, resource in enumerate(resources): 124 for index, resource in enumerate(resources):
125 125
126 # echo resource 126 # echo resource
127 log("syncing:'%s' [%d/%d]" % (resource, index, len(resources))) 127 log("syncing:'%s' [%d/%d]" % (resource, index+1, len(resources)))
128 128
129 # loop over hosts 129 # loop over hosts
130 for host in hosts: 130 for host in hosts:
131 reflector.sync(host, resource, resources[resource]['ignore'], pw.get('host'), test) 131 reflector.sync(host, resource, resources[resource]['ignore'], pw.get('host'), test)
132 os.chdir(cwd) 132 os.chdir(cwd)