Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise logging of files used to create answer input to UI level #137

Open
cvquesty opened this issue May 11, 2017 · 10 comments
Open

Raise logging of files used to create answer input to UI level #137

cvquesty opened this issue May 11, 2017 · 10 comments
Milestone

Comments

@cvquesty
Copy link
Contributor

I have a project I've maintained for quite some time. I generally increment the version number, the provisioner reads the custom pe.conf and builds the appropriate machine as requested.

Today, with the release of 2017.2.1, this functionality has broken.

vagrant-pe_build (0.17.4)

  • Version Constraint: > 0

Vagrantfile provisioner code:

master.vm.provision :pe_bootstrap do |provisioner|
provisioner.role = :master
provisioner.answer_file = 'provision/pe.conf'
end
master.vm.provision :shell, path: "provision/master.sh"
end

a "vagrant up" causes the provisioner to fire, but it never calls the pe.conf.

Immediately following the successful RPM installation of
pe-installer
pe-modules
puppet-agent

it goes straight to evaluating it's own master.txt rather than my specified pe.conf. I also tried moving the pe.conf out of the "provision" subdirectory to no success.

Log output:

==> master: ## We're checking if /vagrant/.pe_build/answers/master.txt contains valid HOCON syntax...
==> master:
==> master:
==> master: ## We're configuring PE using /vagrant/.pe_build/answers/master.txt.

@Sharpie
Copy link
Member

Sharpie commented May 11, 2017

The answer_file parameter is a bit poorly named, it should really be answer_template. The file gets read, passed to ERB to evaluate and template statements, and then the results get written to /vagrant/.pe_build/answers/master.txt.

If you run Vagrant with logging raised to INFO:

VAGRANT_LOG=INFO vagrant up

Somewhere in the epic amount of logs that spew out there should be a line starting with INFO answers_file: that shows which template was read to generate /vagrant/.pe_build/answers/master.txt:

For example using:

$ tree
.
├── Vagrantfile
└── provision
    └── pe.conf

$ cat Vagrantfile
# chdir ensures all relative paths expand relative to the Vagrantfile
# when the vagrant command is run from a subdirectory.
Dir.chdir(File.dirname(__FILE__))

Vagrant.configure('2') do |config|

  config.vm.define(:master) do |master|
    master.vm.hostname = 'master.testnet'
    master.vm.box = 'puppetlabs/centos-7.0-64-nocm'

    master.vm.provision(:pe_bootstrap) do |provisioner|
      provisioner.version = '2017.2.1'
      provisioner.role = :master
      provisioner.answer_file = 'provision/pe.conf'
    end
  end
end

I get:

 INFO answers_file: Using explicit answers file template provision/pe.conf for #<Vagrant::Machine: master (VagrantPlugins::ProviderVirtualBox::Provider)>

If the default template is used, you should see a message like:

INFO answers_file: Using default answers file template /Users/sharpie/.vagrant.d/gems/gems/vagrant-pe_build-0.17.4/templates/answers/master-2016.2.x.conf.erb for #<Vagrant::Machine: pe-201721-master (VagrantPlugins::Openstack::Provider)>

Let me know what you see when the provisioner runs. If nothing else, we should move this info up to the top-level logger so that it isn't buried down in the Vagrant log noise.

@cvquesty
Copy link
Contributor Author

I see the following regarding where it's getting its own pe.conf:

==> master: 2017-05-11 17:47:48,661 Running command: cp /vagrant/.pe_build/answers/master.txt /etc/puppetlabs/enterprise/conf.d/pe.conf

Is this the output you were looking for? (trying to NOT copy in a crazy amount of output)

@Sharpie
Copy link
Member

Sharpie commented May 11, 2017

Nope. The /vagrant/.pe_build/answers/master.txt file is the end result of answer_file being read and then rendered as a template. The log line that shows which file was read to create master.txt starts with INFO answers_file: and only shows up when VAGRANT_LOG=info.

@cvquesty
Copy link
Contributor Author

