Compare commits

..

1 Commits

Author SHA1 Message Date
26690d73d0 fix: ensure $ABRA_DIR/servers is 0600
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Also remove deprecated folders while I'm here: `vendor` / `backup`

See #580
2025-08-12 23:02:49 +02:00
3 changed files with 17 additions and 21 deletions

View File

@ -71,7 +71,7 @@ var AppVolumeListCommand = &cobra.Command{
} }
var AppVolumeRemoveCommand = &cobra.Command{ var AppVolumeRemoveCommand = &cobra.Command{
Use: "remove <domain> [volume] [flags]", Use: "remove <domain> [flags]",
Short: "Remove volume(s) associated with an app", Short: "Remove volume(s) associated with an app",
Long: `Remove volumes associated with an app. Long: `Remove volumes associated with an app.
@ -83,11 +83,6 @@ you to make a seclection. Use the "?" key to see more help on navigating this
interface. interface.
Passing "--force/-f" will select all volumes for removal. Be careful.`, Passing "--force/-f" will select all volumes for removal. Be careful.`,
Example: ` # delete volumes interactively
abra app volume rm 1312.net
# delete specific volume
abra app volume rm 1312.net my_volume`,
Aliases: []string{"rm"}, Aliases: []string{"rm"},
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
ValidArgsFunction: func( ValidArgsFunction: func(

View File

@ -31,21 +31,21 @@ func Run(version, commit string) {
"upgrade", "upgrade",
}, },
PersistentPreRun: func(cmd *cobra.Command, args []string) { PersistentPreRun: func(cmd *cobra.Command, args []string) {
paths := []string{ dirs := []map[string]os.FileMode{
config.ABRA_DIR, {config.ABRA_DIR: 0764},
config.SERVERS_DIR, {config.SERVERS_DIR: 0600},
config.RECIPES_DIR, {config.RECIPES_DIR: 0764},
config.LOGS_DIR, {config.LOGS_DIR: 0764},
config.VENDOR_DIR, // TODO(d1): remove > 0.9.x
config.BACKUP_DIR, // TODO(d1): remove > 0.9.x
} }
for _, path := range paths { for _, dir := range dirs {
if err := os.Mkdir(path, 0764); err != nil { for path, perm := range dir {
if !os.IsExist(err) { if err := os.Mkdir(path, perm); err != nil {
log.Fatal(err) if !os.IsExist(err) {
log.Fatal(err)
}
continue
} }
continue
} }
} }

View File

@ -24,7 +24,7 @@ setup(){
assert_success assert_success
} }
@test "abra directory is created" { @test "abra directories are created" {
run $ABRA app ls run $ABRA app ls
# NOTE(d1): no servers yet, so will fail. however, it will run the required # NOTE(d1): no servers yet, so will fail. however, it will run the required
@ -35,8 +35,9 @@ setup(){
assert_exists "$ABRA_DIR" assert_exists "$ABRA_DIR"
assert_exists "$ABRA_DIR/servers" assert_exists "$ABRA_DIR/servers"
assert_exists "$ABRA_DIR/recipes" assert_exists "$ABRA_DIR/recipes"
assert_exists "$ABRA_DIR/backups"
assert_exists "$ABRA_DIR/vendor"
assert_not_exists "$ABRA_DIR/catalogue" assert_not_exists "$ABRA_DIR/catalogue"
server_dir_perms=$(stat -c "%a" "$ABRA_DIR/servers")
assert_equal $server_dir_perms "600"
} }