|
Methods defined here:
- __init__(self, portsFilePath)
- Create new .ports file descriptor.
A descriptor can describe a .ports file that does or doesn't yet exist on the host disk.
- changeIPAddress(self, oldIpAddress, newIpAddress)
- Set .ports file entry for shutdown command for machine.
- create(self)
- Create a .ports file.
As implemented creates an empty container.
Does nothing in case file already exist on the host disk.
- exists(self)
- Return True if file exists on the host disk.
- getPorts(self, protocol=None, user=None)
- Return a list of dictionaries of .ports file entries for a user.
If self.portsFileContent is None then return None.
If no match then return empty list [].
protocol
e.g. "ssh".
If None then all.
user
e.g. "joe".
If None then all.
- getRegularUser(self)
- Return a regular user from .ports file entry.
Often the main user.
If none then return None.
- modify(self, portsFileContentModifyingMethod)
- Recommended safe wrapper to modify .ports file.
Does nothing in case file doesn't exist on the host disk.
Intentionally does nothing to support installation policies where .ports files
are not to be stored.
To make sure file exists, call create().
- removeSsh(self, ipaddress, user)
- Remove .ports file entry for ssh access for a user.
- setRegularUser(self, regularUser)
- Set .ports file entry for a regular user.
Often the main user.
regularUser
name of regular user.
If falsy then remove entry.
- setShutdown(self, command='shutdown -P now', user='root', protocol='ssh')
- Set .ports file entry for shutdown command for machine.
- setSsh(self, ipaddress, user, pwd)
- Set .ports file entry for ssh access for a user.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- portsFileContent
- An xml.etree.ElementTree instance.
If not exists() may be None.
- portsFilePath
- Path of the .ports file.
|