Sorry.. I'm an idiot. Ok, here's what appears to be pertinent. (you're right... this is huge)

INFO answers_file: Using explicit answers file template provision/pe.conf for #<Vagrant::Machine: master (VagrantPlugins::ProviderVirtualBox::Provider)>
INFO answers_file: Writing answers file for #<Vagrant::Machine: master (VagrantPlugins::ProviderVirtualBox::Provider)> to /Users/jsheetsjr/Projects/Vagrant/centos7-pe2017.2.1/.pe_build/answers/master.txt
...
...
INFO guest: Execute capability: run_install [#<Vagrant::Machine: master (VagrantPlugins::ProviderVirtualBox::Provider)>, "/vagrant/.pe_build/puppet-enterprise-2017.2.1-el-7-x86_64", "/vagrant/.pe_build/answers/master.txt", {:use_pem=>true, :update_gpg=>false}] (redhat)
INFO ssh: Execute: /vagrant/.pe_build/puppet-enterprise-2017.2.1-el-7-x86_64/puppet-enterprise-installer -c /vagrant/.pe_build/answers/master.txt (sudo=true)
...
...
INFO interface: info: 2017-05-11 18:51:35,278 Running command: cp /vagrant/.pe_build/answers/master.txt /etc/puppetlabs/enterprise/conf.d/pe.conf
INFO interface: info: ==> master: 2017-05-11 18:51:35,278 Running command: cp /vagrant/.pe_build/answers/master.txt /etc/puppetlabs/enterprise/conf.d/pe.conf
==> master: 2017-05-11 18:51:35,278 Running command: cp /vagrant/.pe_build/answers/master.txt /etc/puppetlabs/enterprise/conf.d/pe.conf
...
...
FIRST ERROR <= jms
INFO interface: info: 2017-05-11 18:51:38,100 - [Error]: Evaluation Error: Error while evaluating a Function Call, Class[Puppet_enterprise]: expects a value for parameter $puppet_master_host at line 1:1 on node master.puppetlabs.vm
INFO interface: info: ==> master: 2017-05-11 18:51:38,100 - [Error]: Evaluation Error: Error while evaluating a Function Call, Class[Puppet_enterprise]: expects a value for parameter $puppet_master_host at line 1:1 on node master.puppetlabs.vm
==> master: 2017-05-11 18:51:38,100 - [Error]: Evaluation Error: Error while evaluating a Function Call, Class[Puppet_enterprise]: expects a value for parameter $puppet_master_host at line 1:1 on node master.puppetlabs.vm
...
...
SECOND ERROR <= jms
==> master: * /opt/puppetlabs/puppet/bin/puppet infrastructure configure --detailed-exitcodes --modulepath /opt/puppetlabs/server/data/enterprise/modules
INFO interface: info: * returned: 1
INFO interface: info: ==> master: * returned: 1
==> master: * returned: 1
INFO interface: info: 2017-05-11 18:51:38,139 [ERROR]: !! There were problems during the application of the installation catalog. !!
INFO interface: info: ==> master: 2017-05-11 18:51:38,139 [ERROR]: !! There were problems during the application of the installation catalog. !!
==> master: 2017-05-11 18:51:38,139 [ERROR]: !! There were problems during the application of the installation catalog. !!

That's what appears to be the pertinent lines. I'll attach a file of the log if you're interested.

@cvquesty
Copy link
Contributor Author

Vagrant_Output.txt

@Sharpie
Copy link
Member

Sharpie commented May 11, 2017

Looks like your configured provision/pe.conf file is being used:

INFO answers_file: Using explicit answers file template provision/pe.conf for #<Vagrant::Machine: master (VagrantPlugins::ProviderVirtualBox::Provider)>

From the error message, Class[Puppet_enterprise]: expects a value for parameter $puppet_master_host, I'd guess that the "puppet_enterprise::puppet_master_host" setting wasn't in the pe.conf file. Make sure something like the following is there:

# The two required bits of configuration data for a monolithic install
"console_admin_password": "puppetlabs"
"puppet_enterprise::puppet_master_host": "%{::trusted.certname}"

You can view the answer content that was generated by running the following from the directory containing the Vagrantfile:

cat .pe_build/answers/master.txt

@cvquesty
Copy link
Contributor Author

Well, this is awesome-peachy. There is a new pe.conf that comes with the new PE. It doesn't have that setting in it at all. This is curious to say the least. Let me put that value in and then have a look. I'll update here.

@cvquesty
Copy link
Contributor Author

got considerably further, but added errors... still suggesting something about the answers file:

/vagrant/.pe_build/puppet-enterprise-2017.2.1-el-7-x86_64/puppet-enterprise-installer -c /vagrant/.pe_build/answers/master.txt

Stdout from the command:

/vagrant/.pe_build/puppet-enterprise-2017.2.1-el-7-x86_64 /home/vagrant

I'll pick up in the morning.

@cvquesty
Copy link
Contributor Author

You know what? This is likely a PE lack of full documentation on the pe.conf. I'll close this since it isn't this project's problem. Thanks so much, @Sharpie . You're a rockstar!

@Sharpie
Copy link
Member

Sharpie commented May 13, 2017

Aww, thanks! For pe.conf settings, a good source of info is the "text-mode installation" section of the docs:

https://docs.puppet.com/pe/2017.2/install_pe_conf_param.html

I'm going to re-open this just so there's a TODO hanging around for improving the logging around which input file gets used to create the answer file passed to the installer. Having that buried down in the INFO firehose isn't very useful.

@Sharpie Sharpie reopened this May 13, 2017
@Sharpie Sharpie changed the title vagrant-pe_build refuses to observe custom pe.conf Raise logging of files used to create answer input to UI level May 13, 2017
@Sharpie Sharpie added this to the 0.18.0 milestone May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants