Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _checkStoreConnectivity(self):
- """ check for connectivity to the snap store to install snaps"""
- res = False
- snap_env = os.environ.copy()
- snap_env["LANG"] = "C.UTF-8"
- connected = Popen(["snap", "debug", "connectivity"], stdout=PIPE,
- stderr=PIPE, env=snap_env,
- universal_newlines=True).communicate()
- if re.search("^ \* PASS", connected[0], re.MULTILINE):
- return
- # can't connect
- elif re.search("^ \*.*unreachable", connected[0], re.MULTILINE):
- logging.error("No snap store connectivity")
- res = self._view.askYesNoQuestion(
- _("Connection to Snap Store failed"),
- _("Your system does not have a connection to the Snap "
- "Store. For the best upgrade experience make sure "
- "that your system can connect to api.snapcraft.io.\n"
- "Do you still want to continue with the upgrade?")
- )
- # debug command not available
- elif 'error: unknown command' in connected[1]:
- logging.error("snap debug command not available")
- res = self._view.askYesNoQuestion(
- _("Outdated snapd package"),
- _("Your system does not have the latest version of snapd. "
- "Please update the version of snapd on your system to "
- "improve the upgrade experience.\n"
- "Do you still want to continue with the upgrade?")
- )
- # not running as root
- elif 'error: access denied' in connected[1]:
- res = False
- logging.error("Not running as root!")
- if not res:
- self.controller.abort()
Advertisement
Add Comment
Please, Sign In to add comment