Skip to content

write warning for deps for V3 #971

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

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/code/FindHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,12 @@ private IEnumerable<PSResourceInfo> SearchByNames(ServerApiCall currentServer, R
// After retrieving all packages
if (_includeDependencies)
{
if (currentServer.repository.ApiVersion == PSRepositoryInfo.APIVersion.v3)
{
_cmdletPassedIn.WriteWarning("Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.");
yield break;
}

foreach (PSResourceInfo currentPkg in parentPkgs)
{
// Actually find and return the dependency packages
Expand Down
10 changes: 9 additions & 1 deletion src/code/InstallHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ private List<PSResourceInfo> ProcessRepositories(
{
ServerApiCall currentServer = ServerFactory.GetServer(repo);
ResponseUtil currentResponseUtil = ResponseUtilFactory.GetResponseUtil(repo);
bool installDepsForRepo = skipDependencyCheck;

// If no more packages to install, then return
if (_pkgNamesToInstall.Count == 0) {
Expand All @@ -186,8 +187,15 @@ private List<PSResourceInfo> ProcessRepositories(
string repoName = repo.Name;
_cmdletPassedIn.WriteVerbose(string.Format("Attempting to search for packages in '{0}'", repoName));


if (repo.ApiVersion == PSRepositoryInfo.APIVersion.v2 || repo.ApiVersion == PSRepositoryInfo.APIVersion.v3)
{
if ((repo.ApiVersion == PSRepositoryInfo.APIVersion.v3) && (!installDepsForRepo))
{
_cmdletPassedIn.WriteWarning("Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.");
installDepsForRepo = true;
}

return HttpInstall(_pkgNamesToInstall.ToArray(), repo, currentServer, currentResponseUtil, credential, scope);
}
else
Expand Down Expand Up @@ -225,7 +233,7 @@ private List<PSResourceInfo> ProcessRepositories(
tag: null,
repository: new string[] { repoName },
credential: credential,
includeDependencies: !skipDependencyCheck).ToList();
includeDependencies: !installDepsForRepo).ToList();

if (pkgsFromRepoToInstall.Count == 0)
{
Expand Down