本文整理汇总了Python中smart.sysconf.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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")
示例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)
示例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")
示例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")
示例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")
示例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/"
},
})
示例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/"
},
})
示例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"}})
示例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)
示例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"}})
示例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"}})
示例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)
示例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/"},
})
示例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://"},
})