builder.oracle.oci: make ConfigProvider unexported
so that it doesn't temper with hcl2 code generation & parsing. The field is set only later on after further processing.
This commit is contained in:
parent
17c069baa5
commit
3fa614b5e1
|
@ -84,7 +84,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
return nil, rawErr.(error)
|
||||
}
|
||||
|
||||
region, err := b.config.ConfigProvider.Region()
|
||||
region, err := b.config.configProvider.Region()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ type Config struct {
|
|||
common.PackerConfig `mapstructure:",squash"`
|
||||
Comm communicator.Config `mapstructure:",squash"`
|
||||
|
||||
ConfigProvider ocicommon.ConfigurationProvider
|
||||
configProvider ocicommon.ConfigurationProvider
|
||||
|
||||
AccessCfgFile string `mapstructure:"access_cfg_file"`
|
||||
AccessCfgFileAccount string `mapstructure:"access_cfg_file_account"`
|
||||
|
@ -69,6 +69,10 @@ type Config struct {
|
|||
ctx interpolate.Context
|
||||
}
|
||||
|
||||
func (c *Config) ConfigProvider() ocicommon.ConfigurationProvider {
|
||||
return c.configProvider
|
||||
}
|
||||
|
||||
func NewConfig(raws ...interface{}) (*Config, error) {
|
||||
c := &Config{}
|
||||
|
||||
|
@ -158,7 +162,7 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
|||
errs, errors.New("'key_file' must be specified"))
|
||||
}
|
||||
|
||||
c.ConfigProvider = configProvider
|
||||
c.configProvider = configProvider
|
||||
|
||||
if c.AvailabilityDomain == "" {
|
||||
errs = packer.MultiErrorAppend(
|
||||
|
|
|
@ -117,7 +117,7 @@ func TestConfig(t *testing.T) {
|
|||
t.Fatalf("Unexpected error in configuration %+v", errs)
|
||||
}
|
||||
|
||||
tenancy, err := c.ConfigProvider.TenancyOCID()
|
||||
tenancy, err := c.configProvider.TenancyOCID()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error getting tenancy ocid: %v", err)
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ func TestConfig(t *testing.T) {
|
|||
t.Fatalf("Unexpected error in configuration %+v", errs)
|
||||
}
|
||||
|
||||
region, err := c.ConfigProvider.Region()
|
||||
region, err := c.configProvider.Region()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error getting region: %v", err)
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ func TestConfig(t *testing.T) {
|
|||
t.Fatalf("Unexpected error in configuration %+v", errs)
|
||||
}
|
||||
|
||||
user, _ := c.ConfigProvider.UserOCID()
|
||||
user, _ := c.configProvider.UserOCID()
|
||||
if user != expected {
|
||||
t.Errorf("Expected ConfigProvider.UserOCID: %s, got %s", expected, user)
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ func TestConfig(t *testing.T) {
|
|||
t.Fatalf("Unexpected error in configuration %+v", errs)
|
||||
}
|
||||
|
||||
tenancy, _ := c.ConfigProvider.TenancyOCID()
|
||||
tenancy, _ := c.configProvider.TenancyOCID()
|
||||
if tenancy != expected {
|
||||
t.Errorf("Expected ConfigProvider.TenancyOCID: %s, got %s", expected, tenancy)
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ func TestConfig(t *testing.T) {
|
|||
t.Fatalf("Unexpected error in configuration %+v", errs)
|
||||
}
|
||||
|
||||
region, _ := c.ConfigProvider.Region()
|
||||
region, _ := c.configProvider.Region()
|
||||
if region != expected {
|
||||
t.Errorf("Expected ConfigProvider.Region: %s, got %s", expected, region)
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ func TestConfig(t *testing.T) {
|
|||
t.Fatalf("Unexpected error in configuration: %+v", errs)
|
||||
}
|
||||
|
||||
fingerprint, _ := c.ConfigProvider.KeyFingerprint()
|
||||
fingerprint, _ := c.configProvider.KeyFingerprint()
|
||||
if fingerprint != expected {
|
||||
t.Errorf("Expected ConfigProvider.KeyFingerprint: %s, got %s", expected, fingerprint)
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ type driverOCI struct {
|
|||
|
||||
// NewDriverOCI Creates a new driverOCI with a connected compute client and a connected vcn client.
|
||||
func NewDriverOCI(cfg *Config) (Driver, error) {
|
||||
coreClient, err := core.NewComputeClientWithConfigurationProvider(cfg.ConfigProvider)
|
||||
coreClient, err := core.NewComputeClientWithConfigurationProvider(cfg.configProvider)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vcnClient, err := core.NewVirtualNetworkClientWithConfigurationProvider(cfg.ConfigProvider)
|
||||
vcnClient, err := core.NewVirtualNetworkClientWithConfigurationProvider(cfg.configProvider)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue