From eb9a591fbc9436b58ab551007149eb6748ae0c5d Mon Sep 17 00:00:00 2001 From: Anthony F McInerney Date: Tue, 8 Jan 2019 00:16:22 +0000 Subject: [PATCH] fix spinx build warnings (cherry picked from commit 6bb64f94ff7b3b7d8bda28d0c7fc2e8a907a381e) --- src/pylorax/api/v0.py | 10 ++++++++-- src/pylorax/imgutils.py | 2 +- src/pylorax/ltmpl.py | 16 ++++++++++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/pylorax/api/v0.py b/src/pylorax/api/v0.py index cc8a9707..5f8724a0 100644 --- a/src/pylorax/api/v0.py +++ b/src/pylorax/api/v0.py @@ -690,7 +690,9 @@ POST `/api/v0/compose` ^^^^^^^^^^^^^^^^^^^^^^ Start a compose. The content type should be 'application/json' and the body of the POST - should look like this:: + should look like this + + Example:: { "blueprint_name": "http-server", @@ -700,8 +702,10 @@ POST `/api/v0/compose` Pass it the name of the blueprint, the type of output (from '/api/v0/compose/types'), and the blueprint branch to use. 'branch' is optional and will default to master. It will create a new - build and add it to the queue. It returns the build uuid and a status if it succeeds:: + build and add it to the queue. It returns the build uuid and a status if it succeeds + Example:: + { "build_id": "e6fa6db4-9c81-4b70-870f-a697ca405cdf", "status": true @@ -712,6 +716,8 @@ POST `/api/v0/compose` Returns the list of supported output types that are valid for use with 'POST /api/v0/compose' + Example:: + { "types": [ { diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index 616199fa..cf05bb2f 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -445,7 +445,7 @@ def mkfsimage(fstype, rootdir, outfile, size=None, mkfsargs=None, mountargs="", '''Generic filesystem image creation function. fstype should be a filesystem type - "mkfs.${fstype}" must exist. graft should be a dict: {"some/path/in/image": "local/file/or/dir"}; - if the path ends with a '/' it's assumed to be a directory. + if the path ends with a '/' it's assumed to be a directory. Will raise CalledProcessError if something goes wrong.''' mkfsargs = mkfsargs or [] graft = graft or {} diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index d00876c8..6076f241 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -121,6 +121,7 @@ class LoraxTemplateRunner(object): * Parsing procedure is roughly: 1. Mako template expansion (on the whole file) 2. For each line of the result, + a. Whitespace splitting (using shlex.split()) b. Brace expansion (using brace_expand()) c. If the first token is the name of a function, call that function @@ -264,6 +265,7 @@ class LoraxTemplateRunner(object): If DEST doesn't exist, SRC will be copied to a file with that name, assuming the rest of the path exists. This is pretty much like how the 'cp' command works. + Examples: install usr/share/myconfig/grub.conf /boot install /usr/share/myconfig/grub.conf.in /boot/grub.conf @@ -319,6 +321,7 @@ class LoraxTemplateRunner(object): ''' mkdir DIR [DIR ...] Create the named DIR(s). Will create leading directories as needed. + Example: mkdir /images ''' @@ -332,6 +335,7 @@ class LoraxTemplateRunner(object): replace PATTERN REPLACEMENT FILEGLOB [FILEGLOB ...] Find-and-replace the given PATTERN (Python-style regex) with the given REPLACEMENT string for each of the files listed. + Example: replace @VERSION@ ${product.version} /boot/grub.conf /boot/isolinux.cfg ''' @@ -349,7 +353,9 @@ class LoraxTemplateRunner(object): Append STRING (followed by a newline character) to FILE. Python character escape sequences ('\\n', '\\t', etc.) will be converted to the appropriate characters. + Examples: + append /etc/depmod.d/dd.conf "search updates built-in" append /etc/resolv.conf "" ''' @@ -362,6 +368,7 @@ class LoraxTemplateRunner(object): Add an item to the treeinfo data store. The given SECTION will have a new item added where KEY = ARG ARG ... + Example: treeinfo images-${kernel.arch} boot.iso images/boot.iso ''' @@ -462,6 +469,7 @@ class LoraxTemplateRunner(object): ''' log MESSAGE Emit the given log message. Be sure to put it in quotes! + Example: log "Reticulating splines, please wait..." ''' @@ -485,7 +493,7 @@ class LoraxTemplateRunner(object): (this should be replaced with a "find" function) runcmd find ${root} -name "*.pyo" -type f -delete %for f in find(root, name="*.pyo"): - remove ${f} + remove ${f} %endfor ''' cmd = cmdlist @@ -580,6 +588,7 @@ class LoraxTemplateRunner(object): ''' removepkg PKGGLOB [PKGGLOB...] Delete the named package(s). + IMPLEMENTATION NOTES: RPM scriptlets (%preun/%postun) are *not* run. Files are deleted, but directories are left behind. @@ -644,6 +653,7 @@ class LoraxTemplateRunner(object): (or packages) named. If '--allbut' is used, all the files from the given package(s) will be removed *except* the ones which match the file globs. + Examples: removefrom usbutils /usr/bin/* removefrom xfsprogs --allbut /sbin/* @@ -688,7 +698,7 @@ class LoraxTemplateRunner(object): to search and one KEEPGLOB to keep. The KEEPGLOB is expanded to be *KEEPGLOB* so that it will match anywhere in the path. - This only removes files from under /lib/modules/*/kernel/ + This only removes files from under /lib/modules/\*/kernel/ Examples: removekmod sound drivers/media drivers/hwmon drivers/video @@ -737,6 +747,7 @@ class LoraxTemplateRunner(object): ''' createaddrsize INITRD_ADDRESS INITRD ADDRSIZE Create the initrd.addrsize file required in LPAR boot process. + Examples: createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize ''' @@ -749,6 +760,7 @@ class LoraxTemplateRunner(object): ''' systemctl [enable|disable|mask] UNIT [UNIT...] Enable, disable, or mask the given systemd units. + Examples: systemctl disable lvm2-monitor.service systemctl mask fedora-storage-init.service fedora-configure.service