Skip to content

Commit

Permalink
fix(configtree): update sentinel key when tree is imported in etcd
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain committed Jul 26, 2024
1 parent 9c74fb5 commit c648af6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions riocli/configtree/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import time
from base64 import b64encode
from typing import Optional

Expand Down Expand Up @@ -53,6 +54,22 @@ def import_in_etcd(
}
})

sentinel_key = b64encode('/sentinel_key'.encode('utf-8')).decode()
sentinel_val = b64encode(f'{time.time_ns()}|riocli-import'.encode('utf-8')).decode()

compares.append({
'key': sentinel_key,
'result': 'EQUAL',
'target': 'VALUE',
'value': sentinel_val,
})
failures.append({
'request_put': {
'key': sentinel_key,
'value': sentinel_val,
}
})

txn = {
'compare': compares,
'failure': failures,
Expand Down

0 comments on commit c648af6

Please sign in to comment.