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 &quot;adresse_wazuh_manager&quot; string =3D&gt; &quot=
;10.54.1.40&quot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 &quot;fic_conf_wazuh&quot; =C2=A0 =C2=A0 =C2=A0 =C2=A0string =3D&gt; &q=
uot;/var/ossec/etc/ossec.conf&quot;;</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 &quot;${fic_conf_wazuh}&quot;<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&gt;=
 mog(&quot;550&quot;,&quot;root&quot;,&quot;root&quot;),<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 edit_xml =C2=A0 =3D&gt; xml_set_v=
alue(&quot;10.54.1.40&quot;,&quot;/ossec_config/client/server/address&quot;=
),<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 classes =C2=
=A0 =C2=A0=3D&gt; results(&quot;bundle&quot;,&quot;relance_wazuh_agent&quot=
;),<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comment =C2=
=A0 =C2=A0=3D&gt; &quot;/?\ --------- Configuration wazuh agent&quot;;<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&amp;q=3Dhttps://documenta=
tion.wazuh.com&amp;source=3Dgmail&amp;ust=3D1738400726196000&amp;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&amp;q=3Dhttps://groups.google.com/forum/%23!forum/wazuh&amp;so=
urce=3Dgmail&amp;ust=3D1738400726196000&amp;usg=3DAOvVaw10YfIxGFi5z-tftcQXu=
vi0">https://groups.google.com/forum/#!forum/wazuh</a><br>--&gt;<br><br>&lt=
;ossec_config&gt;<br>=C2=A0 &lt;client&gt;<br>=C2=A0 =C2=A0 &lt;server&gt;<=
br>=C2=A0 =C2=A0 =C2=A0 &lt;address&gt;XXXXXX&lt;/address&gt;<br>=C2=A0 =C2=
=A0 =C2=A0 &lt;port&gt;1514&lt;/port&gt;<br>=C2=A0 =C2=A0 =C2=A0 &lt;protoc=
ol&gt;tcp&lt;/protocol&gt;<br>=C2=A0 =C2=A0 &lt;/server&gt;<br>=C2=A0 =C2=
=A0 &lt;config-profile&gt;debian, debian12&lt;/config-profile&gt;<br>=C2=A0=
 =C2=A0 &lt;notify_time&gt;10&lt;/notify_time&gt;<br>=C2=A0 =C2=A0 &lt;time=
-reconnect&gt;60&lt;/time-reconnect&gt;<br>=C2=A0 =C2=A0 &lt;auto_restart&g=
t;yes&lt;/auto_restart&gt;<br>=C2=A0 =C2=A0 &lt;crypto_method&gt;aes&lt;/cr=
ypto_method&gt;<br>=C2=A0 &lt;/client&gt;<br>....<br>=C2=A0&lt;/ossec_confi=
g&gt;<br><br>&lt;ossec_config&gt;<br>=C2=A0 &lt;localfile&gt;<br>=C2=A0 =C2=
=A0 &lt;log_format&gt;journald&lt;/log_format&gt;<br>=C2=A0 =C2=A0 &lt;loca=
tion&gt;journald&lt;/location&gt;<br></span></span><div><span style=3D"text=
-align:left" dir=3D"ltr"><span lang=3D"en">=C2=A0 &lt;/localfile&gt;</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">&lt;/ossec_config&gt;<br><br>Thank&#39;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&quot; 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--