Skip to content

Conversation

@ayesharustgi-delphix
Copy link
Contributor

Problem

Solution

Testing Done

ayesharustgi-delphix and others added 4 commits May 25, 2023 14:42
…#42)

* DXE-683 Rename Select Connector - CouchBase

* Version 1.1.1 (#31)

* initial support for using non couchbase user through sudo

* issue #22 - initial deployment, index support changes for backup ingestion, various fixes

* partial work

* cbbackupmgr working with sudo, bucket list in snapshot in JSON

* version 1.0.2

* fixing uid/gid regex

* version 1.0.3 - error messages fix

* ver 1.0.3.1

* ver 1.0.3.2 - sudo for all

* resync of xdcr and backupmgr OK

* workinf with copy config

* working with indexes - tested with backup only - ee, analytics removed from schema

* add end of multi cluster

* working multinode

* checks added, upgrade added

* version 1.1.0 build 0

* check mount points / doc updates

* cbbackup exit code check

* xdcr fixed for multi IP, and different scenarios

* v1.1.1 build 1.1.0.2

* v1.1.0 build 1.1.0.2

* version 1.1.1 - added field for hostname

* Issue #32 - multinode start

* version 1.1.2

* Set theme jekyll-theme-minimal

* doc fixes

* new logo

* proper style

* docs with multi node

Co-authored-by: Marcin Przepiorowski <marcin@delphix.com>
Co-authored-by: ayesharustgi-delphix <88486745+ayesharustgi-delphix@users.noreply.github.com>

* DXE-988 Couchbase - VDB failed to enable (#36)

* CE-59 Couchbase Plugin : Conversion of python2 to python3 (#38)

* CE-332 Disable python2.7 unit tests on couchbase repository (#41)

* unit test upgrade to python3.8

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/41

* unit test upgrade to python3.8

* removing python2.7 tests

* fixing python version to python3.8 for pytest

* disabling unit tests in github workflows

* reverting changes in test

---------

Co-authored-by: atyagi <ankur.tyagi@delphix.com>
Co-authored-by: Marcin Przepiorowski <pioro1@gmail.com>
Co-authored-by: Marcin Przepiorowski <marcin@delphix.com>
* CE-235 Enable CodeQL on Couchbase Repository

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/45

* CE-339 Addition of security tests in codeQL
* * Issue #32 - multinode start
* Set theme jekyll-theme-minimal
* add end of multi cluster
* cbbackup exit code check
* cbbackupmgr working with sudo, bucket list in snapshot in JSON
* check mount points / doc updates
* checks added, upgrade added
* doc fixes
* docs with multi node
* fixing uid/gid regex
* initial support for using non couchbase user through sudo
* issue #22 - initial deployment, index support changes for backup ingestion, various fixes
* new logo
* partial work
* proper style
* resync of xdcr and backupmgr OK
* v1.1.0 build 1.1.0.2
* v1.1.1 build 1.1.0.2
* ver 1.0.3.1
* ver 1.0.3.2 - sudo for all
* version 1.0.2
* version 1.0.3 - error messages fix
* version 1.1.0 build 0
* version 1.1.1 - added field for hostname
* version 1.1.2
* workinf with copy config
* working multinode
* working with indexes - tested with backup only - ee, analytics removed from schema
* xdcr fixed for multi IP, and different scenarios
CE-59 Couchbase Plugin : Conversion of python2 to python3 (#38)
Co-authored-by: Marcin Przepiorowski <marcin@delphix.com>
Co-authored-by: ayesharustgi-delphix <88486745+ayesharustgi-delphix@users.noreply.github.com>
DXE-683 Rename Select Connector - CouchBase
DXE-988 Couchbase - VDB failed to enable (#36)
Version 1.1.1 (#31)
security fix draft

* CE-340 Code changes to mask password in "ps" using expect utility

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/47

* code update

* code update

* removing commented code
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

* CE-509 REST API implementation for cluster-init
CE-510 REST API implementation for xdcr-setup
CE-511 REST API implementation for setting-cluster
CE-518 index creation inside scope support
CE-519 snapshot fails with backup restore failure
CE-520 status check of replication fails in xdcr dsource type
CE-521 cluster init fails when couchbase instance is recreated on a machine
CE-523 bucket-flush command fix
CE-525 server-add command fix
VDB creation fix for couchbase version 7.1.3

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/54

* CE-543 scope and collection pre-creation for xdcr dsource type

* CE-544 fix XDCR delete configuration

* CE-545 code hardening

* CE-546 plugin version upgrade

* CE-547 CodeQL fixes

* CE-547 CodeQL fixes

* CE-550 Changes in cluster-init and server-add for couchbase 7.1.1

* CE-550 Changes in cluster-init and server-add for couchbase 7.1.1

* CE-550 Changes in cluster-init and server-add for couchbase 7.1.1
* CE-554 Implement precommit checks in couchbase repo

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/56

* CodeQL fixes

* CodeQL fixes
command = CommandFactory.change_permission(directory_path)
utilities.execute_bash(self.connection, command)

command_output, std_err, exit_code = self.run_os_command(

Check warning

Code scanning / CodeQL

Variable defined multiple times Warning

This assignment to 'command_output' is unnecessary as it is
redefined
before this value is used.

Copilot Autofix

AI 3 days ago

To fix the issue, we should remove the unnecessary assignment of command_output, std_err, and exit_code for the first OS command in the make_directory method. Specifically, remove the left-hand assignment and simply execute the method for its side effect. The second assignment (after the permission change) should remain as is. This edit should be done only within the method's body to avoid unintended side effects.

Suggested changeset 1
src/controller/couchbase_operation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_operation.py b/src/controller/couchbase_operation.py
--- a/src/controller/couchbase_operation.py
+++ b/src/controller/couchbase_operation.py
@@ -419,7 +419,7 @@
 
         logger.debug("Creating Directory {} ".format(directory_path))
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="make_directory", directory_path=directory_path
         )
 
EOF
@@ -419,7 +419,7 @@

logger.debug("Creating Directory {} ".format(directory_path))

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="make_directory", directory_path=directory_path
)

Copilot is powered by AI and may make mistakes. Always verify output.
command = CommandFactory.change_permission(directory_path)
utilities.execute_bash(self.connection, command)

command_output, std_err, exit_code = self.run_os_command(

Check warning

Code scanning / CodeQL

Variable defined multiple times Warning

This assignment to 'std_err' is unnecessary as it is
redefined
before this value is used.

Copilot Autofix

AI 3 days ago

To fix this problem, remove the first assignment to command_output, std_err, exit_code at line 422 in the make_directory method. Since the right-hand side (self.run_os_command(...)) performs the actual operation, we must ensure the directory gets created (and not just the assignment is removed). Therefore, we should leave the line invoking self.run_os_command(...) but only for its side effect (do not assign output to any variable, since the value is unused). Thus, change line 422 from an assignment to a plain function call. Only line 422 needs to be edited; no additional imports, methods, or changes are required.

Suggested changeset 1
src/controller/couchbase_operation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_operation.py b/src/controller/couchbase_operation.py
--- a/src/controller/couchbase_operation.py
+++ b/src/controller/couchbase_operation.py
@@ -419,7 +419,7 @@
 
         logger.debug("Creating Directory {} ".format(directory_path))
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="make_directory", directory_path=directory_path
         )
 
EOF
@@ -419,7 +419,7 @@

logger.debug("Creating Directory {} ".format(directory_path))

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="make_directory", directory_path=directory_path
)

Copilot is powered by AI and may make mistakes. Always verify output.
command = CommandFactory.change_permission(directory_path)
utilities.execute_bash(self.connection, command)

command_output, std_err, exit_code = self.run_os_command(

Check warning

Code scanning / CodeQL

Variable defined multiple times Warning

This assignment to 'exit_code' is unnecessary as it is
redefined
before this value is used.

Copilot Autofix

AI 3 days ago

To fix this problem, don't assign the result of self.run_os_command on line 422 to any variables if they're not subsequently used before being redefined. Instead, just call self.run_os_command(...) for its side effect. The second block (line 430) should retain the variable assignments since those values may be used for debugging or error checking later (if extended), but the first assignments can be dropped.

Only lines 422 need to be changed in src/controller/couchbase_operation.py. Leave the call in place (so the directory is created) but remove the assignment to command_output, std_err, exit_code = ..., calling self.run_os_command() for the side effect. No import or interface changes are required.

Suggested changeset 1
src/controller/couchbase_operation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_operation.py b/src/controller/couchbase_operation.py
--- a/src/controller/couchbase_operation.py
+++ b/src/controller/couchbase_operation.py
@@ -419,7 +419,7 @@
 
         logger.debug("Creating Directory {} ".format(directory_path))
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="make_directory", directory_path=directory_path
         )
 
EOF
@@ -419,7 +419,7 @@

logger.debug("Creating Directory {} ".format(directory_path))

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="make_directory", directory_path=directory_path
)

Copilot is powered by AI and may make mistakes. Always verify output.
"Changing permission of directory path {}".format(directory_path)
)

command_output, std_err, exit_code = self.run_os_command(

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable command_output is not used.

Copilot Autofix

AI 3 days ago

To fix an unused local variable assignment where the right-hand side has side effects (making it necessary to keep the call), you should remove only the unused variable(s) on the left side of the assignment, leaving the function call on its own line. This makes the code cleaner and clarifies that the result is not needed. In this case, for line 430 in src/controller/couchbase_operation.py, change:

430:         command_output, std_err, exit_code = self.run_os_command(
431:             os_command="change_permission", path=directory_path
432:         )

to:

430:         self.run_os_command(
431:             os_command="change_permission", path=directory_path
432:         )

Make this change at line 430, keep three lines of context around the change, and ensure you do NOT remove the function call itself.

Suggested changeset 1
src/controller/couchbase_operation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_operation.py b/src/controller/couchbase_operation.py
--- a/src/controller/couchbase_operation.py
+++ b/src/controller/couchbase_operation.py
@@ -427,7 +427,7 @@
             "Changing permission of directory path {}".format(directory_path)
         )
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="change_permission", path=directory_path
         )
 
EOF
@@ -427,7 +427,7 @@
"Changing permission of directory path {}".format(directory_path)
)

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="change_permission", path=directory_path
)

