summaryrefslogtreecommitdiff
path: root/src/Propellor/Engine.hs
AgeCommit message (Collapse)Author
2017-11-21avoid backtrace from already running on this host messageJoey Hess
2017-09-01Make lock file descriptors close-on-exec.Joey Hess
2017-07-05avoid buffering container chain outputJoey Hess
When provisioning a container, output was buffered until the whole process was done; now output will be displayed immediately. I know this didn't used to be a problem. I belive it was introduced by accident when propellor started using concurrent-output. I know I've seen it for a while and never was bothered enough to get to the bottom of it; apparently "a while" was longer than I thought. Also refactored code to do with chain provisioning to all be in Propellor.Engine and avoided some duplication. This commit was sponsored by Anthony DeRobertis on Patreon.
2017-03-15Property types changed to use a Maybe (Propellor Result). (API change)Joey Hess
* Property types changed to use a Maybe (Propellor Result). (API change) * When Nothing needs to be done to ensure a property, propellor will avoid displaying its description at all. The doNothing property is an example of such a property. This is mostly in preparation for Monoid instances for Property types, but is's also nice that anything that uses doNothing will avoid printing out any message at all. At least, I think it probably is. It might potentially be confusing for something that sometimes takes an action and sometimes resolves to doNothing and in either case has a description set to not always show the description. If this did turn out to be confusing, the change to doNothing could be reverted. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
2016-04-28Fix build with directory-1.2.6.2.Joey Hess
It's now exporting a conflicting isSymbolicLink https://github.com/haskell/directory/issues/52 Only a few places in propellor use isSymbolicLink, but to prevent future problems, made as much of it as possible import Utility.Directory, which re-exports System.Directory without the conflicting symbol. (Utility.Tmp and System.Console.Concurrent.Internal cannot import Utility.Directory due to cycles, and don't use isSymbolicLink anyway.)
2016-03-27improve haddocks and move code around to make them more clearJoey Hess
2016-03-25rename toProp to toChildPropertiesJoey Hess
and note that it's not meant to be used by regular users
2016-03-25ported mainPropertiesJoey Hess
2016-03-25ported Property.ListJoey Hess
I wanted to keep propertyList [foo, bar] working, but had some difficulty making the type class approach work. Anyway, that's unlikely to be useful, since foo and bar probably have different types, or could easiy have their types updated breaking it.
2016-03-06move backJoey Hess
2016-03-06propellor spinJoey Hess
2015-12-19Clean build with ghc 7.10.Joey Hess
Import Prelude after modules that cause warnings due to AMP change
2015-10-27make Propellor.Message use lock to handle concurrent threads outputting messagesJoey Hess
Not yet handled: Output from concurrent programs.
2015-10-27use a shared global for the MessageHandleJoey Hess
2015-10-24simpliftJoey Hess
2015-10-17use Info to detect controller loopsJoey Hess
Much less invasive than the other implementation.
2015-10-16improve ssh user key propertiesJoey Hess
* Ssh.keyImported is replaced with Ssh.userKeys. (API change) The new property only gets the private key from the privdata; the public key is provided as a parameter, and so is available as Info that other properties can use. * Ssh.keyImported' is renamed to Ssh.userKeyAt, and also changed to only import the private key from the privdata. (API change) * While Ssh.keyImported and Ssh.keyImported' avoided updating existing keys, the new Ssh.userKeys and Ssh.userKeyAt properties will always update out of date key files. * Ssh.pubKey renamed to Ssh.hostPubKey. (API change) This makes eg, setting up ssh for spin controllers work better.
2015-10-16Added Propellor.Property.Spin, which can be used to make a host be a ↵Joey Hess
controller of other hosts. The hard part of this is avoiding loops of controllers. To make that work, a ControllerChain is passed to the host that's spun, and is added to the Info of the host being spun, where the controller property can check it to detect an avoid a loop. That needed an expansion of the CmdLine data type. I made the new ControlledRun only be used when there is a ControllerChain provided. This avoids breaking backwards compatability with old propellor deployments, as --spin still uses SimpleRun. Note: Making an old propellor deployment be controlled by a controller won't work until it's been updated to this commit, so it knows about the ControlledRun parameter. (Untested)
2015-10-10propellor spinJoey Hess
2015-04-29propellor spinJoey Hess
2015-01-24GADT properties seem to work (untested)Joey Hess
* Property has been converted to a GADT, and will be Property NoInfo or Property HasInfo. This was done to make sure that ensureProperty is only used on properties that do not have Info. Transition guide: - Change all "Property" to "Property NoInfo" or "Property WithInfo" (The compiler can tell you if you got it wrong!) - To construct a RevertableProperty, it is useful to use the new (<!>) operator - Constructing a list of properties can be problimatic, since Property NoInto and Property WithInfo are different types and cannot appear in the same list. To deal with this, "props" has been added, and can built up a list of properties of different types, using the same (&) and (!) operators that are used to build up a host's properties.
2015-01-24moving to using the GADTJoey Hess
The problem this exposes has to do with requires. As implemented, requires yields either a Property HasInfo or a Property NoInfo depending on its inputs. That works. But look what happens when it's used: *Propellor.Types> let foo = IProperty "foo" (return NoChange) mempty mempty *Propellor.Types> let bar = IProperty "bar" (return NoChange) mempty mempty *Propellor.Types> foo `requires` bar <interactive>:17:5: No instance for (Requires (Property HasInfo) (Property HasInfo) r0) arising from a use of `requires' The type variable `r0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Note: there is a potential instance available: instance Requires (Property HasInfo) (Property HasInfo) (Property HasInfo) -- Defined at Propellor/Types.hs:167:10 Possible fix: add an instance declaration for (Requires (Property HasInfo) (Property HasInfo) r0) In the expression: foo `requires` bar In an equation for `it': it = foo `requires` bar This can be avoided by specifying the result type: *Propellor.Types> (foo `requires` bar) :: Property HasInfo property "foo" But then when multiple `requires` are given, the result type has to be given each time: *Propellor.Types> (foo `requires` bar `requires` bar) :: Property HasInfo <interactive>:22:6: No instance for (Requires (Property HasInfo) (Property HasInfo) x0) arising from a use of `requires' The type variable `x0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Note: there is a potential instance available: instance Requires (Property HasInfo) (Property HasInfo) (Property HasInfo) -- Defined at Propellor/Types.hs:167:10 Possible fix: add an instance declaration for (Requires (Property HasInfo) (Property HasInfo) x0) In the first argument of `requires', namely `foo `requires` bar' In the expression: (foo `requires` bar `requires` bar) :: Property HasInfo In an equation for `it': it = (foo `requires` bar `requires` bar) :: Property HasInfo <interactive>:22:21: No instance for (Requires x0 (Property HasInfo) (Property HasInfo)) arising from a use of `requires' The type variable `x0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Note: there are several potential instances: instance Requires (Property NoInfo) (Property HasInfo) (Property HasInfo) -- Defined at Propellor/Types.hs:175:10 instance Requires (Property HasInfo) (Property HasInfo) (Property HasInfo) -- Defined at Propellor/Types.hs:167:10 Possible fix: add an instance declaration for (Requires x0 (Property HasInfo) (Property HasInfo)) In the expression: (foo `requires` bar `requires` bar) :: Property HasInfo In an equation for `it': it = (foo `requires` bar `requires` bar) :: Property HasInfo *Propellor.Types> (((foo `requires` bar) :: Property HasInfo) `requires` bar) :: Property HasInfo property "foo" Yuggh!
2015-01-24added GADT to determine between a property with info and withoutJoey Hess
Not yet used
2015-01-19add back a warning aboit info propigation to ensurePropertyJoey Hess
2015-01-19split out types to improve haddock for Propellor.TypesJoey Hess
2015-01-18Property treeJoey Hess
Properties now form a tree, instead of the flat list used before. This simplifies propigation of Info from the Properties used inside a container to the outer host; the Property that docks the container on the host can just have as child properties all the inner Properties, and their Info can then be gathered recursively. (Although in practice it still needs to be filtered, since not all Info should propigate out of a container.) Note that there is no change to how Properties are actually satisfied. Just because a Property lists some child properties, this does not mean they always have their propertySatisfy actions run. It's still up to the parent property to run those actions. That's necessary so that a container's properties can be satisfied inside it, not outside. It also allows property combinators to add the combined Properties to their childProperties list, even if, like onChange, they don't always run the child properties at all. Testing: I tested that the exact same Info is calculated before and after this change, for every Host in my config file.
2015-01-04sshPubKey is renamed to Ssh.pubKeyJoey Hess
2014-12-21Revert ensureProperty warning message, too many false positives in places ↵Joey Hess
where Info is correctly propigated. Better approach needed.
2014-12-21propellor spinJoey Hess
2014-12-07Display a warning when ensureProperty is used on a property which has Info ↵Joey Hess
and is so prevented from propigating it. Would much rather a type-based fixed, but this is all I have for now.
2014-12-07docuemnt info propigtion problemJoey Hess
2014-12-06Reboot.atEndJoey Hess
2014-12-06endAction can be used to register an action to run once propellor has ↵Joey Hess
successfully run on a host.
2014-11-27added more debuggingJoey Hess
2014-11-27propellor spinJoey Hess
2014-11-22propellor spinJoey Hess
2014-11-21avoid setting title when not at consoleJoey Hess
2014-11-21show last line if it cannot be parsed as a serialized ResultJoey Hess
2014-11-20propellor spinJoey Hess
2014-11-20propellor spinJoey Hess
2014-11-19prevent multiple concurrent provisioning inside docker containerJoey Hess
Lock a lock file while provisioning inside, otherwise propellor could be running to init the container when the system has just booted, or the container was just started from being stopped, and at the same time, propellor run outside the container chains into it to provision. Previously, simplesh prevented this in a different way.
2014-07-23propellor spinJoey Hess
2014-07-23propellor spinJoey Hess
2014-07-23propellor spinJoey Hess
2014-06-09Attr is renamed to Info.Joey Hess
2014-05-31simplified record accessorsJoey Hess
2014-05-31got rid of the Attr -> Attr SetAttr hack, and use monoids for AttrJoey Hess
The SetAttr hack used to be needed because the hostname was part of the Attr, and was required to be present. Now that it's moved to Host, let's get rid of that, since it tended to waste CPU.
2014-05-31propellor spinJoey Hess
2014-05-31propellor spinJoey Hess
2014-05-31remove now redundant _hostname field of AttrJoey Hess
Now that Host includes _hostName, it's redundant to also keep it in Attr. This requires changing the reader monad to operate on the whole Host.