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

Python sysconf.get函数代码示例

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

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



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

示例1: test_doesnt_break_on_unexisting_file

 def test_doesnt_break_on_unexisting_file(self):
     os.unlink(self.client_conf_path)
     sysconf.set("use-landscape-proxies", True)
     landscape.run()
     self.assertEquals(sysconf.get("http-proxy"), None)
     self.assertEquals(sysconf.get("https-proxy"), None)
     self.assertEquals(sysconf.get("ftp-proxy"), None)
开发者ID:pombredanne,项目名称:packagemanagement,代码行数:7,代码来源:test_landscape.py


示例2: test_use_proxies_set_in_landscape

 def test_use_proxies_set_in_landscape(self):
     """
     If enabled, the landscape smart plugin will read the proxies
     set in Landscape.
     """
     sysconf.set("use-landscape-proxies", True)
     landscape.run()
     self.assertEquals(sysconf.get("http-proxy"), "http://proxy.url")
     self.assertEquals(sysconf.get("https-proxy"), "https://proxy.url")
     self.assertEquals(sysconf.get("ftp-proxy"), "ftp://proxy.url")
开发者ID:pombredanne,项目名称:packagemanagement,代码行数:10,代码来源:test_landscape.py


示例3: test_nothing_happens_if_there_are_no_proxy_settings

 def test_nothing_happens_if_there_are_no_proxy_settings(self):
     """
     The default settings won't be touched if there are no
     proxy options in the client configuration.
     """
     self.write_client_conf(EMPTY_CLIENT_CONF)
     sysconf.set("use-landscape-proxies", True)
     landscape.run()
     self.assertEquals(sysconf.get("http-proxy"), None)
     self.assertEquals(sysconf.get("https-proxy"), None)
     self.assertEquals(sysconf.get("ftp-proxy"), None)
开发者ID:pombredanne,项目名称:packagemanagement,代码行数:11,代码来源:test_landscape.py


示例4: test_synchronize_config_mirrorlist

 def test_synchronize_config_mirrorlist(self):
     product_id = self.makeFile(PRODUCT_ID, dirname=self.config_dir, basename="product.id")
     sysconf.set("product-id", product_id, soft=True)
     filename = self.makeFile(URPMI_CONFIG_MIRRORLIST, dirname=self.urpmi_dir, basename="urpmi.cfg")
     syncURPMIChannels(filename, self.media_dir)
     self.assertEquals(sysconf.get("channels")["urpmisync-MirrorList"]["mirrorurl"],
                       "http://api.mandriva.com/mirrors/base.2010.1.x86_64.list")
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:7,代码来源:test_urpmichannelsync.py


示例5: test_when_missing_do_not_override_existing_options

    def test_when_missing_do_not_override_existing_options(self):
        """
        If there are existing settings, they won't be overriden if
        the Landscape client didn't provide any options.
        """
        sysconf.set("http-proxy", "http-url", weak=True)
        sysconf.set("https-proxy", "https-url", weak=True)
        sysconf.set("ftp-proxy", "ftp-url", weak=True)

        self.write_client_conf(EMPTY_CLIENT_CONF)
        sysconf.set("use-landscape-proxies", True)
        landscape.run()

        self.assertEquals(sysconf.get("http-proxy"), "http-url")
        self.assertEquals(sysconf.get("https-proxy"), "https-url")
        self.assertEquals(sysconf.get("ftp-proxy"), "ftp-url")
开发者ID:pombredanne,项目名称:packagemanagement,代码行数:16,代码来源:test_landscape.py


示例6: test_synchronize_config_variables

 def test_synchronize_config_variables(self):
     release = self.makeFile(RELEASE, dirname=self.config_dir, basename="release")
     sysconf.set("release", release, soft=True)
     filename = self.makeFile(URPMI_CONFIG_VARIABLES, dirname=self.urpmi_dir, basename="urpmi.cfg")
     syncURPMIChannels(filename, self.media_dir)
     self.assertEquals(sysconf.get("channels")["urpmisync-Variables"]["mirrorurl"],
                       "2010.1/x86_64")
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:7,代码来源:test_urpmichannelsync.py


