Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Get variable from module A into module B

Hi, I'm trying to get a variable value from one class into another class (different modules) but run into issues. From what I have read in the docs you are supposed to be able to include a class multiple times without running into "already defined..." ?!

What I'm trying to do:

Module A (class "abc")

abcvar = 'something'

Module B (class "xyz")

include abc notify {"######my var is: ${$abc::abcvar}": }

site.pp

node 'my-test-node' { class {'abc': abcvar => 'somethingelse', } include xyz }

Result


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[abc] is already declared; cannot redeclare at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51 at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51:3 on node my-test-node Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Would this be possible in any other way or am I doing it totally wrong? Many thanks for your feedback

Regards Tomas

Get variable from module A into module B

Hi, I'm trying to get a variable value from one class into another class (different modules) but run into issues. From what I have read in the docs you are supposed to be able to include a class multiple times without running into "already defined..." ?!

What I'm trying to do:

Module A (class "abc")

abcvar = 'something'

'something'

Module B (class "xyz")

 include abc
  notify {"######my var is: ${$abc::abcvar}": }

}

site.pp

node 'my-test-node'
'my-test-node'   {
    class {'abc':
      abcvar => 'somethingelse',
    }   include xyz   }
  include xyz
  }

Result


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[abc] is already declared; cannot redeclare at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51 at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51:3 on node my-test-node Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Would this be possible in any other way or am I doing it totally wrong? Many thanks for your feedback

Regards Tomas

Get variable from module A into module B

Hi, I'm trying to get a variable value from one class into another class (different modules) but run into issues. From what I have read in the docs you are supposed to be able to include a class multiple times without running into "already defined..." declared..." ?!

What I'm trying to do:

Module A (class "abc")

abcvar = 'something'

Module B (class "xyz")

  include abc
  notify {"######my var is: ${$abc::abcvar}": }

site.pp

node 'my-test-node'   {
    class {'abc':
      abcvar => 'somethingelse',
    }   include xyz   }

Result


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[abc] is already declared; cannot redeclare at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51 at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51:3 on node my-test-node Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Would this be possible in any other way or am I doing it totally wrong? Many thanks for your feedback

Regards Tomas

Get variable from module A into module B

Hi, I'm trying to get a variable value from one class into another class (different modules) but run into issues. From what I have read in the docs you are supposed to be able to include a class multiple times without running into "already declared..." ?!

What I'm trying to do:

Module A (class "abc")

abcvar = 'something'

Module B (class "xyz")

  include abc
  notify {"######my var is: ${$abc::abcvar}": }

site.pp

node 'my-test-node'   {
    class {'abc':
      abcvar => 'somethingelse',
    }   include xyz   }

include xyz
}

Result


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[abc] is already declared; cannot redeclare at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51 at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51:3 on node my-test-node Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Would this be possible in any other way or am I doing it totally wrong? Many thanks for your feedback

Regards Tomas

Get variable from module A into module B

Hi, I'm trying to get a variable value from one class into another class (different modules) but run into issues. From what I have read in the docs you are supposed to be able to include a class multiple times without running into "already declared..." ?!

What I'm trying to do:

Module A (class "abc")

abcvar = 'something'

Module B (class "xyz")

  include abc
  notify {"######my var is: ${$abc::abcvar}": }

site.pp

 node 'my-test-node'   {
     class {'abc':
       abcvar => 'somethingelse',
        }  
  include xyz  
 }

include xyz
}

Result


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[abc] is already declared; cannot redeclare at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51 at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51:3 on node my-test-node Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Would this be possible in any other way or am I doing it totally wrong? Many thanks for your feedback

Regards Tomas

Get variable from module A into module B

Hi, I'm trying to get a variable value from one class into another class (different modules) but run into issues. From what I have read in the docs you are supposed to be able to include a class multiple times without running into "already declared..." ?!

What I'm trying to do:

Module A (class "abc")

abcvar = 'something'

Module B (class "xyz")

  include abc
  notify {"######my var is: ${$abc::abcvar}": }

site.pp

  node 'my-test-node'   {
        class {'abc':
          abcvar => 'somethingelse',
        }  
  include xyz  
 }

Result


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[abc] is already declared; cannot redeclare at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51 at /etc/puppetlabs/code/environments/puppet_test/manifests/site.pp:51:3 on node my-test-node Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Would this be possible in any other way or am I doing it totally wrong? Many thanks for your feedback

Regards Tomas