Re: Xml_set_value fonction problem
"'Lars Erik Wik' via help-cfengine" <[email protected]> Fri, 31 Jan 2025 01:16:17 -0800 (PST)
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_91784_597879327.1738314977606 Content-Type: multipart/alternative; boundary="----=_Part_91785_1447772815.1738314977606" ------=_Part_91785_1447772815.1738314977606 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi there, What is the error message you get? Is it perhaps `parser error : Extra=20 content at the end of the document`? The XLM that you reference does not look valid. Not because of duplicate=20 tags. However, it breaks the following rule: "XML documents must contain=20 one root element that is the parent of all other elements".=20 See https://www.w3schools.com/xml/xml_syntax.asp. Hope this helps :) On Friday, January 31, 2025 at 8:18:28=E2=80=AFAM UTC+1 [email protected] wr= ote: > Hello everyone, > I am having difficulty editing an xml file.=20 > > In particular that of the wazuh agent to be deployed automatically by cf. > I need to set a tag value. I use the xml_set_value function which seems= =20 > very simple to use.=20 > > The only problem is that the basic Wazuh configuration file has two=20 > sections with the same tag. therefore, the xml_set_status function does n= ot=20 > work.=20 > > .... > vars: > # "adresse_wazuh_manager" string =3D> "10.54.1.40"; > "fic_conf_wazuh" string =3D>=20 > "/var/ossec/etc/ossec.conf"; > files: > "${fic_conf_wazuh}" > perms =3D> mog("550","root","root"), > edit_xml =3D>=20 > xml_set_value("10.54.1.40","/ossec_config/client/server/address"), > classes =3D> results("bundle","relance_wazuh_agent"), > comment =3D> "/?\ --------- Configuration wazuh agent"= ; > ...... > > > > > file to edit:=20 > > !-- > Wazuh - Agent - Default configuration for debian 12 > More info at: https://documentation.wazuh.com > Mailing list: https://groups.google.com/forum/#!forum/wazuh > --> > > <ossec_config> > <client> > <server> > <address>XXXXXX</address> > <port>1514</port> > <protocol>tcp</protocol> > </server> > <config-profile>debian, debian12</config-profile> > <notify_time>10</notify_time> > <time-reconnect>60</time-reconnect> > <auto_restart>yes</auto_restart> > <crypto_method>aes</crypto_method> > </client> > .... > </ossec_config> > > <ossec_config> > <localfile> > <log_format>journald</log_format> > <location>journald</location> > </localfile> > ...... > </ossec_config> > > Thank's for your help > --=20 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 e= mail to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/help-cfengi= ne/270645e5-2c1b-4854-8a9b-4b0508d5b908n%40googlegroups.com. ------=_Part_91785_1447772815.1738314977606 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi there,<div><br /></div><div>What is the error message you get? Is it per= haps `parser error : Extra content at the end of the document`?<div><br /><= /div><div>The XLM that you reference does not look valid. Not because of du= plicate tags. However, it breaks the following rule: "XML documents must co= ntain one root element that is the parent of all other elements". See=C2=A0= https://www.w3schools.com/xml/xml_syntax.asp.</div><div><br /></div><div>Ho= pe this helps :)<br /><br /></div></div><div class=3D"gmail_quote"><div dir= =3D"auto" class=3D"gmail_attr">On Friday, January 31, 2025 at 8:18:28=E2=80= =AFAM UTC+1 [email protected] wrote:<br/></div><blockquote class=3D"gmail_qu= ote" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204= ); padding-left: 1ex;"> <span style=3D"text-align:left" dir=3D"ltr"><span lang=3D"en">Hello everyon= e,<br> I am having difficulty editing an xml file. <br><br>In particular that of t= he wazuh agent to be deployed automatically by cf.<br> I need to set a tag value. I use the xml_set_value function which seems very simple to use. <br><br>The only problem is that the basic Wazuh configuration file has two= sections with the same tag. therefore, the xml_set_status function does no= t work. <br><br>....<br></span></span><div><span style=3D"text-align:left" = dir=3D"ltr"><span lang=3D"en">vars:<br>#=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 "adresse_wazuh_manager" string =3D> "= ;10.54.1.40";<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 "fic_conf_wazuh" =C2=A0 =C2=A0 =C2=A0 =C2=A0string =3D> &q= uot;/var/ossec/etc/ossec.conf";</span></span></div><div><span style=3D= "text-align:left" dir=3D"ltr"><span lang=3D"en">files:</span></span></div><= div><span style=3D"text-align:left" dir=3D"ltr"><span lang=3D"en"></span></= span></div><span style=3D"text-align:left" dir=3D"ltr"><span lang=3D"en">= =C2=A0 =C2=A0 =C2=A0 =C2=A0 "${fic_conf_wazuh}"<br>=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 perms =C2=A0 =C2=A0 =C2=A0=3D>= mog("550","root","root"),<br>=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 edit_xml =C2=A0 =3D> xml_set_v= alue("10.54.1.40","/ossec_config/client/server/address"= ),<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 classes =C2= =A0 =C2=A0=3D> results("bundle","relance_wazuh_agent"= ;),<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comment =C2= =A0 =C2=A0=3D> "/?\ --------- Configuration wazuh agent";<br>.= .....<br><br><br><br><br>file to edit: <br><br>!--<br>=C2=A0 Wazuh - Agent = - Default configuration for debian 12<br>=C2=A0 More info at: <a href=3D"ht= tps://documentation.wazuh.com" target=3D"_blank" rel=3D"nofollow" data-safe= redirecturl=3D"https://www.google.com/url?hl=3Den&q=3Dhttps://documenta= tion.wazuh.com&source=3Dgmail&ust=3D1738400726196000&usg=3DAOvV= aw3PWHmVLjYXHBmfjgHYI_QO">https://documentation.wazuh.com</a><br>=C2=A0 Mai= ling list: <a href=3D"https://groups.google.com/forum/#!forum/wazuh" target= =3D"_blank" rel=3D"nofollow" data-saferedirecturl=3D"https://www.google.com= /url?hl=3Den&q=3Dhttps://groups.google.com/forum/%23!forum/wazuh&so= urce=3Dgmail&ust=3D1738400726196000&usg=3DAOvVaw10YfIxGFi5z-tftcQXu= vi0">https://groups.google.com/forum/#!forum/wazuh</a><br>--><br><br><= ;ossec_config><br>=C2=A0 <client><br>=C2=A0 =C2=A0 <server><= br>=C2=A0 =C2=A0 =C2=A0 <address>XXXXXX</address><br>=C2=A0 =C2= =A0 =C2=A0 <port>1514</port><br>=C2=A0 =C2=A0 =C2=A0 <protoc= ol>tcp</protocol><br>=C2=A0 =C2=A0 </server><br>=C2=A0 =C2= =A0 <config-profile>debian, debian12</config-profile><br>=C2=A0= =C2=A0 <notify_time>10</notify_time><br>=C2=A0 =C2=A0 <time= -reconnect>60</time-reconnect><br>=C2=A0 =C2=A0 <auto_restart&g= t;yes</auto_restart><br>=C2=A0 =C2=A0 <crypto_method>aes</cr= ypto_method><br>=C2=A0 </client><br>....<br>=C2=A0</ossec_confi= g><br><br><ossec_config><br>=C2=A0 <localfile><br>=C2=A0 =C2= =A0 <log_format>journald</log_format><br>=C2=A0 =C2=A0 <loca= tion>journald</location><br></span></span><div><span style=3D"text= -align:left" dir=3D"ltr"><span lang=3D"en">=C2=A0 </localfile></span>= </span></div><div><span style=3D"text-align:left" dir=3D"ltr"><span lang=3D= "en">......</span></span></div><div><span style=3D"text-align:left" dir=3D"= ltr"><span lang=3D"en"></ossec_config><br><br>Thank's for your he= lp<br></span></span></div><div><span style=3D"text-align:left" dir=3D"ltr">= <span lang=3D"en"></span></span></div> </blockquote></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;help-cfengine" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">help-= [email protected]</a>.<br /> To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/= help-cfengine/270645e5-2c1b-4854-8a9b-4b0508d5b908n%40googlegroups.com?utm_= medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/help-= cfengine/270645e5-2c1b-4854-8a9b-4b0508d5b908n%40googlegroups.com</a>.<br /= > ------=_Part_91785_1447772815.1738314977606-- ------=_Part_91784_597879327.1738314977606--