示例7: test_synchronize_sources_list_directory

 def test_synchronize_sources_list_directory(self):
     filename = self.makeFile(
         SOURCES_LIST_1, dirname=self.apt_dir, basename="sources.list")
     self.makeFile(SOURCES_LIST_2, dirname=self.sources_dir, suffix=".list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1cd42dbb12232a2e2582ad0145fd0516": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
             "aptsync-ca9430daa6beaccf4d4c9aad9e365c26": {
                 "type": "apt-rpm",
                 "name": "distro/name2 - comp1 comp2",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/distro/name2"
             },
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
         })
开发者ID:pombredanne,项目名称:smart,代码行数:28,代码来源:test_aptchannelsync.py


示例8: test_cleanup_removed_entries

 def test_cleanup_removed_entries(self):
     filename = self.makeFile(
         SOURCES_LIST_1, dirname=self.apt_dir, basename="sources.list")
     self.makeFile(SOURCES_LIST_2, dirname=self.sources_dir, suffix=".list")
     syncAptChannels(filename, self.sources_dir)
     filename = self.makeFile(
         SOURCES_LIST_3, dirname=self.apt_dir, basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1cd42dbb12232a2e2582ad0145fd0516": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
         })
开发者ID:pombredanne,项目名称:smart,代码行数:25,代码来源:test_aptchannelsync.py


示例9: test_rpm_database_detected_with_individual_setting

 def test_rpm_database_detected_with_individual_setting(self):
     self.make_rpm()
     self.make_deb()
     sysconf.set("detect-sys-channels", "rpm")
     self.rerun_plugin()
     self.assertEquals(sysconf.get("channels"),
                       {"rpm-sys":
                        {"type": "rpm-sys", "name": "RPM System"}})
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:8,代码来源:test_detectsys.py


示例10: test_detect_none_when_disabled_with_false

 def test_detect_none_when_disabled_with_false(self):
     self.make_rpm()
     self.make_deb()
     self.make_slack()
     self.make_arch()
     sysconf.set("detect-sys-channels", False)
     self.rerun_plugin()
     self.assertEquals(sysconf.get("channels"), None)
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:8,代码来源:test_detectsys.py


示例11: test_slack_database_detected_with_individual_setting

 def test_slack_database_detected_with_individual_setting(self):
     self.make_rpm()
     self.make_slack()
     sysconf.set("detect-sys-channels", "slack")
     self.rerun_plugin()
     self.assertEquals(sysconf.get("channels"),
                       {"slack-sys":
                        {"type": "slack-sys", "name": "Slackware System"}})
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:8,代码来源:test_detectsys.py


示例12: test_arch_database_detected_with_individual_setting

 def test_arch_database_detected_with_individual_setting(self):
     self.make_rpm()
     self.make_arch()
     sysconf.set("detect-sys-channels", "arch")
     self.rerun_plugin()
     self.assertEquals(sysconf.get("channels"),
                       {"arch-sys":
                        {"type": "arch-sys", "name": "Archlinux System"}})
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:8,代码来源:test_detectsys.py


示例13: test_do_not_override_environment_variable

    def test_do_not_override_environment_variable(self):
        """
        If the environment variable is set for some variable, do not
        import the setting from Landscape.
        """
        environ_snapshot = EnvironSnapshot()
        self.addCleanup(environ_snapshot.restore)

        os.environ["http_proxy"] = "http_from_environ"
        os.environ["https_proxy"] = "https_from_environ"
        os.environ["ftp_proxy"] = "ftp_from_environ"

        sysconf.set("use-landscape-proxies", True)
        landscape.run()

        self.assertEquals(sysconf.get("http-proxy"), None)
        self.assertEquals(sysconf.get("https-proxy"), None)
        self.assertEquals(sysconf.get("ftp-proxy"), None)
开发者ID:pombredanne,项目名称:packagemanagement,代码行数:18,代码来源:test_landscape.py


