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

Marketplace item generation executable download does not handle disconnected environments #313

Open
MatthewMcGlynn opened this issue Aug 23, 2017 · 6 comments

Comments

@MatthewMcGlynn
Copy link
Contributor

No description provided.

@MatthewMcGlynn
Copy link
Contributor Author

A new parameter is needed to ingest the marketplace item packager from a local path

@dfencegit
Copy link

Hi

I tweaked the code in AzureStack.ComputeAdmin.psm1 to allow you to specify a pre-downloaded Marketplace Item generator package so that you can do an offline install, give it a try.

137a138,140

    [Parameter()]
    [string] $MarketPlaceZipPath = '',

300c303
< $GalleryItem = CreateGalleryItem -publisher $publisher -offer $offer -sku $sku -version $version -osType $osType -title $title -description $description

    $GalleryItem = CreateGalleryItem -publisher $publisher -offer $offer -sku $sku -version $version -osType $osType -title $title -description $description -MarketPlaceZipPath "$MarketPlaceZipPath"

473c476,479
< [bool] $Net35 = $true

    [bool] $Net35 = $true,

    [Parameter()]
    [string] $MarketPlaceZipPath

660c666
< Add-AzsVMImage -sku $sku -osDiskLocalPath $ImagePath @PublishArguments -title "Windows Server 2016 Datacenter Core Eval" -description $description -CreateGalleryItem $CreateGalleryItem

                Add-AzsVMImage -sku $sku -osDiskLocalPath $ImagePath @PublishArguments -title "Windows Server 2016 Datacenter Core Eval" -description $description -CreateGalleryItem $CreateGalleryItem -MarketPlaceZipPath "$MarketPlaceZipPath"

694c700
< Add-AzsVMImage -sku $sku -osDiskLocalPath $ImagePath @PublishArguments -title "Windows Server 2016 Datacenter Eval" -description $description -CreateGalleryItem $CreateGalleryItem

                Add-AzsVMImage -sku $sku -osDiskLocalPath $ImagePath @PublishArguments -title "Windows Server 2016 Datacenter Eval" -description $description -CreateGalleryItem $CreateGalleryItem -MarketPlaceZipPath "$MarketPlaceZipPath"

732c738,740
< [string] $Description

    [string] $Description,

    [string] $MarketPlaceZipPath = ''

742,752c750,764
<
< $maxAttempts = 5
< for ($retryAttempts = 1; $retryAttempts -le $maxAttempts; $retryAttempts++) {
< try {
< Write-Verbose -Message "Downloading Azure Stack Marketplace Item Generator Attempt $retryAttempts" -Verbose
< Invoke-WebRequest -Uri http://www.aka.ms/azurestackmarketplaceitem -OutFile "$workdir\MarketplaceItem.zip"
< break
< }
< catch {
< if ($retryAttempts -ge $maxAttempts) {
< Write-Error "Failed to download Azure Stack Marketplace Item Generator" -ErrorAction Stop

# Check if we were provided with the MarketPlace Item Generator File
if ( $MarketPlaceZipPath = '' )
{
    $maxAttempts = 5
    for ($retryAttempts = 1; $retryAttempts -le $maxAttempts; $retryAttempts++) {
        try {
            Write-Verbose -Message "Downloading Azure Stack Marketplace Item Generator Attempt $retryAttempts" -Verbose
            Invoke-WebRequest -Uri http://www.aka.ms/azurestackmarketplaceitem -OutFile "$workdir\MarketplaceItem.zip"
            break
        }
        catch {
            if ($retryAttempts -ge $maxAttempts) {
                Write-Error "Failed to download Azure Stack Marketplace Item Generator" -ErrorAction Stop
            }

755a768,786

else
{
    # Copy the provided file into the working directory
    if ( Test-Path -Path "$MarketPlaceZipPath" )
    {
        try {
            Write-Verbose -Message "Copying Market Place Item Generator zip file into working directory" -Verbose
            copy-item -Path "$MarketPlaceZipPath" -Destination "$workdir\MarketplaceItem.zip"
        }
        catch
        {
            Write-Error "Failed to copy Market Place Item Generator zip into working directory: $_" -ErrorAction Stop
        }
    }
    else
    {
        Write-Error "Provided Market Place Item Generator zip file does not exist" -ErrorAction Stop
    }
}

@dfencegit
Copy link

Sorry, there was an error in that update, new diff attached this time.

AzureStack.ComputeAdmin.psm1.diff.txt

@marcvaneijk
Copy link
Contributor

@dfencegit, thanks! Since you have the diff, can you open a PR?

@dfencegit
Copy link

@marcvaneijk I would happily do that but I dont have access to raise a PR.

@marcvaneijk
Copy link
Contributor

Thanks @dfencegit. The AzureStack-Tools repo is a public repo. Anyone with a GitHub account has access to submit a pull request. It would be great if you can do so. Once you have submitted the PR, we'll evaluate it and if approved, we'll merge it.

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

3 participants