WahlNetwork / vester

Easily validate and remediate your vSphere configuration
https://wahlnetwork.com
Apache License 2.0
146 stars 45 forks source link

Improve New-VesterConfig $Desired RegEx #178

Open brianbunke opened 7 years ago

brianbunke commented 7 years ago

Expected Behavior

New-VesterConfig successfully pulls the config value to populate from the $Desired line.

Current Behavior

The RegEx catches all instances of $cfg, instead of just the one desired. (Heyooo puns)

Possible Solution

Make dirty RegEx less dirty and more complicated

Be awesome and use the AST to properly parse the variable assignment

Steps to Reproduce (for bugs)

Try to run New-VesterConfig against the #176 version of the module, and watch it not populate a value for the new host VDS membership test. (Because "$cfg" is commented out in the fix block.)

Your Environment

176

brianbunke commented 7 years ago

Have this working, it looks pretty sweet 😃 Will hopefully submit a PR today.