-
Notifications
You must be signed in to change notification settings - Fork 4k
Marketplace ordering Add Get/Set-AzureRmMarketplaceTerms Cmdlets #4694
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
Marketplace ordering Add Get/Set-AzureRmMarketplaceTerms Cmdlets #4694
Conversation
Can one of the admins verify this patch? |
@azuresdkci add to whitelist |
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.
@prbansa a few initial comments.
Also, it looks like you will need to regenerate the wxi
file as there are a lot of unnecessary changes made to that file.
@cormacpayne - Need some help to fix the wxi file, not sure what needs to be done, this was autogenerated
thanks @cormacpayne , updated the wxi file.
# RootModule = '' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '1.0.0' |
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.
@prbansa please set this to version 0.1.0
, which is the initial version we set for all modules.
--> | ||
## Current Release | ||
|
||
## Version 1.0.0 |
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.
@prbansa please remove this header and put all information under the Current Release
header. We have a script that runs during the release that will place all of this information under the correct header.
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.
Done
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("0.0.1")] | ||
[assembly: AssemblyFileVersion("0.0.1")] |
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.
@prbansa both of these versions should match the module version, 0.1.0
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.
Updated
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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.
@prbansa same comment about these versions matching the module version, 0.1.0
``` | ||
|
||
### -InputObject | ||
Terms object returned in Get-AzureRmMarketplaceTerms cmdlet. This is a mandatory parameter if Accepted paramter is true.```yaml |
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.
@prbansa the ```yaml
string at the end should be moved to a line by itself; this is a bug with platyPS
. Please see other parameters in this file for an example of how this should look.
|
||
namespace Microsoft.Azure.Commands.MarketplaceOrdering.Cmdlets.Agreements | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "AzureRmMarketplaceTerms", DefaultParameterSetName = Constants.ParameterSetNames.AgreementParameterSet), OutputType(typeof(PSAgreementTerms))] |
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.
@prbansa I missed the design review for these cmdlets, so this may have been answered: is this a resource that can be created for a specific subscription, or even a resource group? Most Get-*
cmdlets support providing no parameters (returns all resources in the subscription) or providing a resource group (returns all resources in the resource group).
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.
@cormacpayne - Get-AzureRmMarketplaceTerms returns "Terms" object which user can accept and fully automate 3rd party VM deployment experience.
This is not a resource so Get-* is not supported in this case.
[Parameter(Mandatory = false, ValueFromPipeline = true, HelpMessage = "Terms object returned in Get-AzureRmMarketplaceTerms cmdlet. This is a mandatory parameter if Accepted paramter is true.", ParameterSetName = Constants.ParameterSetNames.AgreementParameterSet)] | ||
[ValidateNotNullOrEmpty] | ||
[Alias("Terms")] | ||
public PSAgreementTerms InputObject { get; set; } |
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.
@prbansa InputObject
should be in a separate parameter set from Publisher
, Product
and Name
since it will already have the values for these parameters (they should be properties of the object returned from the Get-*
cmdlet).
Also, this parameter should accept its value from the pipeline, which will allow a user to pipe the result from the Get-*
cmdlet into this parameter. Please take a look at this guide.
|
||
[Parameter(Mandatory = true, HelpMessage = "Boolean which would indicate the status of acceptance of the terms, it should be true if any version of the terms have been accepted.", ParameterSetName = Constants.ParameterSetNames.AgreementParameterSet)] | ||
[ValidateNotNullOrEmpty] | ||
public SwitchParameter Accepted { get; set; } |
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.
@prbansa take another look at this parameter after moving the InputObject
parameter into a separate parameter set. Right now it is a mandatory SwitchParameter, meaning it should always be provided in the single parameter set that exists today, which provides no value to the cmdlet.
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.
@cormacpayne Let's discuss this, I changed this from bool based on comment I got on this PR
https://github.com/Azure/azure-powershell-pr/pull/331
Look for comments on this file -MarketplaceOrdering/Cmdlets/Agreements/SetAzureRmMarketplaceTerms.cs
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.
changed to bool as discussed
@cormacpayne - updated after review, please look at my changes. Let's work together to fix wxi file |
``` | ||
|
||
### -DefaultProfile | ||
The credentials, account, tenant, and subscription used for communication with azure.```yaml |
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 ```yaml
text needs to be on a line by itself; this is a bug in the platyPS module. Please see the below parameters for how this should look.
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.
@prbansa a couple minor things I forgot to mention:
(1) You will need to add your module to the AzureRM.psd1
roll-up module. This will ensure that your cmdlets are installed when a user runs Install-Module AzureRM
.
(2) In order for your tests to be run, you will need to make sure they get picked up by our Smart Tester (which scans the files in a PR and runs tests associated with the files changed). To do so, you will need to update the following things:
- Add your test dll to this json file (you can follow the format of the other services)
- There are a few tests with hard-coded values in the Smart Tester that fail whenever a new module is added, so would you mind adding a
Skip
to these tests so you don't have to deal with updating the values? We will create a work item to update these values.- https://github.com/Azure/azure-powershell/blob/preview/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks.Test/TestSetGeneratorTester.cs#L391
- https://github.com/Azure/azure-powershell/blob/preview/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks.Test/TestSetGeneratorTester.cs#L451
- https://github.com/Azure/azure-powershell/blob/preview/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks.Test/TestSetGeneratorTester.cs#L543
@cormacpayne Updated the code as discussed, I like to understand how to skip the tests as you suggested. |
@cormacpayne this build failed because of unit tests as you predicted, let me know how can I skip the tests and if any other feedback you have on my latest commit. |
<None Include="ScenarioTests\AgreementsTests.ps1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="SessionRecords\Microsoft.Azure.Commands.MarketplaceOrdering.Test.ScenarioTests.AgreementsTests\TestGetAgreement.json" /> |
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.
Session records should all be copied to output directory (similar to ScenarioTest\AgreementTests.ps1 above) - this should solve your issue.
<None Include="SessionRecords\Microsoft.Azure.Commands.MarketplaceOrdering.Test.ScenarioTests.AgreementsTests\TestGetAgreement.json" > <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>
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.
Sure will update this
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.
@prbansa two minor comments, otherwise LGTM
``` | ||
|
||
### -Reject | ||
Pass this to reject the legal terms.```yaml |
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.
@prbansa looks like the ```yaml
string got added to the wrong line in the last commit
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.
yes, fixed.
} | ||
catch (ErrorResponseException e) | ||
{ | ||
WriteWarning(e.Body.Error.Message); |
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.
@prbansa I think we should do some null-checking around this, I would hate for the actual cmdlet error to not get bubbled up because some part of this chain is null
@prbansa you will need to resolve the merge conflicts; I sent you a message offline about how to do so. Also, the on-demand job is failing StaticAnalysis because the noun used for a couple of cmdlets/parameters is plural, which goes against PowerShell guidance. However, in this case, it is allowed, so you will need to suppress these errors. To do so, you will need to open on-demand job and open the |
…s for workernode during cluster creation.
…e to comments on PR
…SetGeneratorTester.cs
…ated Set-AzureRmMarketplaceTerms.md
3865fa3
to
9278752
Compare
@cormacpayne , @markcowl I have made the necessary changes to merge the conflicts in wxi, it gave some trouble. |
On-demand: http://azuresdkci.cloudapp.net/job/powershell-demand/1913/ |
# ProcessorArchitecture = '' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '3.4.0'; }) |
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.
This version will need to be updated for the preview branch
…hell into MarketplaceOrdering_CmdLets # Conflicts: # tools/AzureRM/AzureRM.psd1
On-demand: http://azuresdkci.cloudapp.net/job/powershell-demand/1920/ |
@cormacpayne - I tested the installer from - http://azuresdkci.cloudapp.net/job/posh-pack/37/artifact/setup/build/Debug/ |
on demand run here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1927/ release build here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/posh-release/3/ |
Description
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines