Hi puppet users,

I have a question about crossdependencies. Let's say I want to manage an
application my_application and the backupclient on a node. I always need
a backclient but its configuration depends on
a) wether my_application is installed or not
b) the configuration of my_application

This is one pattern I can think of:

    node 'mynode' {
      class { 'my_application':
        paramA => valueA,
        paramBalsoInterestingForBackupclass => valueB,
        paramCalsoInterestingForBackupclass => valueC,
      }
      class { 'backup::client':
        backup_definitions => [ 'my_application' ],
      }
    }


Is it ALWAYS safe to access $::my_application::paramBalsoInterestingForBackup
inside the backup::client class or can I run into ordering issues?

Or how whould you model this kind of relationship? A second pattern I
can think of is having a third class backup::client::my_application that
takes the same params as the my_application class and gets included
inside the my_application class. So I would end up with

    node 'mynode' {
      class { 'my_application':
        paramA => valueA,
        paramBalsoInterestingForBackupclass => valueB,
        paramCalsoInterestingForBackupcalss => valueC,
        backup => true,
      }
      class { 'backup::client': } # just the basic config
    }

and inside class my_application:

    if $backup {
      class { 'backup::client::my_application':
        paramB  => $paramBalsoInterestingForBackupclass,
        paramC  => $paramCalsoInterestingForBackupclass,
        require => Class['backup::client'],
      }
    }

Does this sound like a better approach? Nevertheless is the first one
save?

-Stefan

Attachment: pgpCkK5clqYuV.pgp
Description: PGP signature

Reply via email to