<feed xmlns='http://www.w3.org/2005/Atom'>
<title>puppet.git/lib/puppet/agent, 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>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: 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: Line modifiers are preferred to one-line blocks.</title>
<updated>2010-07-10T01:06:06+00:00</updated>
<author>
<name>Markus Roberts</name>
<email>Markus@reality.com</email>
</author>
<published>2010-07-10T01:06:06+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=81e283b28cdd91d259e3b60687aee7ea66e9d05d'/>
<id>81e283b28cdd91d259e3b60687aee7ea66e9d05d</id>
<content type='text'>
* Replaced 6 occurances of (while .*?) *do$ with

  The do is unneeded in the block header form and causes problems
  with the block-to-one-line transformation.

  3 Examples:

      The code:
          while line = f.gets do
      becomes:
          while line = f.gets
      The code:
          while line = shadow.gets do
      becomes:
          while line = shadow.gets
      The code:
          while wrapper = zeros.pop do
      becomes:
          while wrapper = zeros.pop

* Replaced 19 occurances of ((if|unless) .*?) *then$ with

  The then is unneeded in the block header form and causes problems
  with the block-to-one-line transformation.

  3 Examples:

      The code:
          if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then
      becomes:
          if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
      The code:
          unless defined?(@spec_command) then
      becomes:
          unless defined?(@spec_command)
      The code:
          if c == ?\n then
      becomes:
          if c == ?\n

* Replaced 758 occurances of

      ((?:if|unless|while|until) .*)
          (.*)
      end

  with

  The one-line form is preferable provided:

      * The condition is not used to assign a variable
      * The body line is not already modified
      * The resulting line is not too long

  3 Examples:

      The code:
          if Puppet.features.libshadow?
              has_feature :manages_passwords
          end
      becomes:
          has_feature :manages_passwords if Puppet.features.libshadow?
      The code:
          unless (defined?(@current_pool) and @current_pool)
              @current_pool = process_zpool_data(get_pool_data)
          end
      becomes:
          @current_pool = process_zpool_data(get_pool_data) unless (defined?(@current_pool) and @current_pool)
      The code:
          if Puppet[:trace]
              puts detail.backtrace
          end
      becomes:
          puts detail.backtrace if Puppet[:trace]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Replaced 6 occurances of (while .*?) *do$ with

  The do is unneeded in the block header form and causes problems
  with the block-to-one-line transformation.

  3 Examples:

      The code:
          while line = f.gets do
      becomes:
          while line = f.gets
      The code:
          while line = shadow.gets do
      becomes:
          while line = shadow.gets
      The code:
          while wrapper = zeros.pop do
      becomes:
          while wrapper = zeros.pop

* Replaced 19 occurances of ((if|unless) .*?) *then$ with

  The then is unneeded in the block header form and causes problems
  with the block-to-one-line transformation.

  3 Examples:

      The code:
          if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then
      becomes:
          if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
      The code:
          unless defined?(@spec_command) then
      becomes:
          unless defined?(@spec_command)
      The code:
          if c == ?\n then
      becomes:
          if c == ?\n

* Replaced 758 occurances of

      ((?:if|unless|while|until) .*)
          (.*)
      end

  with

  The one-line form is preferable provided:

      * The condition is not used to assign a variable
      * The body line is not already modified
      * The resulting line is not too long

  3 Examples:

      The code:
          if Puppet.features.libshadow?
              has_feature :manages_passwords
          end
      becomes:
          has_feature :manages_passwords if Puppet.features.libshadow?
      The code:
          unless (defined?(@current_pool) and @current_pool)
              @current_pool = process_zpool_data(get_pool_data)
          end
      becomes:
          @current_pool = process_zpool_data(get_pool_data) unless (defined?(@current_pool) and @current_pool)
      The code:
          if Puppet[:trace]
              puts detail.backtrace
          end
      becomes:
          puts detail.backtrace if Puppet[:trace]
