Discussion:
Functions for text manipulation
Thomas Bellman
2008-12-18 18:47:56 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have written a couple of custom functions that I think would be
nice for more people if they were included in standard Puppet.

They are:

* regsubst() Perform regexp matching and substitution on a string.
Basically a wrapper around the method String.sub() in
Ruby.

* sprintf() Perform printf-style formatting of text.

For a real-life use-case, see the short thread in
http://groups.google.com/group/puppet-users/browse_thread/thread/3cfc79469caafbac?hl=en
which was my actual motivation for writing the regsubst()
function in the first place.

(I realize that the inline_template() function in 0.24.7 *can* be
used for this, but it would be quite a lot less convenient than
having them as built-in functions.)

They could probably do with some criticism from more experienced
Puppet coders, and I definitely need help writing proper markup
for the docstrings. Anyway, I'm posting them as followups to
this message.


/Thomas Bellman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAklKmtwACgkQDGpP8Cv3aqIrOwCfZ8TIkMxLlBheJZ80qvaPYP9q
F88An1J+BfFRYaS8ERF+HsRUF1oIE5NE
=iA6c
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2008-12-18 18:49:21 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Signed-off-by: Thomas Bellman <***@nsc.liu.se>
- ---
~ lib/puppet/parser/functions/regsubst.rb | 70 +++++++++++++++++++++++++++++++
~ 1 files changed, 70 insertions(+), 0 deletions(-)
~ create mode 100644 lib/puppet/parser/functions/regsubst.rb