Copilot is powered by AI and may make mistakes. Always verify output.
"Changing permission of directory path {}".format(directory_path)
)

command_output, std_err, exit_code = self.run_os_command(

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable std_err is not used.

Copilot Autofix

AI 3 days ago

To fix the problem of unused variables being assigned but never used, we should remove those assignments. For the line command_output, std_err, exit_code = self.run_os_command(...) at line 430, since none of the unpacked tuple values are used later, we can simply call self.run_os_command(...) without assigning its output to variables. This will maintain any side effects of the function call but not unnecessarily assign unused local variables. Only line 430 needs to be updated in this case.

Suggested changeset 1
src/controller/couchbase_operation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_operation.py b/src/controller/couchbase_operation.py
--- a/src/controller/couchbase_operation.py
+++ b/src/controller/couchbase_operation.py
@@ -427,7 +427,7 @@
             "Changing permission of directory path {}".format(directory_path)
         )
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="change_permission", path=directory_path
         )
 
EOF
@@ -427,7 +427,7 @@
"Changing permission of directory path {}".format(directory_path)
)

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="change_permission", path=directory_path
)

Copilot is powered by AI and may make mistakes. Always verify output.
"Changing permission of directory path {}".format(directory_path)
)

command_output, std_err, exit_code = self.run_os_command(

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable exit_code is not used.

Copilot Autofix

AI 3 days ago

The most precise way to fix this problem is to remove the unused left-hand side variables—command_output, std_err, exit_code—from the assignment, replacing them with just the function call (since the run_os_command call may have side effects and should not be removed). This should be done for both lines 422 and 430, as the pattern repeats in the same method. No additional imports or definitions are necessary. Edits should be made directly in the make_directory method within src/controller/couchbase_operation.py, lines 422 and 430.

Suggested changeset 1
src/controller/couchbase_operation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_operation.py b/src/controller/couchbase_operation.py
--- a/src/controller/couchbase_operation.py
+++ b/src/controller/couchbase_operation.py
@@ -419,7 +419,7 @@
 
         logger.debug("Creating Directory {} ".format(directory_path))
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="make_directory", directory_path=directory_path
         )
 
