コード例 #1
0
ファイル: transaction.py プロジェクト: alhazred/v9os-pkg5
    def open(self):
        """Starts an in-flight transaction. Returns a URL-encoded
                transaction ID on success."""

        trans_id = None

        try:
            trans_id = self.transport.publish_open(
                self.publisher,
                client_release=os_util.get_os_release(),
                pkg_name=self.pkg_name)
        except apx.TransportError as e:
            msg = str(e)
            raise TransactionOperationError("open",
                                            trans_id=self.trans_id,
                                            msg=msg)

        self.trans_id = trans_id

        if self.trans_id is None:
            raise TransactionOperationError(
                "open",
                msg=_("Unknown failure; no transaction ID provided"
                      " in response."))

        return self.trans_id
コード例 #2
0
ファイル: transaction.py プロジェクト: Turvamies/pkg5
    def append(self):
        """Starts an in-flight transaction to append to an existing
                manifest. Returns a URL-encoded transaction ID on success."""

        self._append_mode = True
        trans_id = None

        try:
            trans_id = self.transport.publish_append(
                self.publisher,
                client_release=os_util.get_os_release(),
                pkg_name=self.pkg_name)
        except apx.TransportError as e:
            msg = str(e)
            raise TransactionOperationError("append",
                                            trans_id=self.trans_id,
                                            msg=msg)

        self.trans_id = trans_id

        if self.trans_id is None:
            raise TransactionOperationError(
                "append",
                msg=_("Unknown failure; no transaction ID provided"
                      " in response."))

        self._init_upload()

        return self.trans_id
コード例 #3
0
        def open(self):
                """Starts an in-flight transaction. Returns a URL-encoded
                transaction ID on success."""

                try:
                        self.trans_id = self.__repo.open(
                            os_util.get_os_release(), self.pkg_name)
                except repo.RepositoryError, e:
                        raise TransactionOperationError("open",
                            trans_id=self.trans_id, msg=str(e))
コード例 #4
0
        def open(self):
                """Starts an in-flight transaction. Returns a URL-encoded
                transaction ID on success."""

                trans_id = None

                try:
                        trans_id = self.transport.publish_open(self.publisher,
                            client_release=os_util.get_os_release(),
                            pkg_name=self.pkg_name)
                except apx.TransportError, e:
                        msg = str(e)
                        raise TransactionOperationError("open",
                            trans_id=self.trans_id, msg=msg)
コード例 #5
0
        def open(self):
                """Starts an in-flight transaction. Returns a URL-encoded
                transaction ID on success."""

                # XXX This opens a Transaction, but who manages the server
                # connection?  If we want a pipelined HTTP session (multiple
                # operations -- even if it's only one Transaction -- over a
                # single connection), then we can't call HTTPConnection.close()
                # here, and we shouldn't reopen the connection in add(),
                # close(), etc.
                try:
                        headers = {"Client-Release": os_util.get_os_release()}
                        c, v = versioned_urlopen(self.origin_url, "open",
                            [0], urllib.quote(self.pkg_name, ""),
                            headers=headers)
                        self.trans_id = c.headers.get("Transaction-ID", None)
                except (httplib.BadStatusLine, RuntimeError), e:
                        status = httplib.INTERNAL_SERVER_ERROR
                        msg = str(e)
コード例 #6
0
ファイル: t_plat.py プロジェクト: aszeszo/test
 def testRelease(self):
         rel = util.get_os_release()
         # make sure it can be used in an fmri
         test_fmri = fmri.PkgFmri("testpkg", build_release = rel)
コード例 #7
0
ファイル: t_plat.py プロジェクト: wmaddox/pkg5
 def testRelease(self):
     rel = util.get_os_release()
     # make sure it can be used in an fmri
     test_fmri = fmri.PkgFmri("testpkg", build_release=rel)