• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python rhnSQL.fetchone_dict函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中spacewalk.server.rhnSQL.fetchone_dict函数的典型用法代码示例。如果您正苦于以下问题:Python fetchone_dict函数的具体用法?Python fetchone_dict怎么用?Python fetchone_dict使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fetchone_dict函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: lookupChannel

    def lookupChannel(self, name, username, password):
        log_debug(3)
        authobj = self._auth(username, password)
        authobj.isChannelAdmin()

        row = rhnSQL.fetchone_dict("select * from rhnChannel where label = :label",
                                   label=name)
        if row:
            row.update(self._insert_channel_family(row['id']))
            row['last_modified'] = str(row['last_modified'])
            row['modified'] = str(row['modified'])
            row['created'] = str(row['created'])
            return removeNone(row)

        # Look the channel up by id
        try:
            name = int(name)
        except ValueError:
            return ''

        row = rhnSQL.fetchone_dict("select * from rhnChannel where id = :channel_id",
                                    channel_id = name)
        if row:
            row.update(self._insert_channel_family(row['id']))
            return removeNone(row)

        return ''
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:27,代码来源:channel.py


示例2: lookup_org_config_channel_by_name

 def lookup_org_config_channel_by_name(self, config_channel):
     row = rhnSQL.fetchone_dict(self._query_org_config_channels,
                                config_channel=config_channel, org_id=self.org_id)
     if not row:
         raise rhnFault(4009, "Configuration channel %s does not exist" %
                        config_channel, explain=0)
     return row
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:7,代码来源:rhn_config_management.py


示例3: management_create_channel

    def management_create_channel(self, dict):
        log_debug(1)
        self._get_and_validate_session(dict)

        config_channel = dict.get('config_channel')
        # XXX Validate the namespace

        config_channel_name = dict.get('config_channel_name') or config_channel
        config_channel_description = dict.get('description') or config_channel

        row = rhnSQL.fetchone_dict(self._query_lookup_config_channel,
                                   org_id=self.org_id, config_channel=config_channel)
        if row:
            raise rhnFault(4010, "Configuration channel %s already exists" %
                           config_channel, explain=0)

        insert_call = rhnSQL.Function('rhn_config.insert_channel',
                                      rhnSQL.types.NUMBER())
        config_channel_id = insert_call(self.org_id,
                                        'normal',
                                        config_channel_name,
                                        config_channel,
                                        config_channel_description)

        rhnSQL.commit()
        return {}
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:26,代码来源:rhn_config_management.py


示例4: isAllowedSlave

def isAllowedSlave(hostname):
    rhnSQL.initDB()
    if not rhnSQL.fetchone_dict("select 1 from rhnISSSlave where slave = :hostname and enabled = 'Y'",
                                hostname=idn_puny_to_unicode(hostname)):
        log_error('Server "%s" is not enabled for ISS.' % hostname)
        return False
    return True
开发者ID:m47ik,项目名称:uyuni,代码行数:7,代码来源:suseLib.py


示例5: getISSCurrentMaster

def getISSCurrentMaster():
    rhnSQL.initDB()
    master = rhnSQL.fetchone_dict(
        "select label from rhnISSMaster where is_current_master = 'Y'")
    if not master:
        return None
    return master['label']
开发者ID:m47ik,项目名称:uyuni,代码行数:7,代码来源:suseLib.py


示例6: management_remove_channel

    def management_remove_channel(self, dict):
        log_debug(1)
        self._get_and_validate_session(dict)

        config_channel = dict.get('config_channel')
        # XXX Validate the namespace

        row = rhnSQL.fetchone_dict(self._query_config_channel_by_label,
                                   org_id=self.org_id, label=config_channel)

        if not row:
            raise rhnFault(4009, "Channel not found")

        delete_call = rhnSQL.Procedure('rhn_config.delete_channel')

        try:
            delete_call(row['id'])
        except rhnSQL.SQLError:
            e = sys.exc_info()[1]
            errno = e.args[0]
            if errno == 2292:
                raise_with_tb(rhnFault(4005, "Cannot remove non-empty channel %s" %
                               config_channel, explain=0), sys.exc_info()[2])
            raise

        log_debug(5, "Removed:", config_channel)
        rhnSQL.commit()
        return ""
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:28,代码来源:rhn_config_management.py


示例7: lookupChannelArch

    def lookupChannelArch(self, label, username, password):
        log_debug(3)
        self._auth(username, password)

        row = rhnSQL.fetchone_dict("select id from rhnChannelArch where label = :label",
                                    label=label)
        if not row:
            return 0
        return row['id']
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:9,代码来源:channel.py


