Comparing pathes in puppet

12 views
Skip to first unread message

Roman Alekseev

unread,
Mar 21, 2014, 8:23:51 AM3/21/14
to puppet...@googlegroups.com
Hello,

I have two variables:
$a = some_path
$b = othe_path
and truing to compare it

if $a != $b { do something }
but always these variables are not equal for puppet.
In my case it can be equal, for example
$a = /var/cache/nginx/proxy_temp
$b = /var/cache/nginx/proxy_temp

How can it be fixed?



Garrett Honeycutt

unread,
Mar 23, 2014, 5:01:22 PM3/23/14
to puppet...@googlegroups.com
Hi Roman,

String comparison definitely works in Puppet. Perhaps your variables are
not what you think they are. Here's an example to help you debug the issue.

notify { "a = <${a}>": }
notify { "b = <${b}>": }

If they look the same, you might have a difference in type. '/foo' !=
['/foo'].

You can use the following to help you debug further.

$type_a = type($a)
$type_b = type($b)

notify { "type_a = <${type_a}>": }
notify { "type_b = <${type_b}>": }

Best regards,
-g

--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658
Reply all
Reply to author
Forward
0 new messages