diff --git a/lib/puppet/parser/functions/regsubst.rb b/lib/puppet/parser/functions/regsubst.rb
new file mode 100644
index 0000000..91a1edb
- --- /dev/null
+++ b/lib/puppet/parser/functions/regsubst.rb
@@ -0,0 +1,70 @@
+module Puppet::Parser::Functions
+ newfunction(:regsubst, :type => :rvalue,
+ :doc => "\
+ Perform regexp replacement on a string.
+ Parameters (in order):
+ str The string to operate on.
+ regexp The regular expression matching the string. If you
+ want it anchored at the start and/or end of the string,
+ you must do that with ^ and $ yourself.
+ replacement Replacement string. Can contain back references
+ to what was matched using \\0, \\1, and so on.
+ flags Optional. String of single letter flags for how
+ the regexp is interpreted:
+ E Extended regexps
+ I Ignore case in regexps
+ M Multiline regexps
+ G Global replacement; all occurances of the
+ regexp in the string will be replaced.
+ Without this, only the first occurance will
+ be replaced.
+ lang Optional. How to handle multibyte characters. A
+ single-character string with the following values:
+ N None
+ E EUC
+ S SJIS
+ U UTF-8
+
+ Examples:
+ Get the third octet from the node's IP address:
+ $i3 = regsubst($ipaddress,
+ '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$',
+ '\3')
+
+ Put angle brackets around each octet in the node's IP address:
+ $x = regsubst($ipaddress, '([0-9]+)', '<\1>', 'G')
+ ") \
+ do |args|
+ flag_mapping = {
+ "E" => Regexp::EXTENDED,
+ "I" => Regexp::IGNORECASE,
+ "M" => Regexp::MULTILINE,
+ }
+ if args.length < 3 or args.length > 5
+ self.fail("regsub(): wrong number of arguments" +
+ " (#{args.length}; min 3, max 5)")
+ end
+ str, regexp, replacement, flags, lang = args
+ reflags = 0
+ global = false
+ (flags or "").each_byte do |f|
+ f = f.chr
+ if f == "G"
+ global = true
+ else
+ fvalue = flag_mapping[f]
+ if !fvalue
+ self.fail("regsub(): bad flag `#{f}'")
+ end
+ reflags |= fvalue
+ end
+ end
+ re = Regexp.compile(regexp, reflags, lang)
+ if global
+ result = str.gsub(re, replacement)
+ else
+ result = str.sub(re, replacement)
+ end
+ return result
+ end
+end
- --
1.5.6.5

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAklKmzEACgkQDGpP8Cv3aqLBhgCfTU9TxoaTDEbNMFiDwqy5mH5/
ULAAni/YmNeC+m0wjU1KPClbyyDiDK2q
=Q5mY
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-12-19 05:30:12 UTC
Permalink
Post by Thomas Bellman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- ---
~ lib/puppet/parser/functions/regsubst.rb | 70 ++++++++++++++++++++
+++++++++++
~ 1 files changed, 70 insertions(+), 0 deletions(-)
~ create mode 100644 lib/puppet/parser/functions/regsubst.rb
diff --git a/lib/puppet/parser/functions/regsubst.rb b/lib/puppet/
parser/functions/regsubst.rb
new file mode 100644
index 0000000..91a1edb
- --- /dev/null
+++ b/lib/puppet/parser/functions/regsubst.rb
@@ -0,0 +1,70 @@
+module Puppet::Parser::Functions
+ newfunction(:regsubst, :type => :rvalue,
+ :doc => "\
+ Perform regexp replacement on a string.
+ str The string to operate on.
+ regexp The regular expression matching the string. If you
+ want it anchored at the start and/or end of the string,
+ you must do that with ^ and $ yourself.
+ replacement Replacement string. Can contain back references
+ to what was matched using \\0, \\1, and so on.
+ flags Optional. String of single letter flags for how
+ E Extended regexps
+ I Ignore case in regexps
+ M Multiline regexps
+ G Global replacement; all occurances of the
+ regexp in the string will be replaced.
+ Without this, only the first occurance will
+ be replaced.
+ lang Optional. How to handle multibyte characters. A
+ N None
+ E EUC
+ S SJIS
+ U UTF-8
The markup should be in Restructured Text. You probably want a list
that looks something like this:

* *str*: The string to operate on.
* *regexp*: ...

Further indentation should work fine. The leading '*' makes a list
item, wrapping a term in '**' makes it italic, double '*' makes it bold.

Run 'puppetdoc -r type' (or maybe types?) to get the reference, then
run rst2html (a python script) to convert to html to verify it looks ok.
Post by Thomas Bellman
+ $i3 = regsubst($ipaddress,
+ '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$',
+ '\3')
+
+ $x = regsubst($ipaddress, '([0-9]+)', '<\1>', 'G')
+ ") \
+ do |args|
+ flag_mapping = {
+ "E" => Regexp::EXTENDED,
+ "I" => Regexp::IGNORECASE,
+ "M" => Regexp::MULTILINE,
+ }
+ if args.length < 3 or args.length > 5
+ self.fail("regsub(): wrong number of arguments" +
+ " (#{args.length}; min 3, max 5)")
+ end
Why not just "unless args.lenth == 4"?
Post by Thomas Bellman
+ str, regexp, replacement, flags, lang = args
And here you've got five items, even though you're failing if the
length isn't == 4.
Post by Thomas Bellman
+ reflags = 0
+ global = false
+ (flags or "").each_byte do |f|
+ f = f.chr
+ if f == "G"
+ global = true
+ else
+ fvalue = flag_mapping[f]
+ if !fvalue
+ self.fail("regsub(): bad flag `#{f}'")
+ end
+ reflags |= fvalue
+ end
+ end
+ re = Regexp.compile(regexp, reflags, lang)
+ if global
+ result = str.gsub(re, replacement)
+ else
+ result = str.sub(re, replacement)
+ end
+ return result
+ end
+end
This is a bit messy, but I don't se a cleaner way to do it, really.
--
A diplomat is a man who can convince his wife she'd look stout in a fur
coat.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2008-12-19 16:33:19 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luke Kanies wrote:

| The markup should be in Restructured Text. You probably want a list
| that looks something like this:
|
| * *str*: The string to operate on.
| * *regexp*: ...
|
| Further indentation should work fine. The leading '*' makes a list
| item, wrapping a term in '**' makes it italic, double '*' makes it bold.
|
| Run 'puppetdoc -r type' (or maybe types?) to get the reference, then
| run rst2html (a python script) to convert to html to verify it looks ok.

Ah, thanks. For this purpose, 'puppetdoc -r function' is probably
the correct invocation. :-) However, it seems as if newlines are
stripped from the function doc-strings, making it difficult to
get proper formatting. Compare for example the output from
puppetdoc for the defined() and generate() functions to the
literal strings in defined.rb and generate.rb.

|> + if args.length < 3 or args.length > 5
|> + self.fail("regsub(): wrong number of arguments" +
|> + " (#{args.length}; min 3, max 5)")
|> + end

| Why not just "unless args.lenth == 4"?

I'm far from being a Ruby expert, but I'm fairly certain that
Ruby doesn't have *that* fuzzy comparisons. 3 and 5 are
perfectly valid number of arguments, but "== 4" would forbid
them.

|> + str, regexp, replacement, flags, lang = args

| And here you've got five items, even though you're failing if the
| length isn't == 4.

I don't think so. If three parameters are give, flags and lang
will be set to nil, if there are four parameters, then lang will
be set to nil, and if all five parameters are given, then of
course all the variables will be set to strings. The function
*does* have five parameters, but the last two are optional.

I explicitly handle flags being nil below '(flags or "")', and
lang being nil is handled by Regexp.compile() from what I
understand.

|> + reflags = 0
|> + global = false
|> + (flags or "").each_byte do |f|
|> + f = f.chr
|> + if f == "G"
|> + global = true
|> + else
|> + fvalue = flag_mapping[f]
|> + if !fvalue
|> + self.fail("regsub(): bad flag `#{f}'")
|> + end
|> + reflags |= fvalue
|> + end
|> + end
|> + re = Regexp.compile(regexp, reflags, lang)
|> + if global
|> + result = str.gsub(re, replacement)
|> + else
|> + result = str.sub(re, replacement)
|> + end
|> + return result
|> + end
|> +end

| This is a bit messy, but I don't se a cleaner way to do it, really.

Agreed. I'm not quite satisfied with that bit of code either,
but it seems to do its job.

I'll continue with trying to add tests after Christmas.


/Bellman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAklLzM8ACgkQDGpP8Cv3aqKgXACdHBuLZEfsNtsrtgzry2zDhiJg
UcwAmQHMoY1/L3lRbsord0Pn5XGlgHgj
=MVE4
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-12-19 18:18:39 UTC
Permalink
Post by Thomas Bellman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
| The markup should be in Restructured Text. You probably want a list
|
| * *str*: The string to operate on.
| * *regexp*: ...
|
| Further indentation should work fine. The leading '*' makes a list
| item, wrapping a term in '**' makes it italic, double '*' makes it bold.
|
| Run 'puppetdoc -r type' (or maybe types?) to get the reference, then
| run rst2html (a python script) to convert to html to verify it looks ok.
Ah, thanks. For this purpose, 'puppetdoc -r function' is probably
the correct invocation. :-) However, it seems as if newlines are
stripped from the function doc-strings, making it difficult to
get proper formatting. Compare for example the output from
puppetdoc for the defined() and generate() functions to the
literal strings in defined.rb and generate.rb.
Yeah, sorry about that.

