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

(MODULES-3037) Manage sources #1

Merged

Conversation

ferventcoder
Copy link

@ferventcoder ferventcoder commented Mar 15, 2016

Provide the ability manage a source with a custom type and provider.
This allows a source to be ensurable, and also allows for a source to
be manageable in the same converge that Chocolatey is installed
during. This further allows for installing packages from custom
sources all in the same Puppet run.

@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch 2 times, most recently from bf02558 to c00496f Compare March 16, 2016 23:08
@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch from c00496f to 9b0f33f Compare April 21, 2016 23:24
@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch 3 times, most recently from d4ef65d to 00a0d0e Compare May 6, 2016 23:39
@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch 9 times, most recently from dd56022 to 1a83680 Compare May 13, 2016 20:25
@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch from 1a83680 to 3ca0c2e Compare May 13, 2016 20:49
describe 'Chocolatey Common' do

context 'on Windows', :if => Puppet::Util::Platform.windows? do

Copy link
Author

Choose a reason for hiding this comment

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

This is empty right now, but I wanted to get eyes on this so we can get it merged and through soon. So we can pick this up in other tickets or as maint.

@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch from 3ca0c2e to a9f159a Compare May 13, 2016 20:58
@ferventcoder ferventcoder changed the title (MODULES-3037) WIP (MODULES-3037) Manage sources May 13, 2016
@ferventcoder
Copy link
Author

@puppetlabs/windows please review.

@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch 2 times, most recently from 10e5f8f to 187c92c Compare May 13, 2016 22:22
if Puppet::Util::Platform.windows?
chocoInstallPath = PuppetX::Chocolatey::ChocolateyInstall.install_path
#default_location = $::choco_installpath || ENV['ALLUSERSPROFILE'] + '\chocolatey'
chocopath = ('C:\ProgramData\chocolatey' if file_exists?('C:\ProgramData\chocolatey\bin\choco.exe')) ||

Choose a reason for hiding this comment

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

I'm not 100% comfortable with using a hardcoded path for C:\ProgramData. It tends to be surfaced as %ALLUSERSPROFILE% or at least %SYSTEMDRIVE%\ProgramData

Copy link
Author

Choose a reason for hiding this comment

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

This section is a straight copy from the package provider. There be voodo and reasons there, they haven't been all determined yet.

@glennsarti
Copy link

Is it worth refactoring out the "magic" version numbers in the unit tests e.g. 0.9.9.10 etc?

@ferventcoder
Copy link
Author

Is it worth refactoring out the "magic" version numbers in the unit tests e.g. 0.9.9.10 etc?

Yeah, I think we should make it clearer - I'll change it to minimum_supported_version - that should make it pretty clear what is being tested.

@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch from 187c92c to 8a97145 Compare May 17, 2016 17:31

context 'on Linux', :if => Puppet.features.posix? do
it "should return the default install path on a non-windows system" do
PuppetX::Chocolatey::ChocolateyInstall.install_path.must == 'C:\ProgramData\chocolatey'

Choose a reason for hiding this comment

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

This seems counter-intuitive. On a linux system wouldn't the install path be nil or empty?

Copy link
Author

Choose a reason for hiding this comment

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

Default path when one is not found.

@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch 3 times, most recently from 382550d to 1ff4c3e Compare May 17, 2016 23:57
@ferventcoder
Copy link
Author

@puppetlabs/windows paired with @glennsarti some today on this as we fought through refactoring the Chocolatey package provider bits to get them to use PuppetX::Chocolatey::ChocolateyCommon. Lots of tests needed touched and adjusted.

There may be an underlying issue or two with when choco.exe is actually found (every system that runs these tests has Chocolatey installed). We removed it for a bit to ensure things would work without it.

@ferventcoder
Copy link
Author

ferventcoder commented May 18, 2016

I'll pick these up tomorrow and work to get them overridden. All ready to go

- Move chocolatey_spec to spec/unit/puppet/provider/package
- Add tests around `PuppetX::ChocolateyInstall`.
- Lean out tests for `choco_install_path` Fact since it calls
`PuppetX::ChocolateyInstall `.
Move the bits for the fact `chocolateyversion` to
`PuppetX::Chocolatey::ChocolateyVersion`. Move the tests around and
update appropriately as well.

Also when working against 0.9.8.33, handle the warning message
that is shown to users before the version message.
If a registry check does not turn up results, ChocolateyInstall should
fall back to looking at process/user environment variable to determine
if the environment variable `ChocolateyInstall` is defined.
When working with Chocolatey, there are common calls that are necessary
to complete operations using choco. Create that as a PuppetX module to
be used by providers.
The package provider for Chocolatey should use the ChocolateyCommon
methods instead of maintaining its own version of those methods.
Refactor it to use those instead.
Provide the ability manage a source with a custom type and provider.
This allows a source to be ensurable, and also allows for a source to
be manageable in the same converge that Chocolatey is installed
during. This further allows for installing packages from custom
sources all in the same Puppet run.
@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-3037-source branch from 28bd939 to 086cb40 Compare May 20, 2016 19:52
@ferventcoder
Copy link
Author

@puppetlabs/windows all comments have been addressed. Ready to go.

@glennsarti
Copy link

Looks good to me.

@glennsarti glennsarti merged commit e08b0dd into puppetlabs:master May 20, 2016
@ferventcoder ferventcoder deleted the ticket/master/MODULES-3037-source branch May 20, 2016 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants