summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/File.hs
AgeCommit message (Collapse)Author
2017-07-05Added File.checkOverwrite.Joey Hess
This commit was sponsored by Ethan Aubin.
2017-07-05File.isCopyOf: Fix bug that prevented this property from working when the ↵Joey Hess
destination file did not yet exist. This commit was sponsored by andrea rota.
2017-07-05rename confusing f' to srcJoey Hess
f' normally means a later version of f
2017-07-05XFCE and applyPath propertiesJoey Hess
* Propellor.Property.XFCE added with some useful properties for the desktop environment. * Added File.applyPath property. This commit was sponsored by Riku Voipio.
2017-02-26Added ConfigurableValue type classJoey Hess
* Added ConfigurableValue type class, for values that can be used in a config file, or to otherwise configure a program. * The val function converts such values to String. This was motivated by the bug caused by type Port = Int changing to newtype Port = Port Int deriving Show After that change, some things that used show port to generate config files were broken. By using the ConfigurableValue type class instead, such breakage can be prevented.
2017-02-02Merge remote-tracking branch 'upstream/master' into pinSean Whitton
2017-02-02better exampleJoey Hess
2017-02-02haddock formattingJoey Hess
2017-02-02Added Propellor.Property.File.configFileName and related functions to ↵Joey Hess
generate good filenames for config directories. spwhitton has a branch that could use this, and there are several places in propellor that do something ad-hoc that would have been better implemented using this. I was not able to switch any of the existing ad-hoc stuff, but this can be used going forward for new stuff. This commit was sponsored by Anthony DeRobertis on Patreon.
2017-01-31fix removal of blocksSean Whitton
2017-01-31add File.containsBlockSean Whitton
2017-01-31document File.containsLinesSean Whitton
2016-06-19fix descJoey Hess
2016-06-19reordered more commonly used stuff firstJoey Hess
2016-06-19Generalized fileProperty can now operate on files as either a series of ↵Joey Hess
lines, or a ByteString.
2016-06-19Write privdata files in binary rather than textAndrew Schurman
https://propellor.branchable.com/todo/bytes_in_privData__63__/
2016-03-26more portingJoey Hess
2016-03-24convert ensurePropertyJoey Hess
Moved to its own module to keep everything related in one place.
2016-03-24converted to metatypesJoey Hess
A few parts using ensureProperty need more work to compile
2016-03-06eek, nasty debug left inJoey Hess
2016-03-06Locale.available: Run locale-gen, instead of dpkg-reconfigure locales, which ↵Joey Hess
modified the locale.gen file and sometimes caused the property to need to make changes every time.
2015-12-15Merged Utility changes from git-annex.Joey Hess
2015-12-05UncheckedProperty for cmdProperty et alJoey Hess
* Properties that run an arbitrary command, such as cmdProperty and scriptProperty are converted to use UncheckedProperty, since they cannot tell on their own if the command truely made a change or not. (API Change) Transition guide: - When GHC complains about an UncheckedProperty, add: `assume` MadeChange - Since these properties used to always return MadeChange, that change is always safe to make. - Or, if you know that the command should modifiy a file, use: `changesFile` filename * A few properties have had their Result improved, for example Apt.buldDep and Apt.autoRemove now check if a change was made or not.
2015-10-26Add File.isCopyOfPer Olofsson
Signed-off-by: Per Olofsson <pelle@dsv.su.se>
2015-10-23Add File.basedOnPer Olofsson
Signed-off-by: Per Olofsson <pelle@dsv.su.se>
2015-10-21Added Ssh properties to remove authorized_keys and known_hosts lines.Joey Hess
And use when reverting conductor property. Note that I didn't convert existing ssh properties to RevertablePropery because the API change was too annoying to work through.
2015-10-16add a LinkTarget type to disambiguate parameters of isSymlinkedToJoey Hess
Something about making symlinks is very confusing about which parameter is which. It perhaps doesn't help that isSymlinkedTo has the target second, while ln has it first. Let's use a type to prevent confusion. Also, simplified some properties that now use isSymlinkedTo. Since isSymlinkedTo checks the link target, these properties don't need to check themselves that the link is in place.
2015-10-16clarify which param is whichJoey Hess
2015-10-14fileProperty, and properties derived from it now write the new file content ↵Joey Hess
via origfile.propellor-new~, instead of to a randomly named temp file. This allows them to clean up any temp file that may have been left by an interrupted run of propellor. Also converted the new isSymlinkedTo property to use the same implementation, with some simplifications.
2015-10-14excess newlineJoey Hess
2015-10-14Add File.isSymlinkedToPer Olofsson
Signed-off-by: Per Olofsson <pelle@dsv.su.se>
2015-10-10propellor spinJoey Hess
2015-09-20make sure aiccu.conf is only readable by root, even if it had a different ↵Joey Hess
mode to start with
2015-09-14clean up privdata excess/lacking newline issueJoey Hess
* PrivData converted to newtype (API change). * Stopped stripping trailing newlines when setting PrivData; this was previously done to avoid mistakes when pasting eg passwords with an unwanted newline. Instead, PrivData consumers should use either privDataLines or privDataVal, to extract respectively lines or a value (without internal newlines) from PrivData.
2015-09-13Follow some hlint suggestions.Mario Lang
2015-09-04Added Propellor.Property.Rsync.Joey Hess
2015-09-04wipJoey Hess
2015-04-23fix type signature, filepath and string params were flippedJoey Hess
thanks, gueux
2015-04-22API change: Added User and Group newtypes, and Properties that used to use ↵Joey Hess
the type UserName = String were changed to use them. Note that UserName is kept and PrivData still uses it in its sum type. This is to avoid breaking PrivData serialization.
2015-01-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-03add hasPrivContentFromJoey Hess
2014-12-14broke up big function to describe PrivDataFieldJoey Hess
2014-12-09fix a case where fileProperty reported a change despite not making oneJoey Hess
The problem occurred because two lists of lines of the file can be different, while representing the same file content. For example: ["foo", "bar"] ["foo\nbar"]
2014-12-07Fixed privdata introspection for User.hasPassword and User.hasSomePasswordJoey Hess
This is not a complete fix for the problem that Info doen't propigate from the called property when code does something like: do hostname <- asks hostName ensureProperty $ foo hostname Instead, I just eliminated the need to implement hasPassword that way, by making the PrivData Info use a HostContext which automatically gets the right hostname passed to it. All other uses of withPrivData don't have the problem. It's still possible for the user to run into the problem if they write something like the above, where foo is a property that uses privdata. However, all properties that take a Context now also accept a HostContext, so it's at least less likely the user needs to write that.
2014-07-17Fix bug in File.containsLines that caused lines that were already in the ↵Joey Hess
file to sometimes be appended to the end.
2014-07-17better hasPrivContentExposedJoey Hess
Avoid locking down and then lossening the file mode; just use the default/current mode from the beginning.
2014-07-06propellor spinJoey Hess
2014-05-14moved source code to srcJoey Hess
This is to work around OSX's brain-damange regarding filename case insensitivity. Avoided moving config.hs, because it's a config file. Put in a symlink to make build work.