Changeset 6491 for lliurex-remote-installer/trunk/fuentes
- Timestamp:
- Dec 15, 2017, 12:29:49 PM (3 years ago)
- Location:
- lliurex-remote-installer/trunk/fuentes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-remote-installer/trunk/fuentes/lliurex-remote-installer-client.install/usr/share/n4d/python-plugins/LliurexRemoteInstallerClient.py
r6301 r6491 35 35 def __init__(self): 36 36 self.dbg=0 37 if self.dbg==1: 38 print ("-----------------------------------------------------" ) 39 print ("-----------------------------------------------------" ) 40 print ("") 41 print ("[LLXRemoteInstaller] DEBUG_MODE ACTIVATED" ) 42 print ("") 43 print ("-----------------------------------------------------" ) 44 print ("-----------------------------------------------------" ) 37 45 pass 38 46 #def __init__ … … 42 50 43 51 def _debug(self,message): 52 self._log(message) 44 53 if self.dbg==1: 45 54 print("RemoteInstallerClient: "+str(message)) … … 51 60 f=open (logFile,"a") 52 61 else: 62 #os.system(touch /tmp/remoteInstall.log) 53 63 f=open (logFile,"w") 54 64 f.write(str(message)+"\n") … … 71 81 #def startup 72 82 83 84 def read_n4dkey(self): 85 86 try: 87 f=open("/etc/n4d/key") 88 key=f.readline().strip("\n") 89 f.close() 90 91 return key 92 93 except Exception as e: 94 95 return None 96 97 # def_read_n4dke 98 99 100 73 101 def create_dict (self,mode=[]): 74 102 try: … … 78 106 dict[mod]=[] 79 107 COMMENT="[LLXRemoteInstallerClient] (create_dict) Dictionary is created %s"%(dict) 108 print COMMENT 80 109 self._debug(COMMENT) 81 110 return [True,str(COMMENT),dict] … … 118 147 COMMENT=("[LLXRemoteInstallerClient] (initialize_n4dvar) Dict initialized") 119 148 self._debug(COMMENT) 149 print COMMENT 120 150 return [True,str(COMMENT),dict] 121 151 except Exception as e: … … 138 168 import xmlrpclib as x 139 169 c=x.ServerProxy(proxy) 170 u=self.read_n4dkey() 140 171 VALOR=c.get_variable("","VariablesManager",namevar) 141 172 self._debug("[LLXRemoteInstallerClient] (test_var) Value of N4d var "+str(namevar)+" is: "+str(VALOR)) … … 143 174 if not VALOR: 144 175 list_dict=[self.APT,self.DEB,self.SH,self.UPDATE] 145 VALOR=self.create_dict ([self.APT,self.DEB,self.SH,self.UPDATE])[2] 146 if objects["VariablesManager"].add_variable(namevar,VALOR,"",namevar,[],False,False)[0]: 176 VALOR=self.create_dict ([self.APT,self.DEB,self.SH,self.UPDATE])[2] 177 #if objects["VariablesManager"].add_variable(namevar,VALOR,"",namevar,[],False,False)[0]: 178 if c.add_variable(u,"VariablesManager",namevar,VALOR,"",namevar,[],False,False)[0]: 147 179 COMMENT = ("[LLXRemoteInstallerClient] (test_var) Added variable %s to VariablesManager with valor %s" %(namevar,VALOR)) 148 180 self._debug(COMMENT) … … 173 205 c=x.ServerProxy(proxy) 174 206 data=None 175 objects["VariablesManager"].set_variable(namevar,data) 207 u=self.read_n4dkey() 208 #objects["VariablesManager"].set_variable(namevar,data) 209 c.set_variable(u,"VariablesManager",namevar,data) 176 210 COMMENT=("[LLXRemoteInstallerClient] (reset_var) %s has been updated" %namevar) 177 211 self._debug(COMMENT) … … 193 227 import xmlrpclib as x 194 228 c=x.ServerProxy(proxy) 195 objects["VariablesManager"].set_variable(namevar,dict) 229 u=self.read_n4dkey() 230 #objects["VariablesManager"].set_variable(namevar,dict) 231 c.set_variable(u,"VariablesManager",namevar,dict) 196 232 COMMENT="[LLXRemoteInstallerClient] (update_var_list) %s has been updated with this list of APP %s" %(namevar,dict) 197 233 self._debug(COMMENT) … … 493 529 list_apt_not=[] 494 530 list_apt_system=[] 495 self._debug(" (apt_install) Apps list: "+str(list_apt))531 self._debug("[LLXRemoteInstallerClient](apt_install) Apps list: "+str(list_apt)) 496 532 for app in list_apt: 497 self._debug(" (apt_install) Checking if app "+app+" is available and installable")533 self._debug("[LLXRemoteInstallerClient](apt_install) Checking if app "+app+" is available and installable") 498 534 if app in self.cache: 499 535 pkg=self.cache[app] 500 536 if pkg.is_installed: 501 self._debug(" (apt_install) The APP: "+app+" is intalled in your system")537 self._debug("[LLXRemoteInstallerClient](apt_install) The APP: "+app+" is intalled in your system") 502 538 list_apt_system.append(app) 503 539 else: 504 self._debug(" (apt_install) The APP: "+app+" wil be installed soon")540 self._debug("[LLXRemoteInstallerClient](apt_install) The APP: "+app+" will be installed soon") 505 541 pkg.mark_install() 506 542 list_apt_ok.append(app) 507 543 # list_apt_system.append(app) 508 544 else: 545 self._debug("[LLXRemoteInstallerClient](apt_install) The APP: "+app+" is not in your repositories") 509 546 list_apt_not.append(app) 510 547 511 548 if list_apt_ok: 512 549 # self._debug("(apt_install) Please wait while installing: "+str(list_apt_ok)) 513 self._debug(" (apt_install) Please wait while installing: "+str(list_apt_ok))550 self._debug("[LLXRemoteInstallerClient](apt_install) Please wait while installing: "+str(list_apt_ok)) 514 551 self.cache.commit() 515 552 # if list_apt_not in ["",None,[]]: … … 531 568 # list_apt_ok.append(app) 532 569 self._debug(COMMENT) 533 self._debug( str(list_apt_ok)+" --- "+str(list_apt_not)+" ---"+str(list_apt_system))570 self._debug("APT installed:"+str(list_apt_ok)+" --- APT not installed"+str(list_apt_not)+" --- APT in system:"+str(list_apt_system)) 534 571 return [True,str(COMMENT),list_apt_ok,list_apt_not,list_apt_system] 535 572 … … 541 578 def deb_test(self,appDict,dictOrig): 542 579 self._debug("deb_test") 543 544 580 #Get dict values 545 581 list_deb=appDict[self.LIST] … … 562 598 # if list_deb not in ["",None,[]]: 563 599 if list_deb: 564 #Create token to indicator565 self._manage_indicator_token("deb","create")566 600 self._debug("(test_system) Debs list is "+str(list_deb)+" Download path is: "+url_deb) 567 601 self.download(list_deb,url_deb,dir_deb) 568 602 result_deb=self.deb_install(list_deb,dir_deb) 569 #Delete token to indicator570 self._manage_indicator_token("deb","delete")571 603 572 604 else: 573 605 self._debug("(test_system) Deb list is empty") 574 606 result_deb=["","","","",""] 575 576 607 return(result_deb) 577 608 #def deb_test … … 579 610 def sh_test(self,appDict,dictOrig): 580 611 self._debug("sh_test") 581 582 612 #Get dict values 583 613 list_sh=appDict[self.LIST] … … 588 618 # if list_sh not in ["",None,[]]: 589 619 if list_sh: 590 #Create token to indicator591 self._manage_indicator_token("sh","create")592 620 sh_aux=[] 593 621 for sh_tupla in list_sh: … … 608 636 self._debug("(test_system) Script list is empty") 609 637 result_sh=["","","","",""] 610 #Create token to indicator611 self._manage_indicator_token("sh","delete")612 638 613 639 else: 614 640 self._debug("(test_system) Script list is empty") 615 641 result_sh=["","","","",""] 616 617 642 return(result_sh) 618 643 #def sh_test … … 655 680 date=datetime.datetime.now() 656 681 date_update=date.strftime("%d-%m-%Y %H:%M:%S") 657 print("[LLXRemoteInstallerClient](update_test) Actualizacion terminada...... %s"%date_update)682 self._debug("[LLXRemoteInstallerClient](update_test) Actualizacion terminada...... %s"%date_update) 658 683 if proc.returncode == 1: 659 print "[LLXRemoteInstallerClient](update_test) Fallo actulalizacion"684 self._debug("[LLXRemoteInstallerClient](update_test) Fallo actulalizacion") 660 685 else: 661 686 proc = subprocess.Popen('http_proxy=http://proxy:3128 /usr/sbin/lliurex-upgrade -u', shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") … … 663 688 date=datetime.datetime.now() 664 689 date_update=date.strftime("%d-%m-%Y %H:%M:%S") 665 print("[LLXRemoteInstallerClient](update_test) Actualizacion terminada...... %s"%date_update)690 self._debug("[LLXRemoteInstallerClient](update_test) Actualizacion terminada...... %s"%date_update) 666 691 if proc.returncode == 1: 667 print "[LLXRemoteInstallerClient](update_test) Fallo actulalizacion"692 self._debug("[LLXRemoteInstallerClient](update_test) Fallo actulalizacion") 668 693 669 694 updated="True" … … 698 723 url=appDict[source][self.URL] 699 724 apt_aux=[] 700 self._debug("( test_system) Checking if apt list is installed "+str(aux_list_apt))725 self._debug("(_refine_apt_repoList) Checking if apt list is installed "+str(aux_list_apt)) 701 726 for apt in aux_list_apt: 702 727 if apt not in dictOrig: 703 self._debug("( test_system) Must install APT: "+apt)728 self._debug("(_refine_apt_repoList) Must install APT: "+apt) 704 729 apt_aux.append(apt) 705 730 else: 706 self._debug("( test_system) "+apt+" is installed")731 self._debug("(_refine_apt_repoList) "+apt+" is installed") 707 732 #Add non installed debs to list 708 733 list_apt.extend(apt_aux) … … 720 745 def apt_test(self,appDict,dict_orig): 721 746 self._debug("apt_test") 722 723 747 #Get dict values 724 748 list_apt_resume=[] … … 734 758 self.repo_customize_apt(repoList) 735 759 if list_apt: 736 #Create token to indicator737 self._manage_indicator_token("apt","create")738 760 for url in repoList: 739 761 if self.repo_add(url): 740 762 self._debug("(test_system) New REPO has been added to your system") 741 763 if self.repo_update(): 742 self._debug("[LLXRemoteInstallerClient]( test_system) Your CACHE has been updated")764 self._debug("[LLXRemoteInstallerClient](apt_test) Your CACHE has been updated") 743 765 else: 744 766 # return [False,"failed repo_update"] 745 #Delete token to indicator746 self._manage_indicator_token("apt","delete")747 767 return result_apt 748 768 else: 749 769 # return [False,"failed repo_add"] 750 #Delete token to indicator751 self._manage_indicator_token("apt","delete")752 770 return result_apt 753 771 #Proceed with the list, repos are updated 754 self._debug("[LLXRemoteInstallerClient]( test_system) Calling apt_install with "+str(list_apt))772 self._debug("[LLXRemoteInstallerClient](apt_test) Calling apt_install with "+str(list_apt)) 755 773 result_apt=self.apt_install(list_apt)[2] 756 #Delete token to indicator757 self._manage_indicator_token("apt","delete")758 774 if result_apt: 759 775 for app in result_apt: … … 763 779 self.repo_restore(self.file_sources) 764 780 else: 765 self._debug( "[LLXRemoteInstallerClient]( test_system) No apps installed")781 self._debug( "[LLXRemoteInstallerClient](apt_test) No apps installed") 766 782 result_apt=["","","","",""] 767 783 … … 769 785 self._debug("Call repo_restore_config") 770 786 self.repo_restore_config() 771 772 787 result_apt=list_apt_resume 773 788 return(result_apt) … … 777 792 if not dict_orig: 778 793 #Create dict if doesn't exists 779 self._debug("[LLXRemoteInstallerClient]( test_system) Creando el diccionario.......")794 self._debug("[LLXRemoteInstallerClient](_update_results) Creando el diccionario.......") 780 795 dict_new=self.create_dict ([self.APT,self.DEB,self.SH,self.UPDATE])[2] 781 796 dict_new[self.APT]=list(result_apt) … … 798 813 799 814 dict_new=dict_orig 800 log="[LLXRemoteInstallerClient]( test_system) Will add APT: %s ** DEBS: %s ** SH: %s ** UPDATE: %s "%(result_apt,result_deb[2],result_sh[2],result_update)815 log="[LLXRemoteInstallerClient](_update_results) Will add APT: %s ** DEBS: %s ** SH: %s ** UPDATE: %s "%(result_apt,result_deb[2],result_sh[2],result_update) 801 816 self._debug(log) 802 817 #Check the dict against a tuple … … 809 824 #Check values 810 825 if updated == 'True': 811 log="[LLXRemoteInstallerClient]( test_system) System has been updated to version: %s"%result_update['version']826 log="[LLXRemoteInstallerClient](_update_results) System has been updated to version: %s"%result_update['version'] 812 827 self._debug(log) 813 828 dict_new[self.UPDATE]=result_update 814 829 for valor_dict in dict_help: 815 self._debug("[LLXRemoteInstallerClient]( test_system) Test APP from: "+valor_dict)830 self._debug("[LLXRemoteInstallerClient](_update_results) Test APP from: "+valor_dict) 816 831 try: 817 832 for app_installed in dict_help[valor_dict]: 818 833 ok=False 819 self._debug("[LLXRemoteInstallerClient]( test_system) Check if app is installed: "+str(app_installed))834 self._debug("[LLXRemoteInstallerClient](_update_results) Check if app is installed: "+str(app_installed)) 820 835 for app_history in dict_orig[valor_dict]: 821 log="[LLXRemoteInstallerClient]( test_system) APP Installed: %s -- TESTING -- APP System: %s"%(app_installed,app_history)836 log="[LLXRemoteInstallerClient](_update_results) APP Installed: %s -- TESTING -- APP System: %s"%(app_installed,app_history) 822 837 self._debug(log) 823 838 if app_history == app_installed: 824 self._debug("[LLXRemoteInstallerClient]( test_system) App exists, don't add to dict")839 self._debug("[LLXRemoteInstallerClient](_update_results) App exists, don't add to dict") 825 840 ok=True 826 841 if not ok: 827 log="[LLXRemoteInstallerClient]( test_system) Adding app to list: %s"%app_installed842 log="[LLXRemoteInstallerClient](_update_results) Adding app to list: %s"%app_installed 828 843 self._debug(log) 829 844 dict_new[valor_dict].append(app_installed) 830 845 else: 831 log="[LLXRemoteInstallerClient]( test_system) App hasn't been added to dict: %s"%app_installed846 log="[LLXRemoteInstallerClient](_update_results) App hasn't been added to dict: %s"%app_installed 832 847 self._debug(log) 833 848 except Exception as e: … … 838 853 def test_system(self): 839 854 try: 840 855 logFile="/tmp/remoteInstall.log" 856 if os.path.exists(logFile): 857 f=open (logFile,"a") 858 f.write("\n") 859 f.write("\n") 860 f.write("-----------------------INIT--------------------\n") 861 f.close() 841 862 #Get installed apps dict 842 863 self.test_var(self.N4D_INSTALLED,"localhost") 843 864 dict_orig=self.read_var(self.N4D_INSTALLED,"localhost")[2] 844 865 #print dict_orig 845 866 #Get server dict 846 867 appDict=self.read_var(self.N4D_VAR)[2] 847 868 #Check the server's dict for install 848 # if appDict in ["",None,"None"]: 869 #if appDict in ["",None,"None"]: 870 #print appDict 849 871 if not appDict: 850 872 COMMENT="[LLXRemoteInstallerClient](test_system) Variable %s do not exist in your server, do nothing"%self.N4D_VAR 851 873 self._debug(COMMENT) 852 874 return [True,str(COMMENT)] 853 854 875 self._debug("[LLXRemoteInstallerClient] (test_system) The DICTIONARY to use is: "+str(appDict)) 855 876 self._debug("[LLXRemoteInstallerClient] (test_system) The DICTIONARY installed in your system is: "+str(dict_orig)) 877 856 878 dict_orig_aux=dict_orig 857 879 858 #Create tmp folder 859 if not os.path.exists(self.dir_tmp): 860 os.makedirs(self.dir_tmp) 861 880 862 881 #TEST Debs 863 self._debug("Call deb_test") 882 self._debug("------------------------------------------------------------------") 883 self._debug("[LLXRemoteInstallerClient] (test_system) -----> call DEB_test") 864 884 result_deb=self.deb_test(appDict[self.DEB],dict_orig[self.DEB]) 885 self._debug("[LLXRemoteInstallerClient] (test_system) -----> end DEB_test <-----") 865 886 #TEST SH 866 self._debug("Call sh_test") 887 self._debug("------------------------------------------------------------------") 888 self._debug("[LLXRemoteInstallerClient] (test_system) -----> call SH_test") 867 889 result_sh=self.sh_test(appDict[self.SH],dict_orig[self.SH]) 890 self._debug("[LLXRemoteInstallerClient] (test_system) -----> end SH_test <-----") 868 891 #TEST Apt 869 self._debug("Call apt_test") 892 self._debug("------------------------------------------------------------------") 893 self._debug("[LLXRemoteInstallerClient] (test_system) -----> call APT_test") 870 894 result_apt=self.apt_test(appDict,dict_orig) 895 self._debug("[LLXRemoteInstallerClient] (test_system) -----> end APT_test <-----") 871 896 #TEST UPDATE 872 self._debug(" Call update_test")873 self._debug( appDict[self.UPDATE]['activate'])897 self._debug("------------------------------------------------------------------") 898 self._debug("[LLXRemoteInstallerClient] (test_system) -----> call UPDATE_test") 874 899 if appDict[self.UPDATE]['activate']=="True": 875 900 try: 876 901 result_update_vector=self.update_test(appDict,dict_orig) 877 self._debug(result_update_vector)902 #print result_update_vector 878 903 result_update=result_update_vector[0] 904 #print result_update 879 905 updated=result_update_vector[1] 906 #print updated 880 907 except Exception as e: 881 self._debug(str(e)) 882 print e 883 else: 884 if len(dict_orig[self.UPDATE])>0: 885 result_update={'version':dict_orig[self.UPDATE]['version'],'url':dict_orig[self.UPDATE]['url'],'datetime':dict_orig[self.UPDATE]['datetime']} 886 else: 887 result_update={} 908 print e,"appDict" 909 else: 910 result_update={'version':dict_orig[self.UPDATE]['version'],'url':dict_orig[self.UPDATE]['url'],'datetime':dict_orig[self.UPDATE]['datetime']} 888 911 updated="False" 889 self._debug("Updated is %s"%updated) 890 912 self._debug("[LLXRemoteInstallerClient] (test_system) Updated is necessary??? : %s"%updated) 913 print "Updated is %s"%updated 914 self._debug("[LLXRemoteInstallerClient] (test_system) -----> end UPDATE_test <---") 891 915 #Check that it's a list 892 916 sh_installed=list(result_sh[2]) … … 894 918 dict_new=self._update_results(dict_orig,result_deb,result_sh,result_apt,result_update,updated) 895 919 # if dict_orig in ["",None,{}]: 896 log="Dict now is %s"%dict_new 920 log="[LLXRemoteInstallerClient] (test_system) Dict now is %s"%dict_new 921 #print log 897 922 self._debug(log) 898 self._debug(" Updating N4D Variable.......")923 self._debug("[LLXRemoteInstallerClient] (test_system) Updating N4D Variable.......") 899 924 #Add installed apps to N4D 900 925 self.update_var_dict (self.N4D_INSTALLED,dict_new,"localhost") … … 904 929 COMMENT="The system has been configured with the APPS: %s * has executed the scripts: %s * Installed new DEBS: %s * Updated to: %s"%(result_apt,sh_installed,result_deb[2],result_update['version']) 905 930 self._debug(COMMENT) 931 #print COMMENT 906 932 return [True,str(COMMENT),result_apt,result_sh[2],result_deb[2],updated,dict_new] 907 933 except Exception as e: 908 934 print e,"!!!!!!!!!!" 909 935 return[False,str(e)] 910 911 #def test_system 912 913 def _manage_indicator_token(self,type,action): 914 915 if type=="deb": 916 file=os.path.join(self.dir_tmp,"llxremote_deb_token") 917 elif type=="sh": 918 file=os.path.join(self.dir_tmp,"llxremote_sh_token") 919 elif type=="apt": 920 file=os.path.join(self.dir_tmp,"llxremote_apt_token") 921 922 if action=="create": 923 self._debug("Create token to indicator") 924 try: 925 if not os.path.exists(file): 926 tmp=open(file,'w') 927 tmp.close() 928 except Exception as e: 929 self._debug("ERROR: "+str(e)) 930 print e 931 pass 932 elif action=="delete": 933 self._debug("Delete token to indicator") 934 try: 935 if os.path.exists(file): 936 os.remove(file) 937 except Exception as e: 938 self._debug("ERROR: "+str(e)) 939 print e 940 pass 941 return 942 943 #def _manage_indicator_token 944 945 936 -
lliurex-remote-installer/trunk/fuentes/lliurex-remote-installer-server.install/usr/share/n4d/python-plugins/LliureXRemoteInstaller.py
r6208 r6491 34 34 35 35 def __init__(self): 36 self.dbg=0 37 if self.dbg==1: 38 print ("-----------------------------------------------------" ) 39 print ("-----------------------------------------------------" ) 40 print ("") 41 print ("[LLXRemoteInstaller] DEBUG_MODE ACTIVATED" ) 42 print ("") 43 print ("-----------------------------------------------------" ) 44 print ("-----------------------------------------------------" ) 36 45 pass 37 46 38 47 #def __init__ 39 48 49 def _log(self, message): 50 try: 51 logFile="/tmp/remoteInstall.log" 52 if os.path.exists(logFile): 53 f=open (logFile,"a") 54 else: 55 #os.system(touch /tmp/remoteInstall.log) 56 f=open (logFile,"w") 57 f.write(str(message)+"\n") 58 f.close() 59 except Exception as e: 60 print ("[LLXRemoteInstaller] (_log) %s" %(str(e))) 61 62 #def__log 63 64 def _debug(self,message): 65 try: 66 self._log(message) 67 if self.dbg==1: 68 print(str(message)) 69 self._log(message) 70 71 except Exception as e: 72 print ("[LLXRemoteInstaller] (_debug) %s" %(str(e))) 73 74 #def__debug 75 76 77 def read_n4dkey(self): 78 79 try: 80 f=open("/etc/n4d/key") 81 key=f.readline().strip("\n") 82 f.close() 83 84 return key 85 86 except Exception as e: 87 self._debug ("[LLXRemoteInstaller] (read_n4dkey) %s" %(str(e))) 88 return None 89 90 # def_read_n4dkey 91 92 93 94 def set_var_remote(self,namevar=None,data=None,user=None,passwd=None ): 95 try: 96 import xmlrpclib as x 97 c=x.ServerProxy("https://server:9779") 98 #u=(user,passwd) 99 u=self.read_n4dkey() 100 VALOR=c.set_variable(u,"VariablesManager",namevar,data) 101 if VALOR[0]: 102 COMMENT=("[LLXRemoteInstaller] (set_var_remote) %s = %s" %(namevar,data)) 103 return [True,str(COMMENT)] 104 else: 105 COMMENT=("[LLXRemoteInstaller] (set_var_remote) %s" %(VALOR[1])) 106 return [False,str(COMMENT)] 107 108 except Exception as e: 109 self._debug ("[LLXRemoteInstaller] (set_var_remote) %s" %(str(e))) 110 return [False,str(e)] 111 112 # def_set_var_remote 113 114 40 115 def test_var (self,namevar=None,user=None,passwd=None): 41 116 try: 42 print "------------------------------------"43 print "Lliurex Remote Installer Test Var"44 print "------------------------------------"117 self._debug ("------------------------------------") 118 self._debug ("Lliurex Remote Installer Test Var") 119 self._debug ("------------------------------------") 45 120 import xmlrpclib as x 46 121 ppa_lliurex=False 47 122 ppa_mirror=False 48 123 c=x.ServerProxy("https://server:9779") 49 u=(user,passwd) 124 #u=(user,passwd) 125 u=self.read_n4dkey() 50 126 VALOR=c.get_variable(u,"VariablesManager",namevar) 51 #print VALOR127 self._debug ("[LLXRemoteInstaller] (test_var) Value for variable %s: %s"%(namevar,VALOR)) 52 128 if not os.path.exists(self.SHARE_DIRECTORY): 53 129 os.makedirs(self.SHARE_DIRECTORY) … … 57 133 os.system("setfacl -m g:adm:rwx -d -m g:adm:rwx %s"%self.SHARE_DIRECTORY) 58 134 os.system("setfacl -m g:admins:rwx -d -m g:admins:rwx %s"%self.SHARE_DIRECTORY) 59 print "[LLXRemoteInstaller] (test_var) New directory to shared files is created: %s"%(self.SHARE_DIRECTORY)60 else: 61 print "[LLXRemoteInstaller] (test_var) Directory to shared files exists: %s"%(self.SHARE_DIRECTORY)135 self._debug("[LLXRemoteInstaller] (test_var) New directory to shared files is created: %s"%(self.SHARE_DIRECTORY)) 136 else: 137 self._debug ("[LLXRemoteInstaller] (test_var) Directory to shared files exists: %s"%(self.SHARE_DIRECTORY)) 62 138 os.system("setfacl -m g:adm:rwx -d -m g:adm:rwx %s"%self.SHARE_DIRECTORY) 63 139 os.system("setfacl -m g:admins:rwx -d -m g:admins:rwx %s"%self.SHARE_DIRECTORY) 64 140 #os.chmod(self.SHARE_DIRECTORY, 755) 65 print "[LLXRemoteInstaller] (test_var) Value for variable %s: %s"%(namevar,VALOR) 66 if VALOR in ["",None,'None']: 67 objects["VariablesManager"].add_variable(namevar,self.initial_dict,"",namevar,[],False,False) 141 #print "[LLXRemoteInstaller] (test_var) Value for variable %s: %s"%(namevar,VALOR) 142 if VALOR in ["",None,'None','']: 143 #objects["VariablesManager"].add_variable(namevar,self.initial_dict,"",namevar,[],False,False) 144 c.add_variable(u,"VariablesManager",namevar,self.initial_dict,"",namevar,[],False,False) 68 145 COMMENT = ("[LLXRemoteInstaller] (test_var) Added variable %s to VariablesManager" %namevar) 69 print("%s" %COMMENT)146 self._debug ("%s" %COMMENT) 70 147 return [True,str(COMMENT)] 71 148 else: … … 76 153 ppa_mirror=True 77 154 if not ppa_lliurex: 78 print "No tiene lliurex.net"155 self._debug ("No tiene lliurex.net") 79 156 VALOR[self.APT].update({'LliureX':{'url':'lliurex', 'packages': []}}) 80 objects["VariablesManager"].set_variable(namevar,VALOR) 157 #objects["VariablesManager"].set_variable(namevar,VALOR) 158 c.set_variable(u,"VariablesManager",namevar,VALOR) 81 159 if not ppa_mirror: 82 print "No tiene mirror"160 self._debug ("No tiene mirror") 83 161 VALOR[self.APT].update({'Mirror':{'url':'mirror', 'packages': []}}) 84 objects["VariablesManager"].set_variable(namevar,VALOR) 162 #objects["VariablesManager"].set_variable(namevar,VALOR) 163 c.set_variable(u,"VariablesManager",namevar,VALOR) 85 164 try: 86 165 exists=VALOR[self.UPDATE] 87 166 except Exception as e: 88 print "[LLXRemoteInstaller] (test_var) Creating new values to variable[update]......."167 self._debug ("[LLXRemoteInstaller] (test_var) Creating new values to variable[update].......") 89 168 VALOR[self.UPDATE]={} 90 169 VALOR[self.UPDATE]['activate']='False' … … 92 171 VALOR[self.UPDATE]['version']='0' 93 172 VALOR[self.UPDATE]['datetime']='0' 94 objects["VariablesManager"].set_variable(namevar,VALOR) 173 #objects["VariablesManager"].set_variable(namevar,VALOR) 174 c.set_variable(u,"VariablesManager",namevar,VALOR) 95 175 COMMENT=("[LLXRemoteInstaller] (test_var) %s Variable exists in your system, it hasn't been created again" %namevar) 96 print("%s" %COMMENT)176 self._debug ("%s" %COMMENT) 97 177 return [True,str(COMMENT)] 98 178 99 179 except Exception as e: 100 print("[LLXRemoteInstaller] (test_var) %s" %(str(e)))180 self._debug ("[LLXRemoteInstaller] (test_var) %s" %(str(e))) 101 181 return [False,str(e)] 102 182 … … 110 190 c=x.ServerProxy("https://server:9779") 111 191 data=None 112 objects["VariablesManager"].set_variable(namevar,data) 192 u=self.read_n4dkey() 193 #objects["VariablesManager"].set_variable(namevar,data) 194 c.set_variable(u,"VariablesManager",namevar,data) 113 195 COMMENT=("[LLXRemoteInstaller] (reset_var) %s has been updated" %namevar) 114 print("%s" %COMMENT)196 self._debug ("%s" %COMMENT) 115 197 return [True,str(COMMENT)] 116 198 117 199 except Exception as e: 118 print("[LLXRemoteInstaller] (reset_var) %s" %(str(e)))200 self._debug ("[LLXRemoteInstaller] (reset_var) %s" %(str(e))) 119 201 return [False,str(e)] 120 202 … … 123 205 def mirror_version(self): 124 206 try: 125 mirror_version_exists=objects["LliurexVersion"].lliurex_version("-m") 207 #mirror_version_exists=objects["LliurexVersion"].lliurex_version("-m") 208 import xmlrpclib as x 209 c=x.ServerProxy("https://server:9779") 210 data=None 211 u=self.read_n4dkey() 212 mirror_version_exists=c.lliurex_version(u,"LliurexVersion","-m") 213 self._debug ("[LLXRemoteInstaller] (mirror_version) mirror_version_exists = %s" %(mirror_version_exists[0])) 126 214 version='False' 127 215 if mirror_version_exists[0]: … … 134 222 return [True,version] 135 223 except Exception as e: 136 print("[LLXRemoteInstaller] (mirror_version) %s" %(str(e)))224 self._debug ("[LLXRemoteInstaller] (mirror_version) %s" %(str(e))) 137 225 return [False,str(e)] 138 226 #def_mirror_version … … 151 239 return [True,version] 152 240 except Exception as e: 153 print("[LLXRemoteInstaller] (net_mirror_version) %s" %(str(e)))241 self._debug ("[LLXRemoteInstaller] (net_mirror_version) %s" %(str(e))) 154 242 return [False,str(e)] 155 243 #def_mirror_version … … 162 250 else : 163 251 option='w' 164 print ('Option to write_log is.......%s'%option)252 #self._debug ('[LLXRemoteInstaller] (write_log) Option to write_log is.......%s'%option) 165 253 date=datetime.datetime.now() 166 254 date_update=date.strftime("%d-%m-%Y %H:%M") … … 171 259 removed = d2_keys - d1_keys 172 260 modified = {o : (dict[o]) for o in intersect_keys if dict[o] != dict_orig[o]} 173 print ('New data to write_log is.......%s'%modified)261 #self._debug ('[LLXRemoteInstaller] (write_log) New data to write_log is.......%s'%modified) 174 262 f=open(self.LOG_FILE,option) 175 263 f.write('### User: %s \n'%(user)) … … 185 273 return [True] 186 274 except Exception as e: 187 print("[LLXRemoteInstaller] (write_log) %s" %(str(e)))275 self._debug ("[LLXRemoteInstaller] (write_log) %s" %(str(e))) 188 276 return [False,str(e)] 189 277 … … 192 280 def update_var_dict (self,namevar=None,dict={},user=None,passwd=None): 193 281 try: 194 print "[LLXRemoteInstaller] (update_var_list) Test if_exists variable %s"%namevar282 self._debug ("[LLXRemoteInstaller] (update_var_list) Test if_exists variable %s"%namevar) 195 283 if self.test_var(namevar,user, passwd)[0]: 196 print "[LLXRemoteInstaller] (update_var_list) Variable %s is now in your system"%namevar284 self._debug ("[LLXRemoteInstaller] (update_var_list) Variable %s is now in your system"%namevar) 197 285 import xmlrpclib as x 198 286 c=x.ServerProxy("https://server:9779") 199 if objects["VariablesManager"].set_variable(namevar,dict)[0]: 287 #if objects["VariablesManager"].set_variable(namevar,dict)[0]: 288 if c.set_variable(u,"VariablesManager",namevar,dict)[0]: 200 289 if os.path.exists(self.LOG_FILE): 201 290 option='w' … … 209 298 f.close 210 299 COMMENT="[LLXRemoteInstaller] (update_var_list) %s has been updated with this list of APP %s" %(namevar,dict) 211 print("%s" %COMMENT)300 self._debug ("%s" %COMMENT) 212 301 return [True,str(COMMENT)] 213 302 else: 214 303 COMMENT="[LLXRemoteInstaller] (update_var_list) Cannot updated variable" 215 print("%s" %COMMENT)304 self._debug ("%s" %COMMENT) 216 305 return [False,str(COMMENT)] 217 306 218 307 except Exception as e: 219 print("[LLXRemoteInstaller] (update_var_list) %s" %(str(e)))308 self._debug ("[LLXRemoteInstaller] (update_var_list) %s" %(str(e))) 220 309 return [False,str(e)] 221 310 … … 233 322 234 323 COMMENT="Update_version is: %s" %update_version 235 print("%s" %COMMENT)324 self._debug ("%s" %COMMENT) 236 325 return [True,str(COMMENT)] 237 326 238 327 except Exception as e: 239 print("[LLXRemoteInstaller] (update2version) %s" %(str(e)))328 self._debug ("[LLXRemoteInstaller] (update2version) %s" %(str(e))) 240 329 return [False,str(e)] 241 330 … … 248 337 #exist=os.system("LANGUAGE=en_EN; apt-cache policy %s | grep -i candidate" %app) 249 338 exist=subprocess.Popen(["LANGUAGE=en_EN; apt-cache policy %s | grep -i candidate" %app],shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()[0] 250 print("[LLXRemoteInstaller] (app_repo_exist) APP candidate in your repo is: %s"%exist)339 self._debug ("[LLXRemoteInstaller] (app_repo_exist) APP candidate in your repo is: %s"%exist) 251 340 if exist in [None,"None","none",""]: 252 341 COMMENT="[LLXRemoteInstaller] (app_repo_exist) APP: %s doesn't exist in your repository, you can't add it to install list" %app 253 print("%s" %COMMENT)342 self._debug ("%s" %COMMENT) 254 343 return [False,str(COMMENT)] 255 344 else: 256 345 COMMENT="[LLXRemoteInstaller] (app_repo_exist) APP: %s is avaiable from your repo, it has been added to your install list" %app 257 print("%s" %COMMENT)346 self._debug ("%s" %COMMENT) 258 347 return [True,str(COMMENT)] 259 348 260 349 except Exception as e: 261 print("[LLXRemoteInstaller] (app_repo_exist) %s" %(str(e)))350 self._debug ("[LLXRemoteInstaller] (app_repo_exist) %s" %(str(e))) 262 351 return [False,str(e)] 263 352 … … 269 358 try: 270 359 url_all=str(url)+str(app) 271 print("[LLXRemoteInstaller] (app_deb_exist) VAR URL_ALL: %s"%url_all)360 self._debug ("[LLXRemoteInstaller] (app_deb_exist) VAR URL_ALL: %s"%url_all) 272 361 import urllib 273 362 if urllib.urlopen(url_all).code == 200: 274 363 COMMENT="[LLXRemoteInstaller](app_deb_exist) APP: %s is avaiable and added to list to install it" %app 275 print("%s" %COMMENT)364 self._debug ("%s" %COMMENT) 276 365 return [True,str(COMMENT)] 277 366 else: 278 367 COMMENT="[LLXRemoteInstaller] (app_deb_exist) Can't find APP: %s to download it from URL %s, you can't added to install it" %(app,url) 279 print("%s" %COMMENT)368 self._debug ("%s" %COMMENT) 280 369 return [False,str(COMMENT)] 281 370 282 371 except Exception as e: 283 print("[LLXRemoteInstaller] (app_deb_exist) %s" %(str(e)))372 self._debug ("[LLXRemoteInstaller] (app_deb_exist) %s" %(str(e))) 284 373 return [False,str(e)] 285 374 … … 292 381 if sources_private not in ["",None,[]]: 293 382 COMMENT="[LLXRemoteInstaller](repo_add) REPO IS PARTICULAR %s" %sources_private 294 print("%s" %COMMENT)295 print "[LLXRemoteInstaller](repo_add) Creating new file %s" %self.file_sources383 self._debug ("%s" %COMMENT) 384 self._debug ("[LLXRemoteInstaller](repo_add) Creating new file %s" %self.file_sources) 296 385 mode = 'a' if os.path.exists(self.file_sources) else 'w' 297 386 f_used=open(self.file_sources,mode) 298 print "open(%s,%s)"%(self.file_sources,mode)387 self._debug ("open(%s,%s)"%(self.file_sources,mode)) 299 388 f_used.write(sources_private+'\n') 300 389 f_used.close() 301 print "[LLXRemoteInstaller](repo_add) File created now read it"390 self._debug ("[LLXRemoteInstaller](repo_add) File created now read it" ) 302 391 #NOW READ THE NEW SOURCES.LIST 303 392 sources=[] … … 306 395 for line in f: 307 396 sources.append(line) 308 print "[LLXRemoteInstaller](repo_add) Line added: %s" %line397 self._debug ("[LLXRemoteInstaller](repo_add) Line added: %s" %line) 309 398 file.close() 310 399 311 400 COMMENT="[LLXRemoteInstaller](repo_add) Your repo LLXRemoteInstaller has new lines %s"%sources 312 print("%s" %COMMENT)401 self._debug ("%s" %COMMENT) 313 402 return [True,str(COMMENT),sources] 314 403 315 404 316 405 except Exception as e: 317 print("[LLXRemoteInstaller] (repo_add) %s" %(str(e)))406 self._debug ("[LLXRemoteInstaller] (repo_add) %s" %(str(e))) 318 407 return [False,str(e)] 319 408 … … 324 413 325 414 COMMENT="[LLXRemoteInstaller](remove_file) Reemoving file %s"%file 326 print("%s" %COMMENT)415 self._debug ("%s" %COMMENT) 327 416 if os.path.exists(file): 328 417 #print "Borrandoooooooooooooooooooooooooooooo" … … 330 419 331 420 COMMENT="[LLXRemoteInstaller](remove_file) File %s has been deleted from server"%file 332 print("%s" %COMMENT)421 self._debug ("%s" %COMMENT) 333 422 return [True,str(COMMENT)] 334 423 else: 335 424 COMMENT="[LLXRemoteInstaller](remove_file) ERROR: Cannot delete file %s from server"%file 336 print("%s" %COMMENT)425 self._debug ("%s" %COMMENT) 337 426 return [False,str(COMMENT)] 338 427 339 428 except Exception as e: 340 print("[LLXRemoteInstaller] (remove_file) %s" %(str(e)))429 self._debug ("[LLXRemoteInstaller] (remove_file) %s" %(str(e))) 341 430 return [False,str(e)] 342 431 … … 347 436 348 437 COMMENT="[LLXRemoteInstaller](repo_restore) Repo %s to test APT Aplications is deleted and restore to initial state"%file 349 print("%s" %COMMENT)438 self._debug ("%s" %COMMENT) 350 439 if os.path.exists(file): 351 440 #print "Borrandoooooooooooooooooooooooooooooo" … … 355 444 356 445 COMMENT="[LLXRemoteInstaller](repo_restore) Repo from AddApplications has deleted" 357 print("%s" %COMMENT)446 self._debug ("%s" %COMMENT) 358 447 return [True,str(COMMENT)] 359 448 360 449 except Exception as e: 361 print("[LLXRemoteInstaller] (repo_restore) %s" %(str(e)))450 self._debug ("[LLXRemoteInstaller] (repo_restore) %s" %(str(e))) 362 451 return [False,str(e)] 363 452 … … 368 457 try: 369 458 COMMENT="[LLXRemoteInstaller](repo_restore) Actualizando los indices, espera........" 370 print("%s" %COMMENT)459 self._debug ("%s" %COMMENT) 371 460 proc = subprocess.Popen('apt-get update', shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") 372 461 proc.wait() 373 462 COMMENT="[LLXRemoteInstaller](repo_restore) Se han actualizado los indices" 374 print("%s" %COMMENT)463 self._debug ("%s" %COMMENT) 375 464 return [True,str(COMMENT)] 376 465 377 466 except Exception as e: 378 print("[LLXRemoteInstaller] (repo_update) %s" %(str(e)))467 self._debug ("[LLXRemoteInstaller] (repo_update) %s" %(str(e))) 379 468 return [False,str(e)] 380 469 … … 393 482 lliurex_mirror=["deb http://mirror/llx16 xenial main restricted universe multiverse","deb http://mirror/llx16 xenial-security main restricted universe multiverse","deb http://mirror/llx16 xenial-updates main restricted universe multiverse"] 394 483 for x in dict[self.APT]: 395 print "[LLXRemoteInstaller](test_apt_list) Comprobando el PPA: %s"%x484 self._debug ("[LLXRemoteInstaller](test_apt_list) Comprobando el PPA: %s"%x) 396 485 #print "[LLXRemoteInstaller](dict_ok) Comprobando el listado de APP: %s"%list_apt 397 486 url=dict[self.APT][x][self.URL] … … 404 493 self.repo_add(line) 405 494 COMMENT="[LLXRemoteInstaller](test_apt_list) Repo esta ADDED" 406 print COMMENT495 self._debug (COMMENT) 407 496 list_apt=list_apt+list_apt_testing 408 497 restore=True 409 print "[LLXRemoteInstaller](test_apt_list) Anyadimos las APT del repo anterior, nueva lista: %s"%(list_apt)498 self._debug ("[LLXRemoteInstaller](test_apt_list) Anyadimos las APT del repo anterior, nueva lista: %s"%(list_apt)) 410 499 elif x in ["Mirror"]: 411 500 for line in lliurex_mirror: 412 501 self.repo_add(line) 413 502 COMMENT="[LLXRemoteInstaller](test_apt_list) Repo esta ADDED" 414 print COMMENT503 self._debug (COMMENT) 415 504 list_apt=list_apt+list_apt_testing 416 505 restore=True 417 print "[LLXRemoteInstaller](test_apt_list) Anyadimos las APT del repo anterior, nueva lista: %s"%(list_apt)506 self._debug ("[LLXRemoteInstaller](test_apt_list) Anyadimos las APT del repo anterior, nueva lista: %s"%(list_apt)) 418 507 else: 419 508 if self.repo_add(url)[0]: 420 509 COMMENT="[LLXRemoteInstaller](test_apt_list) Repo esta ADDED" 421 print COMMENT510 self._debug (COMMENT) 422 511 list_apt=list_apt+list_apt_testing 423 512 restore=True 424 print "[LLXRemoteInstaller](test_apt_list) Anyadimos las APT del repo anterior, nueva lista: %s"%(list_apt)513 self._debug ("[LLXRemoteInstaller](test_apt_list) Anyadimos las APT del repo anterior, nueva lista: %s"%(list_apt)) 425 514 else: 426 515 self.repo_restore(self.file_sources) … … 431 520 if self.repo_update()[0]: 432 521 for app in list_apt: 433 print "[LLXRemoteInstaller](test_apt_list) Comprobando si es avaiable el APT: %s"%app522 self._debug ("[LLXRemoteInstaller](test_apt_list) Comprobando si es avaiable el APT: %s"%app) 434 523 if self.app_repo_exist(app)[0]: 435 524 list_apt_ok.append(app) 436 525 list_apt=list_apt_ok 437 526 COMMENT="[LLXRemoteInstaller](test_apt_list) El listado de APT disponibles en el repo es: %s"%(list_apt) 438 print COMMENT527 self._debug (COMMENT) 439 528 else: 440 529 self.repo_restore(self.file_sources) … … 445 534 else: 446 535 COMMENT="[LLXRemoteInstaller](test_apt_list) No hacemos nada con este REPO esta vacio de contenido" 447 print COMMENT536 self._debug (COMMENT) 448 537 449 538 #UPDATE DICT … … 464 553 465 554 except Exception as e: 466 print("[LLXRemoteInstaller] (test_apt_list) %s" %(str(e)))555 self._debug ("[LLXRemoteInstaller] (test_apt_list) %s" %(str(e))) 467 556 return [False,str(e)] 468 557 … … 478 567 url=dict[self.DEB][self.URL] 479 568 #url=self.SHARE_DIRECTORY 480 print "[LLXRemoteInstaller](test_deb_list) El listado de DEBS es %s i lo comprobaremos en la URL: %s"%(list_debs,url)569 self._debug ("[LLXRemoteInstaller](test_deb_list) El listado de DEBS es %s i lo comprobaremos en la URL: %s"%(list_debs,url)) 481 570 list_debs_ok=[] 482 571 list_debs_fail=[] 483 572 for app in list_debs: 484 print "[LLXRemoteInstaller](test_deb_list) Comprobando si es avaiable el DEB: %s"%app573 self._debug ("[LLXRemoteInstaller](test_deb_list) Comprobando si es avaiable el DEB: %s"%app) 485 574 if self.app_deb_exist(app,url)[0]: 486 575 list_debs_ok.append(app) … … 489 578 list_debs=list_debs_ok 490 579 dict[self.DEB][self.LIST]=list_debs 491 print "[LLXRemoteInstaller](test_deb_list) Listado avaiable de DEBS: %s"%list_debs_ok492 print "[LLXRemoteInstaller](test_deb_list) Listado Unavaiable de DEBS: %s"%list_debs_fail580 self._debug ("[LLXRemoteInstaller](test_deb_list) Listado avaiable de DEBS: %s"%list_debs_ok) 581 self._debug ("[LLXRemoteInstaller](test_deb_list) Listado Unavaiable de DEBS: %s"%list_debs_fail) 493 582 return [True,dict,list_debs_ok,list_debs_fail] 494 583 except Exception as e: 495 print("[LLXRemoteInstaller] (test_deb_list) %s" %(str(e)))584 self._debug ("[LLXRemoteInstaller] (test_deb_list) %s" %(str(e))) 496 585 return [False,str(e)] 497 586 … … 507 596 url=dict[type][self.URL] 508 597 #url=self.SHARE_DIRECTORY 509 print "[LLXRemoteInstaller](test_list) El listado de SH es %s y lo comprobaremos en la URL: %s"%(list_debs,url)598 self._debug ("[LLXRemoteInstaller](test_list) El listado de SH es %s y lo comprobaremos en la URL: %s"%(list_debs,url)) 510 599 list_debs_ok=[] 511 600 list_debs_fail=[] … … 514 603 app=app_tupla[0] 515 604 md5=app_tupla[1] 516 print "[LLXRemoteInstaller](test_list) Comprobando si es avaiable el SH: %s"%app605 self._debug ("[LLXRemoteInstaller](test_list) Comprobando si es avaiable el SH: %s"%app) 517 606 if self.app_deb_exist(app,url)[0]: 518 607 list_debs_ok.append(app) … … 522 611 list_debs=list_tupla_ok 523 612 dict[type][self.LIST]=list_debs 524 print "[LLXRemoteInstaller](test_list) Listado avaiable de SH: %s"%list_debs_ok525 print "[LLXRemoteInstaller](test_list) Listado Unavaiable de SH: %s"%list_debs_fail613 self._debug ("[LLXRemoteInstaller](test_list) Listado avaiable de SH: %s"%list_debs_ok) 614 self._debug ("[LLXRemoteInstaller](test_list) Listado Unavaiable de SH: %s"%list_debs_fail) 526 615 return [True,dict,list_debs_ok,list_debs_fail] 527 616 except Exception as e: 528 print("[LLXRemoteInstaller] (test_list) %s" %(str(e)))617 self._debug ("[LLXRemoteInstaller] (test_list) %s" %(str(e))) 529 618 return [False,str(e)] 530 619 … … 543 632 os.remove(self.file_sources) 544 633 COMMENT="[LLXRemoteInstaller](dict_ok) Comprobando la lista de la GUI........" 545 print("%s" %COMMENT)634 self._debug ("%s" %COMMENT) 546 635 547 636 #TEST DEL UPDATE … … 551 640 datetime_update=dict[self.UPDATE]['datetime'] 552 641 553 print "[LLXRemoteInstaller](dict_ok) El update posee activate:%s - url:%s - version:%s - datetime:%s "%(activate_update,url_update,version_update,datetime_update)642 self._debug ("[LLXRemoteInstaller](dict_ok) El update posee activate:%s - url:%s - version:%s - datetime:%s "%(activate_update,url_update,version_update,datetime_update)) 554 643 if activate_update or url_update or version_update or datetime_update == None: 555 644 dict[self.UPDATE]['activate']='False' 556 645 557 print "[LLXRemoteInstaller](dict_ok) Finalmente UPDATE posee activate:%s - url:%s - version:%s - datetime:%s "%(activate_update,url_update,version_update,datetime_update)646 self._debug ("[LLXRemoteInstaller](dict_ok) Finalmente UPDATE posee activate:%s - url:%s - version:%s - datetime:%s "%(activate_update,url_update,version_update,datetime_update)) 558 647 559 648 … … 562 651 #url=dict[self.DEB][self.URL] 563 652 564 print "[LLXRemoteInstaller](dict_ok) El listado de DEBS es %s i lo comprobaremos en la URL: %s"%(list_debs,url)653 self._debug ("[LLXRemoteInstaller](dict_ok) El listado de DEBS es %s i lo comprobaremos en la URL: %s"%(list_debs,url)) 565 654 list_debs_ok=[] 566 655 for app in list_debs: 567 print "[LLXRemoteInstaller](dict_ok) Comprobando si es avaiable el DEB: %s"%app656 self._debug ("[LLXRemoteInstaller](dict_ok) Comprobando si es avaiable el DEB: %s"%app) 568 657 if self.app_deb_exist(app,url)[0]: 569 658 list_debs_ok.append(app) 570 659 list_debs=list_debs_ok 571 660 dict[self.DEB][self.LIST]=list_debs 572 print "[LLXRemoteInstaller](dict_ok) El listado de DEBS disponibles es: %s"%list_debs661 self._debug ("[LLXRemoteInstaller](dict_ok) El listado de DEBS disponibles es: %s"%list_debs) 573 662 574 663 #TEST DE LOS SH 575 664 list_sh=dict[self.SH][self.LIST] 576 665 url=dict[self.SH][self.URL] 577 print "[LLXRemoteInstaller](dict_ok) El listado de SCRIPTS es %s i lo comprobaremos en la URL: %s"%(list_debs,url)666 self._debug ("[LLXRemoteInstaller](dict_ok) El listado de SCRIPTS es %s i lo comprobaremos en la URL: %s"%(list_debs,url)) 578 667 list_sh_ok=[] 579 668 for app_tupla in list_sh: 580 669 app=app_tupla[0] 581 670 md5=app_tupla[1] 582 print "[LLXRemoteInstaller](dict_ok) Comprobando si es avaiable el SCRIPTS: %s"%app671 self._debug ("[LLXRemoteInstaller](dict_ok) Comprobando si es avaiable el SCRIPTS: %s"%app) 583 672 if self.app_deb_exist(app,url)[0]: 584 673 list_sh_ok.append([app,md5]) 585 674 list_sh=list_sh_ok 586 675 dict[self.SH][self.LIST]=list_sh 587 print "[LLXRemoteInstaller](dict_ok) El listado de SCRIPTS disponibles es: %s"%list_sh676 self._debug ("[LLXRemoteInstaller](dict_ok) El listado de SCRIPTS disponibles es: %s"%list_sh) 588 677 589 678 … … 593 682 list_apt=None 594 683 list_apt_ok=[] 595 print "[LLXRemoteInstaller](dict_ok) Comprobando el PPA: %s"%x684 self._debug ("[LLXRemoteInstaller](dict_ok) Comprobando el PPA: %s"%x) 596 685 list_apt=dict[self.APT][x][self.LIST] 597 # print"[LLXRemoteInstaller](dict_ok) Comprobando el listado de APP: %s"%list_apt686 #self._debug "[LLXRemoteInstaller](dict_ok) Comprobando el listado de APP: %s"%list_apt 598 687 url=dict[self.APT][x][self.URL] 599 print "[LLXRemoteInstaller](dict_ok) El listado de APT es %s lo comprobaremos en la URL: %s"%(list_apt,url)688 self._debug ("[LLXRemoteInstaller](dict_ok) El listado de APT es %s lo comprobaremos en la URL: %s"%(list_apt,url)) 600 689 601 690 if list_apt not in ["",None,[]] or url not in ["",None]: 602 691 #print "entro aqui dos" 603 692 if self.repo_add(url)[0]: 604 print "[LLXRemoteInstaller](dict_ok) Repo esta ADDED"693 self._debug ("[LLXRemoteInstaller](dict_ok) Repo esta ADDED") 605 694 if self.repo_update()[0]: 606 print "[LLXRemoteInstaller](dict_ok) Repo is UPDATED"695 self._debug ("[LLXRemoteInstaller](dict_ok) Repo is UPDATED") 607 696 pass 608 697 else: … … 614 703 615 704 for app in list_apt: 616 print "[LLXRemoteInstaller](dict_ok) Comprobando si es avaiable el APT: %s"%app705 self._debug ("[LLXRemoteInstaller](dict_ok) Comprobando si es avaiable el APT: %s"%app) 617 706 if self.app_repo_exist(app)[0]: 618 707 list_apt_ok.append(app) … … 620 709 list_apt=list_apt_ok 621 710 dict[self.APT][x][self.LIST]=list_apt 622 print "[LLXRemoteInstaller](dict_ok) El listado de APT disponibles en el repo %s es: %s"%(x,list_apt)711 self._debug ("[LLXRemoteInstaller](dict_ok) El listado de APT disponibles en el repo %s es: %s"%(x,list_apt)) 623 712 else: 624 print "[LLXRemoteInstaller](dict_ok) No hacemos nada con este REPO %s esta vacio de contenido"%x713 self._debug ("[LLXRemoteInstaller](dict_ok) No hacemos nada con este REPO %s esta vacio de contenido"%x) 625 714 626 715 self.repo_restore(self.file_sources) 627 716 COMMENT="[LLXRemoteInstaller](dict_ok) El listado de disponibles es ** DEBS: %s ** SH: %s ** APT: %s"%(list_debs,list_sh,list_apt_resume) 628 print("%s" %COMMENT)717 self._debug ("%s" %COMMENT) 629 718 return [True,str(COMMENT),dict,list_apt_resume] 630 719 631 720 except Exception as e: 632 print("[LLXRemoteInstaller] (dict_ok) %s" %(str(e)))721 self._debug ("[LLXRemoteInstaller] (dict_ok) %s" %(str(e))) 633 722 return [False,str(e)] 634 723
Note: See TracChangeset
for help on using the changeset viewer.