Exemple #1
0
    def reply(self, path, args, types, src_addr):
        if not (len(args) >= 2 and ray.areTheyAllString(args)):
            self.unknownMessage(path, types, src_addr)
            return False

        reply_path = args[0]

        if reply_path == '/ray/server/list_sessions':
            # this reply is only used here for reply from net_daemon
            # it directly resend its infos
            # to the last addr that asked session list
            if self.list_asker_addr:
                self.send(self.list_asker_addr, path, *args)
            return False

        if reply_path == '/ray/gui/script_user_action':
            self.sendGui('/ray/gui/hide_script_user_action')
            for controller in self.controller_list:
                self.send(controller.addr, '/reply',
                          '/ray/server/script_user_action',
                          'User action dialog validate')
            return False

        if not len(args) == 2:
            return False
Exemple #2
0
    def rayServerNewSession(self, path, args, types, src_addr):
        if not ray.areTheyAllString(args):
            self.unknownMessage(path, types, src_addr)
            return False

        if self.is_nsm_locked:
            return False

        if not pathIsValid(args[0]):
            self.send(src_addr, "/error", path, ray.Err.CREATE_FAILED,
                      "Invalid session name.")
            return False
Exemple #3
0
    def raySessionAddExecutableStrings(self, path, args, types, src_addr):
        if not (args and ray.areTheyAllString(args)):
            self.unknownMessage(path, types, src_addr)
            return False

        if not self.session.path:
            self.send(src_addr, "/error", path, ray.Err.NO_SESSION_OPEN,
                      "Cannot add to session because no session is loaded.")
            return False

        executable_path = args[0]
        via_proxy = bool(len(args) > 1 and 'via_proxy' in args[1:])
        ray_hack = bool(len(args) > 1 and 'ray_hack' in args[1:])

        if '/' in executable_path and not (via_proxy or ray_hack):
            self.send(
                src_addr, "/error", path, ray.Err.LAUNCH_FAILED,
                "Absolute paths are not permitted. Clients must be in $PATH")
            return False
Exemple #4
0
    def rayServerSetOptions(self, path, args, types, src_addr):
        if not ray.areTheyAllString(args):
            self.unknownMessage(path, types, src_addr)
            return False

        for option in args:
            option_value = True
            if option.startswith('not_'):
                option_value = False
                option = option.replace('not_', '', 1)

            if option == 'save_from_client':
                self.option_save_from_client = option_value
            elif option == 'bookmark_session_folder':
                self.option_bookmark_session = option_value
            elif option == 'desktops_memory':
                if option_value and not self.option_has_wmctrl:
                    self.send(
                        src_addr, '/minor_error', path,
                        "wmctrl is not present. Impossible to activate 'desktops_memory' option"
                    )
                    continue
                self.option_desktops_memory = option_value
            elif option == 'snapshots':
                if option_value and not self.option_has_git:
                    self.send(
                        src_addr, '/minor_error', path,
                        "git is not present. Impossible to activate 'snapshots' option"
                    )
                    continue
                self.option_snapshots = option_value
            elif option == 'session_scripts':
                self.option_session_scripts = option_value

        options = self.getOptions()

        for gui_addr in self.gui_list:
            if not ray.areSameOscPort(gui_addr.url, src_addr.url):
                self.send(gui_addr, '/ray/gui/server/options', options)

        self.send(src_addr, '/reply', path, 'Options set')
    def _reply(self, path, args, types, src_addr):
        if len(args) < 2:
            return

        if not ray.areTheyAllString(args):
            return

        reply_path = args.pop(0)

        if reply_path == '/ray/server/list_sessions':
            self._signaler.add_sessions_to_list.emit(args)
        elif reply_path == '/ray/server/list_path':
            self._signaler.new_executable.emit(args)
        elif reply_path == '/ray/server/list_session_templates':
            self._signaler.session_template_found.emit(args)
        elif reply_path == '/ray/server/list_user_client_templates':
            self._signaler.user_client_template_found.emit(args)
        elif reply_path == '/ray/server/list_factory_client_templates':
            self._signaler.factory_client_template_found.emit(args)
        elif reply_path == '/ray/session/list_snapshots':
            self._signaler.snapshots_found.emit(args)
Exemple #6
0
 def rayGuiClientSetProperties(self, path, args, types, src_addr):
     if not (len(args) >= 2 and ray.areTheyAllString(args)):
         self.unknownMessage(path, types, src_addr)
         return
Exemple #7
0
 def raySessionListClients(self, path, args, types, src_addr):
     if not ray.areTheyAllString(args):
         self.unknownMessage(path, types, src_addr)
         return False
Exemple #8
0
 def rayServerReorderClients(self, path, args, types, src_addr):
     if not (args and ray.areTheyAllString(args)):
         self.unknownMessage(path, types, src_addr)
         return False
 def _session_sort_clients(self, path, args, types, src_addr):
     if not ray.areTheyAllString(args):
         return False