-
Notifications
You must be signed in to change notification settings - Fork 21
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-6697) Implement packageprovider type and provider #9
Conversation
lib/puppet/type/packageprovider.rb
Outdated
|
||
newproperty(:ensure) do | ||
newvalue(:present) do | ||
provider.create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot delete packageproviders or modify them once created, as there is no external official API to do so
@RandomNoun7 @michaeltlombardi review plz thx |
@hbuckle Are you ok with this implementation? |
flush_command << " -#{key} '#{value}'" | ||
end | ||
end | ||
require 'pry';binding.pry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
Should it be |
Tests pass on my machine. :) |
Hey all, sorry for the delay, github isn't sending me notifications on these for some reason. Will check this first thing tomorrow |
@jpogran Needs a rebase |
Should the RequiredVersion parameter be exposed as well seeing as there are multiple versions of the nuget provider available? Find-PackageProvider -Name nuget -AllVersions
Name Version Source Summary
---- ------- ------ -------
nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.207 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.206 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.205 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.204 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.202 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.201 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.127 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.122 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.101 https://onege... NuGet provider for the OneGet meta-package manager
nuget 2.8.5.24 https://onege... NuGet provider for the OneGet meta-package manager |
@hbuckle I certainly don't have a problem with exposing it for the sake of completeness. |
@hbuckle I added a |
@RandomNoun7 I add more information to the readme. Can you see if is easier to understand? |
README.md
Outdated
In order to use this module to to get packages from a PSRepository like the `PSGallery`, you will have to ensure the `Nuget` provider is installed: | ||
|
||
```puppet | ||
pspackageprovider {'ExampleProvider': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Nuget
rather than ExampleProvider
?
README.md
Outdated
```puppet | ||
pspackageprovider {'Nuget': | ||
ensure => 'present', | ||
sourece_location => 'C:\some\location', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - spelling of source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
flush_command << " -#{key} '#{value}'" | ||
end | ||
end | ||
self.class.invoke_ps_command flush_command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flush_command will need a -Force on it otherwise you get a prompt when installing a new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh! Good catch again!
@(Get-PackageProvider).foreach({ | ||
[ordered]@{ | ||
'name' = $_.Name.ToLower() | ||
'source_location' = $_.ProviderPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provider path is where the packageprovider is installed to not where it is installed from so this will always be different. There is a Source property, although I haven't checked if it is populated when installing from a custom source.
It might make more sense to have source_location as a parameter rather than a property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(tableflip). Need to think on this more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, after trying things out manually, I can't get this to work regardless. OneGet/oneget#308 details the problem and that there hasn't been a resolution.
A workaround is to file copy the DLL yourself to the expected location, which we could add as a README.
I am going to remove source paramter, update the ticket with this information and create a new ticket to discuss adding the source parameter as a later date
<<-COMMAND | ||
@(Get-PackageProvider).foreach({ | ||
[ordered]@{ | ||
'name' = $_.Name.ToLower() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the name is always ToLower I think you need a corresponding munge(&:downcase) in the type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Munge added
README.md
Outdated
## Limitations | ||
|
||
Note that PowerShell modules can be installed side by side so installing a newer | ||
version of a module will not remove any previous versions. | ||
|
||
- As detailed in https://github.com/OneGet/oneget/issues/308, installing PackageProviders from a offline location instead of online is currently not working. A workaround is to use the Puppet file resource to ensure the prescence of the file before attempting to use the NuGet PackageProvider. | ||
|
||
The following is an incompe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
README.md
Outdated
### Install PowerShellGet PackageProviders | ||
|
||
|
||
You can install PackageProviders for PowerShelLGet using the `pspackageprovieder` type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in pspackageprovider
Manual verification of changes complete on a Windows 2008r2 WMF5 machine. Output pasted below. These changes look good to go to me.
|
This commit adds a new type and provider for managing the PowerShellGet package providers. **Note** The official API at this time does not allow removing PowerShellGet PackageProviders. There is a way to delete the source_location to remove a PackageProvider, but this is an unsupported method that may cause side effects. Thus this provider only implements create and update.
This PR adds a new type and provider to correctly setup PowerShellGet PackageProviders.
Note, there is no official API to remove a PackageProvider, so this provider does not implement a destroy, only create and update.