1
0
mirror of https://github.com/go-acme/lego.git synced 2024-11-25 00:56:20 +02:00

Deprecate OS_TENANT_NAME as required field (#1279)

This commit is contained in:
Stamatis Katsaounis 2020-11-04 00:28:25 +02:00 committed by GitHub
parent 38f23c8c52
commit ff0377ac02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 25 deletions

View File

@ -461,7 +461,6 @@ func displayDNSHelp(name string) error {
ew.writeln(` - "OS_PASSWORD": Password`)
ew.writeln(` - "OS_PROJECT_NAME": Project 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()
@ -470,6 +469,7 @@ func displayDNSHelp(name string) error {
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(` - "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(`More information: https://go-acme.github.io/lego/dns/designate`)

View File

@ -33,7 +33,6 @@ _Please contribute by adding a CLI example._
| `OS_PASSWORD` | Password |
| `OS_PROJECT_NAME` | Project name |
| `OS_REGION_NAME` | Region name |
| `OS_TENANT_NAME` | Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID) |
| `OS_USERNAME` | Username |
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_TTL` | The TTL of the TXT record used for the DNS challenge |
| `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.
More information [here](/lego/dns/#configuration-and-credentials).

View File

@ -63,7 +63,7 @@ type DNSProvider struct {
// NewDNSProvider returns a DNSProvider instance configured for Designate.
// 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.
func NewDNSProvider() (*DNSProvider, error) {
config := NewDefaultConfig()
@ -80,7 +80,7 @@ func NewDNSProvider() (*DNSProvider, error) {
config.opts = *opts
} else {
_, err = env.Get(EnvAuthURL, EnvUsername, EnvPassword, EnvTenantName, EnvRegionName)
_, err = env.Get(EnvAuthURL, EnvUsername, EnvPassword, EnvRegionName)
if err != nil {
return nil, fmt.Errorf("designate: %w", err)
}

View File

@ -12,10 +12,10 @@ Example = ''''''
OS_USERNAME = "Username"
OS_PASSWORD = "Password"
OS_PROJECT_NAME = "Project name"
OS_TENANT_NAME = "Tenant name (deprecated see OS_PROJECT_NAME and OS_PROJECT_ID)"
OS_REGION_NAME = "Region name"
[Configuration.Additional]
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_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
DESIGNATE_TTL = "The TTL of the TXT record used for the DNS challenge"

View File

@ -45,8 +45,7 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "B",
EnvPassword: "C",
EnvRegionName: "D",
EnvTenantName: "E",
EnvProjectID: "F",
EnvProjectID: "E",
},
},
{
@ -56,9 +55,8 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "",
EnvPassword: "",
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",
@ -67,7 +65,6 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "B",
EnvPassword: "C",
EnvRegionName: "D",
EnvTenantName: "E",
},
expected: "designate: some credentials information are missing: OS_AUTH_URL",
},
@ -78,7 +75,6 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "",
EnvPassword: "C",
EnvRegionName: "D",
EnvTenantName: "E",
},
expected: "designate: some credentials information are missing: OS_USERNAME",
},
@ -89,7 +85,6 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "B",
EnvPassword: "",
EnvRegionName: "D",
EnvTenantName: "E",
},
expected: "designate: some credentials information are missing: OS_PASSWORD",
},
@ -100,21 +95,9 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "B",
EnvPassword: "C",
EnvRegionName: "",
EnvTenantName: "E",
},
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 {
@ -307,7 +290,7 @@ func getServer(t *testing.T) *httptest.Server {
"user": {
"name": "a",
"roles": [ ],
"role_links": [ ]
"role_links": [ ]
},
"serviceCatalog": [
{