Created
February 1, 2017 12:53
-
-
Save mattyw/37bd419bed69954adfb7ff625d367ce6 to your computer and use it in GitHub Desktop.
cheap juju bootstrap, now in haskell \o/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env runhaskell | |
{-# LANGUAGE OverloadedStrings #-} | |
import System.Environment | |
import System.Process | |
import System.Exit | |
usage = putStrLn "need to specify cloud and controller name" | |
parse [""] = usage >> exitWith ExitSuccess | |
parse ["-h"] = usage >> exitWith ExitSuccess | |
parse a = run a >> exitWith ExitSuccess | |
main = getArgs >>= parse | |
run :: [[Char]] -> IO ExitCode | |
run ("aws" : controller : xs) = bootstrapAndConstraint "aws" "t1.micro" controller | |
run ("google" : controller: xs) = bootstrapAndConstraint "google" "g1-small" controller | |
run a = usage >> exitWith ExitSuccess | |
bootstrapAndConstraint cloud inst controller = system (bootstrap cloud inst controller) >> system (constraint inst) | |
bootstrap cloud inst controller = "juju bootstrap " ++ cloud ++ " " ++controller ++ " --constraints instance-type=" ++ inst | |
constraint inst = "juju set-model-constraints instance-type=" ++ inst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment