Skip to content

Commit

Permalink
bluecat: skip deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jul 19, 2024
1 parent 04864ff commit 435386d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions cmd/zz_gen_cmd_dnshelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ func displayDNSHelp(w io.Writer, name string) error {
ew.writeln(` - "BLUECAT_HTTP_TIMEOUT": API request timeout`)
ew.writeln(` - "BLUECAT_POLLING_INTERVAL": Time between DNS propagation check`)
ew.writeln(` - "BLUECAT_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
ew.writeln(` - "BLUECAT_SKIP_DEPLOY": Skip deployements`)
ew.writeln(` - "BLUECAT_TTL": The TTL of the TXT record used for the DNS challenge`)

ew.writeln()
Expand Down
1 change: 1 addition & 0 deletions docs/content/dns/zz_gen_bluecat.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ More information [here]({{< ref "dns#configuration-and-credentials" >}}).
| `BLUECAT_HTTP_TIMEOUT` | API request timeout |
| `BLUECAT_POLLING_INTERVAL` | Time between DNS propagation check |
| `BLUECAT_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
| `BLUECAT_SKIP_DEPLOY` | Skip deployements |
| `BLUECAT_TTL` | The TTL of the TXT record used for the DNS challenge |

The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
Expand Down
21 changes: 14 additions & 7 deletions providers/dns/bluecat/bluecat.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const (
EnvConfigName = envNamespace + "CONFIG_NAME"
EnvDNSView = envNamespace + "DNS_VIEW"
EnvDebug = envNamespace + "DEBUG"
EnvSkipDeploy = envNamespace + "SKIP_DEPLOY"

EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
Expand All @@ -43,6 +44,7 @@ type Config struct {
TTL int
HTTPClient *http.Client
Debug bool
SkipDeploy bool
}

// NewDefaultConfig returns a default configuration for the DNSProvider.
Expand All @@ -54,7 +56,8 @@ func NewDefaultConfig() *Config {
HTTPClient: &http.Client{
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
},
Debug: env.GetOrDefaultBool(EnvDebug, false),
Debug: env.GetOrDefaultBool(EnvDebug, false),
SkipDeploy: env.GetOrDefaultBool(EnvSkipDeploy, false),
}
}

Expand Down Expand Up @@ -143,9 +146,11 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
return fmt.Errorf("bluecat: add TXT record: %w", err)
}

err = d.client.Deploy(ctx, parentZoneID)
if err != nil {
return fmt.Errorf("bluecat: deploy: %w", err)
if !d.config.SkipDeploy {
err = d.client.Deploy(ctx, parentZoneID)
if err != nil {
return fmt.Errorf("bluecat: deploy: %w", err)
}
}

err = d.client.Logout(ctx)
Expand Down Expand Up @@ -185,9 +190,11 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return fmt.Errorf("bluecat: delete TXT record: %w", err)
}

err = d.client.Deploy(ctx, parentZoneID)
if err != nil {
return fmt.Errorf("bluecat: deploy: %w", err)
if !d.config.SkipDeploy {
err = d.client.Deploy(ctx, parentZoneID)
if err != nil {
return fmt.Errorf("bluecat: deploy: %w", err)
}
}

err = d.client.Logout(ctx)
Expand Down
1 change: 1 addition & 0 deletions providers/dns/bluecat/bluecat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ lego --email you@example.com --dns bluecat --domains my.example.org run
BLUECAT_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
BLUECAT_TTL = "The TTL of the TXT record used for the DNS challenge"
BLUECAT_HTTP_TIMEOUT = "API request timeout"
BLUECAT_SKIP_DEPLOY = "Skip deployements"

[Links]
API = "https://docs.bluecatnetworks.com/r/Address-Manager-API-Guide/REST-API/9.1.0"

0 comments on commit 435386d

Please sign in to comment.