packages feed

ec2-unikernel 0.9.2 → 0.9.8

raw patch · 3 files changed

+34/−18 lines, 3 filesdep ~amazonkadep ~amazonka-coredep ~amazonka-ec2

Dependency ranges changed: amazonka, amazonka-core, amazonka-ec2, amazonka-s3, process, time

Files

ec2-unikernel.cabal view
@@ -1,5 +1,5 @@ name:                ec2-unikernel-version:             0.9.2+version:             0.9.8 synopsis:            A handy tool for uploading unikernels to Amazon's EC2. description:         This tool uploads unikernels built with the HaLVM, Mirage,                      or other tools to Amazon's cloud. The unikernel will then@@ -13,7 +13,8 @@ category:            AWS, Unikernel build-type:          Simple extra-doc-files:     README.md-cabal-version:       >=1.10+cabal-version:       >=1.18+Tested-with:         GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3  executable ec2-unikernel   main-is:             Main.hs@@ -21,20 +22,20 @@   default-extensions:  OverloadedStrings, TemplateHaskell   ghc-options:         -Wall   build-depends:-                       amazonka       >= 1.4.0 && < 1.6.0,-                       amazonka-core  >= 1.4.0 && < 1.6.0,-                       amazonka-ec2   >= 1.4.0 && < 1.6.0,-                       amazonka-s3    >= 1.4.0 && < 1.6.0,+                       amazonka       >= 1.5.0 && < 1.7.0,+                       amazonka-core  >= 1.5.0 && < 1.7.0,+                       amazonka-ec2   >= 1.5.0 && < 1.7.0,+                       amazonka-s3    >= 1.5.0 && < 1.7.0,                        base           >= 4.7.0 && < 5.0.0,                        bytestring     >= 0.10  && < 0.12,                        directory      >= 1.2.2 && < 1.4,                        filepath       >= 1.3.0 && < 1.5,                        lens           >= 4.13  && < 5.0,-                       process        >= 1.2   && < 1.5,+                       process        >= 1.2   && < 1.7,                        semigroups     >= 0.18  && < 0.20,                        temporary      >= 1.2.0 && < 1.4,                        text           >= 1.2.2 && < 1.4,-                       time           >= 1.5   && < 1.8,+                       time           >= 1.5   && < 1.10,                        unix           >= 2.7.1 && < 2.9   hs-source-dirs:      src   default-language:    Haskell2010
src/CommandLine.hs view
@@ -1,7 +1,7 @@ module CommandLine(getOptions)  where -import Control.Exception(catch)+import Control.Exception(SomeException,catch) import Control.Lens(ASetter, view, set, elemOf, folded) import Control.Monad(forM_, unless, when) import Data.Char(isAlphaNum, toLower)@@ -10,13 +10,12 @@ import Data.Time.Clock(UTCTime, getCurrentTime) import Data.Time.Format(formatTime, defaultTimeLocale) import Network.AWS(Region(..), Credentials(..), Env,-                   runAWS, runResourceT, newEnv, send)+                   runAWS, runResourceT, newEnv, send, envRegion) import Network.AWS.Data(toText) import Network.AWS.EC2.DescribeAvailabilityZones(describeAvailabilityZones,                                                  dazrsAvailabilityZones,                                                  dazZoneNames) import Network.AWS.EC2.Types(azZoneName)-import Network.AWS.Types(ServiceError, Error(..)) import Options import System.Console.GetOpt(ArgDescr(..), OptDescr(..), ArgOrder(..)) import System.Console.GetOpt(getOpt, usageInfo)@@ -56,9 +55,8 @@  validateZone :: String -> OptOrErr -> OptOrErr validateZone z opts-  | z `elem` zones = addOpt   opts (set optS3Zone (fromString z))+  | z `elem` availabilityZones = addOpt   opts (set optS3Zone (fromString z))   | otherwise      = addError opts "Unknown S3 zone."- where zones = ["us-west-2a"]  validateRegion :: String -> OptOrErr -> OptOrErr validateRegion r opts =@@ -80,8 +78,25 @@   , ("govcloud", GovCloud), ("us-gov-west-1", GovCloud)   , ("govcloudfips", GovCloudFIPS), ("fips-us-gov-west-1", GovCloudFIPS)   , ("saopaulo", SaoPaulo), ("sa-east-1", SaoPaulo)+  , ("london", London), ("eu-west-2", London)   ] +availabilityZones :: [String]+availabilityZones =+  [ "us-west-2a"+  , "us-west-2b"+  , "us-west-2c"+  , "eu-west-1a"+  , "eu-west-1b"+  , "eu-west-1c"+  , "eu-west-2a"+  , "eu-west-2b"+  , "eu-west-2c"+  , "eu-central-1a"+  , "eu-central-1b"+  , "eu-central-1c"+  ]+ options :: [OptDescr (OptOrErr -> OptOrErr)] options =   [ Option ['o'] ["aws-access-key"] (ReqArg validateAccessKey "KEY")@@ -132,11 +147,11 @@      let akey  = view optAwsAccessKey opts          skey  = view optAwsSecretKey opts          creds = FromKeys akey skey-     e <- newEnv (view optAwsRegion opts) creds+     e <- set envRegion (view optAwsRegion opts) `fmap` newEnv creds      let region = toText (view optS3Zone opts)          zoneRequest = set dazZoneNames [region] describeAvailabilityZones      r <- catch ((runResourceT . runAWS e) (send zoneRequest))-            (\ (ServiceError se) ->+            (\ se ->                do printInitialServiceError se                   exitWith (ExitFailure 1))      let z = Just (view optS3Zone opts)@@ -144,7 +159,7 @@        fail' ["Invalid availability zone for region."]      return (opts, e) -printInitialServiceError :: ServiceError -> IO ()+printInitialServiceError :: SomeException -> IO () printInitialServiceError se =   do putStrLn "ERROR: Failed to get list of zones from Amazon. This typically"      putStrLn "is caused by one of two problems:"
src/Main.hs view
@@ -13,7 +13,7 @@ import           Network.AWS.Data.Body(RqBody(..), toHashed, contentLength) import           Network.AWS.Data.Text(toText) import           Network.AWS.EC2.DescribeImages(describeImages, deseOwners, deseFilters,-                                                desrsImages)+                                                diirsImages) import           Network.AWS.EC2.DescribeImportSnapshotTasks(DescribeImportSnapshotTasksResponse,                                                              distImportTaskIds,                                                              describeImportSnapshotTasks,@@ -85,7 +85,7 @@ findPVGrubAKI :: Env -> IO Text findPVGrubAKI e =   do res <- awsSend e findRequest-     let grubs = filter isPVGrub (view desrsImages res)+     let grubs = filter isPVGrub (view diirsImages res)      case reverse (sortBy sortGrubs grubs) of        [] ->          abort "Couldn't find PV-GRUB kernel for your region."