Skip to content

Add helper script for kuberay rbac #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

hemildesai
Copy link
Contributor

Run using kuberay-rbac after installing nemo-run.

Start with kuberay-rbac --help

Signed-off-by: Hemil Desai <[email protected]>
terrykong
terrykong previously approved these changes Jun 5, 2025
Copy link

@terrykong terrykong left a comment

Choose a reason for hiding this comment

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

generally lgtm. but out of curiosity, would the code be more succinct if you used rich instead of manually doing the ansi color codes?

Signed-off-by: Hemil Desai <[email protected]>
)
if result.returncode == 0 and result.stdout.strip():
return result.stdout.strip()
except Exception:

Check notice

Code scanning / CodeQL

Empty except Note

'except' clause does nothing but pass and there is no explanatory comment.

Copilot Autofix

AI about 1 month ago

To fix the issue, the except Exception: block should log the exception using the existing print_error function. This ensures that any errors encountered during the execution of the subprocess.run command are visible to the user, aiding in debugging and transparency. The fallback behavior (return "default") can remain unchanged, as it provides a reasonable default in case of failure.

Steps to implement the fix:

  1. Modify the except Exception: block to log the exception using print_error.
  2. Include the exception message in the log for better debugging.
  3. Ensure the fallback behavior (return "default") remains intact.

Suggested changeset 1
nemo_run/tools/kuberay_rbac.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/nemo_run/tools/kuberay_rbac.py b/nemo_run/tools/kuberay_rbac.py
--- a/nemo_run/tools/kuberay_rbac.py
+++ b/nemo_run/tools/kuberay_rbac.py
@@ -62,4 +62,4 @@
             return result.stdout.strip()
-    except Exception:
-        pass
+    except Exception as e:
+        print_error(f"Failed to retrieve default namespace: {e}")
 
EOF
@@ -62,4 +62,4 @@
return result.stdout.strip()
except Exception:
pass
except Exception as e:
print_error(f"Failed to retrieve default namespace: {e}")

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
terrykong
terrykong previously approved these changes Jun 5, 2025
Signed-off-by: Hemil Desai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants