Here are the examples of the python api SystemConfiguration.SCDynamicStoreCreate taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
3
Example 1
def searchnodes():
if not bound():
raise NotBound
net_config = SystemConfiguration.SCDynamicStoreCreate(None, 'directory-nodes', None, None)
nodes = SystemConfiguration.SCDynamicStoreCopyValue(net_config, 'com.apple.opendirectoryd.node:/Search')
if nodes:
return list(nodes)
else:
return None
3
Example 2
Project: ShareMounter Source File: __init__.py
def domain_dns():
if not bound():
raise NotBound
net_config = SystemConfiguration.SCDynamicStoreCreate(None, 'active-directory', None, None)
ad_info = SystemConfiguration.SCDynamicStoreCopyValue(net_config, 'com.apple.opendirectoryd.ActiveDirectory')
if ad_info:
return ad_info.get('DomainNameDns')
else:
return None
3
Example 3
def realms():
if not bound():
raise NotBound
store = SystemConfiguration.SCDynamicStoreCreate(None, 'default-realms', None, None)
realms = SystemConfiguration.SCDynamicStoreCopyValue(store, 'Kerberos-Default-Realms')
return list(realms) if realms else None
0
Example 4
def __init__(self):
super(SCDynamicPreferences, self).__init__()
self.store = SCDynamicStoreCreate(None, 'gmacpyutil', None, None)
0
Example 5
def setup_dns(self, iface_name, service_id, dns_servers, dns_domains, revdns_domains, override_gateway):
"""Setup DNS the OSX magic way."""
# Preferentially use the SystemConfiguration library (included with OSX
# 10.5) if available, as scutil has a command-length limitation of 256
# chars. With 256 chars it's generally not reasonable to add in the
# revdns domains, so don't bother trying.
# NOTE: There's a 3rd party SystemConfiguration package for 10.4 which
# seems to have a different API (that I don't support currently)
try:
SystemConfiguration=self.load_SystemConfigurationFramework()
SystemConfiguration.SCDynamicStoreCreate
except:
# fall back to scutil.
config = "d.init\n"
config += "d.add ServerAddresses * %s\n" % ' '.join(dns_servers)
if override_gateway:
config += "d.add SearchDomains * %s\n" % ' '.join(dns_domains)
else:
config += "d.add SupplementalMatchDomains * %s\n" % ' '.join(dns_domains)
config += "set State:/Network/Service/%s/DNS\n" % service_id
run_as_root(['/usr/sbin/scutil'], stdin=config)
else:
def setup_helper():
sc = SystemConfiguration.SCDynamicStoreCreate(None, "f5vpn-login", None, None)
d = SystemConfiguration.NSMutableDictionary.new()
d[u'ServerAddresses'] = dns_servers
if override_gateway:
d[u'SearchDomains'] = dns_domains
else:
d[u'SupplementalMatchDomains'] = dns_domains + revdns_domains
SystemConfiguration.SCDynamicStoreSetValue(sc, 'State:/Network/Service/%s/DNS' % service_id, d)
as_root(setup_helper)