Skip to content

Instantly share code, notes, and snippets.

@raphink
Created November 19, 2020 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphink/39a8443ee3d116e3570d41f1dcb35262 to your computer and use it in GitHub Desktop.
Save raphink/39a8443ee3d116e3570d41f1dcb35262 to your computer and use it in GitHub Desktop.
Augeas {
lens => 'Xml.lns',
incl => '/home/raphink/bas/puppet/hibernate.cfg.xml',
context => '/files/home/raphink/bas/puppet/hibernate.cfg.xml/hibernate-configuration/session-factory',
}
$settings = [
"set property[#attribute/name='hibernate.connection.driver_class']/#text 'org.postgresql.Driver'",
"ins property after property[#attribute/name='hibernate.connection.driver_class']",
"set property[count(#attribute)=0]/#attribute/name 'hibernate.dialect'",
"set property[#attribute/name='hibernate.dialect']/#text 'org.hibernate.dialect.PostgreSQLDialect'",
"set property[#attribute/name='hibernate.jdbc.use_streams_for_binary']/#attribute/name 'hibernate.jdbc.use_streams_for_binary'",
"set property[#attribute/name='hibernate.jdbc.use_streams_for_binary']/#text 'false'",
"set property[#attribute/name='xwiki.virtual_mode']/#attribute/name 'xwiki.virtual_mode'",
"set property[#attribute/name='xwiki.virtual_mode']/#text 'schema'",
"rm mapping[#attribute/resource='xwiki.hbm.xml']",
"set mapping[#attribute/resource='xwiki.postgresql.hbm.xml']/#attribute/resource 'xwiki.postgresql.hbm.xml'",
]
augeas { 'sql':
changes => $settings,
}
augeas { 'ins dialect':
changes => [
"ins property after property[#attribute/name='hibernate.connection.driver_class']",
"set property[count(#attribute)=0]/#attribute/name 'hibernate.dialect'",
],
onlyif => 'match property[#attribute/name="hibernate.dialect"] size == 0',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment