forked from TrueCloudLab/lego
Deprecate OS_TENANT_NAME as required field (#1279)
This commit is contained in:
parent
38f23c8c52
commit
ff0377ac02
5 changed files with 8 additions and 25 deletions
|
@ -461,7 +461,6 @@ func displayDNSHelp(name string) error {
|
||||||
ew.writeln(` - "OS_PASSWORD": Password`)
|
ew.writeln(` - "OS_PASSWORD": Password`)
|
||||||
ew.writeln(` - "OS_PROJECT_NAME": Project name`)
|
ew.writeln(` - "OS_PROJECT_NAME": Project name`)
|
||||||
ew.writeln(` - "OS_REGION_NAME": Region name`)
|
ew.writeln(` - "OS_REGION_NAME": Region name`)
|
||||||
ew.writeln(` - "OS_TENANT_NAME": Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID)`)
|
|
||||||
ew.writeln(` - "OS_USERNAME": Username`)
|
ew.writeln(` - "OS_USERNAME": Username`)
|
||||||
ew.writeln()
|
ew.writeln()
|
||||||
|
|
||||||
|
@ -470,6 +469,7 @@ func displayDNSHelp(name string) error {
|
||||||
ew.writeln(` - "DESIGNATE_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
|
ew.writeln(` - "DESIGNATE_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
|
||||||
ew.writeln(` - "DESIGNATE_TTL": The TTL of the TXT record used for the DNS challenge`)
|
ew.writeln(` - "DESIGNATE_TTL": The TTL of the TXT record used for the DNS challenge`)
|
||||||
ew.writeln(` - "OS_PROJECT_ID": Project ID`)
|
ew.writeln(` - "OS_PROJECT_ID": Project ID`)
|
||||||
|
ew.writeln(` - "OS_TENANT_NAME": Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID)`)
|
||||||
|
|
||||||
ew.writeln()
|
ew.writeln()
|
||||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/designate`)
|
ew.writeln(`More information: https://go-acme.github.io/lego/dns/designate`)
|
||||||
|
|
|
@ -33,7 +33,6 @@ _Please contribute by adding a CLI example._
|
||||||
| `OS_PASSWORD` | Password |
|
| `OS_PASSWORD` | Password |
|
||||||
| `OS_PROJECT_NAME` | Project name |
|
| `OS_PROJECT_NAME` | Project name |
|
||||||
| `OS_REGION_NAME` | Region name |
|
| `OS_REGION_NAME` | Region name |
|
||||||
| `OS_TENANT_NAME` | Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID) |
|
|
||||||
| `OS_USERNAME` | Username |
|
| `OS_USERNAME` | Username |
|
||||||
|
|
||||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||||
|
@ -48,6 +47,7 @@ More information [here](/lego/dns/#configuration-and-credentials).
|
||||||
| `DESIGNATE_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
|
| `DESIGNATE_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
|
||||||
| `DESIGNATE_TTL` | The TTL of the TXT record used for the DNS challenge |
|
| `DESIGNATE_TTL` | The TTL of the TXT record used for the DNS challenge |
|
||||||
| `OS_PROJECT_ID` | Project ID |
|
| `OS_PROJECT_ID` | Project ID |
|
||||||
|
| `OS_TENANT_NAME` | Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID) |
|
||||||
|
|
||||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||||
More information [here](/lego/dns/#configuration-and-credentials).
|
More information [here](/lego/dns/#configuration-and-credentials).
|
||||||
|
|
|
@ -63,7 +63,7 @@ type DNSProvider struct {
|
||||||
|
|
||||||
// NewDNSProvider returns a DNSProvider instance configured for Designate.
|
// NewDNSProvider returns a DNSProvider instance configured for Designate.
|
||||||
// Credentials must be passed in the environment variables:
|
// Credentials must be passed in the environment variables:
|
||||||
// OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_REGION_NAME.
|
// OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, OS_REGION_NAME.
|
||||||
// Or you can specify OS_CLOUD to read the credentials from the according cloud entry.
|
// Or you can specify OS_CLOUD to read the credentials from the according cloud entry.
|
||||||
func NewDNSProvider() (*DNSProvider, error) {
|
func NewDNSProvider() (*DNSProvider, error) {
|
||||||
config := NewDefaultConfig()
|
config := NewDefaultConfig()
|
||||||
|
@ -80,7 +80,7 @@ func NewDNSProvider() (*DNSProvider, error) {
|
||||||
|
|
||||||
config.opts = *opts
|
config.opts = *opts
|
||||||
} else {
|
} else {
|
||||||
_, err = env.Get(EnvAuthURL, EnvUsername, EnvPassword, EnvTenantName, EnvRegionName)
|
_, err = env.Get(EnvAuthURL, EnvUsername, EnvPassword, EnvRegionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("designate: %w", err)
|
return nil, fmt.Errorf("designate: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,10 @@ Example = ''''''
|
||||||
OS_USERNAME = "Username"
|
OS_USERNAME = "Username"
|
||||||
OS_PASSWORD = "Password"
|
OS_PASSWORD = "Password"
|
||||||
OS_PROJECT_NAME = "Project name"
|
OS_PROJECT_NAME = "Project name"
|
||||||
OS_TENANT_NAME = "Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID)"
|
|
||||||
OS_REGION_NAME = "Region name"
|
OS_REGION_NAME = "Region name"
|
||||||
[Configuration.Additional]
|
[Configuration.Additional]
|
||||||
OS_PROJECT_ID = "Project ID"
|
OS_PROJECT_ID = "Project ID"
|
||||||
|
OS_TENANT_NAME = "Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID)"
|
||||||
DESIGNATE_POLLING_INTERVAL = "Time between DNS propagation check"
|
DESIGNATE_POLLING_INTERVAL = "Time between DNS propagation check"
|
||||||
DESIGNATE_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
|
DESIGNATE_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
|
||||||
DESIGNATE_TTL = "The TTL of the TXT record used for the DNS challenge"
|
DESIGNATE_TTL = "The TTL of the TXT record used for the DNS challenge"
|
||||||
|
|
|
@ -45,8 +45,7 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
|
||||||
EnvUsername: "B",
|
EnvUsername: "B",
|
||||||
EnvPassword: "C",
|
EnvPassword: "C",
|
||||||
EnvRegionName: "D",
|
EnvRegionName: "D",
|
||||||
EnvTenantName: "E",
|
EnvProjectID: "E",
|
||||||
EnvProjectID: "F",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -56,9 +55,8 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
|
||||||
EnvUsername: "",
|
EnvUsername: "",
|
||||||
EnvPassword: "",
|
EnvPassword: "",
|
||||||
EnvRegionName: "",
|
EnvRegionName: "",
|
||||||
EnvTenantName: "",
|
|
||||||
},
|
},
|
||||||
expected: "designate: some credentials information are missing: OS_AUTH_URL,OS_USERNAME,OS_PASSWORD,OS_TENANT_NAME,OS_REGION_NAME",
|
expected: "designate: some credentials information are missing: OS_AUTH_URL,OS_USERNAME,OS_PASSWORD,OS_REGION_NAME",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "missing auth url",
|
desc: "missing auth url",
|
||||||
|
@ -67,7 +65,6 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
|
||||||
EnvUsername: "B",
|
EnvUsername: "B",
|
||||||
EnvPassword: "C",
|
EnvPassword: "C",
|
||||||
EnvRegionName: "D",
|
EnvRegionName: "D",
|
||||||
EnvTenantName: "E",
|
|
||||||
},
|
},
|
||||||
expected: "designate: some credentials information are missing: OS_AUTH_URL",
|
expected: "designate: some credentials information are missing: OS_AUTH_URL",
|
||||||
},
|
},
|
||||||
|
@ -78,7 +75,6 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
|
||||||
EnvUsername: "",
|
EnvUsername: "",
|
||||||
EnvPassword: "C",
|
EnvPassword: "C",
|
||||||
EnvRegionName: "D",
|
EnvRegionName: "D",
|
||||||
EnvTenantName: "E",
|
|
||||||
},
|
},
|
||||||
expected: "designate: some credentials information are missing: OS_USERNAME",
|
expected: "designate: some credentials information are missing: OS_USERNAME",
|
||||||
},
|
},
|
||||||
|
@ -89,7 +85,6 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
|
||||||
EnvUsername: "B",
|
EnvUsername: "B",
|
||||||
EnvPassword: "",
|
EnvPassword: "",
|
||||||
EnvRegionName: "D",
|
EnvRegionName: "D",
|
||||||
EnvTenantName: "E",
|
|
||||||
},
|
},
|
||||||
expected: "designate: some credentials information are missing: OS_PASSWORD",
|
expected: "designate: some credentials information are missing: OS_PASSWORD",
|
||||||
},
|
},
|
||||||
|
@ -100,21 +95,9 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
|
||||||
EnvUsername: "B",
|
EnvUsername: "B",
|
||||||
EnvPassword: "C",
|
EnvPassword: "C",
|
||||||
EnvRegionName: "",
|
EnvRegionName: "",
|
||||||
EnvTenantName: "E",
|
|
||||||
},
|
},
|
||||||
expected: "designate: some credentials information are missing: OS_REGION_NAME",
|
expected: "designate: some credentials information are missing: OS_REGION_NAME",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
desc: "missing tenant name",
|
|
||||||
envVars: map[string]string{
|
|
||||||
EnvAuthURL: server.URL + "/v2.0/",
|
|
||||||
EnvUsername: "B",
|
|
||||||
EnvPassword: "C",
|
|
||||||
EnvRegionName: "D",
|
|
||||||
EnvTenantName: "",
|
|
||||||
},
|
|
||||||
expected: "designate: some credentials information are missing: OS_TENANT_NAME",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
|
|
Loading…
Reference in a new issue