| |
- access(...)
- access(path, mode) -> True if granted, False otherwise
Use the real uid/gid to test for access to a path. Note that most
operations will use the effective uid/gid, therefore this routine can
be used in a suid/sgid environment to test if the invoking user has the
specified access to the path. The mode argument can be F_OK to test
existence, or the inclusive-OR of R_OK, W_OK, and X_OK.
- chdir(...)
- chdir(path)
Change the current working directory to the specified path.
- cleanUp()
- #-----------------------------------------------------------------------------
#--Functions
- coercePortNumber(port_number)
- This helper function takes a port number which can be in string or integer
format and converts it to an integer. In the event of any failure, it
returns None. Also, in the case that the port number is set to be an offset
from the ACS_INSTANCE, this method handles that as well.
Params: port_number port number. Can be absolute (i.e., "3075") or dynamic
(i.e., "0"-"24").
Returns: the port number in integer format or None if there was some sort
of failure
- exit(...)
- exit([status])
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
- fstat(...)
- fstat(fd) -> stat result
Like stat(), but for an open file descriptor.
- getContainerDict(portsFile)
- Returns a dictionary where each key is the name of a container and the
value is the absolute TCP port number it should use.
Params:
- portsFile A file which contains "someContainerName 1234" on each line
where 1234 is a TCP port number.
Returns: a dictionary where each key is the name of a container and the
value is the absolute TCP port number it should use
- getExistingPort(cont_name, port_dict, host_dict)
- If the port dictionary already has an entry stating that this container
should be using some port, returns that port. If not, returns None.
- getNextAvailablePort(host, ports_dict, hosts_dict, baseport)
- Returns the next available port
- getPortsFile(baseport)
- Returns the file containing a list of containers and used ports
- lockf(...)
- lockf (fd, operation, length=0, start=0, whence=0)
This is essentially a wrapper around the fcntl() locking calls. fd is the
file descriptor of the file to lock or unlock, and operation is one of the
following values:
LOCK_UN - unlock
LOCK_SH - acquire a shared lock
LOCK_EX - acquire an exclusive lock
When operation is LOCK_SH or LOCK_EX, it can also be bit-wise OR'd with
LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and the
lock cannot be acquired, an IOError will be raised and the exception will
have an errno attribute set to EACCES or EAGAIN (depending on the operating
system -- for portability, check for either value).
length is the number of bytes to lock, with the default meaning to lock to
EOF. start is the byte offset, relative to whence, to that the lock
starts. whence is as with fileobj.seek(), specifically:
0 - relative to the start of the file (SEEK_SET)
1 - relative to the current buffer position (SEEK_CUR)
2 - relative to the end of the file (SEEK_END)
- main(prog_args)
- portIsFree(ip_addr, tcp_port)
- Simple helper function returns true if the TCP port, tcp_port, of the
host, ip_addr, is free to use.
- portNumberAlreadyUsed(port_number, host, port_dict, host_dict)
- Function returns 1 if the port number is already in use and false
otherwise.
- sleep(...)
- sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
- system(...)
- system(command) -> exit_status
Execute the command (a string) in a subshell.
|