Skip to content

Commit 60b7341

Browse files
committed
remove unnecessary comments and print statements
1 parent f4e7b8e commit 60b7341

File tree

3 files changed

+11
-32
lines changed

3 files changed

+11
-32
lines changed

src/Support/Support.Autorest/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ commit: 99b27b136352e2f16c3f868857fa33157ace895f
3535
require:
3636
# readme.azure.noprofile.md is the common configuration file
3737
- $(this-folder)/../../readme.azure.noprofile.md
38-
# - $(repo)/specification/support/resource-manager/readme.md
3938
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
4039
# - (this-folder)/relative-path-to-your-local-readme.md
4140
input-file:
4241
- $(repo)/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/support.json
43-
# try-require:
44-
# - $(repo)/specification/support/resource-manager/readme.powershell.md
4542

4643
# For new RP, the version is 0.1.0
4744
module-version: 0.1.0

src/Support/Support.Autorest/custom/New-AzSupportFileAndUpload.ps1

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,49 +103,39 @@ param(
103103
)
104104

105105
process {
106-
#Write-Output "file path: " + $FilePath
107106
$FileName = Split-Path $FilePath -Leaf
108-
Write-Output "file name: " $FileName
109107
$MaxChunkSize = 2.5 * 1024 * 1024 #2.5 MB
110108
$MaxFileSize = 5 * 1024 * 1024 #5 MB
111-
Write-Output "about to get file content"
112109
$FileContentBytes = Get-Content -Path $FilePath -Raw
113-
Write-Output "got file content"
110+
114111
if($FileContentBytes -eq $Null){
115112
throw "File cannot be empty"
116113
}
114+
117115
$FileContentByteArray = [System.Text.Encoding]::UTF8.GetBytes($FileContentBytes)
118116
$FileSize = $FileContentByteArray.Length
119-
Write-Output "file size: " $FileSize
117+
120118
if($FileSize -gt $MaxFileSize){
121119
throw "File size is greater than the maximum file size of 5 MB"
122120
}
121+
123122
$ChunkSize = If($FileSize -gt $MaxChunkSize) {$MaxChunkSize} Else {$FileSize}
124-
# Write-Output "Length of byte array: " $FileSize
125-
# Write-Output "Max chunk size: " $MaxChunkSize
126-
# Write-Output "Chunk Size: " $ChunkSize
127123
$NumberOfChunks = [int][Math]::Floor($FileSize / $ChunkSize);
124+
128125
If($FileSize % $ChunkSize -gt 0)
129126
{
130127
$NumberOfChunks++
131128
}
132-
# Write-Output "Number of chunks: " $NumberOfChunks
129+
133130
$PSBoundParameters.Remove('FilePath') | Out-Null
134131
New-AzSupportFile -ErrorAction Stop -Name $FileName -FileSize $FileSize -ChunkSize $ChunkSize -NumberOfChunk $NumberOfChunks @PSBoundParameters
135132

136-
Write-Output "successfully created file"
137133
$chunkIndex = 0
138134
$startIndex = 0
139135
$endIndex = $ChunkSize - 1
140136

141-
# $FileContent = [convert]::ToBase64String((Get-Content -path $FilePath -Encoding byte))
142-
143137
while($chunkIndex -lt $NumberOfChunks){
144-
# Write-Output "chunk index: " + $chunkIndex
145-
# Write-Output "start index: " + $startIndex
146-
# Write-Output "end index: " + $endIndex
147138
$FileContent = [convert]::ToBase64String($FileContentByteArray[$startIndex..$endIndex])
148-
149139
Invoke-AzSupportUploadFile -ErrorAction Stop -FileName $FileName -ChunkIndex $chunkIndex -Content $FileContent @PSBoundParameters
150140
$chunkIndex++
151141
$startIndex = $endIndex + 1

src/Support/Support.Autorest/custom/New-AzSupportFileAndUploadNoSubscription.ps1

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,47 +97,39 @@ param(
9797

9898

9999
process {
100-
Write-Output "file path: " $FilePath
101100
$FileName = Split-Path $FilePath -Leaf
102-
Write-Output "file name: " + $FileName
103101
$MaxChunkSize = 2.5 * 1024 * 1024 #2.5 MB
104102
$MaxFileSize = 5 * 1024 * 1024 #5 MB
105103
$FileContentBytes = Get-Content -Path $FilePath -Raw
104+
106105
if($FileContentBytes -eq $Null){
107106
throw "File cannot be empty"
108107
}
108+
109109
$FileContentByteArray = [System.Text.Encoding]::UTF8.GetBytes($FileContentBytes)
110110
$FileSize = $FileContentByteArray.Length
111+
111112
if($FileSize -gt $MaxFileSize){
112113
throw "File size is greater than the maximum file size of 5 MB"
113114
}
115+
114116
$ChunkSize = If($FileSize -gt $MaxChunkSize) {$MaxChunkSize} Else {$FileSize}
115-
Write-Output "Length of byte array: " $FileSize
116-
Write-Output "Max chunk size: " $MaxChunkSize
117-
Write-Output "Chunk Size: " $ChunkSize
118117
$NumberOfChunks = [int][Math]::Floor($FileSize / $ChunkSize);
118+
119119
If($FileSize % $ChunkSize -gt 0)
120120
{
121121
$NumberOfChunks++
122122
}
123-
Write-Output "Number of chunks: " $NumberOfChunks
124123

125124
$PSBoundParameters.Remove('FilePath') | Out-Null
126125
New-AzSupportFilesNoSubscription -ErrorAction Stop -Name $FileName -FileSize $FileSize -ChunkSize $ChunkSize -NumberOfChunk $NumberOfChunks @PSBoundParameters
127126

128-
Write-Output "successfully created file"
129127
$chunkIndex = 0
130128
$startIndex = 0
131129
$endIndex = $ChunkSize - 1
132130

133-
# $FileContent = [convert]::ToBase64String((Get-Content -path $FilePath -Encoding byte))
134-
135131
while($chunkIndex -lt $NumberOfChunks){
136-
Write-Output "chunk index: " + $chunkIndex
137-
Write-Output "start index: " + $startIndex
138-
Write-Output "end index: " + $endIndex
139132
$FileContent = [convert]::ToBase64String($FileContentByteArray[$startIndex..$endIndex])
140-
141133
Invoke-AzSupportUploadFilesNoSubscription -ErrorAction Stop -FileName $FileName -ChunkIndex $chunkIndex -Content $FileContent @PSBoundParameters
142134
$chunkIndex++
143135
$startIndex = $endIndex + 1

0 commit comments

Comments
 (0)