Re: Weird sys.fqhost value

Bas van der Vlies <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Robert good find and debuging!

On 26/09/2022 20:25, 'Robert Markula' via help-cfengine wrote:
> I can see now where this is coming from. Whenever I set the 'domain' 
> component in promises.cf, the error is triggered:
> 
> body common control {
>    domain => "example.com";
> }
> 
> Output:
> root@test1:~# cf-promises --show-vars | grep sys.fqhost
> default:sys.fqhost                                                       
>                                                                          
>                                                                          
>                                                                          
>                                                                          
>                                                                          
>                                                                          
>                                            test1.                       
>                                                                          
>                                                                          
>                                                                          
>                                                                          
>                                                                          
>                                                                          
>                                               example.com 
> inventory,source=agent,attribute_name=Host name
> 
> However, when commenting out this line, everything works as expected:
> body common control {
>    domain => "example.com";
> }
> 
> Output:
> root@test1:~# cf-promises --show-vars | grep sys.fqhost
> default:sys.fqhost                       test1.example.com               
>                               inventory,source=agent,attribute_name=Host 
> name
> 
> The error occurs with Cfengine 3.18.2 and MPF 3.18.2. on Ubuntu 20.04 
> using the cfengine-community_3.18.2-1.ubuntu20_amd64.deb package.
> The error is also present with Cfengine 3.20.0 and MPF 3.20.0 on Ubuntu 
> 20.04 using the cfengine-community_3.20.0-1.ubuntu20_amd64.deb package.
> It does not occur with Cfengine 3.15.2 and MPT 3.15.2 on Ubuntu 20.04 
> using the cfengine-community_3.15.2-1.ubuntu18_amd64.deb package.
> 
> Tested on a vanilla Ubuntu 20.04.1 desktop host.
> Bas van der Vlies schrieb am Freitag, 23. September 2022 um 15:15:12 UTC+2:
> 
>     That is really strange. You can try the 3.20 ubuntu package to see if
>     the problem still is there.
> 
>     We are using suse/redhat/debian and did not see this issue.
> 
>     On 23/09/2022 13:47, 'Robert Markula' via help-cfengine wrote:
>      > Hi Bas,
>      >
>      > thanks for trying to reproduce the error. The host is running on
>     Ubuntu
>      > 20.04. If I downgrade to Cfengine 15.2, then sys.fqhost is working
>      > correctly. As soon as I upgrade to Cfengine 18.2 or above, the error
>      > appears. There is no change on the configuration or the masterfiles
>      > between upgrading/downgrading.
>      >
>      > <snip>
>      > root@test1:~# *cat /etc/hosts*
>      > 127.0.0.1    localhost
>      > 127.0.1.1 test1.example.com <http://test1.example.com> test1
>      >
>      > ::1        localhost ip6-localhost ip6-loopback
>      > ff02::1        ip6-allnodes
>      > ff02::2        ip6-allrouters
>      >
>      > root@test1:~# *cat /etc/hostname *
>      > test1
>      >
>      > root@test1:~# *cat /proc/sys/kernel/hostname*
>      > test1
>      >
>      > root@test1:~# *echo $HOSTNAME*
>      > test1
>      > </snip>
>      >
>      > I have absolutely no idea where redundant space characters are
>     coming
>      > from. This is so weird.
>      > Bas van der Vlies schrieb am Freitag, 23. September 2022 um
>     11:03:35 UTC+2:
>      >
>      > Hi Robert,
>      >
>      > On which OS?
>      > I have done dome tests and I also rely on this variable. But on our
>      > machines I do not see this weird behaviour.
>      >
>      > You can check:
>      > ```
>      > /etc/hosts for networking
>      > /etc/hostname : This will be read by boot scripts on boot time and
>      > set its value.
>      > /proc/sys/kernel/hostname : Current hostname.
>      > /etc/sysconfig/network : Networking (HOSTNAME=”server1″ parameter)
>      > ```
>      >
>      > maybe there is some weird character somewehere
>      >
>      >
>      >
>      > On 23/09/2022 10:37, 'Robert Markula' via help-cfengine wrote:
>      > > Greetings everyone,
>      > >
>      > > Since the upgrade from Cfengine 3.15 to 3.18 I can observe a weird
>      > > '*sys.fqhost*' value.
>      > >
>      > > In 3.15.2 this variable is correct:
>      > > default:sys.fqhost test1.example.com <http://test1.example.com>
>     <http://test1.example.com <http://test1.example.com>>
>      > >
>      >  inventory,source=agent,attribute_name=Host
>      > > name
>      > >
>      > > In 3.18.2 and 3.20.0 however, there are numerous spaces around
>      > the hostname:
>      > > default:sys.fqhost
>      > >
>      > >
>      > >
>      > >
>      > >
>      > >
>      > >                                           test1.
>      > >
>      > >
>      > >
>      > >
>      > >
>      > >
>      > > example.com <http://example.com> <http://example.com
>     <http://example.com>>
>      > > inventory,source=agent,attribute_name=Host name
>      > > default:sys.uqhost                       test1
>      > >
>      >  inventory,source=agent,attribute_name=none
>      > > default:sys.domain example.com <http://example.com>
>     <http://example.com <http://example.com>>
>      > >                              source=agent
>      > >
>      > > Note the many spaces between the hostname and the domain name.
>      > >
>      > > Accordingly, cf-exec fails to run with his message in
>      > /var/log/syslog:
>      > > error: Couldn't open
>      > >
>      >
>     '/var/cfengine/outputs/cf___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________test1_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________example_com__1663916430_Fri_Sep_23_09_00_30_2022_0x7ff5fa880b80' - aborting exec. (fopen: File name too long)
>      > >
>      > > 'hostname -f' gives:
>      > > test1.example.com <http://test1.example.com>
>     <http://test1.example.com <http://test1.example.com>>
>      > >
>      > > root@test1:~# hostname
>      > > test1
>      > >
>      > > And in the body common control in promises.cf <http://promises.cf>
>      > <http://promises.cf <http://promises.cf>> I have set:
>      > > body common control
>      > > {
>      > > [...]
>      > > domain => "example.com <http://example.com> <http://example.com
>     <http://example.com>>";
>      > > [...]
>      > > }
>      > >
>      > > And, for completeness sake:
>      > > root@test1:~# cat /etc/hosts
>      > > 127.0.0.1    localhost
>      > > 127.0.1.1 test1.example.com <http://test1.example.com>
>     <http://test1.example.com <http://test1.example.com>> test1
>      > >
>      > > ::1        localhost ip6-localhost ip6-loopback
>      > > ff02::1        ip6-allnodes
>      > > ff02::2        ip6-allrouters
>      > >
>      > > root@test1:~# cat /etc/hostname
>      > > test1
>      > >
>      > > So I have absolutely no idea where these spaces are coming from.
>      > Any ideas?
>      > >
>      > > --
>      > > You received this message because you are subscribed to the Google
>      > > Groups "help-cfengine" group.
>      > > To unsubscribe from this group and stop receiving emails from it,
>      > send
>      > > an email to [email protected]
>      > > <mailto:[email protected]>.
>      > > To view this discussion on the web visit
>      > >
>      >
>     https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com> <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com>> <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/help-cfengine/4dc4492a-d42a-4610-a9df-ad15dd0a36dcn%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
>      >
>      > --
>      > --
>      > Bas van der Vlies
>      > | High Performance Computing & Visualization | SURF| Science Park
>     140 |
>      > 1098 XG Amsterdam
>      > | T +31 (0) 20 800 1300 <tel:+31%2020%20800%201300>
>     <tel:+31%2020%20800%201300> |
>      > [email protected] | www.surf.nl <http://www.surf.nl>
>     <http://www.surf.nl <http://www.surf.nl>> |
>      >
>      > --
>      > You received this message because you are subscribed to the Google
>      > Groups "help-cfengine" group.
>      > To unsubscribe from this group and stop receiving emails from it,
>     send
>      > an email to [email protected]
>      > <mailto:[email protected]>.
>      > To view this discussion on the web visit
>      >
>     https://groups.google.com/d/msgid/help-cfengine/2964882d-b48a-4219-bb8b-967e0725f5den%40googlegroups.com <https://groups.google.com/d/msgid/help-cfengine/2964882d-b48a-4219-bb8b-967e0725f5den%40googlegroups.com> <https://groups.google.com/d/msgid/help-cfengine/2964882d-b48a-4219-bb8b-967e0725f5den%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/help-cfengine/2964882d-b48a-4219-bb8b-967e0725f5den%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
>     -- 
>     -- 
>     Bas van der Vlies
>     | High Performance Computing & Visualization | SURF| Science Park 140 |
>     1098 XG Amsterdam
>     | T +31 (0) 20 800 1300 <tel:+31%2020%20800%201300> |
>     [email protected] | www.surf.nl <http://www.surf.nl> |
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/help-cfengine/e869d4a8-4500-4167-9ad7-568e51ed1327n%40googlegroups.com <https://groups.google.com/d/msgid/help-cfengine/e869d4a8-4500-4167-9ad7-568e51ed1327n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
--
Bas van der Vlies
| High Performance Computing & Visualization | SURF| Science Park 140 | 
1098 XG  Amsterdam
| T +31 (0) 20 800 1300  | [email protected] | www.surf.nl |

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/6eb3c35b-55d4-0d95-575c-0fb1b4945187%40surf.nl.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.