Skip to content

Commit

Permalink
Merge pull request #33 from Venafi/remobe-deprecated-fields
Browse files Browse the repository at this point in the history
remove deprecated fields. fix #32
  • Loading branch information
mr-tron committed Feb 19, 2020
2 parents 3e387a1 + 4e64167 commit 179af7a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 45 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mount_dev: unset

import_config_write:
vault write $(MOUNT)/roles/$(IMPORT_ROLE) \
tpp_import="true" \
venafi_import="true" \
tpp_url=$(TPPURL) \
tpp_user=$(TPPUSER) \
tpp_password=$(TPPPASSWORD) \
Expand All @@ -107,8 +107,8 @@ import_config_write:
allowed_domains=$(IMPORT_DOMAIN) \
allow_subdomains=true \
trust_bundle_file=$(TRUST_BUNDLE) \
tpp_import_timeout=15 \
tpp_import_workers=5
venafi_import_timeout=15 \
venafi_import_workers=5

import_config_read:
vault read $(MOUNT)/roles/$(IMPORT_ROLE)
Expand Down
34 changes: 17 additions & 17 deletions plugin/pki/path_import_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ func getTPPRoleConfig(domain string, timeout, workers int) map[string]interface{

func getCloudRoleConfig(domain string, timeout, workers int) map[string]interface{} {
return map[string]interface{}{
"allowed_domains": domain,
"allow_subdomains": "true",
"max_ttl": "4h",
"allow_bare_domains": true,
"generate_lease": true,
"tpp_import": true,
"apikey": os.Getenv("CLOUDAPIKEY"),
"cloud_url": os.Getenv("CLOUDURL"),
"zone": os.Getenv("CLOUDZONE"),
"trust_bundle_file": os.Getenv("TRUST_BUNDLE"),
"tpp_import_timeout": timeout,
"tpp_import_workers": workers,
"organization": "Venafi Inc.",
"ou": "Integration",
"locality": "Salt Lake",
"province": "Utah",
"country": "US",
"allowed_domains": domain,
"allow_subdomains": "true",
"max_ttl": "4h",
"allow_bare_domains": true,
"generate_lease": true,
"venafi_import": true,
"apikey": os.Getenv("CLOUDAPIKEY"),
"cloud_url": os.Getenv("CLOUDURL"),
"zone": os.Getenv("CLOUDZONE"),
"trust_bundle_file": os.Getenv("TRUST_BUNDLE"),
"venafi_import_timeout": timeout,
"venafi_import_workers": workers,
"organization": "Venafi Inc.",
"ou": "Integration",
"locality": "Salt Lake",
"province": "Utah",
"country": "US",
}
}

Expand Down
27 changes: 2 additions & 25 deletions plugin/pki/path_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,6 @@ Example for Venafi Cloud: Default`,
Description: `Import certificate to Venafi Platform if true. False by default.`,
Required: false,
},
"tpp_import": { // todo: deprecated. should be removed and venafi_import should become required.
Type: framework.TypeBool,
Description: `Import certificate to Venafi Platform if true. False by default.`,
Required: false,
},
"trust_bundle_file": {
Type: framework.TypeString,
Description: `Use to specify a PEM formatted file with certificates to be used as trust anchors when communicating with the remote server.
Expand All @@ -343,19 +338,9 @@ Example:
Default: 15,
Description: `Timeout in second to rerun import queue`,
},
"tpp_import_timeout": { // todo: deprecated. should be removed
Type: framework.TypeInt,
Default: 15,
Description: `Timeout in second to rerun import queue`,
},
"venafi_import_workers": {
Type: framework.TypeInt,
Default: 12,
Description: `Max amount of simultaneously working instances of vcert import`,
},
"tpp_import_workers": { // todo: deprecated. should be removed
Type: framework.TypeInt,
Default: 12,
Default: 5,
Description: `Max amount of simultaneously working instances of vcert import`,
},
"venafi_check_policy": {
Expand Down Expand Up @@ -590,19 +575,11 @@ func (b *backend) pathRoleCreate(ctx context.Context, req *logical.Request, data
Apikey: data.Get("apikey").(string),
CloudURL: data.Get("cloud_url").(string),
},
TPPImport: data.Get("venafi_import").(bool) || data.Get("tpp_import").(bool),
TPPImport: data.Get("venafi_import").(bool),
TPPImportTimeout: data.Get("venafi_import_timeout").(int),
TPPImportWorkers: data.Get("venafi_import_workers").(int),
VenafiCheckPolicy: data.Get("venafi_check_policy").(string),
}
deprecatedTimeout := data.Get("tpp_import_timeout").(int)
deprecatedWorkers := data.Get("tpp_import_workers").(int)
if deprecatedTimeout != 15 { //todo: remove deprecated
entry.TPPImportTimeout = deprecatedTimeout
}
if deprecatedWorkers != 3 { //todo: remove deprecated
entry.TPPImportWorkers = deprecatedWorkers
}
otherSANs := data.Get("allowed_other_sans").([]string)
if len(otherSANs) > 0 {
_, err := parseOtherSANs(otherSANs)
Expand Down

0 comments on commit 179af7a

Please sign in to comment.