summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-joey.hs2
-rw-r--r--debian/changelog11
-rw-r--r--doc/todo/issue_after_upgrading_shared_library.mdwn1
-rw-r--r--doc/todo/issue_after_upgrading_shared_library/comment_2_6025ec35330fbac220f2888e60be1e78._comment17
-rw-r--r--doc/usage.mdwn4
-rw-r--r--src/Propellor/Bootstrap.hs21
-rw-r--r--src/Propellor/CmdLine.hs3
-rw-r--r--src/Propellor/Property/Cron.hs4
-rw-r--r--src/Propellor/Types/CmdLine.hs1
9 files changed, 57 insertions, 7 deletions
diff --git a/config-joey.hs b/config-joey.hs
index 5b134c45..3d23de08 100644
--- a/config-joey.hs
+++ b/config-joey.hs
@@ -304,7 +304,7 @@ beaver = host "beaver.kitenet.net"
iabak :: Host
iabak = host "iabak.archiveteam.org"
- & aias "ia-bak.joeyh.name"
+ & alias "ia-bak.joeyh.name"
& ipv4 "124.6.40.227"
& os (System (Debian Testing) "amd64")
& Apt.stdSourcesList `onChange` Apt.upgrade
diff --git a/debian/changelog b/debian/changelog
index 9ac8c3f8..db9ffbd9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+propellor (2.2.2) UNRELEASED; urgency=medium
+
+ * Make propellor resistent to changes to shared libraries, such as libffi,
+ which might render the propellor binary unable to run. This is dealt with
+ by checking the binary both when running propellor on a remote host,
+ and by Cron.runPropellor. If the binary doesn't work, it will be rebuilt.
+ * Note that since a new switch had to be added to allow testing the binary,
+ upgrading to this version will cause a rebuild from scratch of propellor.
+
+ -- Joey Hess <id@joeyh.name> Thu, 02 Apr 2015 10:09:46 -0400
+
propellor (2.2.1) unstable; urgency=medium
* userScriptProperty now passes --shell /bin/sh, so it can be used
diff --git a/doc/todo/issue_after_upgrading_shared_library.mdwn b/doc/todo/issue_after_upgrading_shared_library.mdwn
index 3cf73e88..52e72d4a 100644
--- a/doc/todo/issue_after_upgrading_shared_library.mdwn
+++ b/doc/todo/issue_after_upgrading_shared_library.mdwn
@@ -22,3 +22,4 @@ After upgrading my server to jessie, I noticed that propellor does not work anym
./propellor: error while loading shared libraries: libffi.so.5: cannot open shared object file: No such file or directory
propellor: user error (ssh ["-o","ControlPath=/home/myuser/.ssh/propellor/myserver.sock","-o","ControlMaster=auto","-o","ControlPersist=yes","root@myserver","sh -c 'if [ ! -d /usr/local/propellor/.git ] ; then (if ! git --version >/dev/null; then apt-get update && apt-get --no-install-recommends --no-upgrade -y install git; fi && echo STATUSNeedGitClone) || echo STATUSNeedPrecompiled ; else cd /usr/local/propellor && if ! test -x ./propellor; then ( apt-get update ; apt-get --no-upgrade --no-install-recommends -y install gnupg ; apt-get --no-upgrade --no-install-recommends -y install ghc ; apt-get --no-upgrade --no-install-recommends -y install cabal-install ; apt-get --no-upgrade --no-install-recommends -y install libghc-async-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-missingh-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-hslogger-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-unix-compat-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-ansi-terminal-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-ifelse-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-network-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-quickcheck2-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-mtl-dev ; apt-get --no-upgrade --no-install-recommends -y install libghc-monadcatchio-transformers-dev ; cabal update ; cabal install --only-dependencies ) || true && cabal configure && cabal build && ln -sf dist/build/propellor-config/propellor-config propellor; fi && ./propellor --boot myserver ; fi'"] exited 127)
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/todo/issue_after_upgrading_shared_library/comment_2_6025ec35330fbac220f2888e60be1e78._comment b/doc/todo/issue_after_upgrading_shared_library/comment_2_6025ec35330fbac220f2888e60be1e78._comment
new file mode 100644
index 00000000..bc89ad7f
--- /dev/null
+++ b/doc/todo/issue_after_upgrading_shared_library/comment_2_6025ec35330fbac220f2888e60be1e78._comment
@@ -0,0 +1,17 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 2"""
+ date="2015-04-02T14:27:26Z"
+ content="""
+So I thought of two approaches.
+
+1. Propellor could copy in all the shared libraries. It already contains
+ code to do this. But, this would add overhead to every build. And it
+ might not guard against all snafus.
+
+2. Make propellor --check that should exit 0. Make --spin check that
+ propellor works and rebuild if not. Also make the runPropellor cron job
+ do that.
+
+I've gone with option #2.
+"""]]
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index 8cd9af21..4030628f 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -95,6 +95,10 @@ and configured in haskell.
(This will result in a trapezoid pattern in gitk.)
+* propellor --check
+
+ If propellor is able to run, this simply exists successfully.
+
* propellor hostname
When run with a hostname and no other options, propellor will
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 214f65d5..a07347ed 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -1,5 +1,6 @@
module Propellor.Bootstrap (
bootstrapPropellorCommand,
+ checkBinaryCommand,
installGitCommand,
buildPropellor,
) where
@@ -12,17 +13,27 @@ import Data.List
type ShellCommand = String
--- Shell command line to build propellor, used when bootstrapping on a new
--- host. Should be run inside the propellor config dir, and will install
--- all necessary build dependencies.
+-- Shell command line to ensure propellor is bootstrapped and ready to run.
+-- Should be run inside the propellor config dir, and will install
+-- all necessary build dependencies and build propellor.
bootstrapPropellorCommand :: ShellCommand
-bootstrapPropellorCommand = "if ! test -x ./propellor; then " ++ go ++ "; fi"
+bootstrapPropellorCommand = "if ! test -x ./propellor; then " ++ go ++ "; fi;" ++ checkBinaryCommand
where
- go = intercalate " && "
+ go = intercalate " && "
[ depsCommand
, buildCommand
]
+-- Use propellor --check to detect if the local propellor binary has
+-- stopped working (eg due to library changes), and must be rebuilt.
+checkBinaryCommand :: ShellCommand
+checkBinaryCommand = "if test -x ./propellor && ! ./propellor --check 2>/dev/null; then " ++ go ++ "; fi"
+ where
+ go = intercalate " && "
+ [ "cabal clean"
+ , buildCommand
+ ]
+
buildCommand :: ShellCommand
buildCommand = intercalate " && "
[ "cabal configure"
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index 9d7d0d95..1298daf2 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -33,6 +33,7 @@ usage h = hPutStrLn h $ unlines
, " propellor --list-fields"
, " propellor --merge"
, " propellor --build"
+ , " propellor --check"
]
usageError :: [String] -> IO a
@@ -43,6 +44,7 @@ usageError ps = do
processCmdLine :: IO CmdLine
processCmdLine = go =<< getArgs
where
+ go ("--check":_) = return Check
go ("--spin":ps) = case reverse ps of
(r:"--via":hs) -> Spin
<$> mapM hostname (reverse hs)
@@ -91,6 +93,7 @@ defaultMain hostlist = do
where
go _ (Serialized cmdline) = go True cmdline
go _ (Continue cmdline) = go False cmdline
+ go _ Check = return ()
go _ (Set field context) = setPrivData field context
go _ (Dump field context) = dumpPrivData field context
go _ (Edit field context) = editPrivData field context
diff --git a/src/Propellor/Property/Cron.hs b/src/Propellor/Property/Cron.hs
index 2a28a157..222f3849 100644
--- a/src/Propellor/Property/Cron.hs
+++ b/src/Propellor/Property/Cron.hs
@@ -3,6 +3,7 @@ module Propellor.Property.Cron where
import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
+import Propellor.Bootstrap
import Utility.SafeCommand
import Utility.FileMode
@@ -81,4 +82,5 @@ niceJob desc times user cddir command = job desc times user cddir
-- | Installs a cron job to run propellor.
runPropellor :: Times -> Property NoInfo
-runPropellor times = niceJob "propellor" times "root" localdir "./propellor"
+runPropellor times = niceJob "propellor" times "root" localdir
+ (bootstrapPropellorCommand ++ "; ./propellor")
diff --git a/src/Propellor/Types/CmdLine.hs b/src/Propellor/Types/CmdLine.hs
index b8f488a4..bd0cbdfd 100644
--- a/src/Propellor/Types/CmdLine.hs
+++ b/src/Propellor/Types/CmdLine.hs
@@ -23,5 +23,6 @@ data CmdLine
| DockerChain HostName String
| ChrootChain HostName FilePath Bool Bool
| GitPush Fd Fd
+ | Check
deriving (Read, Show, Eq)