And that's not going to work so hot because you're going to keep getting this on every run:
Error: /Stage[main]/Test_module/Augeas[update_server.xml]: Could not evaluate: Saving failed, see debug To avoid this you can use an "onlyif." onlyif => 'match URIEncoding[. = "UTF-8"] size == 0', This will match any URIEncoding="UTF-8" in any "Connector" section. So it won't work properly if you already have URIEncoding="UTF-8" defined for another "Connector." What a person needs to do is match port="8080" and URIEncoding="UTF-8." But I'm pressed for time and need to get going. Hopefully this will get you down the road a bit further. Someone else may chime in here with a better solution. Kent On Thu, May 8, 2014 at 11:29 AM, Pradeep Reddy <[email protected]>wrote: > Thx Kent. > On 8 May 2014 18:25, "Kenton Brede" <[email protected]> wrote: > >> Try something like this: >> >> augeas { 'update_server.xml': >> lens => 'Xml.lns', >> context => >> '/files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]/#attribute/', >> >> incl => "/opt/apphome/apache-tomcat-7.0.53/conf/server.xml", >> changes => ['ins URIEncoding after port[. = "8080"]', >> 'set URIEncoding UTF-8', >> ], >> } >> >> The "context" is actually the path as augeas sees it. I wildcarded >> "Connector" because there can be more than one. For example "Connector[1]" >> and "Connector[2]." >> >> For "changes" its actually doing this: >> >> Insert URIEncoding after, Connector with "port="8080", and set >> URIEncoding to UTF-8. >> >> It helps to use augtool if you haven't. Try something like: >> >> $ augtool --transform "Xml.lns incl >> /opt/apphome/apache-tomcat-7.0.53/conf/server.xml" >> augtool> print /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml >> augtool> print >> /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*] >> >> Kent >> >> >> >> >> On Wed, May 7, 2014 at 3:40 PM, Pradeep Reddy >> <[email protected]>wrote: >> >>> Hi Team, >>> >>> I am using below info in my manifest. URIEncoding="UTF-8" is not >>> present in server.xml. Trying to inject URIEncoding using below augeas >>> syntax. >>> >>> augeas { 'update_server.xml': >>> lens => 'Xml.lns', >>> incl => >>> "/opt/apphome/apache-tomcat-7.0.53/conf/server.xml", >>> context => >>> '/opt/apphome/apache-tomcat-7.0.53/conf/server.xml'/Connector port="8080"', >>> changes => flatten([ >>> "set >>> Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding >>> UTF-8",]), >>> } >>> >>> After executing getting below information. URIEncoding="UTF-8" is not >>> getting appended in server.xml. >>> >>> Could someone please check and let me know, wehther i am using a wrong >>> syntax. >>> >>> >>> Debug: Augeas[update_server.xml](provider=augeas): Opening augeas with >>> root /, lens path , flags 64 >>> Debug: Augeas[update_server.xml](provider=augeas): Augeas version 1.0.0 >>> is installed >>> Debug: Augeas[update_server.xml](provider=augeas): Will attempt to save >>> and only run if files changed >>> Debug: Augeas[update_server.xml](provider=augeas): sending command 'set' >>> with params >>> ["\"${brand::tomcat_installdir}/${brand::tomcat_version}/conf/server.xml\"/Connector >>> port=\"8080\"/Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding", >>> "UTF-8"] >>> Debug: Augeas[update_server.xml](provider=augeas): Skipping because no >>> files were changed >>> Debug: Augeas[update_server.xml](provider=augeas): Closed the augeas >>> connection >>> >>> Regards, >>> Pradeeo. >>> >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Kent Brede >> >> >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Puppet Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/puppet-users/9h5JjWZpOYM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.com<https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/CALk7d%2BfSu_SQ8j7rcxr%2BnkYTGhzR78A4ud3qwXNTXr9u8dtu_w%40mail.gmail.com<https://groups.google.com/d/msgid/puppet-users/CALk7d%2BfSu_SQ8j7rcxr%2BnkYTGhzR78A4ud3qwXNTXr9u8dtu_w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Kent Brede -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CA%2BnSE39EvD7WqZCoSF_VyLicX_AXNT9r-StXFedJH1dUKTdOFA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
