Additional docs formatting

This commit is contained in:
twangboy 2018-04-20 14:58:27 -06:00
parent ff46b27a60
commit 24df6ec1b7
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB
3 changed files with 47 additions and 35 deletions

View file

@ -21,7 +21,7 @@ can have a value assigned to them under the (Default)
Values or Entries
-----------------
Values/Entries are name/data pairs. There can be many values in a key. The
(Default) value corresponds to the Key, the rest are their own value pairs.
``(Default)`` value corresponds to the Key, the rest are their own value pairs.
:depends: - PyWin32
'''
@ -74,7 +74,7 @@ def key_exists(hive, key, use_32bit_registry=False):
CLI Example:
.. code-block::
.. code-block:: bash
salt '*' reg.key_exists HKLM SOFTWARE\Microsoft
'''
@ -273,8 +273,11 @@ def set_value(hive,
.. note::
The type for the (Default) value is always REG_SZ and cannot be
changed. This parameter is optional. If not passed, the Key will
be created with no associated item/value pairs.
changed.
.. note::
This parameter is optional. If ``vdata`` is not passed, the Key
will be created with no associated item/value pairs.
vtype (str):
The value type. The possible values of the vtype parameter are
@ -323,7 +326,7 @@ def set_value(hive,
.. code-block:: bash
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\\Salt' 'bin_data' vtype=REG_BINARY vdata='!!binary d2hhdCdzIHRoZSBwb2ludA=='
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\\Salt' 'bin_data' vtype=REG_BINARY vdata='Salty Data'
CLI Example:

View file

@ -31,29 +31,35 @@ Values or Entries
-----------------
Values or Entries are the name/data pairs beneath the keys and subkeys. All keys
have a default name/data pair. It is usually "(Default)"="(value not set)". The
actual value for the name and the date is Null. The registry editor will display
"(Default)" and "(value not set)".
have a default name/data pair. The name is ``(Default)`` with a displayed value
of ``(value not set)``. The actual value is Null.
-------
Example
-------
The following example is taken from the windows startup portion of the registry:
```
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"RTHDVCPL"="\"C:\\Program Files\\Realtek\\Audio\\HDA\\RtkNGUI64.exe\" -s"
"NvBackend"="\"C:\\Program Files (x86)\\NVIDIA Corporation\\Update Core\\NvBackend.exe\""
"BTMTrayAgent"="rundll32.exe \"C:\\Program Files (x86)\\Intel\\Bluetooth\\btmshellex.dll\",TrayApp"
```
.. code-block:: bash
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"RTHDVCPL"="\"C:\\Program Files\\Realtek\\Audio\\HDA\\RtkNGUI64.exe\" -s"
"NvBackend"="\"C:\\Program Files (x86)\\NVIDIA Corporation\\Update Core\\NvBackend.exe\""
"BTMTrayAgent"="rundll32.exe \"C:\\Program Files (x86)\\Intel\\Bluetooth\\btmshellex.dll\",TrayApp"
In this example these are the values for each:
Hive: `HKEY_LOCAL_MACHINE`
Hive:
``HKEY_LOCAL_MACHINE``
Key and subkeys: `SOFTWARE\Microsoft\Windows\CurrentVersion\Run`
Key and subkeys:
``SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run``
Value:
- There are 3 value names: `RTHDVCPL`, `NvBackend`, and `BTMTrayAgent`
- There are 3 value names:
- `RTHDVCPL`
- `NvBackend`
- `BTMTrayAgent`
- Each value name has a corresponding value
'''
from __future__ import absolute_import, print_function, unicode_literals
@ -122,13 +128,13 @@ def present(name,
vname (str):
The name of the value you'd like to create beneath the Key. If this
parameter is not passed it will assume you want to set the (Default)
value
parameter is not passed it will assume you want to set the
``(Default)`` value
vdata (str, int, list):
The value you'd like to set. If a value name (vname) is passed, this
will be the data for that value name. If not, this will be the
(Default) value for the key.
The value you'd like to set. If a value name (``vname``) is passed,
this will be the data for that value name. If not, this will be the
``(Default)`` value for the key.
The type of data this parameter expects is determined by the value
type specified in ``vtype``. The correspondence is as follows:
@ -154,9 +160,9 @@ def present(name,
`here <http://yaml.org/type/binary.html>`_
.. note::
The type for the (Default) value is always REG_SZ and cannot be
changed. This parameter is optional. If not passed, the Key will
be created with no associated item/value pairs.
The type for the ``(Default)`` value is always REG_SZ and cannot
be changed. This parameter is optional. If not passed, the Key
will be created with no associated item/value pairs.
vtype (str):
The value type for the data you wish to store in the registry. Valid
@ -276,8 +282,8 @@ def absent(name, vname=None, use_32bit_registry=False):
vname (str):
The name of the value you'd like to create beneath the Key. If this
parameter is not passed it will assume you want to set the (Default)
value
parameter is not passed it will assume you want to set the
``(Default)`` value
use_32bit_registry (bool):
Use the 32bit portion of the registry. Applies only to 64bit
@ -296,7 +302,7 @@ def absent(name, vname=None, use_32bit_registry=False):
In the above example the value named ``version`` will be removed from
the SOFTWARE\\Salt key in the HKEY_CURRENT_USER hive. If ``vname`` was
not passed, the (Default) value would be deleted.
not passed, the ``(Default)`` value would be deleted.
'''
ret = {'name': name,
'result': True,

View file

@ -174,7 +174,7 @@ def key_exists(hive, key, use_32bit_registry=False):
Usage:
.. code-block::
.. code-block:: python
import salt.utils.win_reg
winreg.key_exists(hive='HKLM', key='SOFTWARE\\Microsoft')
@ -206,7 +206,7 @@ def broadcast_change():
Usage:
.. code-block::
.. code-block:: python
import salt.utils.win_reg
winreg.broadcast_change()
@ -246,7 +246,7 @@ def list_keys(hive, key=None, use_32bit_registry=False):
Usage:
.. code-block::
.. code-block:: python
import salt.utils.win_reg
winreg.list_keys(hive='HKLM', key='SOFTWARE\\Microsoft')
@ -313,7 +313,7 @@ def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
Usage:
.. code-block::
.. code-block:: python
import salt.utils.win_reg
winreg.list_values(hive='HKLM', key='SYSTEM\\CurrentControlSet\\Services\\Tcpip')
@ -398,7 +398,7 @@ def read_value(hive, key, vname=None, use_32bit_registry=False):
Usage:
.. code-block::
.. code-block:: python
import salt.utils.win_reg
winreg.read_value(hive='HKLM', key='SOFTWARE\\Salt', vname='version')
@ -513,8 +513,11 @@ def set_value(hive,
.. note::
The type for the (Default) value is always REG_SZ and cannot be
changed. This parameter is optional. If not passed, the Key will
be created with no associated item/value pairs.
changed.
.. note::
This parameter is optional. If not passed, the Key will be
created with no associated item/value pairs.
vtype (str):
The value type. The possible values of the vtype parameter are