Skip to content

Commit

Permalink
#155 Fixed issue causing the need for global Secure Resources to be u…
Browse files Browse the repository at this point in the history
…sed in Repackage and Promote.
  • Loading branch information
Richard Hessinger committed Feb 8, 2021
1 parent a9e2e16 commit 73ae698
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Expand Up @@ -116,7 +116,12 @@ byte[] computePackageHash()

private protected void ResolvePackageSource(IOperationExecutionContext context, string name, out string userName, out SecureString password, out string feedUrl)
{
var packageSource = SecureResource.TryCreate(name, new ResourceResolutionContext(null));
if (context is not IResourceResolutionContext resolutionContext)
throw new InvalidOperationException("Cannot find resource resolution context");
if (context is not ICredentialResolutionContext credentialResolutionContext)
throw new InvalidOperationException("Cannot find credential resolution context");

var packageSource = SecureResource.TryCreate(name, resolutionContext);
if (packageSource == null)
throw new ExecutionFailureException($"Package source \"{name}\" not found.");
else if (packageSource is NuGetPackageSource nps)
Expand All @@ -135,7 +140,7 @@ private protected void ResolvePackageSource(IOperationExecutionContext context,
userName = null;
password = null;

var creds = packageSource.GetCredentials(new CredentialResolutionContext(null, null));
var creds = packageSource.GetCredentials(credentialResolutionContext);
if (creds != null)
{
this.LogDebug($"Looking up credentials ({packageSource.CredentialName})...");
Expand Down
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using System.Threading.Tasks;
using Inedo.Extensibility;
using Inedo.Extensibility.Operations;
using Inedo.Web;

namespace Inedo.Extensions.SuggestionProviders
Expand Down

0 comments on commit 73ae698

Please sign in to comment.