Ejemplo n.º 1
0
 def __init__(self, configfile, opts=None):
     self.connection = HTTPConnection()
     self.check_versions()
     super(RemoteRunContext, self).__init__(configfile, opts)
Ejemplo n.º 2
0
 def __init__(self, configfile, opts=None):
     self.connection = HTTPConnection()
     self.check_versions()
     super(RemoteRunContext, self).__init__(configfile, opts)
Ejemplo n.º 3
0
class RemoteRunContext(RunContext):

    def __init__(self, configfile, opts=None):
        self.connection = HTTPConnection()
        self.check_versions()
        super(RemoteRunContext, self).__init__(configfile, opts)

    def check_versions(self):
        self.connection.request("GET", "/about")
        rsp = self.connection.getresponse()

        if rsp.status != 200:
            self.features = []
            self.versions = {"Yaybu": "0", "yay": "0"}
        else:
            self.features = rsp.getheader("features", "").split(",")
            self.versions = {
                "Yaybu": rsp.getheader("Yaybu", "0"),
                "yay": rsp.getheader("yay", "0"),
                }

        import pkg_resources
        if pkg_resources.parse_version(self.versions["Yaybu"]) <= pkg_resources.parse_version("0"):
            raise Incompatible("You require a newer version of 'Yaybu' to deploy to this server")

        if pkg_resources.parse_version(self.versions["yay"]) <= pkg_resources.parse_version("0"):
            raise Incompatible("You require a newer version of 'yay' to deploy to this server")

    def setup_changelog(self):
        self.changelog = change.RemoteChangeLog(self)

    def get_config(self):
        self.connection.request("GET", "/config")
        rsp = self.connection.getresponse()
        return pickle.loads(rsp.read())

    def get_decrypted_file(self, filename):
        self.connection.request("GET", "/encrypted/" + filename)
        rsp = self.connection.getresponse()

        return rsp

    def get_file(self, filename):
        if filename.startswith("/"):
            return super(RemoteRunContext, self).get_file(filename)

        self.connection.request("GET", "/files/?path=" + filename)
        rsp = self.connection.getresponse()

        if rsp.status == 404:
            raise MissingAsset("Cannot fetch %r" % filename)

        return rsp
Ejemplo n.º 4
0
class RemoteRunContext(RunContext):
    def __init__(self, configfile, opts=None):
        self.connection = HTTPConnection()
        self.check_versions()
        super(RemoteRunContext, self).__init__(configfile, opts)

    def check_versions(self):
        self.connection.request("GET", "/about")
        rsp = self.connection.getresponse()

        if rsp.status != 200:
            self.features = []
            self.versions = {"Yaybu": "0", "yay": "0"}
        else:
            self.features = rsp.getheader("features", "").split(",")
            self.versions = {
                "Yaybu": rsp.getheader("Yaybu", "0"),
                "yay": rsp.getheader("yay", "0"),
            }

        import pkg_resources
        if pkg_resources.parse_version(
                self.versions["Yaybu"]) <= pkg_resources.parse_version("0"):
            raise Incompatible(
                "You require a newer version of 'Yaybu' to deploy to this server"
            )

        if pkg_resources.parse_version(
                self.versions["yay"]) <= pkg_resources.parse_version("0"):
            raise Incompatible(
                "You require a newer version of 'yay' to deploy to this server"
            )

    def setup_changelog(self):
        self.changelog = change.RemoteChangeLog(self)

    def get_config(self):
        self.connection.request("GET", "/config")
        rsp = self.connection.getresponse()
        return pickle.loads(rsp.read())

    def get_decrypted_file(self, filename):
        self.connection.request("GET", "/encrypted/" + filename)
        rsp = self.connection.getresponse()

        return rsp

    def get_file(self, filename):
        if filename.startswith("/"):
            return super(RemoteRunContext, self).get_file(filename)

        self.connection.request("GET", "/files/?path=" + filename)
        rsp = self.connection.getresponse()

        if rsp.status == 404:
            raise MissingAsset("Cannot fetch %r" % filename)

        return rsp