Description
IN 7.X releases the tool couchbase-cli emits Traceback errors importing Eventing function with missing buckets or keyspaces.
Note both the UI and the REST API imports work fine with missing keyspaces.
Create a working eventing function and use couchbase-cli to export it
couchbase-cli eventing-function-setup -c localhost -u Administrator -p password--export --name m1 --file m1.json
|
Delete 1) the function m1 and 2) delete the bucket (or the collection) used for the "Eventing Storage" or metadata (I used m1._default._default).
Now use the couchbase-cli to imported it and we get an ugly Traceback - yes it should fail but not like the below:
couchbase-cli eventing-function-setup -c localhost -u Administrator -p password --import --name m1 --file m1.json
|
Traceback (most recent call last):
|
File "/space/linuxbrew/couch/install/lib/python/couchbase-cli", line 20, in <module>
|
main()
|
File "/space/linuxbrew/couch/install/lib/python/couchbase-cli", line 15, in main
|
cli.execute(args)
|
File "/space/linuxbrew/couch.7.0.2.20210908_queues/install/lib/python/cbmgr.py", line 527, in execute
|
opts.klass().execute(opts)
|
File "/space/linuxbrew/couch.7.0.2.20210908_queues/install/lib/python/cbmgr.py", line 132, in decorator
|
return fn(self, opts)
|
File "/space/linuxbrew/couch.7.0.2.20210908_queues/install/lib/python/cbmgr.py", line 3920, in execute
|
self._import(opts)
|
File "/space/linuxbrew/couch.7.0.2.20210908_queues/install/lib/python/cbmgr.py", line 3951, in _import
|
_exit_if_errors(errors)
|
File "/space/linuxbrew/couch.7.0.2.20210908_queues/install/lib/python/cbmgr.py", line 234, in _exit_if_errors
|
print(f'ERROR: {remove_prefix(error, "_ -").lstrip(" ")}')
|
File "/space/linuxbrew/couch.7.0.2.20210908_queues/install/lib/python/cbmgr.py", line 81, in remove_prefix
|
return val[len(prefix):] if val.startswith(prefix) else val
|
AttributeError: 'dict' object has no attribute 'startswith'
|
Note:
The UI will import it and allow you to see the missing resource and either abort or select another resource so it is fine.
Use the REST API to export two working Functions m1 and m2.
Function m1 uses a BUCKET m1.default._default for it's "_Eventing Storage" or metadata.
Function m2 uses a COLLECTION m2.s2.c2 for it's "Eventing Storage" or metadata.
curl -XGET http://Administrator :password@192.168.3.150:8096/api/v1/functions/m1 -o m1_rest.json
|
curl -XGET http://Administrator :password@192.168.3.150:8096/api/v1/functions/m2 -o m2_rest.json
|
NOw delete Functions m1 and m2.
Now delete BUCKET m1 and delete collection m2.s2.c2 (leaving scope m2.s2)
Finally do an import via the REST API for each function. The REST API works fine and gives the proper error message for Function m1 with a deleted bucket Function m2 with a deleted collection for the "Eventing Storage" or metadata.
curl -XPOST -d @./m1_rest.json http://Administrator :password@192.168.3.150:8096/api/v1/functions/m1
|
{
|
"name": "ERR_BUCKET_MISSING",
|
"code": 41,
|
"description": "Bucket does not exist in the cluster",
|
"attributes": null,
|
"runtime_info": {
|
"code": 41,
|
"info": "Bucket m1 does not exist"
|
}
|
}
|
|
curl -XPOST -d @./m2_rest.json http://Administrator :password@192.168.3.150:8096/api/v1/functions/m2
|
{
|
"name": "ERR_COLLECTION_MISSING",
|
"code": 56,
|
"description": "Collection does not exist in the cluster",
|
"attributes": null,
|
"runtime_info": {
|
"code": 56,
|
"info": "Collection Not defined bucket: m2 scope: s2 collection: c2"
|
}
|
}
|
Attachments
Issue Links
- causes
-
MB-48743 couchbase-cli ip-family command failed on build 7.1.0-1399
- Closed