@@ -427,7 +427,7 @@
             "Changing permission of directory path {}".format(directory_path)
         )
 
-        command_output, std_err, exit_code = self.run_os_command(
+        self.run_os_command(
             os_command="change_permission", path=directory_path
         )
 
EOF
@@ -419,7 +419,7 @@

logger.debug("Creating Directory {} ".format(directory_path))

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="make_directory", directory_path=directory_path
)

@@ -427,7 +427,7 @@
"Changing permission of directory path {}".format(directory_path)
)

command_output, std_err, exit_code = self.run_os_command(
self.run_os_command(
os_command="change_permission", path=directory_path
)

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +70 to +71
# if analytics_service:
# additional_service = additional_service + ",analytics"

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 3 days ago

To fix the problem, we should remove the commented-out code on lines 70 and 71: # if analytics_service: and # additional_service = additional_service + ",analytics". This will help keep the source clear and maintainable. No functional code changes are required, only deletion of these two commented lines. No new imports or definitions are needed.


Suggested changeset 1
src/controller/couchbase_lib/_cluster.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/controller/couchbase_lib/_cluster.py b/src/controller/couchbase_lib/_cluster.py
--- a/src/controller/couchbase_lib/_cluster.py
+++ b/src/controller/couchbase_lib/_cluster.py
@@ -67,8 +67,6 @@
         additional_service = "query"
         if fts_service:
             additional_service = additional_service + ",fts"
-        # if analytics_service:
-        #     additional_service = additional_service + ",analytics"
         if eventing_service:
             additional_service = additional_service + ",eventing"
 
EOF
@@ -67,8 +67,6 @@
additional_service = "query"
if fts_service:
additional_service = additional_service + ",fts"
# if analytics_service:
# additional_service = additional_service + ",analytics"
if eventing_service:
additional_service = additional_service + ",eventing"

Copilot is powered by AI and may make mistakes. Always verify output.
satishk1536 and others added 11 commits October 11, 2023 09:28
* CE-541 Ingestion from multiple full backups

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/60

* Deleting test folder
…ual pre-snapshot failing (#63)

CE-577 Couchbase 1.30 >> Ingestion from multiple full backups >> Pre-snapshot failing

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/63
… permissions (#68)

* CE-633 Couchbase Plugin: Dsource sizing not working due to filesystem permissions

PR URL: https://www.github.com/delphix/couchbase-plugin/pull/68

* CE-633 Couchbase Plugin: Dsource sizing not working due to filesystem permissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants