Skip to content

Commit b0d0e13

Browse files
author
Filiz Topatan
committed
Update description and simple refactor
1 parent 639fa73 commit b0d0e13

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/Blueprint/Blueprint/Cmdlets/BlueprintCmdletBase.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,40 +176,37 @@ protected string GetValidatedFilePath(string fileFullName)
176176
}
177177

178178
/// <summary>
179-
/// This overloaded function expects a folder path and a file name and combines them. Checks if resulting full file name exist.
179+
/// Returns the blueprint file path.
180180
/// </summary>
181-
/// <param name="inputPath"></param>
182-
/// <param name="fileName"></param>
181+
/// <param name="path"></param>
183182
/// <returns></returns>
184183
protected string GetValidatedFilePathForBlueprint(string path)
185184
{
186-
187-
var blueprintFileName = AzureSession.Instance.DataStore.GetFiles(ResolveUserPath(path), "*.*", SearchOption.TopDirectoryOnly)
185+
var blueprintFileName = AzureSession.Instance.DataStore.GetFiles(path, "*.*", SearchOption.TopDirectoryOnly)
188186
.Select(file => Path.GetFileName(file))
189187
.FirstOrDefault(name => String.Equals(name, "blueprint.json", StringComparison.OrdinalIgnoreCase));
190188

191189
if (blueprintFileName == null)
192190
{
193191
throw new Exception(
194-
$"Cannot locate Blueprint.json in: {ResolveUserPath(path)}.");
192+
$"Cannot locate Blueprint.json in: {path}.");
195193
}
196194

197-
return Path.Combine(ResolveUserPath(path), blueprintFileName);
195+
return Path.Combine(path, blueprintFileName);
198196
}
199197

200198
/// <summary>
201-
/// Combines input folder path and folder name and check if the resulting path exists.
199+
/// Returns the artifacts folder path.
202200
/// </summary>
203-
/// <param name="inputPath"></param>
204-
/// <param name="folderName"></param>
201+
/// <param name="path"></param>
205202
/// <returns></returns>
206203
protected string GetValidatedFolderPathForArtifacts(string path)
207204
{
208-
var artifactsFolderName = AzureSession.Instance.DataStore.GetDirectories(ResolveUserPath(path))
205+
var artifactsFolderName = AzureSession.Instance.DataStore.GetDirectories(path)
209206
.Select(folder => Path.GetFileName(folder))
210207
.FirstOrDefault(name => String.Equals(name, "artifacts", StringComparison.OrdinalIgnoreCase));
211208

212-
return artifactsFolderName == null ? null : Path.Combine(ResolveUserPath(path), artifactsFolderName);
209+
return artifactsFolderName == null ? null : Path.Combine(path, artifactsFolderName);
213210
}
214211
}
215212
}

src/Blueprint/Blueprint/Cmdlets/BlueprintDefinition/BlueprintDefinitionCmdletBase.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ private async Task<string> GetManagementGroupAncestorsAsync(string subscriptionI
101101

102102
protected void ImportBlueprint(string blueprintName, string scope, string inputPath, bool force)
103103
{
104-
105-
106-
var blueprintPath = GetValidatedFilePathForBlueprint(inputPath);
104+
var blueprintPath = GetValidatedFilePathForBlueprint(ResolveUserPath(inputPath));
107105

108106
BlueprintModel bpObject;
109107
try
@@ -171,7 +169,7 @@ protected string CreateFolderIfNotExist(string path, string folderName)
171169

172170
protected void ImportArtifacts(string blueprintName, string scope, string inputPath)
173171
{
174-
var artifactsPath = GetValidatedFolderPathForArtifacts(inputPath);
172+
var artifactsPath = GetValidatedFolderPathForArtifacts(ResolveUserPath(inputPath));
175173

176174
if (artifactsPath == null)
177175
{

0 commit comments

Comments
 (0)