Exemplo n.º 1
0
    def change_channel(self, pkg: SnapApplication, root_password: str,
                       watcher: ProcessWatcher) -> bool:
        if not internet.is_available():
            raise NoInternetException()

        try:
            channel = self._request_channel_installation(
                pkg=pkg,
                snap_config=None,
                snapd_client=SnapdClient(self.logger),
                watcher=watcher,
                exclude_current=True)

            if not channel:
                watcher.show_message(
                    title=self.i18n['snap.action.channel.label'],
                    body=self.i18n['snap.action.channel.error.no_channel'])
                return False

            return ProcessHandler(watcher).handle_simple(
                snap.refresh_and_stream(app_name=pkg.name,
                                        root_password=root_password,
                                        channel=channel))[0]
        except:
            return False
Exemplo n.º 2
0
 def refresh(self, pkg: SnapApplication, root_password: str,
             watcher: ProcessWatcher) -> bool:
     return ProcessHandler(watcher).handle(
         SystemProcess(
             subproc=snap.refresh_and_stream(pkg.name, root_password)))
Exemplo n.º 3
0
 def refresh(self, pkg: SnapApplication, root_password: Optional[str],
             watcher: ProcessWatcher) -> bool:
     return ProcessHandler(watcher).handle_simple(
         snap.refresh_and_stream(pkg.name, root_password))[0]