admin: When generating team's symlinks, remove existing ones
This commit is contained in:
parent
52bc7b6650
commit
cf4ff0245f
@ -215,6 +215,12 @@ func genDexConfig() ([]byte, error) {
|
|||||||
} else {
|
} else {
|
||||||
// Also generate team associations
|
// Also generate team associations
|
||||||
for _, team := range teams {
|
for _, team := range teams {
|
||||||
|
if _, err := os.Stat(path.Join(TeamsDir, fmt.Sprintf("team%02d", team.Id))); err == nil {
|
||||||
|
if err = os.Remove(path.Join(TeamsDir, fmt.Sprintf("team%02d", team.Id))); err != nil {
|
||||||
|
log.Println("Unable to remove existing association symlink:", err.Error())
|
||||||
|
return nil, fmt.Errorf("Unable to remove existing association symlink: %s", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
if err := os.Symlink(fmt.Sprintf("%d", team.Id), path.Join(TeamsDir, fmt.Sprintf("team%02d", team.Id))); err != nil {
|
if err := os.Symlink(fmt.Sprintf("%d", team.Id), path.Join(TeamsDir, fmt.Sprintf("team%02d", team.Id))); err != nil {
|
||||||
log.Println("Unable to create association symlink:", err.Error())
|
log.Println("Unable to create association symlink:", err.Error())
|
||||||
return nil, fmt.Errorf("Unable to create association symlink: %s", err.Error())
|
return nil, fmt.Errorf("Unable to create association symlink: %s", err.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user