Reorganize client/common packages

This commit is contained in:
Paul Meyer 2019-10-07 18:56:20 +00:00
parent fe584f4448
commit 0866cb3714
7 changed files with 7 additions and 10 deletions

View File

@ -4,7 +4,6 @@ package client
import (
"fmt"
"github.com/hashicorp/packer/builder/azure/common"
"os"
"strings"
"time"
@ -303,4 +302,4 @@ func (c *Config) FillParameters() error {
}
// allow override for unit tests
var findTenantID = common.FindTenantID
var findTenantID = FindTenantID

View File

@ -1,6 +1,6 @@
// +build !linux
package common
package client
// IsAzure returns true if Packer is running on Azure (currently only works on Linux)
func IsAzure() bool {

View File

@ -1,4 +1,4 @@
package common
package client
import (
"bytes"

View File

@ -1,4 +1,4 @@
package common
package client
import (
"io/ioutil"

View File

@ -1,4 +1,4 @@
package common
package client
import (
"context"

View File

@ -6,12 +6,11 @@ import (
"github.com/Azure/go-autorest/autorest/azure"
"github.com/hashicorp/packer/builder/azure/common"
"github.com/stretchr/testify/assert"
)
func Test_MetadataReturnsComputeInfo(t *testing.T) {
if !common.IsAzure() {
if !IsAzure() {
t.Skipf("Not running on Azure, skipping live IMDS test")
}
mdc := NewMetadataClient()

View File

@ -6,7 +6,6 @@ import (
"github.com/Azure/go-autorest/autorest/adal"
"github.com/Azure/go-autorest/autorest/azure"
packerAzureCommon "github.com/hashicorp/packer/builder/azure/common"
)
func NewDeviceFlowOAuthTokenProvider(env azure.Environment, say func(string), tenantID string) oAuthTokenProvider {
@ -36,5 +35,5 @@ func (tp *deviceflowOauthTokenProvider) getServicePrincipalTokenWithResource(res
tp.say(fmt.Sprintf("Getting token for %s", resource))
}
return packerAzureCommon.Authenticate(tp.env, tp.tenantID, tp.say, resource)
return Authenticate(tp.env, tp.tenantID, tp.say, resource)
}