-
Couldn't load subscription status.
- Fork 20
adcli: Adding further methods #213
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @shridhargadekar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the capabilities of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds several new methods to the AdcliUtils class for managing users and groups in Active Directory. The changes are functional, but there is a significant amount of code duplication across the new methods. My review focuses on refactoring this duplicated logic into a helper method to improve maintainability and consistency. I've also pointed out some minor inconsistencies in parameter naming and command-line argument order that can be addressed during the refactoring.
603e2dd to
5445890
Compare
883fbb1 to
eee1dda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, please, see few comments inside. Otherwise looks good, but I'll let someone else to review functionality.
4ed04e5 to
030483e
Compare
030483e to
36886b9
Compare
|
Hi, I have not comments about the adcli functionality, but a general comment. You are using the Additionally, please check the bye, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my suggestion for create_user.
I think it makes the code more readable and might be applicable to all of the functions.
Alternatively create a generic helper and just add appropriate adcli_cmd :
def _run_adcli(
self,
adcli_cmd: list[str],
domain: str,
password: str,
args: list[str] | None = None,
login_user: str,
krb: bool = False,
) -> ProcessResult:
if args is not None:
adcli_cmd.extend(args)
if krb:
self.host.conn.exec(["kinit", f"{login_user}@{domain.upper()}"], input=password)
else:
adcli_cmd.extend(["--stdin-password", "-U", login_user])
return self.host.conn.exec(adcli_cmd, input=password, raise_on_error=False)
sssd_test_framework/utils/adcli.py
Outdated
| if krb: | ||
| self.host.conn.exec(["kinit", f"{login_user}@{domain.upper()}"], input=password) | ||
| command = self.host.conn.exec( | ||
| ["adcli", "create-user", user, f"--domain={domain}", "-C", *args], raise_on_error=False | ||
| ) | ||
| else: | ||
| command = self.host.conn.exec( | ||
| [ | ||
| "adcli", | ||
| "create-user", | ||
| user, | ||
| "--stdin-password", | ||
| f"--domain={domain}", | ||
| *args, | ||
| "-U", | ||
| login_user, | ||
| ], | ||
| input=password, | ||
| raise_on_error=False, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if krb: | |
| self.host.conn.exec(["kinit", f"{login_user}@{domain.upper()}"], input=password) | |
| command = self.host.conn.exec( | |
| ["adcli", "create-user", user, f"--domain={domain}", "-C", *args], raise_on_error=False | |
| ) | |
| else: | |
| command = self.host.conn.exec( | |
| [ | |
| "adcli", | |
| "create-user", | |
| user, | |
| "--stdin-password", | |
| f"--domain={domain}", | |
| *args, | |
| "-U", | |
| login_user, | |
| ], | |
| input=password, | |
| raise_on_error=False, | |
| ) | |
| adcli_cmd = ["adcli", "create-user", user, f"--domain={domain}", "-C", *args] | |
| if krb: | |
| self.host.conn.exec(["kinit", f"{login_user}@{domain.upper()}"], input=password) | |
| else: | |
| adcli_cmd.extend(["--stdin-password", "-U", login_user]) | |
| command = self.host.conn.exec(adcli_cmd, input=password, raise_on_error=False) |
Adding further methods to adcli class: 1. Create-user 2. Delete-user 3. Create-group, add group-members 4. Remove-group, remove group-members 5. Create MSA 6. (Re)Set password of AD-user
36886b9 to
368f468
Compare
Adding further methods to adcli class:
This PR will complete all the methods available with
adcliso far.