示例14: test_synchronize_repos_directory

 def test_synchronize_repos_directory(self):
     self.makeFile(OPENSUSE_REPO, dirname=self.repos_dir, basename="opensuse.repo")
     syncZyppRepos(self.repos_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "zyppsync-openSUSE-11.0-Oss":
                           {"type": "rpm-md",
                            "disabled": True,
                            "name": "",
                            "baseurl": "http://download.opensuse.org/distribution/11.0/repo/oss/"},
                      })
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:10,代码来源:test_zyppchannelsync.py


示例15: test_synchronize_media_repo

 def test_synchronize_media_repo(self):
     self.makeFile(CENTOS_MEDIA_REPO, dirname=self.repos_dir, basename="c4-media.repo")
     syncYumRepos(self.repos_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "yumsync-c4-media":
                           {"disabled": True,
                            "type": "rpm-md",
                            "name": "CentOS-%s - Media" % RELEASEVER,
                            "baseurl": "localmedia://"},
                      })
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:10,代码来源:test_yumchannelsync.py


示例16: test_synchronize_repos_directory

 def test_synchronize_repos_directory(self):
     self.makeFile(FEDORA_BASE_REPO, dirname=self.repos_dir, basename="fedora-base.repo")
     syncYumRepos(self.repos_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "yumsync-base":
                           {"disabled": False,
                            "type": "rpm-md",
                            "name": "Fedora 8 - i386 - Base",
                            "baseurl": "http://mirrors.kernel.org/fedora/releases/8/Everything/i386/os/"},
                      })
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:10,代码来源:test_yumchannelsync.py


示例17: run

def run():
    if (sysconf.get("use-landscape-proxies", False) and
        os.path.isfile(CLIENT_CONF_PATH)):
        parser = ConfigParser()
        parser.read(CLIENT_CONF_PATH)
        for type in "http", "https", "ftp":
            option = "%s_proxy" % type
            if parser.has_option("client", option) and option not in os.environ:
                setting = parser.get("client", option)
                sysconf.set(option.replace("_", "-"), setting, weak=True)
开发者ID:nikhilgv9,项目名称:winlibrepacman,代码行数:10,代码来源:landscape.py


示例18: test_repo_with_cd_baseurl

 def test_repo_with_cd_baseurl(self):
     self.makeFile(OPENSUSE_DVD_REPO, dirname=self.repos_dir, basename="opensuse-dvd.repo")
     syncZyppRepos(self.repos_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "zyppsync-openSUSE-10.3-DVD 10.3":
                           {"type": "yast2",
                            "disabled": False,
                            "name": "openSUSE-10.3-DVD 10.3",
                            "baseurl": "localmedia://"},
                      })
     os.unlink(os.path.join(self.repos_dir, "opensuse-dvd.repo"))
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:11,代码来源:test_zyppchannelsync.py


示例19: test_translate_ssh_entries

 def test_translate_ssh_entries(self):
     filename = self.makeFile(SOURCES_LIST_5, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "aptsync-1ce4291e0de00c14900dd35eae867c9b":
                           {"type": "apt-deb",
                            "name": "distro/name1 - comp1 comp2",
                            "distribution": "distro/name1",
                            "components": "comp1 comp2",
                            "baseurl": "scp://some/url/"},
                      })
开发者ID:bluelightning,项目名称:smart,代码行数:12,代码来源:test_aptchannelsync.py


示例20: test_synchronize_config_cdrom

 def test_synchronize_config_cdrom(self):
     filename = self.makeFile(URPMI_CONFIG_CDROM, dirname=self.urpmi_dir, basename="urpmi.cfg")
     syncURPMIChannels(filename, self.media_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "urpmisync-Mandriva Linux - 2009.0 (Free) - Installer":
                           {"type": "urpmi",
                            "name": "Mandriva Linux - 2009.0 (Free) - Installer",
                            "baseurl": "localmedia://i586/media/main",
                            "hdlurl": "media_info/synthesis.hdlist.cz",
                            "disabled": True,
                            "removable": True,
                            "priority": 0},
                     })
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:13,代码来源:test_urpmichannelsync.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python smart_open.smart_open函数代码示例发布时间:2022-05-27
下一篇:
Python option.OptionParser类代码示例发布时间: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