summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2015-11-11 13:40:36 -0400
committerJoey Hess2015-11-11 13:40:36 -0400
commitf4ba7abb3a81629d70d0e051226aaee4ab765458 (patch)
tree20ad27678a12911dc70f25ffa90ae1aa38545a3b
parent43fd2eb809178a8fa077950a3c8c0a93d7151c4f (diff)
Add Propellor.Property.PropellorRepo.hasUrl, an explicit way to set the git repository url normally implicitly set when using --spin.
-rw-r--r--debian/changelog7
-rw-r--r--propellor.cabal1
-rw-r--r--src/Propellor/Property/PropellorRepo.hs19
3 files changed, 27 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 49b4922e..dd1ed5c0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+propellor (2.13.1) UNRELEASED; urgency=medium
+
+ * Add Propellor.Property.PropellorRepo.hasUrl, an explicit way to set the
+ git repository url normally implicitly set when using --spin.
+
+ -- Joey Hess <id@joeyh.name> Wed, 11 Nov 2015 13:37:00 -0400
+
propellor (2.13.0) unstable; urgency=medium
* RevertableProperty used to be assumed to contain info, but this is
diff --git a/propellor.cabal b/propellor.cabal
index 2918e662..90871255 100644
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -109,6 +109,7 @@ Library
Propellor.Property.Parted
Propellor.Property.Partition
Propellor.Property.Postfix
+ Propellor.Property.PropellorRepo
Propellor.Property.Prosody
Propellor.Property.Reboot
Propellor.Property.Rsync
diff --git a/src/Propellor/Property/PropellorRepo.hs b/src/Propellor/Property/PropellorRepo.hs
new file mode 100644
index 00000000..20c13df1
--- /dev/null
+++ b/src/Propellor/Property/PropellorRepo.hs
@@ -0,0 +1,19 @@
+module Propellor.Property.PropellorRepo where
+
+import Propellor.Base
+import Propellor.Git
+
+-- | Sets the url to use as the origin of propellor's git repository.
+--
+-- When propellor --spin is used to update a host, the url is taken from
+-- the repository that --spin is run in, and passed to the host. So, you
+-- don't need to specifiy this property then.
+--
+-- This property is useful when hosts are being updated without using
+-- --spin, eg when using the `Propellor.Property.Cron.runPropellor` cron job.
+hasUrl :: String -> Property NoInfo
+hasUrl u = property ("propellor repo url " ++ u) $ do
+ curru <- liftIO getRepoUrl
+ if curru == Just u
+ then return NoChange
+ else makeChange $ setRepoUrl u