</pre>
</div>
</content>
</entry>
<entry>
<title>Feature #3394 REST Runner, preparation</title>
<updated>2010-02-17T14:50:53+00:00</updated>
<author>
<name>Jesse Wolfe</name>
<email>jes5199@gmail.com</email>
</author>
<published>2010-03-19T02:01:29+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=1603f7363728dc41f67cd189ca0dcbf074ec44b4'/>
<id>1603f7363728dc41f67cd189ca0dcbf074ec44b4</id>
<content type='text'>
Rename Puppet::Agent::Runner to Puppet::Run, for consistency
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename Puppet::Agent::Runner to Puppet::Run, for consistency
</pre>
</div>
</content>
</entry>
<entry>
<title>Adding an Agent::Runner class.</title>
<updated>2009-02-07T00:08:43+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@madstop.com</email>
</author>
<published>2009-02-06T23:27:44+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=08a5d492dd3545366a2850d568d87aad0ba884e6'/>
<id>08a5d492dd3545366a2850d568d87aad0ba884e6</id>
<content type='text'>
This will eventually be used by puppetrun, but
for now is just called by the old-school Runner handler.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This will eventually be used by puppetrun, but
for now is just called by the old-school Runner handler.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Creating and using a new Puppet::Daemon class</title>
<updated>2009-02-07T00:08:43+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@madstop.com</email>
</author>
<published>2009-02-02T23:19:07+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=c0fcb2137e66af8ba60a959faa221034c6832b69'/>
<id>c0fcb2137e66af8ba60a959faa221034c6832b69</id>
<content type='text'>
This replaces the short-lived EventManager class, all of
the service- and timer-related code in puppet.rb, and moves
code from agent.rb, server.rb, and other places into one
class responsible for starting, stopping, pids, and more.

The Daemon module is no longer in existence, so it's been
removed from the classes that were using it.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This replaces the short-lived EventManager class, all of
the service- and timer-related code in puppet.rb, and moves
code from agent.rb, server.rb, and other places into one
class responsible for starting, stopping, pids, and more.

The Daemon module is no longer in existence, so it's been
removed from the classes that were using it.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Splitting the Agent class into Agent and Configurer</title>
<updated>2009-02-07T00:08:42+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@madstop.com</email>
</author>
<published>2009-01-28T23:11:19+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=fc14b81f99adc9c9308a26d322adaa59a7b7716d'/>
<id>fc14b81f99adc9c9308a26d322adaa59a7b7716d</id>
<content type='text'>
Once I went to add runinterval support to the Agent class,
I realized it's really two classes:  One that handles starting,
stopping, running, et al (still called Agent), and one that
handles downloading the catalog, running it, etc. (now
called Configurer).

This commit includes some additional code, but 95% of it is just moving code around.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Once I went to add runinterval support to the Agent class,
I realized it's really two classes:  One that handles starting,
stopping, running, et al (still called Agent), and one that
handles downloading the catalog, running it, etc. (now
called Configurer).

This commit includes some additional code, but 95% of it is just moving code around.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Moving the Agent locking code to a module.</title>
<updated>2009-02-07T00:08:41+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@madstop.com</email>
</author>
<published>2009-01-23T22:41:32+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=5a835315c203e6951562c098a99c4276ed60a17e'/>
<id>5a835315c203e6951562c098a99c4276ed60a17e</id>
<content type='text'>
Also cleaning up the lock usage by yielding to a block
when a lock is attained.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also cleaning up the lock usage by yielding to a block
when a lock is attained.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactoring how the Facter integration works</title>
<updated>2009-02-07T00:08:41+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@madstop.com</email>
</author>
<published>2009-01-22T22:51:02+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=e65d7f11dd95ab5432adefeabc3179e9eb5dd050'/>
<id>e65d7f11dd95ab5432adefeabc3179e9eb5dd050</id>
<content type='text'>
I moved all of the extra Fact modifications into the Facts
class, and then moved the calls of those new methods
into the Facter terminus.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I moved all of the extra Fact modifications into the Facts
class, and then moved the calls of those new methods
into the Facter terminus.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Moving fact and plugin handling into modules</title>
<updated>2009-02-07T00:08:40+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@madstop.com</email>
</author>
<published>2009-01-22T22:05:43+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=54faf7825bbffc5a4ca252389305dd23ae8d2d84'/>
<id>54faf7825bbffc5a4ca252389305dd23ae8d2d84</id>
<content type='text'>
This doesn't change functionality, it just simplifies
the agent class.

I've also started the work to get the catalog handling
done using REST/the Indirector.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This doesn't change functionality, it just simplifies
the agent class.

I've also started the work to get the catalog handling
done using REST/the Indirector.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
