fatmcgav / fatmcgav-glassfish

Rewritten Glassfish module to improve functionality and support.
http://github.com/fatmcgav/fatmcgav-glassfish
GNU General Public License v3.0
6 stars 31 forks source link

Don`t abort catalog if template not exist #70

Closed ThoTischner closed 3 months ago

ThoTischner commented 7 years ago

I the domain template file will be created by the same puppet run, which creates the domain, the catalog run fails with the following error:

Error: Failed to apply catalog: Parameter template failed on Domain[domain-test]: /home/glass/template.jar does not exist at /etc/puppetlabs/code/environments/production/..

We don`t need to check if the file is there in the domain type.

fatmcgav commented 7 years ago

@disappear89 Cheers for the PR...

Just to confirm, you're creating the domain template using a standard file resource? Are you able to share an example?

As I'm wondering whether it makes more sense to re-work the validate logic to look for the resource in the catalogue if not present on the file system...

ThoTischner commented 6 years ago

Hi fatmcgav,

here is the example:

  class { 'glassfish':
    version => $glassfish_version,
    download_mirror => $download_mirror,
    manage_java => $manage_java,
    install_method => $install_method,
    parent_dir => $parent_dir,
    install_dir => $install_dir,
    asadmin_passfile => $asadmin_passfile,
    manage_accounts => $manage_accounts,
    user => $user,
    group => $group,
    create_passfile => $create_passfile,
    remove_default_domain => $remove_default_domain,
    domain_name => $domain_name,
    enable_secure_admin => $enable_secure_admin,
    asadmin_user => $asadmin_user,
    asadmin_password => $asadmin_password,
    asadmin_master_password => $asadmin_master_password,
    create_domain => $create_domain,
    create_service => $glassfish_create_service,
    start_domain => $start_domain,
    domain_template => $template_file,
    portbase => $portbase,
  }

  # domain template
  file { "$template_file":
    path   => "$template_file",
    ensure => file,
    source => "puppet:///modules/profile/templates/${domain_template}",
    before => Class['glassfish'],
  }

The problem is, that the module can not copy the template from the puppetserver and checks via domain type if the template file exists.

So there are two solutions:

Option two will be applied by this pull request.

ThoTischner commented 6 years ago

Rebased onto master ;) Fell free to merge :)