summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment13
-rw-r--r--doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn3
-rw-r--r--doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment12
-rw-r--r--doc/usage.mdwn12
-rw-r--r--src/Propellor/CmdLine.hs10
-rw-r--r--src/Propellor/Types/CmdLine.hs1
7 files changed, 48 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 20923ab8..f41c556f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ propellor (3.2.4) UNRELEASED; urgency=medium
* GHC's fileSystemEncoding is used for all String IO, to avoid
encoding-related crashes in eg, Propellor.Property.File.
+ * Add --build option to simply build config.hs.
-- Joey Hess <id@joeyh.name> Sat, 24 Dec 2016 15:06:36 -0400
diff --git a/doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment b/doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment
new file mode 100644
index 00000000..66c4cffa
--- /dev/null
+++ b/doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment
@@ -0,0 +1,13 @@
+[[!comment format=mdwn
+ username="anselmi@0a9758305bef5e058dd0263fa20a27b334b482c7"
+ nickname="anselmi"
+ avatar="http://cdn.libravatar.org/avatar/65b723eb35eb4e3b05fffafd3e13e0fd"
+ subject="Cache gpg passphrase."
+ date="2016-12-22T17:23:58Z"
+ content="""
+The bottom line on this is that gpg2 (via the agent and pinentry) doesn't prompt correctly when run from git. It does when run directly.
+
+One fix is to set GPG_TTY before running propellor: `export GPG_TTY=$(tty)` or some such.
+
+Anything else that caches the pass phrase in the agent works too since that removes the need to prompt.
+"""]]
diff --git a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn
new file mode 100644
index 00000000..52b3b998
--- /dev/null
+++ b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn
@@ -0,0 +1,3 @@
+I've managed to do a few useful things with propellor, but it feels a bit rough around the edges to me. It looked at first like the --check and --build options would be useful for checking that my configs would at least compile, but it turns out that --build doesn't even exist and --check just returns without doing anything. Should they just be removed, or do they need more work to finish them?
+
+[[done]]
diff --git a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment
new file mode 100644
index 00000000..392f0f1c
--- /dev/null
+++ b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment
@@ -0,0 +1,12 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2016-12-26T15:55:36Z"
+ content="""
+--check does just what it's supposed to do. This is used during bootstrap
+to notice if the propellor binary has gotten broken by changes to eg system
+libraries.
+
+--build seems to have been added without being implemented. But it does
+seem useful to have a way to simply build propellor so implemented it now.
+"""]]
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index fec346ae..3d32538f 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -55,6 +55,14 @@ and configured in haskell.
The hostname given to --spin can be a short name, which is
then looked up in the DNS to find the FQDN.
+* propellor --build
+
+ Causes propellor to build itself, checking that your config.hs, etc are
+ valid.
+
+ You do not need to run this as a separate step; propellor automatically
+ builds itself when using things like --spin.
+
* propellor --add-key keyid
Adds a gpg key, which is used to encrypt the privdata.
@@ -66,6 +74,10 @@ and configured in haskell.
using this key. Propellor requires signed commits when pulling from
a central git repository.
+* propellor --rm-key keyid
+
+ Stops encrypting the privdata to a gpg key.
+
* propellor --list-fields
Lists all privdata fields that are used by your propellor configuration.
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index c407fce8..f26e0834 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -26,19 +26,19 @@ usage h = hPutStrLn h $ unlines
[ "Usage:"
, " propellor --init"
, " propellor"
- , " propellor hostname"
, " propellor --spin targethost [--via relayhost]"
+ , " propellor --build"
, " propellor --add-key keyid"
, " propellor --rm-key keyid"
, " propellor --list-fields"
- , " propellor --dump field context"
- , " propellor --edit field context"
, " propellor --set field context"
, " propellor --unset field context"
, " propellor --unset-unused"
+ , " propellor --dump field context"
+ , " propellor --edit field context"
, " propellor --merge"
- , " propellor --build"
, " propellor --check"
+ , " propellor hostname"
]
usageError :: [String] -> IO a
@@ -55,6 +55,7 @@ processCmdLine = go =<< getArgs
<$> mapM hostname (reverse hs)
<*> pure (Just r)
_ -> Spin <$> mapM hostname ps <*> pure Nothing
+ go ("--build":[]) = return Build
go ("--add-key":k:[]) = return $ AddKey k
go ("--rm-key":k:[]) = return $ RmKey k
go ("--set":f:c:[]) = withprivfield f c Set
@@ -104,6 +105,7 @@ defaultMain hostlist = withConcurrentOutput $ do
where
go cr (Serialized cmdline) = go cr cmdline
go _ Check = return ()
+ go cr Build = buildFirst Nothing cr Build $ return ()
go _ (Set field context) = setPrivData field context
go _ (Unset field context) = unsetPrivData field context
go _ (UnsetUnused) = unsetPrivDataUnused hostlist
diff --git a/src/Propellor/Types/CmdLine.hs b/src/Propellor/Types/CmdLine.hs
index 558c6e8b..d712a456 100644
--- a/src/Propellor/Types/CmdLine.hs
+++ b/src/Propellor/Types/CmdLine.hs
@@ -28,4 +28,5 @@ data CmdLine
| ChrootChain HostName FilePath Bool Bool
| GitPush Fd Fd
| Check
+ | Build
deriving (Read, Show, Eq)