Skip to content
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

Added an implementation of .set_domain_workgroup() that corresponds with .get_domain_workgroup() #51379

Merged

Conversation

arizvisa
Copy link
Contributor

@arizvisa arizvisa commented Jan 29, 2019

What does this PR do?

This adds an implementation of set_domain_workgroup() to salt.modules.win_system. The salt.modules.win_system module includes an implementation of get_domain_workgroup(), but nothing in the form of actually setting it (other than joining an AD domain which has differing semantics). This was done using the COM api for WMI similar to other functions defined within the module.

The set_hostname() function was also updated to use the COM api as before it was using salt.cmd to execute wmic to set the name. On top of these additions, a new state function was added to salt.states.win_system as workgroup() which allows one to manage the workgroup of a windows machine in the same way as the "hostname" and "computer_name".

Previous Behavior

There was no way to set the workgroup for a windows machine.

New Behavior

Now it's possible to set the workgroup for a windows machine via the module, or using the state to manage the workgroup. This adds to salt.states.win_system and salt.modules.win_system.

@arizvisa arizvisa requested a review from a team as a code owner January 29, 2019 07:52
@arizvisa
Copy link
Contributor Author

um. wow, let me rebase this....

@arizvisa arizvisa force-pushed the win_system-module-set_domain_workgroup branch from db0fd3c to cec06d1 Compare January 29, 2019 07:56
salt/modules/win_system.py Outdated Show resolved Hide resolved
salt/states/win_system.py Show resolved Hide resolved
salt/states/win_system.py Show resolved Hide resolved
@arizvisa arizvisa force-pushed the win_system-module-set_domain_workgroup branch from 1d90456 to 62bb1e8 Compare February 1, 2019 23:07
@arizvisa
Copy link
Contributor Author

arizvisa commented Feb 1, 2019

Ok. Rebased it.

Copy link
Contributor

@twangboy twangboy left a comment

Choose a reason for hiding this comment

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

A few more things and then I think we're good.

salt/states/win_system.py Show resolved Hide resolved
salt/states/win_system.py Outdated Show resolved Hide resolved
… in test-mode, and to validate whether the name has actually changed or not.
@arizvisa
Copy link
Contributor Author

arizvisa commented Feb 5, 2019

A lot of this PR was based on copy-and-paste from other states because it seemed like a quick thing, but it turns out that a lot of it was wrong. Thanks for helping me improve it.

But, it seems like the schema for these dictionaries could be consolidated into a single function to construct and validate them on return, right? It would allow for stricter enforcement at the very least (and possibly even allow one to do tricky things such as being able to auto-mock some smoke checks for the states, or checking that there's a 'test' mode implemented).

I just don't believe that documentation and clever maintainers (thanks btw) is a strong enough method of validation. Although there's tests and a lot of them, some of the modules aren't really too comprehensive for all of the crazy functionality that you guys support (and some of them require a lot of manual mocking, which for win_system seems to have only been introduced a year ago).

Do you guys keep your milestones or goals up for the project's releases anywhere (something like the Project Tab, but more in the future)?

@twangboy
Copy link
Contributor

twangboy commented Feb 5, 2019

@arizvisa I opened a pull request against your branch. That should fix the failing tests as well as add tests for the new function.

arizvisa#1

@arizvisa
Copy link
Contributor Author

arizvisa commented Feb 5, 2019

@twangboy, thanks sir!

@dwoz dwoz merged commit ec0406d into saltstack:develop Feb 5, 2019
@twangboy
Copy link
Contributor

twangboy commented Feb 5, 2019

@arizvisa Thanks for the contribution. Welcome to the community!

twangboy pushed a commit to twangboy/salt that referenced this pull request Apr 21, 2020
…t_domain_workgroup

Added an implementation of .set_domain_workgroup() that corresponds with .get_domain_workgroup()
@twangboy twangboy mentioned this pull request Apr 21, 2020
3 tasks
@twangboy twangboy added the has master-port port to master has been created label Apr 21, 2020
dwoz added a commit that referenced this pull request Apr 21, 2020
arizvisa added a commit to arizvisa/lolfuzz3 that referenced this pull request Jun 24, 2020
…ernal modules from the master.project states as apparently they were merged by PR saltstack/salt#51379.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has master-port port to master has been created
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants