diff --git a/.buildinfo b/.buildinfo index 33b8a265..489bd916 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 187800f7fe75b395eca127bd57ac4ff9 +config: 7ed19a7584a3ae1b60c0542067c2ec16 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.doctrees/environment.pickle b/.doctrees/environment.pickle index 0876d520..abca290b 100644 Binary files a/.doctrees/environment.pickle and b/.doctrees/environment.pickle differ diff --git a/.doctrees/index.doctree b/.doctrees/index.doctree index 988621f2..43b9de2b 100644 Binary files a/.doctrees/index.doctree and b/.doctrees/index.doctree differ diff --git a/.doctrees/intro.doctree b/.doctrees/intro.doctree index 6eee71bc..cda0b11f 100644 Binary files a/.doctrees/intro.doctree and b/.doctrees/intro.doctree differ diff --git a/.doctrees/livemedia-creator.doctree b/.doctrees/livemedia-creator.doctree index 77294325..79ddb21a 100644 Binary files a/.doctrees/livemedia-creator.doctree and b/.doctrees/livemedia-creator.doctree differ diff --git a/.doctrees/lorax.doctree b/.doctrees/lorax.doctree index cc8e7b9b..27424d18 100644 Binary files a/.doctrees/lorax.doctree and b/.doctrees/lorax.doctree differ diff --git a/.doctrees/modules.doctree b/.doctrees/modules.doctree index a7272363..576deba6 100644 Binary files a/.doctrees/modules.doctree and b/.doctrees/modules.doctree differ diff --git a/.doctrees/product-images.doctree b/.doctrees/product-images.doctree index 60063199..1d6d0de0 100644 Binary files a/.doctrees/product-images.doctree and b/.doctrees/product-images.doctree differ diff --git a/.doctrees/pylorax.doctree b/.doctrees/pylorax.doctree index 52a72fd1..4c224ec4 100644 Binary files a/.doctrees/pylorax.doctree and b/.doctrees/pylorax.doctree differ diff --git a/_modules/index.html b/_modules/index.html index 88f72442..9c2877ed 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -8,7 +8,7 @@ - Overview: module code — Lorax 24.6 documentation + Overview: module code — Lorax 24.10 documentation @@ -30,10 +30,10 @@ - + - + @@ -43,17 +43,27 @@
@@ -137,7 +106,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -150,7 +125,8 @@

-
+
+

All modules for which code is available

+
@@ -198,7 +176,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -153,7 +128,8 @@

-
+
+

Source code for pylorax

 #
@@ -192,6 +168,7 @@
 import locale
 from subprocess import CalledProcessError
 import selinux
+from glob import glob
 
 from pylorax.base import BaseLoraxClass, DataHolder
 import pylorax.output as output
@@ -235,6 +212,7 @@
         self.inroot = None
         self.debug = False
         self.outputdir = None
+        self._templatedir = None
 
         # set locale to C
         locale.setlocale(locale.LC_ALL, 'C')
@@ -295,6 +273,18 @@
         list(os.environ.pop(k) for k in env_remove if k in os.environ)
 
         self._configured = True
+
+ @property +
[docs] def templatedir(self): + """Find the template directory. + + Pick the first directory under sharedir/templates.d/ if it exists. + Otherwise use the sharedir + """ + if not self._templatedir: + self._templatedir = find_templates(self.conf.get("lorax", "sharedir")) + logger.info("Using templatedir %s", self._templatedir) + return self._templatedir
[docs] def init_stream_logging(self): sh = logging.StreamHandler() @@ -410,10 +400,9 @@ logger.fatal("the volume id cannot be longer than 32 characters") sys.exit(1) - templatedir = self.conf.get("lorax", "sharedir") # NOTE: rb.root = dbo.conf.installroot (== self.inroot) rb = RuntimeBuilder(product=self.product, arch=self.arch, - dbo=dbo, templatedir=templatedir, + dbo=dbo, templatedir=self.templatedir, installpkgs=installpkgs, add_templates=add_templates, add_template_vars=add_template_vars) @@ -477,7 +466,7 @@ inroot=installroot, outroot=self.outputdir, runtime=runtime, isolabel=isolabel, domacboot=domacboot, doupgrade=doupgrade, - templatedir=templatedir, + templatedir=self.templatedir, add_templates=add_arch_templates, add_template_vars=add_arch_template_vars, workdir=self.workdir) @@ -562,9 +551,30 @@ f = os.path.abspath(os.path.dirname(logfile))+"/program.log" fh = logging.FileHandler(filename=f, mode="w") fh.setLevel(logging.DEBUG) - program_log.addHandler(fh)
+ program_log.addHandler(fh) + +
+
[docs]def find_templates(templatedir="/usr/share/lorax"): + """ Find the templates to use. + + :param str templatedir: Top directory to search for templates + :returns: Path to templates + :rtype: str + + If there is a templates.d directory under templatedir the + lowest numbered directory entry is returned. + + eg. /usr/share/lorax/templates.d/99-generic/ + """ + if os.path.isdir(joinpaths(templatedir, "templates.d")): + try: + templatedir = sorted(glob(joinpaths(templatedir, "templates.d", "*")))[0] + except IndexError: + pass + return templatedir
+
@@ -594,7 +605,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.base

 #
@@ -224,6 +200,7 @@
         return DataHolder(**dict.copy(self))
+
@@ -253,7 +231,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.buildstamp

 #
@@ -218,6 +194,7 @@
             fobj.write("Lorax={0}\n".format(vernum))
+
@@ -247,7 +225,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.decorators

 #
@@ -190,6 +166,7 @@
     return get_instance
+
@@ -219,7 +197,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.discinfo

 #
@@ -199,6 +175,7 @@
             fobj.write("{0.basearch}\n".format(self))
+
@@ -228,7 +206,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.dnfhelper

 #
@@ -267,6 +243,7 @@
         logger.warning(err_msg)
+
@@ -296,7 +274,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.executils

 #
@@ -505,6 +481,7 @@
     return execWithCapture(cmd[0], cmd[1:], **kwargs)
+
@@ -534,7 +512,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.imgutils

 # imgutils.py - utility functions/classes for building disk images
@@ -290,6 +266,15 @@
     '''use qemu-img to create a file of the given size.
        options is a list of options passed to qemu-img
 
+       Default format is qcow2, override by passing "-f", fmt
+       in options.
+    '''
+    mkqemu_img(outfile, size, options)
+
+
[docs]def mkqemu_img(outfile, size, options=None): + '''use qemu-img to create a file of the given size. + options is a list of options passed to qemu-img + Default format is qcow2, override by passing "-f", fmt in options. ''' @@ -364,8 +349,8 @@ count += 1 if count == maxretry: raise - logger.warn("failed to unmount %s. retrying (%d/%d)...", - mnt, count, maxretry) + logger.warning("failed to unmount %s. retrying (%d/%d)...", + mnt, count, maxretry) if logger.getEffectiveLevel() <= logging.DEBUG: fuser = execWithCapture("fuser", ["-vm", mnt]) logger.debug("fuser -vm:\n%s\n", fuser) @@ -588,7 +573,7 @@
[docs]def mkext4img(rootdir, outfile, size=None, label="", mountargs="", graft=None): graft = graft or {} mkfsimage("ext4", rootdir, outfile, size, mountargs=mountargs, - mkfsargs=["-L", label, "-b", "1024", "-m", "0"], graft=graft) + mkfsargs=["-L", label, "-b", "4096", "-m", "0"], graft=graft)
[docs]def mkbtrfsimg(rootdir, outfile, size=None, label="", mountargs="", graft=None): graft = graft or {} @@ -601,6 +586,7 @@ mkfsargs=["-v", label], graft=graft)
+
@@ -630,7 +617,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.ltmpl

 #
@@ -338,6 +314,37 @@
     def _getsize(self, *files):
         return sum(os.path.getsize(self._out(f)) for f in files if os.path.isfile(self._out(f)))
 
+    def _write_debuginfo_log(self):
+        """
+        Write a list of debuginfo packages to /root/debug-pkgs.log
+
+        If lorax is called with a debug repo find the corresponding debuginfo package
+        names and write them to /root/debubg-pkgs.log on the boot.iso
+        """
+        for repo in self.dbo.repos:
+            repo = self.dbo.repos[repo]
+            if any(True for url in repo.baseurl if "debug" in url):
+                break
+            if repo.metalink and "debug" in repo.metalink:
+                break
+            if repo.mirrorlist and "debug" in repo.mirrorlist:
+                break
+        else:
+            # No debug repos
+            return
+
+        available = self.dbo.sack.query().available()
+        debug_pkgs = []
+        for p in list(self.dbo.transaction.install_set):
+            if available.filter(name=p.name+"-debuginfo"):
+                debug_pkgs += ["{0.name}-debuginfo-{0.epoch}:{0.version}-{0.release}".format(p)]
+
+        os.makedirs(self._out("root/"), exist_ok=True)
+        with open(self._out("root/debug-pkgs.log"), "w") as f:
+            for pkg in debug_pkgs:
+                f.write("%s\n" % pkg)
+
+
 
