Changeset 2556
- Timestamp:
- Oct 5, 2016, 10:08:15 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-mirror/trunk/fuentes/n4d-lliurex-mirror.install/usr/share/n4d/python-plugins/MirrorManager.py
r2516 r2556 154 154 # link config debmirror to correct path with distro name 155 155 self.variable[distro]['status_mirror'] = "Working" 156 self.variable[distro]['progress'] = 0 157 self.variable[distro]['exception_msg'] = "" 156 158 self.n4d_vars.set_variable("LLIUREXMIRROR",self.variable) 157 159 self.build_debmirror_config(distro) … … 160 162 os.symlink(os.path.join(self.debmirrorconfpath,distro),'/etc/debmirror.conf') 161 163 self.mirrorworking = distro 164 165 errors_found = False 162 166 self.debmirrorprocess=pexpect.spawn("/usr/bin/debmirror") 163 167 try: … … 167 171 while True: 168 172 try: 169 self.debmirrorprocess.expect('\n' )173 self.debmirrorprocess.expect('\n',timeout=480) 170 174 line =self.debmirrorprocess.before 171 175 line1=line.strip("\n") … … 174 178 self.variable[distro]['progress'] = self.percentage[0] 175 179 self.n4d_vars.set_variable("LLIUREXMIRROR",self.variable) 180 if line1.startswith("Everything OK"): 181 self.percentage=(100,self.debmirrorprocess.exitstatus) 182 self.variable[distro]['progress'] = 100 183 self.n4d_vars.set_variable("LLIUREXMIRROR",self.variable) 184 185 if errors_found: 186 e=Exception(line1) 187 raise e 188 if line1.startswith("Errors"): 189 errors_found = True 190 191 176 192 except pexpect.EOF: 177 193 line1 = self.debmirrorprocess.before … … 186 202 break 187 203 except Exception as e: 204 print e 188 205 self.variable[distro]['status_mirror'] = "Error" 206 self.variable[distro]["exception_msg"] = str(e) 207 status = self.debmirrorprocess.exitstatus 208 self.percentage=(self.percentage[0],str(e)) 189 209 self.n4d_vars.set_variable("LLIUREXMIRROR",self.variable) 190 210 break … … 231 251 self.variable[distro]["progress"]=self.percentage[0] 232 252 233 printself.n4d_vars.set_variable("LLIUREXMIRROR",self.variable)253 self.n4d_vars.set_variable("LLIUREXMIRROR",self.variable) 234 254 235 255 #set_custom_text(self,app,text): … … 346 366 347 367 return {'status':False,'msg':"debmirror.conf hasn't option update variable" } 348 #def set_option_update368 #def get_option_update 349 369 350 370 def set_option_update(self,distro,option): … … 483 503 dest=os.path.join(path,f) 484 504 485 orig_mirror=self.get_mirror_orig(distro )505 orig_mirror=self.get_mirror_orig(distro,"1") 486 506 url_mirror="http://"+os.path.join(orig_mirror['msg'],f) 487 507
Note: See TracChangeset
for help on using the changeset viewer.