diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
commit | 1be510f9529cb082f802408b472a77d074b394c0 (patch) | |
tree | b175f9d5fcb107576dabc768e7bd04d4a3e491a0 /zarb-ml/mageia-sysadm/2012-April/004402.html | |
parent | fa5098cf210b23ab4f419913e28af7b1b07dafb2 (diff) | |
download | archives-master.tar archives-master.tar.gz archives-master.tar.bz2 archives-master.tar.xz archives-master.zip |
Diffstat (limited to 'zarb-ml/mageia-sysadm/2012-April/004402.html')
-rw-r--r-- | zarb-ml/mageia-sysadm/2012-April/004402.html | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/zarb-ml/mageia-sysadm/2012-April/004402.html b/zarb-ml/mageia-sysadm/2012-April/004402.html new file mode 100644 index 000000000..343f6983e --- /dev/null +++ b/zarb-ml/mageia-sysadm/2012-April/004402.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> + <HEAD> + <TITLE> [Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5Bsysadmin-commits%5D%20%5B2736%5D%20do%20not%20explictely%20set%0A%20the%20same%20value%09as%20default&In-Reply-To=%3C1334493357.3655.47.camel%40localhost%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="004401.html"> + <LINK REL="Next" HREF="004403.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default</H1> + <B>Michael Scherer</B> + <A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5Bsysadmin-commits%5D%20%5B2736%5D%20do%20not%20explictely%20set%0A%20the%20same%20value%09as%20default&In-Reply-To=%3C1334493357.3655.47.camel%40localhost%3E" + TITLE="[Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default">misc at zarb.org + </A><BR> + <I>Sun Apr 15 14:35:57 CEST 2012</I> + <P><UL> + <LI>Previous message: <A HREF="004401.html">[Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default +</A></li> + <LI>Next message: <A HREF="004403.html">[Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#4402">[ date ]</a> + <a href="thread.html#4402">[ thread ]</a> + <a href="subject.html#4402">[ subject ]</a> + <a href="author.html#4402">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Le dimanche 15 avril 2012 à 02:41 +0200, nicolas vigier a écrit : +><i> On Sun, 15 Apr 2012, <A HREF="https://www.mageia.org/mailman/listinfo/mageia-sysadm">root at mageia.org</A> wrote: +</I>><i> +</I>><i> > Revision: 2736 +</I>><i> > Author: misc +</I>><i> > Date: 2012-04-15 01:45:48 +0200 (Sun, 15 Apr 2012) +</I>><i> > Log Message: +</I>><i> > ----------- +</I>><i> > do not explictely set the same value as default +</I>><i> +</I>><i> I don't see the use of not explicitely setting the values and rely on +</I>><i> default value. Actually this make the modules unusable outside mageia +</I>><i> servers, because default values can be different. +</I> +That's default in upstream puppet, so that would work almost everywhere. + +Package without "ensure => installed" are installed on all version of +puppet. + +<A HREF="https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/package.rb#L113">https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/package.rb#L113</A> + +I have yet to see someone explicitly changing the default value. + +File will be root owned if nothing have been specified, since the agent +is running as root ( and if this is not running as root as I have heard +being done at a customer office, forcing the owner would result in a +error, so the unusability argument can be more complex than "default +should be avoided" ) + +And ensure => present is implicit if content is set. + + +><i> In my opinion we should always explicitly set the values when they are +</I>><i> important, and only use default value when we don't care about the +</I>><i> value. +</I> + +Defaults are made to avoid endless duplication of useless source code. +We did the same for rpm. First, every file should have had %attr, then +it became %defattr at the beggining of %files ( I guess that was even +before the first version of rpm ), then %defattr(-,-), then %defattr got +removed. All of this because shorter spec without the same boilerplate +are easier to maintain, and less tedious to write. + +That's just following the DRY principle. + +We also do not repeat file declaration from rpm to make sure that for +example /usr/bin/svn is executable because we assume that's the default +( and we also do not take in account in our script that it could be +anywhere in the path ). +We do not explicitly give the content of every config file in rpm for +the same reason, because we assume the default are correct. So basically +using default value is just one step further in the same direction. + +Out of the box reusability is nice on the paper, but in practice, this +doesn't happen, because we do not care about portability ( like package +name accros diverse distribution or even OS ), genericity ( service +naming in our architecutre, like the ldap server, the prostgres one, and +there is not even documentation about it ) or even puppet version ( we +do no test on previous version or attempt to be compatible ), repository +layout ( cause 1 big svn is not the most reusable way of distributing +module, but the simplest for a infra ), etc. + + +IMHO, out of the box reusability lead to complex code, and except for +trivial service like xinetd, at or cron, people will always have to +modify something to suit them. So in the rare event that someone decide +that default value for package is "uninstalled" or something equally +strange and this person has the same exact architecture than us except +this detail, yes, this will not work out of the box, but in exchange of +this sacrifice, we have shorter manifests, and less repetition. + + +Taking advantage of the default is also a recommendation that I found in +a internal audit done by puppet labs for my employer setup, the main +idea is that it is faster to write, faster to read and understand, and +the less code we write, the less error we can place by inadvertence. + +And for the sake of coherence, the whole repository was cleaned a few +months ago to have manifests without the same boilerplate, and no one +commented, and there is nothing special in repoctl to be different. +-- +Michael Scherer + +</PRE> + + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="004401.html">[Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default +</A></li> + <LI>Next message: <A HREF="004403.html">[Mageia-sysadm] [sysadmin-commits] [2736] do not explictely set the same value as default +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#4402">[ date ]</a> + <a href="thread.html#4402">[ thread ]</a> + <a href="subject.html#4402">[ subject ]</a> + <a href="author.html#4402">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm +mailing list</a><br> +</body></html> |