示例8: sync

    def sync(self):
        """Trigger a reposync"""
        start_time = datetime.now()
        for (repo_id, url, repo_label, channel_family_id) in self.urls:
            print("")
            self.print_msg("Repo URL: %s" % url)
            plugin = None

            # If the repository uses a uln:// URL, switch to the ULN plugin, overriding the command-line
            if url.startswith("uln://"):
                self.repo_plugin = self.load_plugin("uln")

            # pylint: disable=W0703
            try:
                plugin = self.repo_plugin(url, self.channel_label)
                if repo_id is not None:
                    keys = rhnSQL.fetchone_dict("""
                        select k1.key as ca_cert, k2.key as client_cert, k3.key as client_key
                        from rhncontentssl
                                join rhncryptokey k1
                                on rhncontentssl.ssl_ca_cert_id = k1.id
                                left outer join rhncryptokey k2
                                on rhncontentssl.ssl_client_cert_id = k2.id
                                left outer join rhncryptokey k3
                                on rhncontentssl.ssl_client_key_id = k3.id
                        where rhncontentssl.content_source_id = :repo_id
                        or rhncontentssl.channel_family_id = :channel_family_id
                        """, repo_id=int(repo_id), channel_family_id=int(channel_family_id))
                    if keys and ('ca_cert' in keys):
                        plugin.set_ssl_options(keys['ca_cert'], keys['client_cert'], keys['client_key'])
                self.import_packages(plugin, repo_id, url)
                self.import_groups(plugin, url)

                if not self.no_errata:
                    self.import_updates(plugin, url)

                # only for repos obtained from the DB
                if self.sync_kickstart and repo_label:
                    try:
                        self.import_kickstart(plugin, url, repo_label)
                    except:
                        rhnSQL.rollback()
                        raise
            except Exception:
                e = sys.exc_info()[1]
                self.error_msg("ERROR: %s" % e)
            if plugin is not None:
                plugin.clear_ssl_cache()
        if self.regen:
            taskomatic.add_to_repodata_queue_for_channel_package_subscription(
                [self.channel_label], [], "server.app.yumreposync")
            taskomatic.add_to_erratacache_queue(self.channel_label)
        self.update_date()
        rhnSQL.commit()
        total_time = datetime.now() - start_time
        self.print_msg("Sync completed.")
        self.print_msg("Total time: %s" % str(total_time).split('.')[0])
开发者ID:jiridostal,项目名称:spacewalk,代码行数:57,代码来源:reposync.py


示例9: auth_system

    def auth_system(self):
        if CFG.DISABLE_ISS:
            raise rhnFault(2005, _('ISS is disabled on this satellite.'))

        if not rhnSQL.fetchone_dict("select 1 from rhnISSSlave where slave = :hostname and enabled = 'Y'",
                                    hostname=idn_puny_to_unicode(self.remote_hostname)):
            raise rhnFault(2004,
                           _('Server "%s" is not enabled for ISS.')
                           % self.remote_hostname)
        return self.remote_hostname
开发者ID:TJM,项目名称:spacewalk,代码行数:10,代码来源:auth.py


示例10: _get_file

 def _get_file(self, config_channel, path, revision=None):
     log_debug(2, config_channel, path)
     params = {"org_id": self.org_id, "config_channel": config_channel, "path": path}
     if revision is None:
         # Fetch the latest
         q = self._query_get_file_latest
     else:
         params["revision"] = revision
         q = self._query_get_file_revision
     log_debug(4, params)
     return rhnSQL.fetchone_dict(q, **params)
开发者ID:pombredanne,项目名称:spacewalk-2,代码行数:11,代码来源:rhn_config_management.py


示例11: lookupOrgId

    def lookupOrgId(self, org_id, username, password):
        log_debug(3)
        self._auth(username, password)
        
        if not org_id:
            return ''
        row = rhnSQL.fetchone_dict("""select org_id from web_contact
                                        where login_uc = UPPER(:org_id)""",
                                        org_id=org_id)
        if row:
            return row['org_id']
        
        try:
            org_id = int(org_id)
        except ValueError:
            raise rhnFault(42, "Invalid org_id ",explain=0)

        row = rhnSQL.fetchone_dict("""select id from web_customer where id = :org_id""",
                                   org_id=org_id)
        if row:
            return row['id']
        
        return ''
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:23,代码来源:channel.py


