Ejemplo n.º 1
0
 def reconnect(self):
     try:
         api.get_workspace(self.host, 'Floobits', 'doesnotexist')
     except Exception as e:
         print(str_e(e))
         editor.error_message('Something went wrong. See https://%s/help/floorc to complete the installation.' % self.host)
     else:
         editor.error_message(PORT_BLOCK_MSG % self.host)
     self.stop()
Ejemplo n.º 2
0
 def reconnect(self):
     try:
         api.get_workspace(self.host, 'Floobits', 'doesnotexist')
     except Exception as e:
         print(str_e(e))
         editor.error_message('Something went wrong. See https://%s/help/floorc to complete the installation.' % self.host)
     else:
         if G.OUTBOUND_FILTERING:
             editor.error_message('Something went wrong. See https://%s/help/floorc to complete the installation.' % self.host)
             return self.stop()
         if self.host == 'floobits.com':
             G.OUTBOUND_FILTERING = True
             return self.connect()
         editor.error_message(PORT_BLOCK_MSG % self.host)
     self.stop()
Ejemplo n.º 3
0
 def reconnect(self):
     try:
         api.get_workspace(self.host, 'Floobits', 'doesnotexist')
     except Exception as e:
         print(str_e(e))
         editor.error_message(
             'Something went wrong. See https://%s/help/floorc to complete the installation.'
             % self.host)
     else:
         if G.OUTBOUND_FILTERING:
             editor.error_message(
                 'Something went wrong. See https://%s/help/floorc to complete the installation.'
                 % self.host)
             return self.stop()
         if self.host == 'floobits.com':
             G.OUTBOUND_FILTERING = True
             return self.connect()
         editor.error_message(PORT_BLOCK_MSG % self.host)
     self.stop()
Ejemplo n.º 4
0
    def remote_connect(self,
                       context,
                       host,
                       owner,
                       workspace,
                       d,
                       join_action=utils.JOIN_ACTION.PROMPT):
        G.PROJECT_PATH = os.path.realpath(d)
        try:
            utils.mkdir(os.path.dirname(G.PROJECT_PATH))
        except Exception as e:
            msg.error("Couldn't create directory", G.PROJECT_PATH, str_e(e))
            return

        auth = G.AUTH.get(host)
        if not auth:
            success = yield self.link_account, context, host
            if not success:
                return
            auth = G.AUTH.get(host)
            if not auth:
                msg.error("Something went really wrong.")
                return

        try:
            res = api.get_workspace(host, owner, workspace)
            if res.code == 404:
                msg.error("The workspace https://%s/%s/%s does not exist" %
                          (host, owner, workspace))
                return
        except Exception as e:
            message = 'Error getting workspace https://%s/%s/%s: %s' % (
                host, owner, workspace, str_e(e))
            msg.error(message)
            editor.error_message(message)
            return

        if self.agent:
            try:
                self.agent.stop()
            except Exception:
                pass

        G.WORKSPACE_WINDOW = yield self.get_a_window, d
        self.agent = self._make_agent(context, owner, workspace, auth,
                                      join_action)
        self.emit("agent", self.agent)
        reactor.reactor.connect(self.agent, host, G.DEFAULT_PORT, True)
        url = self.agent.workspace_url
        utils.add_workspace_to_persistent_json(owner, workspace, url, d)
        utils.update_recent_workspaces(url)
Ejemplo n.º 5
0
    def remote_connect(self, context, host, owner, workspace, d, join_action=utils.JOIN_ACTION.PROMPT):
        G.PROJECT_PATH = os.path.realpath(d)
        try:
            utils.mkdir(os.path.dirname(G.PROJECT_PATH))
        except Exception as e:
            msg.error("Couldn't create directory", G.PROJECT_PATH, str_e(e))
            return

        auth = G.AUTH.get(host)
        if not auth:
            success = yield self.link_account, context, host
            if not success:
                return
            auth = G.AUTH.get(host)
            if not auth:
                msg.error("Something went really wrong.")
                return

        try:
            res = api.get_workspace(host, owner, workspace)
            if res.code == 404:
                msg.error("The workspace https://%s/%s/%s does not exist" % (host, owner, workspace))
                return
        except Exception as e:
            message = 'Error getting workspace https://%s/%s/%s: %s' % (host, owner, workspace, str_e(e))
            msg.error(message)
            editor.error_message(message)
            return

        if self.agent:
            try:
                self.agent.stop()
            except Exception:
                pass

        G.WORKSPACE_WINDOW = yield self.get_a_window, d
        self.agent = self._make_agent(context, owner, workspace, auth, join_action)
        self.emit("agent", self.agent)
        reactor.reactor.connect(self.agent, host, G.DEFAULT_PORT, True)
        url = self.agent.workspace_url
        utils.add_workspace_to_persistent_json(owner, workspace, url, d)
        utils.update_recent_workspaces(url)