From f4ba7abb3a81629d70d0e051226aaee4ab765458 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 11 Nov 2015 13:40:36 -0400 Subject: Add Propellor.Property.PropellorRepo.hasUrl, an explicit way to set the git repository url normally implicitly set when using --spin. --- debian/changelog | 7 +++++++ propellor.cabal | 1 + src/Propellor/Property/PropellorRepo.hs | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 src/Propellor/Property/PropellorRepo.hs 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 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 -- cgit v1.2.3