On 3/21/14, 1:23 PM, Roman Alekseev wrote:
> 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?

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

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/532F4BA2.5040607%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to