Bcfg2 / bcfg2

Git clone of the Bcfg2 repository
http://bcfg2.org
Other
93 stars 58 forks source link

Add rudimentary windows support for bcfg2 #391

Open chschenk opened 7 years ago

chschenk commented 7 years ago

This pull request adds rudimentary windows support to bcfg2. The most changes are in the probe and the locking sections:

-Probes The shebangline of the probes have to be in the format "#!C:\Path\to\interpreter.exe.fileending" because windows refuses to run files without an fileending. An example shebangline would be "#!C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.ps1"

-Locking Unfortunately windows has no fcntl so that locking under windows is done by writing the pid into the lockfile

-Tools For managing windows i have written three Tools: WinAction, WinFS, WinService -WinAction handles the default Action entrys. Example entry <Action name='test' command="echo test > C:\test.txt" timing="post" when="always" status="check"/> -WinFS handles Path entrys. Example entrys <Path name='/%ProgramFiles%/test/test.txt'/> or <Path name='/C:/test.txt'/>. Currently the options owner, group and mode are ignored completly. -WinService handles service entrys and starts, stops or restarts the services via powershell. Example Entry: <Service name='icinga2' type='windows' status="on" />

AlexanderS commented 7 years ago

Oh wow, thanks.

The errors reported by travis-ci, seems only style issues. That should be fixable. Would you mind to fix the obvious stuff (like line too long)?

I don't like the os.name name checks during the imports. Maybe we can do something like the Compat stuff and externalize this into an external module.

chschenk commented 7 years ago

@AlexanderS What do you think of this? I have added the modules which weren't available under Windows to the Compat module and fixed the style issues

AlexanderS commented 7 years ago

Wow, that looks great.

@solj What do you think?

chschenk commented 7 years ago

You are right i have fixed the issues

odenbach commented 6 years ago

Any chance to get this included? I would love to see this upstream.

solj commented 6 years ago

@chschenk It looks like the exception clauses you're using in Utils.py don't work with < python 2.6. Can you modify those so they don't use the "except Exception as" clause?