summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CmdLine.hs12
-rw-r--r--Propellor.hs11
2 files changed, 13 insertions, 10 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index a4ef3bae..c93d69ad 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -41,14 +41,20 @@ usage = do
]
exitFailure
-defaultMain :: (HostName -> [Property]) -> IO ()
+defaultMain :: (HostName -> Maybe [Property]) -> IO ()
defaultMain getprops = go =<< processCmdLine
where
- go (Run host) = ensureProperties (getprops host)
+ go (Run host) = maybe (unknownhost host) ensureProperties (getprops host)
go (Spin host) = spin host
- go (Boot host) = boot (getprops host)
+ go (Boot host) = maybe (unknownhost host) boot (getprops host)
go (Set host field) = setPrivData host field
+unknownhost :: HostName -> IO a
+unknownhost h = error $ unwords
+ [ "Unknown host:", h
+ , "(perhaps you should specify the real hostname on the command line?)"
+ ]
+
spin :: HostName -> IO ()
spin host = do
url <- getUrl
diff --git a/Propellor.hs b/Propellor.hs
index 7a9e1451..58d8289d 100644
--- a/Propellor.hs
+++ b/Propellor.hs
@@ -19,13 +19,13 @@ main = defaultMain getProperties
{- This is where the system's HostName, either as returned by uname
- or one specified on the command line, is converted into a list of
- Properties for that system. -}
-getProperties :: HostName -> [Property]
-getProperties hostname@"clam.kitenet.net" =
+getProperties :: HostName -> Maybe [Property]
+getProperties hostname@"clam.kitenet.net" = Just
[ cleanCloudAtCost hostname
, standardSystem Apt.Unstable
+ , Network.ipv6to4
-- Clam is a tor bridge, and an olduse.net shellbox.
, Tor.isBridge
- , Network.ipv6to4
, JoeySites.oldUseNetshellBox
-- I play with docker on clam.
, Docker.configured
@@ -37,10 +37,7 @@ getProperties hostname@"clam.kitenet.net" =
]
-- add more hosts here...
--getProperties "foo" =
-getProperties h = error $ unwords
- [ "Unknown host:", h
- , "(perhaps you should specify the real hostname on the command line?)"
- ]
+getProperties _ = Nothing
-- This is my standard system setup
standardSystem :: Apt.Suite -> Property