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

verify_env function for windows #33062

Merged
merged 7 commits into from
May 6, 2016
Merged

Conversation

twangboy
Copy link
Contributor

@twangboy twangboy commented May 4, 2016

What does this PR do?

Creates win_verify_env to handle folder creation and permissions for windows
Fixes problem with missing os.getppid method in windows
Creates win_functions util

What issues does this PR fix or reference?

https://github.com/saltstack/zh/issues/674
https://github.com/saltstack/zh/issues/675

Previous Behavior

Folders were not being created on minion/master start in windows
Stacktrace when launching minion/master when minion/master is running

New Behavior

Creates missing folders and adds permissions
Gracefully exits when instance is already running

Tests written?

No

- Create win_verify_env to create directories for windows minion
  and master. Uses functions from win_functions
- Fix stacktrace when minion starts when there's already a minion
  running. os.getppid doesn't work in windows. Created a function
  in win_functions to duplicate that functionality.
@cachedout
Copy link
Contributor

Hi @twangboy Just some lint here. The rest looks great.

http://166.78.178.63:8080/job/PR/job/salt-pr-lint-n/1576/violations/

@cachedout cachedout added the Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged label May 5, 2016
# There is no os.getppid method for windows
from salt.utils import is_windows
if is_windows():
from salt.utils.win_functions import get_parent_pid
Copy link
Contributor

Choose a reason for hiding this comment

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

This file already has 'import salt.utils' at the top. So I would skip the import and just use:

if salt.utils.is_windows():

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I thought, but it wasn't resolving for me when I was doing it earlier. It is now though. I don't know what happened.

@cachedout cachedout merged commit 2dc45dc into saltstack:develop May 6, 2016
@damon-atkins
Copy link
Contributor

FYI

os.getppid()
Return the parent’s process id. When the parent process has exited, on Unix the id returned is the one of the init process (1), on Windows it is still the same id, which may be already reused by another process.
Availability: Unix, Windows.
Changed in version 3.2: Added support for Windows.

gitebra pushed a commit to gitebra/salt that referenced this pull request May 9, 2016
* commit '2dc45dc97ea0ac630e14988d05346dce27535a9a':
  verify_env function for windows (saltstack#33062)
  PY3: Fix dict keys when using salt.filesystem.FSChan (saltstack#33077)
  Fix typo
@twangboy twangboy deleted the win_verify_env branch August 30, 2016 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants