Skip to content

Commit

Permalink
set acl in zk.set, zk.acquire_lock and zk.create functions
Browse files Browse the repository at this point in the history
  • Loading branch information
munakoiso authored and secwall committed Aug 27, 2024
1 parent e1947e5 commit 415d521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cmd/rdsync/rdsync
tests/logs/
.idea
6 changes: 3 additions & 3 deletions internal/dcs/zk.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (z *zkDCS) AcquireLock(path string) bool {
if err != nil {
panic(fmt.Sprintf("failed to serialize to JSON %#v", self))
}
_, err = z.retryCreate(fullPath, data, zk.FlagEphemeral, nil)
_, err = z.retryCreate(fullPath, data, zk.FlagEphemeral, z.acl)
if err != nil {
if err != zk.ErrNodeExists {
z.logger.Error(fmt.Sprintf("Failed to acquire lock %s", fullPath), "error", err)
Expand Down Expand Up @@ -383,7 +383,7 @@ func (z *zkDCS) create(path string, val interface{}, flags int32) error {
if err != nil {
return fmt.Errorf("failed to serialize to JSON %#v", val)
}
_, err = z.retryCreate(fullPath, data, flags, nil)
_, err = z.retryCreate(fullPath, data, flags, z.acl)
if err != nil {
if err == zk.ErrNodeExists {
return ErrExists
Expand Down Expand Up @@ -418,7 +418,7 @@ func (z *zkDCS) set(path string, val interface{}, flags int32) error {
if err != nil {
return err
}
_, err = z.retryCreate(fullPath, data, flags, nil)
_, err = z.retryCreate(fullPath, data, flags, z.acl)
if err != nil {
z.logger.Error(fmt.Sprintf("Failed to create node %s with %v", fullPath, val), "error", err)
}
Expand Down

0 comments on commit 415d521

Please sign in to comment.