summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-sysadm/2012-April/004402.html
blob: 343f6983e64c4c805f387d7ea38c82fbb0c155a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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 &#224; 02:41 +0200, nicolas vigier a &#233;crit :
&gt;<i> On Sun, 15 Apr 2012, <A HREF="https://www.mageia.org/mailman/listinfo/mageia-sysadm">root at mageia.org</A> wrote:
</I>&gt;<i> 
</I>&gt;<i> &gt; Revision: 2736
</I>&gt;<i> &gt; Author:   misc
</I>&gt;<i> &gt; Date:     2012-04-15 01:45:48 +0200 (Sun, 15 Apr 2012)
</I>&gt;<i> &gt; Log Message:
</I>&gt;<i> &gt; -----------
</I>&gt;<i> &gt; do not explictely set the same value as default
</I>&gt;<i> 
</I>&gt;<i> I don't see the use of not explicitely setting the values and rely on
</I>&gt;<i> default value. Actually this make the modules unusable outside mageia
</I>&gt;<i> servers, because default values can be different.
</I>
That's default in upstream puppet, so that would work almost everywhere.

Package without &quot;ensure =&gt; installed&quot; 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 &quot;default
should be avoided&quot; )

And ensure =&gt; present is implicit if content is set.


&gt;<i> In my opinion we should always explicitly set the values when they are
</I>&gt;<i> important, and only use default value when we don't care about the
</I>&gt;<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 &quot;uninstalled&quot; 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>