[docs] def run(self, templatefile, **variables): for k,v in list(self.defaults.items()) + list(self.builtins.items()): variables.setdefault(k,v) @@ -674,6 +681,9 @@ if len(self.dbo.transaction) == 0: raise Exception("No packages in transaction") + # If a debug repo has been included, write out a list of debuginfo packages + self._write_debuginfo_log() + pkgs_to_download = self.dbo.transaction.install_set logger.info("Downloading packages") progress = LoraxDownloadCallback() @@ -831,6 +841,7 @@ pass
+
@@ -860,7 +872,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.monitor

 # monitor.py
@@ -352,6 +328,7 @@
         self.server_thread.join()
+
@@ -381,7 +359,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.mount

 # mount.py
@@ -256,6 +232,7 @@
                 return
+
@@ -285,7 +263,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.sysutils

 #
@@ -268,6 +244,7 @@
     runcmd(["/bin/cp", "-alx", src, dst])
+
@@ -297,7 +275,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.treebuilder

 # treebuilder.py - handle arch-specific tree building stuff using templates
@@ -549,6 +525,7 @@
     return string.lower()
+
@@ -578,7 +556,7 @@ + @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -155,7 +130,8 @@

-
+
+

Source code for pylorax.treeinfo

 #
@@ -217,6 +193,7 @@
             self.c.write(fobj)
+
@@ -246,7 +224,7 @@ @@ -44,17 +44,27 @@
@@ -138,7 +107,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -151,7 +126,8 @@

-
+
+

Index

@@ -365,16 +341,20 @@
-
findkernels() (in module pylorax.treebuilder) +
find_templates() (in module pylorax)
-
finish() (pylorax.monitor.LogRequestHandler method) +
findkernels() (in module pylorax.treebuilder)
+
finish() (pylorax.monitor.LogRequestHandler method) +
+ +
finished() (pylorax.treebuilder.RuntimeBuilder method)
@@ -613,6 +593,10 @@
+
mkqemu_img() (in module pylorax.imgutils) +
+ +
mkrootfsimg() (in module pylorax.imgutils)
@@ -897,6 +881,10 @@ + -
+
templatedir (pylorax.Lorax attribute) +
+ +
timeout (pylorax.monitor.LogServer attribute)
@@ -904,12 +892,12 @@
touch() (in module pylorax.sysutils)
+
TreeBuilder (class in pylorax.treebuilder)
-
TreeInfo (class in pylorax.treeinfo)
@@ -985,6 +973,7 @@ + @@ -1014,7 +1004,7 @@ @@ -45,17 +45,27 @@
@@ -139,7 +128,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -154,7 +149,8 @@

-
+
+

livemedia-creator

@@ -239,6 +235,13 @@ or the directory specified by --l

Currently the standard lorax templates are used to make a bootable iso, but it should be possible to modify them to output other results. They are written using the Mako template system which is very flexible.

+
+

Note

+

The output from –make-iso includes the artifacts used to create the boot.iso; +the kernel, initrd, the squashfs filesystem, etc. If you only want the +boot.iso you can pass --iso-only and the other files will be removed. You +can also name the iso by using --iso-name my-live.iso.

+

Kickstarts

@@ -404,9 +407,9 @@ from --releasever

The created image can be imported into libvirt using:

virt-image appliance.xml
-

You can also create qcow2 appliance images using --qcow2, for example:

+

You can also create qcow2 appliance images using --image-type=qcow2, for example:

sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/fedora-minimal.ks \
---qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
+--image-type=qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
 
@@ -517,10 +520,10 @@ packages. OpenStack supports setting up the image using cloud-init, and cloud-utils-growpart will grow the image to fit the instance’s disk size.

Create a qcow2 image using the kickstart like this:

-
sudo livemedia-creator --make-disk --iso=/path/to/boot.iso --ks=/path/to/fedora-openstack.ks --qcow2
+
sudo livemedia-creator --make-disk --iso=/path/to/boot.iso --ks=/path/to/fedora-openstack.ks --image-type=qcow2

Note

-

On the RHEL7 version of lmc --qcow2 isn’t supported. You can only create a bare partitioned disk image.

+

On the RHEL7 version of lmc --image-type isn’t supported. You can only create a bare partitioned disk image.

Import the resulting disk image into the OpenStack system, either via the web UI, or glance on the cmdline:

glance image-create --name "fedora-openstack" --is-public true --disk-format qcow2 \
@@ -647,6 +650,7 @@ report bugs against the lorax component.

+
@@ -665,9 +669,10 @@ report bugs against the lorax component.

© Copyright 2015, Red Hat, Inc.. +

- Built with Sphinx using a theme provided by Read the Docs. + Built with Sphinx using a theme provided by Read the Docs. @@ -685,7 +690,7 @@ report bugs against the lorax component.

@@ -43,17 +43,27 @@
@@ -137,7 +106,13 @@
-
+ + + + + + +
  • Docs »
  • @@ -148,7 +123,8 @@

-
+
+
@@ -193,7 +171,7 @@