If $facts['versionrepokubelocal'] is an integer I don't think your
comparison will work. Try:

```
if $facts['versionrepokubelocal'] !=  2 {
  notify { "Upgrading repository version": }type here
}
```

--

Aaron Russo (He/Him/His)
PIXAR | Lead Systems Engineer


On Wed, Jan 10, 2024 at 7:35 AM Pato Bongi <patrick.bong...@gmail.com>
wrote:

> The if statement doesn't work using a custom fact, i try this :
>
> notify { "FACTER value= ${facts['versionrepokubelocal']}": }
> if $facts['versionrepokubelocal'] !=  '2' {
>   notify { "Upgrading repository version": }type here
> }
> I use notify before "if" for to check the value of the custom fact. Trying
> with puppet apply (same with puppet agent -t on remote server) get the
> following output :
>
> Notice: FACTER versionrepokubelocal value = 2
> Notice: /Stage[main]/Kube::Config/Notify[FACTER versionrepokubelocal value
> = 2]/message: defined    'message' as 'FACTER versionrepokubelocal value =
> 2'
> Debug: /Stage[main]/Kube::Config/Notify[FACTER versionrepokubelocal value
> = 2]: The container   Class[Kube::Config] will propagate my refresh event
> Notice: Upgrading repository version
> Notice: /Stage[main]/Kube::Config/Notify[Upgrading repository
> version]/message: defined 'message' as  'Upgrading repository version'
> Before and after the execution I checked the value of the custom fact on
> the server and it is correctly valued as above :
>
> [root@myserver manifests]$ facter versionrepokubelocal 2
>
> I can't understand why it doesn't work correctly if the fact is correctly
> valued and the syntax of the statement is correct (tested with pdk validate
> and pdk test unit), it should not print "Upgrading repository version".
>
> --
> 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/bdb372fb-59ff-4dc6-a521-0ca7eef67b05n%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/bdb372fb-59ff-4dc6-a521-0ca7eef67b05n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAA4bxV5Cb5RLWNkuqFNoRVtze_OBZOZ-FxWV3293jnqY_JUz9Q%40mail.gmail.com.

Reply via email to