Changeset 40dd8c1
- Timestamp:
- Sep 9, 2009 9:52:44 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
- Children:
- 11860f52
- Parents:
- f07fa49
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
rf07fa49 r40dd8c1 339 339 } 340 340 341 def copy_file(self, src, dest, size=1024):342 """343 Exceedingly simple file copy.344 """345 s = open(src,'r')346 d = open(dest, 'w')347 348 buf = "x"349 while buf != "":350 buf = s.read(size)351 d.write(buf)352 s.close()353 d.close()354 355 341 # Call while holding self.state_lock 356 342 def write_state(self): … … 362 348 """ 363 349 if os.access(self.state_filename, os.W_OK): 364 self.copy_file(self.state_filename, \365 350 copy_file(self.state_filename, \ 351 "%s.bak" % self.state_filename) 366 352 try: 367 353 f = open(self.state_filename, 'w') … … 1602 1588 "Cannot write hosts file: %s" % e) 1603 1589 try: 1604 self.copy_file("%s" % gw_pubkey, "%s/%s" % \1590 copy_file("%s" % gw_pubkey, "%s/%s" % \ 1605 1591 (configdir, gw_pubkey_base)) 1606 self.copy_file("%s" % gw_secretkey, "%s/%s" % \1592 copy_file("%s" % gw_secretkey, "%s/%s" % \ 1607 1593 (configdir, gw_secretkey_base)) 1608 1594 except IOError, e: -
fedd/federation/util.py
rf07fa49 r40dd8c1 153 153 log.error("Bad experiment_log value: %s" % level_str) 154 154 155 def copy_file(src, dest, size=1024): 156 """ 157 Exceedingly simple file copy. Throws an IOError if there's a problem. 158 """ 159 s = open(src,'r') 160 d = open(dest, 'w') 161 162 buf = s.read(size) 163 while buf != "": 164 d.write(buf) 165 buf = s.read(size) 166 s.close() 167 d.close() 168
Note: See TracChangeset
for help on using the changeset viewer.