summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Network.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property/Network.hs')
-rw-r--r--src/Propellor/Property/Network.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Propellor/Property/Network.hs b/src/Propellor/Property/Network.hs
index 4d7ccffb..e01edb62 100644
--- a/src/Propellor/Property/Network.hs
+++ b/src/Propellor/Property/Network.hs
@@ -27,6 +27,15 @@ cleanInterfacesFile = hasContent interfacesFile
]
`describe` ("clean " ++ interfacesFile)
+-- | Configures an interface to get its address via dhcp.
+dhcp :: Interface -> Property NoInfo
+dhcp iface = hasContent (interfaceDFile iface)
+ [ "auto " ++ iface
+ , "iface " ++ iface ++ " inet dhcp"
+ ]
+ `describe` ("dhcp " ++ iface)
+ `requires` interfacesDEnabled
+
-- | Writes a static interface file for the specified interface.
--
-- The interface has to be up already. It could have been brought up by