mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
refactor(be): rename column vault_pass_id to vault_key_id
This commit is contained in:
parent
3c20c1abf8
commit
d4dd2052bb
@ -109,7 +109,7 @@ func (t *task) destroyKeys() {
|
||||
t.log("Can't destroy inventory become user key, error: " + err.Error())
|
||||
}
|
||||
|
||||
err = t.destroyKey(t.template.VaultPass)
|
||||
err = t.destroyKey(t.template.VaultKey)
|
||||
if err != nil {
|
||||
t.log("Can't destroy inventory vault password file, error: " + err.Error())
|
||||
}
|
||||
@ -199,7 +199,7 @@ func (t *task) prepareRun() {
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.installVaultPassFile(); err != nil {
|
||||
if err := t.installVaultKeyFile(); err != nil {
|
||||
t.log("Failed to install vault password file: " + err.Error())
|
||||
t.fail()
|
||||
return
|
||||
@ -356,12 +356,12 @@ func (t *task) destroyKey(key db.AccessKey) error {
|
||||
return os.Remove(path)
|
||||
}
|
||||
|
||||
func (t *task) installVaultPassFile() error {
|
||||
if t.template.VaultPassID == nil {
|
||||
func (t *task) installVaultKeyFile() error {
|
||||
if t.template.VaultKeyID == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.template.VaultPass.Install(db.AccessKeyUsageVault)
|
||||
return t.template.VaultKey.Install(db.AccessKeyUsageVault)
|
||||
}
|
||||
|
||||
func (t *task) installKey(key db.AccessKey, accessKeyUsage int) error {
|
||||
@ -582,8 +582,8 @@ func (t *task) getPlaybookArgs() (args []string, err error) {
|
||||
args = append(args, "--check")
|
||||
}
|
||||
|
||||
if t.template.VaultPassID != nil {
|
||||
args = append(args, "--vault-password-file", t.template.VaultPass.GetPath())
|
||||
if t.template.VaultKeyID != nil {
|
||||
args = append(args, "--vault-password-file", t.template.VaultKey.GetPath())
|
||||
}
|
||||
|
||||
extraVars, err := t.getExtraVars()
|
||||
|
@ -144,8 +144,8 @@ type Store interface {
|
||||
}
|
||||
|
||||
func FillTemplate(d Store, template *Template) (err error) {
|
||||
if template.VaultPassID != nil {
|
||||
template.VaultPass, err = d.GetAccessKey(template.ProjectID, *template.VaultPassID)
|
||||
if template.VaultKeyID != nil {
|
||||
template.VaultKey, err = d.GetAccessKey(template.ProjectID, *template.VaultKeyID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ type Template struct {
|
||||
|
||||
Description *string `db:"description" json:"description"`
|
||||
|
||||
VaultPassID *int `db:"vault_pass_id" json:"vault_pass_id"`
|
||||
VaultPass AccessKey `db:"-" json:"-"`
|
||||
VaultKeyID *int `db:"vault_key_id" json:"vault_key_id"`
|
||||
VaultKey AccessKey `db:"-" json:"-"`
|
||||
}
|
@ -82,5 +82,6 @@ func init() {
|
||||
{Major: 2, Minor: 7, Patch: 10},
|
||||
{Major: 2, Minor: 7, Patch: 12},
|
||||
{Major: 2, Minor: 7, Patch: 13},
|
||||
{Major: 2, Minor: 7, Patch: 17},
|
||||
}
|
||||
}
|
||||
|
3
db/sql/migrations/v2.7.17.sql
Normal file
3
db/sql/migrations/v2.7.17.sql
Normal file
@ -0,0 +1,3 @@
|
||||
alter table `project__template` add `vault_key_id` int references access_key(`id`);
|
||||
update `project__template` set `vault_key_id` = `vault_pass_id` where `vault_key_id` is null;
|
||||
alter table `project__template` drop column `vault_pass_id`;
|
@ -64,7 +64,7 @@
|
||||
></v-select>
|
||||
|
||||
<v-select
|
||||
v-model="item.vault_pass_id"
|
||||
v-model="item.vault_key_id"
|
||||
label="Vault Password"
|
||||
clearable
|
||||
:items="loginPasswordKeys"
|
||||
|
Loading…
Reference in New Issue
Block a user