<feed xmlns='http://www.w3.org/2005/Atom'>
<title>puppet.git/spec/unit/node, 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>Fix issue with forward and backslashes in Windows paths</title>
<updated>2011-07-26T21:55:55+00:00</updated>
<author>
<name>Josh Cooper</name>
<email>josh@puppetlabs.com</email>
</author>
<published>2011-07-22T19:44:15+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=9279d0954eb20d75e18a666fd572b5492e157608'/>
<id>9279d0954eb20d75e18a666fd572b5492e157608</id>
<content type='text'>
The environment validates its modulepath and manifestdir settings, but
it uses Dir.getwd to convert a relative path into an absolute path. The
problem is that on Windows, Dir.getwd returns a path with backslashes.
(Interestingly this only happens when puppet is loaded, not in irb for
example.) And since we do not yet support backslashes in Windows paths
or UNC paths, the directory is not included in the environment.

For the time being, I am using File.expand_path to normalize the path.
It has the side-effect of converting backslashes to forward slashes.
This is sufficient to work around backslashes in Dir.getwd. In the near
future, I will be refactoring how paths are split, validated, tested,
etc, and I have a REMIND in place to fix the environment.

But as a result of this change it exposed a bug in our rdoc parser
dealing with the finding the root of a path. The parser assumed that the
root was '/', but caused an infinite loop when passed a Windows path.

I added a test for this case, which is only run on Windows, because on
Unix File.dirname("C:/") == '.'.

After all of that, I had to disable one of the rdoc spec tests, because
it attempted to reproduce a specific bug, which caused rdoc to try to
create a directory of the form: C:/.../files/C:/.... Of course, this
fails because ':' is not a valid filename character on Windows.

Paired-with: Nick Lewis &lt;nick@puppetlabs.com&gt;
Reviewed-by: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The environment validates its modulepath and manifestdir settings, but
it uses Dir.getwd to convert a relative path into an absolute path. The
problem is that on Windows, Dir.getwd returns a path with backslashes.
(Interestingly this only happens when puppet is loaded, not in irb for
example.) And since we do not yet support backslashes in Windows paths
or UNC paths, the directory is not included in the environment.

For the time being, I am using File.expand_path to normalize the path.
It has the side-effect of converting backslashes to forward slashes.
This is sufficient to work around backslashes in Dir.getwd. In the near
future, I will be refactoring how paths are split, validated, tested,
etc, and I have a REMIND in place to fix the environment.

But as a result of this change it exposed a bug in our rdoc parser
dealing with the finding the root of a path. The parser assumed that the
root was '/', but caused an infinite loop when passed a Windows path.

I added a test for this case, which is only run on Windows, because on
Unix File.dirname("C:/") == '.'.

After all of that, I had to disable one of the rdoc spec tests, because
it attempted to reproduce a specific bug, which caused rdoc to try to
create a directory of the form: C:/.../files/C:/.... Of course, this
fails because ':' is not a valid filename character on Windows.

