Definition of a channel within a manifest. Defines a mapping from the host to the ZeroVM filesystem, access type, and read/write limits.
Parameters: |
|
---|
Object representation of a ZeroVM manifest. Includes utilities and sane defaults for generating manifest files.
Get the text representation of the manifest.
Parameters: |
|
---|
Generate the text for an nvram file.
Attr parser: | argparse.ArgumentParser instance, used to define the command line arguments. |
---|---|
Attr args: | argparse.Namespace representing the command line arguments. |
Given a dict of runtime files (see the output _get_runtime_file_paths()), check if any exist. If any exist, raise a RuntimeError.
Given a command, search through the listed tar images (processed_images) and extract the nexe matching command to the target program_path on the host file system.
Parameters: |
|
---|
Generate the runtime files paths for boot, manifest, nvram, stdout, and stderr files, and return them as a OrderedDict with the following structure:
>>> _get_runtime_file_paths('/home/user1', 1)
OrderedDict([('boot', '/home/user1/boot.1'), ('manifest', '/home/user1/manifest.1'), ('nvram', '/home/user1/nvram.1'), ('stdout', '/home/user1/stdout.1'), ('stderr', '/home/user1/stderr.1')])
Note that that paths are created by simply joining working_dir, so relatve file paths can be used as well:
>>> _get_runtime_file_paths('foo/', 1)
OrderedDict([('boot', 'foo/boot.1'), ('manifest', 'foo/manifest.1'), ('nvram', 'foo/nvram.1'), ('stdout', 'foo/stdout.1'), ('stderr', 'foo/stderr.1')])
Escape value for inclusion as a value in a nvram file.
The ini-file parser in ZRT is very simple. One quirk is that it handles ‘,’ the same as ‘n’, which means that a value like
greeting = Hello, World
will be cut-off after “Hello”.
Values also need protection in other ways:
This function escapes ‘\’, ‘”’, ‘,’, ‘ ‘, and ‘n’. These are the characters that conf_parser::unescape_string_copy_to_dest is documented to handle and they are sufficient to handle the above use cases.
>>> _nvram_escape('foo, bar')
'foo\\x2c\\x20bar'
>>> _nvram_escape('new\nline')
'new\\x0aline'
Process a list of the –zvm-image arguments and split them into the path,mount_point,access_type components. This returns a generator of 3-tuples.
mount_point and access_type are optional and will default to / and ro, respectively.
Example:
>>> list(_process_images(['/home/user1/foo.tar',
... '/home/user1/bar.tar,/var/lib',
... '/home/user1/baz.tar,/usr/lib,rw']))
[('/home/user1/foo.tar', '/', 'ro'), ('/home/user1/bar.tar', '/var/lib', 'ro'), ('/home/user1/baz.tar', '/usr/lib', 'rw')]
Parameters: |
|
---|
Parameters: |
|
---|
Parameters: |
---|
Create a spawned process. Based on pty.spawn code.