<feed xmlns='http://www.w3.org/2005/Atom'>
<title>puppet.git/lib/puppet/external, branch ticket/master/7841</title>
<subtitle>Puppet repo</subtitle>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/'/>
<entry>
<title>(#6820) Fix nagios parser to use proper hash syntax for Ruby 1.9</title>
<updated>2011-03-23T20:10:48+00:00</updated>
<author>
<name>Matt Robinson</name>
<email>matt@puppetlabs.com</email>
</author>
<published>2011-03-23T05:56:46+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=8c32db76f68148b2e58ba744b965a3c8cd8f1663'/>
<id>8c32db76f68148b2e58ba744b965a3c8cd8f1663</id>
<content type='text'>
Reviewed-by: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed-by: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>(#6338) Remove unused version control tags</title>
<updated>2011-02-28T20:07:15+00:00</updated>
<author>
<name>Matt Robinson</name>
<email>matt@puppetlabs.com</email>
</author>
<published>2011-02-24T19:43:02+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=bb69011d7042454f6a2ee668a036ac373b4ff1eb'/>
<id>bb69011d7042454f6a2ee668a036ac373b4ff1eb</id>
<content type='text'>
Older version control systems like CVS and SVN used to use these $Id$
tags for version information.

Paired-with: Nick Lewis
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Older version control systems like CVS and SVN used to use these $Id$
tags for version information.

Paired-with: Nick Lewis
</pre>
</div>
</content>
</entry>
<entry>
<title>(#5261) Fix #5261 Don't escape Unicode characters in PSON</title>
<updated>2010-12-02T19:14:10+00:00</updated>
<author>
<name>Jesse Wolfe</name>
<email>jes5199@gmail.com</email>
</author>
<published>2010-11-22T23:17:51+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=c908fdb520e0fc203d49e0c14c4c7cbc193ab262'/>
<id>c908fdb520e0fc203d49e0c14c4c7cbc193ab262</id>
<content type='text'>
This patch removes the escaping of valid UTF-8 sequences as "\uXXXX".
This code was unreliable, as it relied on Iconv's ability to convert
those codepoints between UTF-8 and UTF-16, but some versions of Iconv
barf on some valid codepoints.

Invalid UTF-8 sequences are still passed through unchanged. We believe
that this is fine; if you are concerned about complience with the JSON
standard, what we are doing is equivalent to:
  * interpreting binary files as Latin-1 encoded character sequences
  * JSON-encoding those characters according to RFC 4627
  * outputting the JSON as Latin-1
This allows all raw binary files to be transmitted losslessly.

Paired-With: Paul Berry &lt;paul@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch removes the escaping of valid UTF-8 sequences as "\uXXXX".
This code was unreliable, as it relied on Iconv's ability to convert
those codepoints between UTF-8 and UTF-16, but some versions of Iconv
barf on some valid codepoints.

Invalid UTF-8 sequences are still passed through unchanged. We believe
that this is fine; if you are concerned about complience with the JSON
standard, what we are doing is equivalent to:
  * interpreting binary files as Latin-1 encoded character sequences
  * JSON-encoding those characters according to RFC 4627
  * outputting the JSON as Latin-1
This allows all raw binary files to be transmitted losslessly.

Paired-With: Paul Berry &lt;paul@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix for #4832 -- Making PSON handle arbitrary binary data</title>
<updated>2010-10-13T23:49:53+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-10-12T23:38:59+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=3c56705a95c945778674f9792a07b66b879cb48e'/>
<id>3c56705a95c945778674f9792a07b66b879cb48e</id>
<content type='text'>
The PSON library needlessly assumed that the data to be transmitted was well-
formed unicode.  This made Latin-1 users (and anyone who needed to serialize
arbitrary binary data) sad.  This patch goes some of the way to resolving the
issues, by passing through non-unicode data rather than just failing, adds
tests, and cleans up a pernicious assumption about escape characters in ruby
regular expressions not marked "n" (no-encoding).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The PSON library needlessly assumed that the data to be transmitted was well-
formed unicode.  This made Latin-1 users (and anyone who needed to serialize
arbitrary binary data) sad.  This patch goes some of the way to resolving the
issues, by passing through non-unicode data rather than just failing, adds
tests, and cleans up a pernicious assumption about escape characters in ruby
regular expressions not marked "n" (no-encoding).
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix for #4649 -- avoid unsupported features on non-posix systems</title>
<updated>2010-09-29T03:23:13+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-09-28T18:16:45+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=25738726526c6618906eb02878f32bb276fec26f'/>
<id>25738726526c6618906eb02878f32bb276fec26f</id>
<content type='text'>
MS Windows is apparently only "posix curious;" many of the usual fcntl flags
are not defined when running under MS Windows.  It also appears that we are
only using a small subset of the vendored event-loop library and could replace
it with a handful of (portable) extracted methods.  This, however, would be
too agressive of a refactor for 2.6.2 and so this commit simply avoids referring
to the unsupported flag values in environments where they are not defined.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MS Windows is apparently only "posix curious;" many of the usual fcntl flags
are not defined when running under MS Windows.  It also appears that we are
only using a small subset of the vendored event-loop library and could replace
it with a handful of (portable) extracted methods.  This, however, would be
too agressive of a refactor for 2.6.2 and so this commit simply avoids referring
to the unsupported flag values in environments where they are not defined.
</pre>
</div>
</content>
</entry>
<entry>
<title>Code smell: Two space indentation</title>
<updated>2010-07-10T01:12:17+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-07-10T01:12:17+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=3180b9d9b2c844dade1d361326600f7001ec66dd'/>
<id>3180b9d9b2c844dade1d361326600f7001ec66dd</id>
<content type='text'>
Replaced 106806 occurances of ^( +)(.*$) with

The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.

3 Examples:

    The code:
        end

        # Tell getopt which arguments are valid
        def test_get_getopt_args
            element = Setting.new :name =&gt; "foo", :desc =&gt; "anything", :settings =&gt; Puppet::Util::Settings.new
            assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")

    becomes:
        end

        # Tell getopt which arguments are valid
        def test_get_getopt_args
          element = Setting.new :name =&gt; "foo", :desc =&gt; "anything", :settings =&gt; Puppet::Util::Settings.new
          assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")

    The code:
            assert_equal(str, val)

            assert_instance_of(Float, result)

        end

        # Now test it with a passed object
    becomes:
          assert_equal(str, val)

          assert_instance_of(Float, result)

        end

        # Now test it with a passed object
    The code:
        end

        assert_nothing_raised do
            klass[:Yay] = "boo"
            klass["Cool"] = :yayness
        end

    becomes:
        end

        assert_nothing_raised do
          klass[:Yay] = "boo"
          klass["Cool"] = :yayness
        end
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaced 106806 occurances of ^( +)(.*$) with

The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.

3 Examples:

    The code:
        end

        # Tell getopt which arguments are valid
        def test_get_getopt_args
            element = Setting.new :name =&gt; "foo", :desc =&gt; "anything", :settings =&gt; Puppet::Util::Settings.new
            assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")

    becomes:
        end

        # Tell getopt which arguments are valid
        def test_get_getopt_args
          element = Setting.new :name =&gt; "foo", :desc =&gt; "anything", :settings =&gt; Puppet::Util::Settings.new
          assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")

    The code:
            assert_equal(str, val)

            assert_instance_of(Float, result)

        end

        # Now test it with a passed object
    becomes:
          assert_equal(str, val)

          assert_instance_of(Float, result)

        end

        # Now test it with a passed object
    The code:
        end

        assert_nothing_raised do
            klass[:Yay] = "boo"
            klass["Cool"] = :yayness
        end

    becomes:
        end

        assert_nothing_raised do
          klass[:Yay] = "boo"
          klass["Cool"] = :yayness
        end
</pre>
</div>
</content>
</entry>
<entry>
<title>Code smell: Avoid needless decorations</title>
<updated>2010-07-10T01:07:15+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-07-10T01:07:15+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=543225970225de5697734bfaf0a6eee996802c04'/>
<id>543225970225de5697734bfaf0a6eee996802c04</id>
<content type='text'>
* Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2

  3 Examples:

      The code:
          ctx = OpenSSL::SSL::SSLContext.new()
      becomes:
          ctx = OpenSSL::SSL::SSLContext.new
      The code:
          skip()
      becomes:
          skip
      The code:
          path = tempfile()
      becomes:
          path = tempfile

* Replaced 31 occurances of ^( *)end *#.* with \1end

  3 Examples:

      The code:

      becomes:

      The code:
          end # Dir.foreach
      becomes:
          end
      The code:
          end # def
      becomes:
          end
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2

  3 Examples:

      The code:
          ctx = OpenSSL::SSL::SSLContext.new()
      becomes:
          ctx = OpenSSL::SSL::SSLContext.new
      The code:
          skip()
      becomes:
          skip
      The code:
          path = tempfile()
      becomes:
          path = tempfile

* Replaced 31 occurances of ^( *)end *#.* with \1end

  3 Examples:

      The code:

      becomes:

      The code:
          end # Dir.foreach
      becomes:
          end
      The code:
          end # def
      becomes:
          end
</pre>
</div>
</content>
</entry>
<entry>
<title>Code smell: Don't restate results directly after assignment</title>
<updated>2010-07-10T01:06:58+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-07-10T01:06:58+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=8f15707251cdb58d53e82c4bbd332a38c2d31b4c'/>
<id>8f15707251cdb58d53e82c4bbd332a38c2d31b4c</id>
<content type='text'>
Replaced 33 occurances of

        ([$@]?\w+)( +[|&amp;+-]{0,2}= .+)
        \1
    end

with

3 Examples:

    The code:
            @sync ||= Sync.new
            @sync
        end
    becomes:
            @sync ||= Sync.new
        end
    The code:
            str += "\n"
            str
        end
    becomes:
            str += "\n"
        end
    The code:
            @indirection = Puppet::Indirector::Indirection.new(self, indirection,  options)
            @indirection
        end
    becomes:
            @indirection = Puppet::Indirector::Indirection.new(self, indirection,  options)
        end
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaced 33 occurances of

        ([$@]?\w+)( +[|&amp;+-]{0,2}= .+)
        \1
    end

with

3 Examples:

    The code:
            @sync ||= Sync.new
            @sync
        end
    becomes:
            @sync ||= Sync.new
        end
    The code:
            str += "\n"
            str
        end
    becomes:
            str += "\n"
        end
    The code:
            @indirection = Puppet::Indirector::Indirection.new(self, indirection,  options)
            @indirection
        end
    becomes:
            @indirection = Puppet::Indirector::Indirection.new(self, indirection,  options)
        end
</pre>
</div>
</content>
</entry>
<entry>
<title>Code smell: Use ||= for conditional initialization</title>
<updated>2010-07-10T01:06:48+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-07-10T01:06:48+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=42a539061293f8e745a9dc5b97b4415b6a275e04'/>
<id>42a539061293f8e745a9dc5b97b4415b6a275e04</id>
<content type='text'>
Replaced 55 occurances of

    ([$@]?\w+) += +(.*) +(if +\1.nil\?|if +! *\1|unless +\1|unless +defined\?\(\1\))$

with

    \1 ||= \2

3 Examples:

    The code:
        @sync
    becomes:
        @sync
    The code:

    becomes:

    The code:
        if @yydebug
    becomes:
        if @yydebug
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaced 55 occurances of

    ([$@]?\w+) += +(.*) +(if +\1.nil\?|if +! *\1|unless +\1|unless +defined\?\(\1\))$

with

    \1 ||= \2

3 Examples:

    The code:
        @sync
    becomes:
        @sync
    The code:

    becomes:

    The code:
        if @yydebug
    becomes:
        if @yydebug
</pre>
</div>
</content>
</entry>
<entry>
<title>Code smell: Avoid explicit returns</title>
<updated>2010-07-10T01:06:33+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-07-10T01:06:33+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=8d1fbe4586c91682cdda0cb271649e918fd9778b'/>
<id>8d1fbe4586c91682cdda0cb271649e918fd9778b</id>
<content type='text'>
Replaced 583 occurances of

    (DEF)
        (LINES)
        return (.*)
    end

with

3 Examples:

    The code:
        def consolidate_failures(failed)
            filters = Hash.new { |h,k| h[k] = [] }
            failed.each do |spec, failed_trace|
                if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
                    filters[f] &lt;&lt; spec
                    break
                end
            end
            return filters
        end
    becomes:
        def consolidate_failures(failed)
            filters = Hash.new { |h,k| h[k] = [] }
            failed.each do |spec, failed_trace|
                if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
                    filters[f] &lt;&lt; spec
                    break
                end
            end
            filters
        end
    The code:
        def retrieve
            return_value = super
            return_value = return_value[0] if return_value &amp;&amp; return_value.is_a?(Array)

            return return_value
        end
    becomes:
        def retrieve
            return_value = super
            return_value = return_value[0] if return_value &amp;&amp; return_value.is_a?(Array)

            return_value
        end
    The code:
        def fake_fstab
            os = Facter['operatingsystem']
            if os == "Solaris"
                name = "solaris.fstab"
            elsif os == "FreeBSD"
                name = "freebsd.fstab"
            else
                # Catchall for other fstabs
                name = "linux.fstab"
            end
            oldpath = @provider_class.default_target
            return fakefile(File::join("data/types/mount", name))
        end
    becomes:
        def fake_fstab
            os = Facter['operatingsystem']
            if os == "Solaris"
                name = "solaris.fstab"
            elsif os == "FreeBSD"
                name = "freebsd.fstab"
            else
                # Catchall for other fstabs
                name = "linux.fstab"
            end
            oldpath = @provider_class.default_target
            fakefile(File::join("data/types/mount", name))
        end
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaced 583 occurances of

    (DEF)
        (LINES)
        return (.*)
    end

with

3 Examples:

    The code:
        def consolidate_failures(failed)
            filters = Hash.new { |h,k| h[k] = [] }
            failed.each do |spec, failed_trace|
                if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
                    filters[f] &lt;&lt; spec
                    break
                end
            end
            return filters
        end
    becomes:
        def consolidate_failures(failed)
            filters = Hash.new { |h,k| h[k] = [] }
            failed.each do |spec, failed_trace|
                if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
                    filters[f] &lt;&lt; spec
                    break
                end
            end
            filters
        end
    The code:
        def retrieve
            return_value = super
            return_value = return_value[0] if return_value &amp;&amp; return_value.is_a?(Array)

            return return_value
        end
    becomes:
        def retrieve
            return_value = super
            return_value = return_value[0] if return_value &amp;&amp; return_value.is_a?(Array)

            return_value
        end
    The code:
        def fake_fstab
            os = Facter['operatingsystem']
            if os == "Solaris"
                name = "solaris.fstab"
            elsif os == "FreeBSD"
                name = "freebsd.fstab"
            else
                # Catchall for other fstabs
                name = "linux.fstab"
            end
            oldpath = @provider_class.default_target
            return fakefile(File::join("data/types/mount", name))
        end
    becomes:
        def fake_fstab
            os = Facter['operatingsystem']
            if os == "Solaris"
                name = "solaris.fstab"
            elsif os == "FreeBSD"
                name = "freebsd.fstab"
            else
                # Catchall for other fstabs
                name = "linux.fstab"
            end
            oldpath = @provider_class.default_target
            fakefile(File::join("data/types/mount", name))
        end
</pre>
</div>
</content>
</entry>
</feed>
