Skip to content

(PUP-8632) device --apply works without a cert#6863

Merged
DavidS merged 1 commit intopuppetlabs:5.5.xfrom
tphoney:PUP-8632
Jun 28, 2018
Merged

(PUP-8632) device --apply works without a cert#6863
DavidS merged 1 commit intopuppetlabs:5.5.xfrom
tphoney:PUP-8632

Conversation

@tphoney
Copy link
Copy Markdown
Contributor

@tphoney tphoney commented Jun 1, 2018

puppet device --apply, doesnt error without having to register it with a puppet master.

@tphoney
Copy link
Copy Markdown
Contributor Author

tphoney commented Jun 1, 2018

@joshcooper Thanks for the last merge, i need some feedback on this PR. When writing the logs/reports for the first time (specifically when creating the folders), it would fail. This PR makes the directory creation like "mkdir -p".
The tests i removed relied on the fact that folder creation fails on nested folders. I removed them, but i am open to alternatives.
Is this ok ?

@puppetcla
Copy link
Copy Markdown

CLA signed by all contributors.

@joshcooper
Copy link
Copy Markdown
Contributor

I'd rather not change uniquefile to create parent directories. I would think the device application just needs to call Puppet.settings.use with the sections it needs. We had similar problems with puppet apply fixed in f3f1702.

@tphoney
Copy link
Copy Markdown
Contributor Author

tphoney commented Jun 5, 2018

@joshcooper No worries, i have changed the approach so there is less impact outside of device.
I could not use settings :device as it would require a cert being setup. This just makes sure the cache folder structure exists.

@tphoney
Copy link
Copy Markdown
Contributor Author

tphoney commented Jun 11, 2018

@joshcooper can you have another look please.

@joshcooper
Copy link
Copy Markdown
Contributor

Sorry was out on PTO. I don't have an opinion on the changes, but it'd be good to have a test.

puppet device --apply, now works without having to register it with a puppet master.
@tphoney
Copy link
Copy Markdown
Contributor Author

tphoney commented Jun 28, 2018

Hope you had a good break @joshcooper . I added tests around the logic. @DavidS can you merge

Copy link
Copy Markdown
Contributor

@DavidS DavidS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on my local testcase, and puppet device --apply ... did work on an empty ~/.puppetlabs:

david@davids:~/git/puppetlabs-panos$ rm -Rf ~/.puppet*
david@davids:~/git/puppetlabs-panos$ bundle exec puppet device --modulepath spec/fixtures/modules/ --deviceconfig spec/fixtures/device.conf --target pavm --verbose --trace --apply examples/test_commit.pp
Notice: Compiled catalog for pavm in environment production in 0.08 seconds
Info: Applying configuration version '1530189079'
[...]
Info: Creating state file /home/david/.puppetlabs/opt/puppet/cache/devices/pavm/state/state.yaml
Notice: Applied catalog in 0.17 seconds
david@davids:~/git/puppetlabs-panos$ find ~/.puppetlabs/
/home/david/.puppetlabs/
/home/david/.puppetlabs/etc
/home/david/.puppetlabs/etc/puppet
/home/david/.puppetlabs/etc/puppet/ssl
/home/david/.puppetlabs/etc/puppet/ssl/certificate_requests
/home/david/.puppetlabs/etc/puppet/ssl/private_keys
/home/david/.puppetlabs/etc/puppet/ssl/public_keys
/home/david/.puppetlabs/etc/puppet/ssl/private
/home/david/.puppetlabs/etc/puppet/ssl/certs
/home/david/.puppetlabs/etc/code
/home/david/.puppetlabs/opt
/home/david/.puppetlabs/opt/puppet
/home/david/.puppetlabs/opt/puppet/cache
/home/david/.puppetlabs/opt/puppet/cache/state
/home/david/.puppetlabs/opt/puppet/cache/state/graphs
/home/david/.puppetlabs/opt/puppet/cache/client_data
/home/david/.puppetlabs/opt/puppet/cache/facts.d
/home/david/.puppetlabs/opt/puppet/cache/clientbucket
/home/david/.puppetlabs/opt/puppet/cache/preview
/home/david/.puppetlabs/opt/puppet/cache/lib
/home/david/.puppetlabs/opt/puppet/cache/locales
/home/david/.puppetlabs/opt/puppet/cache/devices
/home/david/.puppetlabs/opt/puppet/cache/devices/pavm
/home/david/.puppetlabs/opt/puppet/cache/devices/pavm/state
/home/david/.puppetlabs/opt/puppet/cache/devices/pavm/state/transactionstore.yaml
/home/david/.puppetlabs/opt/puppet/cache/devices/pavm/state/last_run_report.yaml
/home/david/.puppetlabs/opt/puppet/cache/devices/pavm/state/state.yaml
/home/david/.puppetlabs/opt/puppet/cache/devices/pavm/state/last_run_summary.yaml
/home/david/.puppetlabs/opt/puppet/cache/client_yaml
/home/david/.puppetlabs/var
/home/david/.puppetlabs/var/log
/home/david/.puppetlabs/var/run
david@davids:~/git/puppetlabs-panos$ 

@DavidS DavidS merged commit 2ec7ea0 into puppetlabs:5.5.x Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants