path: root/src
diff options
authorJoey Hess2015-11-11 13:40:36 -0400
committerJoey Hess2015-11-11 13:40:36 -0400
commitf4ba7abb3a81629d70d0e051226aaee4ab765458 (patch)
tree20ad27678a12911dc70f25ffa90ae1aa38545a3b /src
parent43fd2eb809178a8fa077950a3c8c0a93d7151c4f (diff)
Add Propellor.Property.PropellorRepo.hasUrl, an explicit way to set the git repository url normally implicitly set when using --spin.
Diffstat (limited to 'src')
1 files changed, 19 insertions, 0 deletions
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