Skip to content

Commit

Permalink
Deprecate OS_TENANT_NAME as required field (go-acme#1279)
Browse files Browse the repository at this point in the history
  • Loading branch information
skatsaounis authored Nov 3, 2020
1 parent 38f23c8 commit ff0377a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cmd/zz_gen_cmd_dnshelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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`)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/dns/zz_gen_designate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions providers/dns/designate/designate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion providers/dns/designate/designate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 3 additions & 20 deletions providers/dns/designate/designate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ func TestNewDNSProvider_fromEnv(t *testing.T) {
EnvUsername: "B",
EnvPassword: "C",
EnvRegionName: "D",
EnvTenantName: "E",
EnvProjectID: "F",
EnvProjectID: "E",
},
},
{
Expand All @@ -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",
Expand All @@ -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",
},
Expand All @@ -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",
},
Expand All @@ -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",
},
Expand All @@ -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 {
Expand Down Expand Up @@ -307,7 +290,7 @@ func getServer(t *testing.T) *httptest.Server {
"user": {
"name": "a",
"roles": [ ],
"role_links": [ ]
"role_links": [ ]
},
"serviceCatalog": [
{
Expand Down

0 comments on commit ff0377a

Please sign in to comment.