zend-patterns / ZendServerPuppet

ZendServerPuppet
Apache License 2.0
6 stars 16 forks source link

zend_api_key_hash fact not available after zendserver::bootstrap #11

Open evsheffield opened 8 years ago

evsheffield commented 8 years ago

I have been able to reproduce this issue using the Vagrant test box: https://github.com/davidl-zend/zendserverpuppet-vagrant. I followed the set up instructions in the README, with the additional step that I modified manifests/site.pp for the test box to the following:

class {'zendserver':
  admin_password => 'password',
  phpversion => '5.6',
  zend_server_version => '8.5',
  admin_api_key_name => 'admin',
  create_facts => true
}

On the first vagrant up, you can see in the output that the API hash $::zend_api_key_hash is not available even after Zend Server has bootstrapped. (this is the notice created in manifests/init.pp which requires Class['zendserver::bootstrap'])

==> debianbox: Notice: zendserversetup hash
==> debianbox: Notice: /Stage[main]/Zendserver/Notify[zendserversetup hash ]/message: defined 'message' as 'zendserversetup hash '

If you run a subsequent vagrant reload --provision, then the fact file has already been created before the manifest is applied, so the hash is loaded correctly:

==> debianbox: Notice: zendserversetup hash cc8076657313ade468b98f84670a2108e2fe3aa7bd81a893e59801fc0bbdd65b
==> debianbox: Notice: /Stage[main]/Zendserver/Notify[zendserversetup hash cc8076657313ade468b98f84670a2108e2fe3aa7bd81a893e59801fc0bbdd65b]/message: defined 'message' as 'zendserversetup hash cc8076657313ade468b98f84670a2108e2fe3aa7bd81a893e59801fc0bbdd65b'

I'm very new to Puppet, so I don't know what the origin of the issue is. I know that Puppet loads facts before applying a manifest, but is it "refreshed" during an apply so that it can find facts created during the run? Ideally it should be recognized immediately after the fact file is created so that in other parts of the manifest you can use it to interact with zs-manage, for example.

ubellavance commented 7 years ago

You should provide your own 64-bit secret in your manifest. You won't need access to the hash anymore if you do that.

ubellavance commented 7 years ago

@evsheffield can we close this issue?