I wondered if the function docs stripped newlines; I knew others did.

If you want to change the function reference so it doesn't do this,
I'd gladly accept that patch.
Post by Thomas Bellman
|> + if args.length < 3 or args.length > 5
|> + self.fail("regsub(): wrong number of arguments" +
|> + " (#{args.length}; min 3, max 5)")
|> + end
| Why not just "unless args.lenth == 4"?
I'm far from being a Ruby expert, but I'm fairly certain that
Ruby doesn't have *that* fuzzy comparisons. 3 and 5 are
perfectly valid number of arguments, but "== 4" would forbid
them.
Sorry, shouldn't email that early in the morning. :/

I think you can do 'unless 3 < args.length < 5', though.
Post by Thomas Bellman
|> + str, regexp, replacement, flags, lang = args
| And here you've got five items, even though you're failing if the
| length isn't == 4.
I don't think so. If three parameters are give, flags and lang
will be set to nil, if there are four parameters, then lang will
be set to nil, and if all five parameters are given, then of
course all the variables will be set to strings. The function
*does* have five parameters, but the last two are optional.
I explicitly handle flags being nil below '(flags or "")', and
lang being nil is handled by Regexp.compile() from what I
understand.
Sorry, I misread the <, brain no work.
Post by Thomas Bellman
|> + reflags = 0
|> + global = false
|> + (flags or "").each_byte do |f|
|> + f = f.chr
|> + if f == "G"
|> + global = true
|> + else
|> + fvalue = flag_mapping[f]
|> + if !fvalue
|> + self.fail("regsub(): bad flag `#{f}'")
|> + end
|> + reflags |= fvalue
|> + end
|> + end
|> + re = Regexp.compile(regexp, reflags, lang)
|> + if global
|> + result = str.gsub(re, replacement)
|> + else
|> + result = str.sub(re, replacement)
|> + end
|> + return result
|> + end
|> +end
| This is a bit messy, but I don't se a cleaner way to do it, really.
Agreed. I'm not quite satisfied with that bit of code either,
but it seems to do its job.
I'll continue with trying to add tests after Christmas.
Great.
--
Fallacies do not cease to be fallacies because they become fashions.
--G. K. Chesterton
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2008-12-18 18:50:31 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Signed-off-by: Thomas Bellman <***@nsc.liu.se>
- ---
~ lib/puppet/parser/functions/sprintf.rb | 17 +++++++++++++++++
~ 1 files changed, 17 insertions(+), 0 deletions(-)
~ create mode 100644 lib/puppet/parser/functions/sprintf.rb

diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/parser/functions/sprintf.rb
new file mode 100644
index 0000000..2c613f0
- --- /dev/null
+++ b/lib/puppet/parser/functions/sprintf.rb
@@ -0,0 +1,17 @@
+module Puppet::Parser::Functions
+ newfunction(:sprintf, :type => :rvalue,
+ :doc => "\
+ Perform printf-style formatting of text.
+
+ The first parameter is format string describing how the rest of the
+ parameters should be formatted. See the documentation for the
+ Kernel::sprintf() function in Ruby for all the details.
+ ") \
+ do |args|
+ if args.length < 1
+ self.fail('sprintf(): Too few arguments (missing format string)')
+ end
+ fmt = args.shift()
+ return sprintf(fmt, *args)
+ end
+end
- --
1.5.6.5

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAklKm3cACgkQDGpP8Cv3aqLrlACggyPtz15dbYC/w3cwf4mAtnOP
MU4AnjhImIn4GFsrd82s+uSNQEcF8tya
=+9dN
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-12-19 05:31:13 UTC
Permalink
Post by Thomas Bellman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- ---
~ lib/puppet/parser/functions/sprintf.rb | 17 +++++++++++++++++
~ 1 files changed, 17 insertions(+), 0 deletions(-)
~ create mode 100644 lib/puppet/parser/functions/sprintf.rb
diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/
parser/functions/sprintf.rb
new file mode 100644
index 0000000..2c613f0
- --- /dev/null
+++ b/lib/puppet/parser/functions/sprintf.rb
@@ -0,0 +1,17 @@
+module Puppet::Parser::Functions
+ newfunction(:sprintf, :type => :rvalue,
+ :doc => "\
+ Perform printf-style formatting of text.
+
+ The first parameter is format string describing how the rest of the
+ parameters should be formatted. See the documentation for the
+ Kernel::sprintf() function in Ruby for all the details.
+ ") \
+ do |args|
+ if args.length < 1
+ self.fail('sprintf(): Too few arguments (missing format
string)')
+ end
+ fmt = args.shift()
+ return sprintf(fmt, *args)
+ end
+end
Simple and straightforward. +1
--
Nature and nature's laws lay hid in night,
God said, "Let Newton be," and all was light.

It did not last; the devil howling "Ho!
Let Einstein be!" restored the status quo.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-12-19 05:29:22 UTC
Permalink
Post by Thomas Bellman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have written a couple of custom functions that I think would be
nice for more people if they were included in standard Puppet.
* regsubst() Perform regexp matching and substitution on a string.
Basically a wrapper around the method String.sub() in
Ruby.
* sprintf() Perform printf-style formatting of text.
Hi Thomas,

These functions will need at least basic tests before we can accept
them. See Brice's tests in spec/unit/parser/functions as examples.

Also, please open a ticket for these functions, since that's where we
track commit status.

I'm in a quandary on these functions, though. On the one hand, I
don't want to deny people functionality they need, but on the other
hand, the closer we get to Ruby in the language the sillier it seems
to me that we have a separate language. I fear the thought of seeing
50 of these functions shipped as part of the core in 3 years.

At this point, I'm amenable to the patches, but it's a concerning trend.
Post by Thomas Bellman
(I realize that the inline_template() function in 0.24.7 *can* be
used for this, but it would be quite a lot less convenient than
having them as built-in functions.)
I agree that the separate functions are better. Much.
--
The most overlooked advantage to owning a computer is that if they foul
up there's no law against wacking them around a little. -- Joe Martin
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Brice Figureau
2008-12-19 09:53:14 UTC
Permalink
Post by Thomas Bellman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have written a couple of custom functions that I think would be
nice for more people if they were included in standard Puppet.
* regsubst() Perform regexp matching and substitution on a string.
Basically a wrapper around the method String.sub() in
Ruby.
* sprintf() Perform printf-style formatting of text.
[snip]
I'm in a quandary on these functions, though. On the one hand, I
don't want to deny people functionality they need, but on the other
hand, the closer we get to Ruby in the language the sillier it seems
to me that we have a separate language. I fear the thought of seeing
50 of these functions shipped as part of the core in 3 years.
At this point, I'm amenable to the patches, but it's a concerning trend.
I know you started worked on a kind of ruby DSL for puppet, although I
don't know its state.
Is it something you plan to move toward in the future?
--
Brice Figureau
Days of Wonder http://www.daysofwonder.com/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-12-19 15:33:07 UTC
Permalink
Post by Brice Figureau
Post by Thomas Bellman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have written a couple of custom functions that I think would be
nice for more people if they were included in standard Puppet.
* regsubst() Perform regexp matching and substitution on a string.
Basically a wrapper around the method String.sub() in
Ruby.
* sprintf() Perform printf-style formatting of text.
[snip]
I'm in a quandary on these functions, though. On the one hand, I
don't want to deny people functionality they need, but on the other
hand, the closer we get to Ruby in the language the sillier it seems
to me that we have a separate language. I fear the thought of seeing
50 of these functions shipped as part of the core in 3 years.
At this point, I'm amenable to the patches, but it's a concerning trend.
I know you started worked on a kind of ruby DSL for puppet, although I
don't know its state.
Is it something you plan to move toward in the future?
I would describe it more as something I'd like some weekend time to
work on, and weekend dev time is in short supply these days.

As I think I've mentioned earlier, it seems that we've reached a point
where multiple language design goals are all related and need a
holistic solution, and I'm most concerned with how best to provide
that solution; it just keeps coming up that maybe dropping to pure
Ruby actually is the answer, but I don't even know how well it could
express the configurations.
--
'Tis better to be silent and be thought a fool, than to speak and
remove all doubt. --Abraham Lincoln
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2008-12-19 16:26:04 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luke Kanies wrote:

| These functions will need at least basic tests before we can accept
| them. See Brice's tests in spec/unit/parser/functions as examples.

I'll take a look and see if I understand what they do. I'm
unlikely to have time to finish it until after new year, though.

| Also, please open a ticket for these functions, since that's where we
| track commit status.

Done:

~ http://projects.reductivelabs.com/issues/show/1830
~ http://projects.reductivelabs.com/issues/show/1831

| I'm in a quandary on these functions, though. On the one hand, I
| don't want to deny people functionality they need, but on the other
| hand, the closer we get to Ruby in the language the sillier it seems
| to me that we have a separate language. I fear the thought of seeing
| 50 of these functions shipped as part of the core in 3 years.

| At this point, I'm amenable to the patches, but it's a concerning trend.

The trick is to choose functions that are powerful and can be
used for many things, without being *too* generic and difficult
to use for simple tasks. :-) But yes, it's not trivial to do
that balancing act.


/Thomas Bellman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAklLyxwACgkQDGpP8Cv3aqL79QCeIyScvW0f8Oj4b/WNMN/oWauG
MeEAn0dtj7VncpPKPBZPd2kH2q1zUhJ6
=vDRB
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-***@googlegroups.com
To unsubscribe from this group, send email to puppet-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Loading...