Skip to content

Commit f36c9d9

Browse files
CE-574 Upgrade Logic (#61)
* CE-574 Upgrade Logic PR URL: https://www.github.com/delphix/couchbase-plugin/pull/61 * plugin version update
1 parent b25c79c commit f36c9d9

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ repos:
3636
.isort.cfg|
3737
LICENSE|
3838
.gitignore|
39+
plugin_config.yml
3940
)$

plugin_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: 18f4ff11-b758-4bf2-9a37-719a22f5a4b8
22
name: sc:couchbase
3-
externalVersion: "1.2.2"
4-
buildNumber: 1.2.2
3+
externalVersion: "1.3.0"
4+
buildNumber: 1.3.0
55
language: PYTHON38
66
hostTypes:
77
- UNIX

src/plugin_runner.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55

66
import logging
7+
import os
78

89
from controller.couchbase_operation import CouchbaseOperation
910
from controller.helper_lib import check_server_is_used
@@ -29,6 +30,34 @@
2930
logger = logging.getLogger(__name__)
3031

3132

33+
@plugin.upgrade.linked_source("2023.10.27.01")
34+
def update_bucket_size(old_linked_source):
35+
old_linked_source = dict(old_linked_source)
36+
if isinstance(old_linked_source["bucket_size"], int):
37+
if old_linked_source["bucket_size"] == 0:
38+
old_linked_source["bucket_size"] = []
39+
else:
40+
d = [{"bname": "*", "bsize": old_linked_source["bucket_size"]}]
41+
old_linked_source["bucket_size"] = d
42+
return old_linked_source
43+
44+
45+
@plugin.upgrade.linked_source("2023.10.27.02")
46+
def update_archive_name(old_linked_source):
47+
old_linked_source = dict(old_linked_source)
48+
if "archive_name" not in old_linked_source.keys():
49+
if old_linked_source["couchbase_bak_loc"] == "":
50+
old_linked_source["archive_name"] = ""
51+
else:
52+
old_linked_source["archive_name"] = os.path.basename(
53+
old_linked_source["couchbase_bak_loc"]
54+
)
55+
old_linked_source["couchbase_bak_loc"] = os.path.dirname(
56+
old_linked_source["couchbase_bak_loc"]
57+
)
58+
return old_linked_source
59+
60+
3261
#
3362
# Below is an example of the repository discovery operation.
3463
#

0 commit comments

Comments
 (0)