示例12: sync

    def sync(self):
        """Trigger a reposync"""
        start_time = datetime.now()
        for (repo_id, url, repo_label) in self.urls:
            print
            self.print_msg("Repo URL: %s" % url)
            plugin = None

            # If the repository uses a uln:// URL, switch to the ULN plugin, overriding the command-line
            if url.startswith("uln://"):
                self.repo_plugin = self.load_plugin("uln")

            # pylint: disable=W0703
            try:
                plugin = self.repo_plugin(url, self.channel_label)
                if repo_id is not None:
                    keys = rhnSQL.fetchone_dict(
                        """
                        select k1.key as ca_cert, k2.key as client_cert, k3.key as client_key
                        from rhncontentsourcessl
                                join rhncryptokey k1
                                on rhncontentsourcessl.ssl_ca_cert_id = k1.id
                                left outer join rhncryptokey k2
                                on rhncontentsourcessl.ssl_client_cert_id = k2.id
                                left outer join rhncryptokey k3
                                on rhncontentsourcessl.ssl_client_key_id = k3.id
                        where rhncontentsourcessl.content_source_id = :repo_id
                        """,
                        repo_id=int(repo_id),
                    )
                    if keys and keys.has_key("ca_cert"):
                        plugin.set_ssl_options(keys["ca_cert"], keys["client_cert"], keys["client_key"])
                self.import_packages(plugin, repo_id, url)
                self.import_groups(plugin, url)

                if not self.no_errata:
                    self.import_updates(plugin, url)

                # only for repos obtained from the DB
                if self.sync_kickstart and repo_label:
                    try:
                        self.import_kickstart(plugin, url, repo_label)
                    except:
                        rhnSQL.rollback()
                        raise
            except Exception, e:
                self.error_msg("ERROR: %s" % e)
            if plugin is not None:
                plugin.clear_ssl_cache()
开发者ID:jetsaredim,项目名称:spacewalk,代码行数:49,代码来源:reposync.py


示例13: _get_file

 def _get_file(self, config_channel, path, revision=None):
     log_debug(2, config_channel, path)
     params = {
         'org_id': self.org_id,
         'config_channel': config_channel,
         'path': path,
     }
     if revision is None:
         # Fetch the latest
         q = self._query_get_file_latest
     else:
         params['revision'] = revision
         q = self._query_get_file_revision
     log_debug(4, params)
     return rhnSQL.fetchone_dict(q, **params)
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:15,代码来源:rhn_config_management.py


示例14: _insert_channel_family

 def _insert_channel_family(self, channel_id):
     log_debug(3)
     
     # get channel family info for this channel
     # A channel can currently be in at most one channel family
     row = rhnSQL.fetchone_dict("""
     select cfm.channel_family_id, cf.label channel_family
       from rhnChannelFamilyMembers cfm,
            rhnChannelFamily cf
      where cfm.channel_id = :channel_id
        and cfm.channel_family_id = cf.id
     """, channel_id=channel_id)
     if row:
         return removeNone(row)
     
     return { 'channel_family_id' :'', 'channel_family' : ''}
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:16,代码来源:channel.py


示例15: lookupChannelFamily

    def lookupChannelFamily(self, name, username, password):
        log_debug(3)
        
        authobj = self._auth(username, password)
        if not authobj.isChannelAdmin():
            raise rhnFault(50, "Invalid user permissions",
                           explain=0)
        
        row = rhnSQL.fetchone_dict("select * from rhnChannelFamily where label = :label",
                                    label=name)
        if not row:
            return 0
        row = removeNone(row)

        row['modified'] = str(row['modified'])
        row['created'] = str(row['created'])        
        return row
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:17,代码来源:channel.py


示例16: management_disable_file

    def management_disable_file(self, dict):
        log_debug(1)
        self._get_and_validate_session(dict)

        config_channel = dict.get("config_channel")
        # XXX Validate the namespace
        path = dict.get("path")

        t = rhnSQL.Table("rhnConfigFileState", "label")
        state_id_dead = t["dead"]["id"]

        row = rhnSQL.fetchone_dict(self._query_lookup_config_file_by_channel, config_channel=config_channel, path=path)
        if not row or row["state_id"] == state_id_dead:
            raise rhnFault(4011, "File %s does not exist in channel %s" % (path, config_channel), explain=0)

        rhnSQL.execute(self._query_update_file_state, config_file_id=row["id"], state_id=state_id_dead)
        rhnSQL.commit()
        return {}
开发者ID:pombredanne,项目名称:spacewalk-2,代码行数:18,代码来源:rhn_config_management.py


