Skip to content

Commit 7695289

Browse files
authored
Merge pull request #181 from askarsabyrov/master
add support for setting a system scope
2 parents e8fba78 + c41bfb7 commit 7695289

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

openstack/clientconfig/requests.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,12 @@ func v3auth(cloud *Cloud, opts *ClientOpts) (*gophercloud.AuthOptions, error) {
644644
}
645645
}
646646

647+
if cloud.AuthInfo.SystemScope == "" {
648+
if v := env.Getenv(envPrefix + "SYSTEM_SCOPE"); v != "" {
649+
cloud.AuthInfo.SystemScope = v
650+
}
651+
}
652+
647653
// Build a scope and try to do it correctly.
648654
// https://github.com/openstack/os-client-config/blob/master/os_client_config/config.py#L595
649655
scope := new(gophercloud.AuthScope)
@@ -660,6 +666,9 @@ func v3auth(cloud *Cloud, opts *ClientOpts) (*gophercloud.AuthOptions, error) {
660666
} else if cloud.AuthInfo.DomainName != "" {
661667
scope.DomainName = cloud.AuthInfo.DomainName
662668
}
669+
if cloud.AuthInfo.SystemScope != "" {
670+
scope.System = true
671+
}
663672
} else {
664673
// If Domain* is set, but UserDomain* or ProjectDomain* aren't,
665674
// then use Domain* as the default setting.

openstack/clientconfig/results.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ type AuthInfo struct {
7878
// Application Credential secret to login with.
7979
ApplicationCredentialSecret string `yaml:"application_credential_secret,omitempty" json:"application_credential_secret,omitempty"`
8080

81+
// SystemScope is a system information to scope to.
82+
SystemScope string `yaml:"system_scope,omitempty" json:"system_scope,omitempty"`
83+
8184
// ProjectName is the common/human-readable name of a project.
8285
// Users can be scoped to a project.
8386
// ProjectName on its own is not enough to ensure a unique scope. It must

0 commit comments

Comments
 (0)