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 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%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to