Changeset 6355


Ignore:
Timestamp:
Nov 20, 2017, 10:16:27 AM (2 years ago)
Author:
Juanma
Message:

add handler for socket exceptions

Location:
taskscheduler/trunk/fuentes
Files:
2 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • taskscheduler/trunk/fuentes/debian/changelog

    r6314 r6355  
     1taskscheduler (0.2.1) xenial; urgency=medium
     2
     3  * Add handler for socket exceptions
     4
     5 -- Juanma Navarro Mañez <juanma1980@gmail.com>  Mon, 20 Nov 2017 10:15:42 +0100
     6
    17taskscheduler (0.2) xenial; urgency=medium
    28
  • taskscheduler/trunk/fuentes/debian/control

    r6314 r6355  
    1515Package: taskscheduler
    1616Architecture: all
    17 Depends: ${misc:Depends}, ${python3:Depends}, python3-taskscheduler
     17Depends: ${misc:Depends}, ${python3:Depends}, python3-taskscheduler,python3-n4dgtklogin
    1818Description: Main taskschedular program
    1919
  • taskscheduler/trunk/fuentes/python3-taskscheduler.install/usr/share/taskscheduler/taskscheduler.py

    r6314 r6355  
    1616        def __init__(self):
    1717                self.dbg=1
    18                 self.n4dserver=self._n4d_connect()
     18                self.credentials=["",""]
     19                self.n4dserver=None
    1920                self.n4dclient=self._n4d_connect('localhost')
    2021                self.conf_dir="/etc/scheduler/conf.d/"
     
    2425                self.sched_dir="/etc/scheduler/tasks.d"
    2526                self.local_tasks_dir=self.sched_dir+"/local"
    26                 self.credentials=["",""]
    2727        #def __init__
    2828
     
    3232        #def _debug
    3333       
    34         def set_credentials(self,credentials):
    35                 self.credentials=credentials
     34        def set_credentials(self,user,pwd,server):
     35                self.credentials=[user,pwd]
     36                self.n4dserver=self._n4d_connect(server)
    3637        #def set_credentials
    3738
    3839        def get_available_tasks(self):
    3940                tasks={}
    40                 n4d_server=self.n4dserver
    41                 tasks=n4d_server.get_available_tasks("","SchedulerServer")['data'].copy()
    42                 n4d_server=self.n4dclient
    43                 tasks.update(n4d_server.get_available_tasks("","SchedulerServer")['data'])
     41                if self.n4dserver:
     42                        tasks=self.n4dserver.get_available_tasks("","SchedulerServer")['data'].copy()
     43                tasks.update(self.n4dclient.get_available_tasks("","SchedulerServer")['data'])
    4444                return tasks
    4545        #def get_available_tasks
     
    4848                tasks=[]
    4949                self._debug("Retrieving %s task list"%task_type)
    50                 if task_type=='remote':
    51                         n4d_server=self.n4dserver
    52                 else:
    53                         n4d_server=self.n4dclient
    54                 tasks=n4d_server.get_tasks("","SchedulerServer",task_type)['data']
     50                if task_type=='remote' and self.n4dserver:
     51                        tasks=self.n4dserver.get_tasks("","SchedulerServer",task_type)['data']
     52                elif task_type=='local':
     53                        tasks=self.n4dclient.get_tasks("","SchedulerServer",task_type)['data']
    5554                return tasks
    5655        #def get_scheduled_tasks
     
    142141                self._debug("Sending task info to %s server"%task_type)
    143142                if task_type=='remote':
    144                         n4d_server=self.n4dserver
     143                        tasks=self.n4dserver.write_tasks(self.credentials,"SchedulerServer",task_type,tasks)
    145144                else:
    146                         n4d_server=self.n4dclient
    147                 tasks=n4d_server.write_tasks(self.credentials,"SchedulerServer",task_type,tasks)
     145                        tasks=self.n4dclient.write_tasks(self.credentials,"SchedulerServer",task_type,tasks)
    148146                self._debug(tasks)
    149147                return True
     
    153151                self._debug("Removing task from %s server"%task_type)
    154152                if task_type=='remote':
    155                         n4d_server=self.n4dserver
     153                        tasks=self.n4dserver.remove_task(self.credentials,"SchedulerServer",task_type,task_name,task_serial,task_cmd)
    156154                else:
    157                         n4d_server=self.n4dclient
    158                 tasks=n4d_server.remove_task(self.credentials,"SchedulerServer",task_type,task_name,task_serial,task_cmd)
     155                        tasks=self.n4dclient.remove_task(self.credentials,"SchedulerServer",task_type,task_name,task_serial,task_cmd)
    159156                self._debug(tasks)
    160157        #def remove_task
    161158
    162         def _n4d_connect(self,server='server'):
     159        def _n4d_connect(self,server):
    163160                #Setup SSL
    164161                context=ssl._create_unverified_context()
  • taskscheduler/trunk/fuentes/scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py

    r6314 r6355  
    759759        #def _add_custom_task
    760760
    761         def _signin(self,loginMethod=None,user=None,pwd=None,data=None):
     761        def _signin(self,user=None,pwd=None,server=None,data=None):
    762762                self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT)
    763763                self.stack.set_visible_child_name("tasks")
    764764                self.toolbar.show()
    765                 self.scheduler_client.set_credentials([user,pwd])
    766                 if loginMethod!='N4d':
     765                self.scheduler_client.set_credentials(user,pwd,server)
     766                if server=='localhost':
    767767                        self.btn_local_tasks.set_active(True)
    768768                        self.btn_remote_tasks.set_visible(False)
     769                        self.btn_local_tasks.set_visible(False)
    769770                else:
    770771                        self.btn_remote_tasks.set_active(True)
Note: See TracChangeset for help on using the changeset viewer.