aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-11-07 18:49:18 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-11-07 18:49:18 +0200
commitdd30b337f30f226d30f6cfc533ae183b79f31844 (patch)
tree514696e9a044cebc63e18267b02d3e7d35a7a692
parent282b78dc5decd319ed2284f90fd7716cd395a048 (diff)
downloadmachammer-dd30b337f30f226d30f6cfc533ae183b79f31844.tar.gz
machammer-dd30b337f30f226d30f6cfc533ae183b79f31844.tar.bz2
machammer-dd30b337f30f226d30f6cfc533ae183b79f31844.zip
Added network.flush_dns()
-rw-r--r--README.md4
-rw-r--r--machammer/network.py7
2 files changed, 9 insertions, 2 deletions
diff --git a/README.md b/README.md
index 301d009..8e4125d 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
### Introduction
-`machammer` is library/microframework for Macintosh system administration. The idea is to provide a set of common, often-used functions for admins to build their own management tools.
+`machammer` is library/microframework for Macintosh system administration. It provides a set of common, often-used functions for admins to build their own management tools.
### System Requirements
@@ -134,6 +134,8 @@ Check `tests.py` for more usage examples.
* Q: Why not use Munki?
* A: No reason whatsoever. Munki is great and you should totally use it, if it works for you. I just prefer to read and write code than learn a new XML syntax. For me personally, it was difficult to "start small" with Munki - there's a lot you have to learn to get started. Also, there are plenty of apps out there that don't conform to the standard PKG/app bundle format (like the ArchiCAD example above) and your best bet at tackling those is just plain-old scripting. To paraphrase Einstein - an installation tool might take you from A to B, but scripting can take you anywhere. :-)
+[![Documentation Status](https://readthedocs.org/projects/machammer/badge/?version=latest)](http://machammer.readthedocs.io/en/latest/?badge=latest)
+
### License
diff --git a/machammer/network.py b/machammer/network.py
index 5f5fb87..2c4dcfc 100644
--- a/machammer/network.py
+++ b/machammer/network.py
@@ -19,7 +19,7 @@ def set_wifi_power(on=True):
def get_wifi_power():
- """Get AirPort power state"""
+ """Get AirPort power state."""
results = []
for i in get_ports('AirPort'):
iface = i['interface']
@@ -55,3 +55,8 @@ def get_primary(port=None):
for i in [x for x in route if 'interface: ' in x]:
p = i.split(': ')[1]
return p == port if port else p
+
+
+def flush_dns():
+ """Flush the DNS cache."""
+ call('/usr/bin/killall', '-HUP', 'mDNSResponder')