Paired-with: Nick Lewis &lt;nick@puppetlabs.com&gt;
Reviewed-by: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't use non-1.8.5-compatible methods 'Object#tap' and 'Dir.mktmpdir'</title>
<updated>2011-07-22T04:27:42+00:00</updated>
<author>
<name>Nick Lewis</name>
<email>nick@puppetlabs.com</email>
</author>
<published>2011-07-22T04:25:21+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=61df3f7c39d74b82e37f48c3519293406036e1e9'/>
<id>61df3f7c39d74b82e37f48c3519293406036e1e9</id>
<content type='text'>
These methods aren't available until Ruby 1.8.6 (Dir.mktmpdir) and Ruby 1.8.7
(Object#tap).

Reviewed-By: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These methods aren't available until Ruby 1.8.6 (Dir.mktmpdir) and Ruby 1.8.7
(Object#tap).

Reviewed-By: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rework Puppet::Util::Cacher to only expire using TTLs</title>
<updated>2011-07-22T03:10:28+00:00</updated>
<author>
<name>Nick Lewis</name>
<email>nick@puppetlabs.com</email>
</author>
<published>2011-07-21T18:53:06+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=d198fedf65e472b384666fc9ae3bef487852068a'/>
<id>d198fedf65e472b384666fc9ae3bef487852068a</id>
<content type='text'>
We have removed every usage of cached_attr in which the attribute needs to be
manually expired. Thus, the only meaningful behavior provided by
Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the
cacher to only support that behavior.

Rather than accepting an options hash, of which :ttl is the only available
option, cached_attr now requires a second argument, which is the TTL.

TTLs are now used to compute expirations, which are stored and used for
expiring values. Previously, we stored a timestamp and used it and the TTL to
determine whether the attribute was expired. This had the potentially
undesirable side effect that the lifetime of a cached attribute could be
extended after its insertion by modifying the TTL setting for the cache. Now,
the lifetime of an attribute is determined when it is set, and is thereafter
immutable, aside from deliberately re-setting the expiration for that
particular attribute.

Reviewed-By: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have removed every usage of cached_attr in which the attribute needs to be
manually expired. Thus, the only meaningful behavior provided by
Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the
cacher to only support that behavior.

Rather than accepting an options hash, of which :ttl is the only available
option, cached_attr now requires a second argument, which is the TTL.

TTLs are now used to compute expirations, which are stored and used for
expiring values. Previously, we stored a timestamp and used it and the TTL to
determine whether the attribute was expired. This had the potentially
undesirable side effect that the lifetime of a cached attribute could be
extended after its insertion by modifying the TTL setting for the cache. Now,
the lifetime of an attribute is determined when it is set, and is thereafter
immutable, aside from deliberately re-setting the expiration for that
particular attribute.

Reviewed-By: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix tests with "relative" paths on Windows</title>
<updated>2011-07-19T21:06:36+00:00</updated>
<author>
<name>Josh Cooper</name>
<email>josh@puppetlabs.com</email>
</author>
<published>2011-07-19T06:05:35+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=462a95e3d077b1915a919399b846068816c84583'/>
<id>462a95e3d077b1915a919399b846068816c84583</id>
<content type='text'>
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows,
which breaks many test cases. This commit adds a method to
PuppetSpec::Files.make_absolute that makes the path absolute in
test cases.

On Unix (Puppet.features.posix?) it is a no-op. On Windows,
(Puppet.features.microsoft_windows?) the drive from the current
 working directory is prepended.

Reviewed-by: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows,
which breaks many test cases. This commit adds a method to
PuppetSpec::Files.make_absolute that makes the path absolute in
test cases.

On Unix (Puppet.features.posix?) it is a no-op. On Windows,
(Puppet.features.microsoft_windows?) the drive from the current
 working directory is prepended.

Reviewed-by: Jacob Helwig &lt;jacob@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Making Fact json handling more resilient</title>
<updated>2011-07-15T18:16:09+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@puppetlabs.com</email>
</author>
<published>2011-07-07T07:03:51+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=7e5ca648112a2703ba827f96f36fe2a5f7d1c751'/>
<id>7e5ca648112a2703ba827f96f36fe2a5f7d1c751</id>
<content type='text'>
We were failing if any values were nil, and values
were often nil, at least in testing.

We now only include non-nil values, and we handle nil
values just fine.

Signed-off-by: Luke Kanies &lt;luke@puppetlabs.com&gt;
Reviewed-by: Nick Lewis &lt;nick@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We were failing if any values were nil, and values
were often nil, at least in testing.

We now only include non-nil values, and we handle nil
values just fine.

Signed-off-by: Luke Kanies &lt;luke@puppetlabs.com&gt;
Reviewed-by: Nick Lewis &lt;nick@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Fixing Facts pson methods more resilient"</title>
<updated>2011-04-22T00:20:28+00:00</updated>
<author>
<name>Max Martin</name>
<email>max@puppetlabs.com</email>
</author>
<published>2011-04-21T23:56:03+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=2a2226c0b71aafcda953057d3ecc8df5638447f2'/>
<id>2a2226c0b71aafcda953057d3ecc8df5638447f2</id>
<content type='text'>
This reverts commit 07a7a68a25eb9b21189751c27f90f972224ea533.
The JSON patch series has caused problems with the inventory service,
and further discussion is needed to decide how to serialize objects to
PSON with regards to future compatibility.

Conflicts:

	spec/unit/node/facts_spec.rb

Paired-with:Matt Robinson &lt;matt@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 07a7a68a25eb9b21189751c27f90f972224ea533.
The JSON patch series has caused problems with the inventory service,
and further discussion is needed to decide how to serialize objects to
PSON with regards to future compatibility.

Conflicts:

	spec/unit/node/facts_spec.rb

Paired-with:Matt Robinson &lt;matt@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>maint: Fix the missed failure from the previous commit</title>
<updated>2011-04-15T23:12:30+00:00</updated>
<author>
<name>Nick Lewis</name>
<email>nick@puppetlabs.com</email>
</author>
<published>2011-04-15T23:10:01+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=d85c2a8ed1423f11b2c91e084765a81aebfeb2fc'/>
<id>d85c2a8ed1423f11b2c91e084765a81aebfeb2fc</id>
<content type='text'>
There were two times being used, and the previous fix only fixed one of them.

Reviewed-By: Jacob Helwig
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There were two times being used, and the previous fix only fixed one of them.

Reviewed-By: Jacob Helwig
</pre>
</div>
</content>
</entry>
<entry>
<title>maint: Fix a broken Puppet::Node::Facts spec</title>
<updated>2011-04-15T22:53:51+00:00</updated>
<author>
<name>Nick Lewis</name>
<email>nick@puppetlabs.com</email>
</author>
<published>2011-04-15T22:53:51+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=e946a17bf7d8c728adc8ab8868d67ebb2832b703'/>
<id>e946a17bf7d8c728adc8ab8868d67ebb2832b703</id>
<content type='text'>
This was breaking in other timezones because it was comparing to a string
literal representation of a time, which really varies between timezones.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This was breaking in other timezones because it was comparing to a string
literal representation of a time, which really varies between timezones.
</pre>
</div>
</content>
</entry>
<entry>
<title>Adding json-specific matchers</title>
<updated>2011-04-15T00:07:39+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@puppetlabs.com</email>
</author>
<published>2011-04-13T06:54:08+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=e424740d78b8b72dc6bd7ebbbe27b237347d67f5'/>
<id>e424740d78b8b72dc6bd7ebbbe27b237347d67f5</id>
<content type='text'>
These make the JSON tests much easier to read and
write.  They're the first custom matchers that I can
find, so they're breaking a bit of new ground,
but the JSON tests were pretty hard to read
and there was a lot of duplication, so it seemed
worth it.

Note that for some reason they're not working on
Facts - it seems to get immediately turned into
a full instance by the JSON parsing subsystem,
and I've no idea why.

Reviewed-by: Daniel Pittman &lt;daniel@puppetlabs.com&gt;
Signed-off-by: Luke Kanies &lt;luke@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These make the JSON tests much easier to read and
write.  They're the first custom matchers that I can
find, so they're breaking a bit of new ground,
but the JSON tests were pretty hard to read
and there was a lot of duplication, so it seemed
worth it.

Note that for some reason they're not working on
Facts - it seems to get immediately turned into
a full instance by the JSON parsing subsystem,
and I've no idea why.

Reviewed-by: Daniel Pittman &lt;daniel@puppetlabs.com&gt;
Signed-off-by: Luke Kanies &lt;luke@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixing Facts pson methods more resilient</title>
<updated>2011-04-15T00:07:08+00:00</updated>
<author>
<name>Luke Kanies</name>
<email>luke@puppetlabs.com</email>
</author>
<published>2011-04-13T04:01:09+00:00</published>
<link rel='alternate' type='text/html' href='https://fedorapeople.org/cgit/ricky/public_git/puppet.git/commit/?id=07a7a68a25eb9b21189751c27f90f972224ea533'/>
<id>07a7a68a25eb9b21189751c27f90f972224ea533</id>
<content type='text'>
They were currently failing if any values were nil,
which happened a lot.

We also prefer not to include nil values, since it muddies
the json unnecessarily.

Reviewed-by: Daniel Pittman &lt;daniel@puppetlabs.com&gt;
Signed-off-by: Luke Kanies &lt;luke@puppetlabs.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They were currently failing if any values were nil,
which happened a lot.

We also prefer not to include nil values, since it muddies
the json unnecessarily.

Reviewed-by: Daniel Pittman &lt;daniel@puppetlabs.com&gt;
Signed-off-by: Luke Kanies &lt;luke@puppetlabs.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
