当前位置: 首页>>代码示例>>Python>>正文


Python rhnSQL.fetchone_dict函数代码示例

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


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


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