示例17: auth_system

    def auth_system(self, req):
        if CFG.DISABLE_ISS:
            raise rhnFault(2005, _('ISS is disabled on this satellite.'))

        remote_hostname = req.get_remote_host(apache.REMOTE_DOUBLE_REV)
        row = rhnSQL.fetchone_dict("""
        select id, allow_all_orgs
          from rhnISSSlave
         where slave = :hostname
           and enabled = 'Y'
        """, hostname=idn_puny_to_unicode(remote_hostname))
        if not row:
            raise rhnFault(2004,
                           _('Server "%s" is not enabled for ISS.')
                           % remote_hostname)
        iss_slave_condition = "select id from web_customer"
        if not(row['allow_all_orgs'] == 'Y'):
            iss_slave_condition = "select rhnISSSlaveOrgs.org_id from rhnISSSlaveOrgs where slave_id = %d" % row['id']
        return iss_slave_condition
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:19,代码来源:satexport.py


示例18: sync

    def sync(self):
        """Trigger a reposync"""
        start_time = datetime.now()
        for (repo_id, url, repo_label) in self.urls:
            self.print_msg("Repo URL: %s" % url)
            plugin = None
            try:
                plugin = self.repo_plugin(url, self.channel_label)
                if repo_id is not None:
                    keys = rhnSQL.fetchone_dict(
                        """
                        select k1.key as ca_cert, k2.key as client_cert, k3.key as client_key
                        from rhncontentsourcessl
                                join rhncryptokey k1
                                on rhncontentsourcessl.ssl_ca_cert_id = k1.id
                                left outer join rhncryptokey k2
                                on rhncontentsourcessl.ssl_client_cert_id = k2.id
                                left outer join rhncryptokey k3
                                on rhncontentsourcessl.ssl_client_key_id = k3.id
                        where rhncontentsourcessl.content_source_id = :repo_id
                        """,
                        repo_id=int(repo_id),
                    )
                    if keys and keys.has_key("ca_cert"):
                        plugin.set_ssl_options(keys["ca_cert"], keys["client_cert"], keys["client_key"])
                self.import_packages(plugin, repo_id, url)
                self.import_groups(plugin, url)

                if not self.no_errata:
                    self.import_updates(plugin, url)
                if self.sync_kickstart:
                    try:
                        self.import_kickstart(plugin, url, repo_label)
                    except:
                        rhnSQL.rollback()
                        raise
            except Exception, e:
                self.error_msg("ERROR: %s" % e)
            if plugin is not None:
                plugin.clear_ssl_cache()
开发者ID:T-D-Oe,项目名称:spacewalk,代码行数:40,代码来源:reposync.py


示例19: management_remove_file

    def management_remove_file(self, dict):
        log_debug(1)
        self._get_and_validate_session(dict)

        config_channel = dict.get('config_channel')
        # XXX Validate the namespace
        path = dict.get('path')

        row = rhnSQL.fetchone_dict(self._query_lookup_config_file_by_channel,
                                   org_id=self.org_id, config_channel=config_channel, path=path)
        if not row:
            raise rhnFault(4011, "File %s does not exist in channel %s" %
                           (path, config_channel), explain=0)

        config_file_id = row['id']

        delete_call = rhnSQL.Procedure("rhn_config.delete_file")
        delete_call(config_file_id)

        rhnSQL.commit()

        return {}
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:22,代码来源:rhn_config_management.py


示例20: management_remove_channel

    def management_remove_channel(self, dict):
        log_debug(1)
        self._get_and_validate_session(dict)

        config_channel = dict.get("config_channel")
        # XXX Validate the namespace

        row = rhnSQL.fetchone_dict(self._query_config_channel_by_label, org_id=self.org_id, label=config_channel)

        if not row:
            raise rhnFault(4009, "Channel not found")

        delete_call = rhnSQL.Procedure("rhn_config.delete_channel")

        try:
            delete_call(row["id"])
        except rhnSQL.SQLError, e:
            errno = e.args[0]
            if errno == 2292:
                raise rhnFault(
                    4005, "Cannot remove non-empty channel %s" % config_channel, explain=0
                ), None, sys.exc_info()[2]
            raise
开发者ID:pombredanne,项目名称:spacewalk-2,代码行数:23,代码来源:rhn_config_management.py



注:本文中的spacewalk.server.rhnSQL.fetchone_dict函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python rhnSQL.initDB函数代码示例发布时间:2022-05-27
下一篇:
Python rhnSQL.execute函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap