Anton Arapov wrote:
On Wed, Dec 17, 2008 at 11:06:41AM +0000, Henry Kemp wrote:
> I just saw the cobbler buildiso functionality and decided to have a play
> with it but it looks to be failing on working out if selinux is enabled.
> I'm running this on a Centos 5.2 i386 box and it looks as though the
> is_selinux_enabled function in utils.py is calling the
> /usr/sbin/selinuxenabled binary from the libselinux RPM that is
> installed and returns ok.
>
> # /usr/sbin/selinuxenabled && echo $?
> 0
>
> # cobbler version
> cobbler 1.3.4
>
> build date : Wed Dec 17 10:48:44 2008
> git hash : 642faeb69dc16670d4ce5e6485758fbfed680f33
> git date : Wed Dec 17 10:24:00 2008 +0000
>
> # cobbler buildiso
> - using/creating tempdir: /tmp/buildiso
> - building tree for isolinux
> - copying miscellaneous files
>
> 'NoneType' object has no attribute 'is_selinux_enabled'
> File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 83,
> in main
> rc = BootCLI().run(sys.argv)
>
> File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 61,
> in run
> return self.loader.run(args)
>
> File "/usr/lib/python2.4/site-packages/cobbler/commands.py", line 122,
> in run
> return fn.run()
>
> File "/usr/lib/python2.4/site-packages/cobbler/modules/cli_misc.py",
> line 237, in run
> tempdir=self.options.tempdir
>
> File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 651, in
> build_iso
> return builder.run(
>
> File "/usr/lib/python2.4/site-packages/cobbler/action_buildiso.py",
> line 118, in run
> utils.copyfile(f, os.path.join(isolinuxdir, os.path.basename(f)))
>
> File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 884, in
> copyfile
> restorecon(dst,api)
>
> File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 915, in
> restorecon
> if not api.is_selinux_enabled():
>
> Rgds,
> Henry
>
Yeah, seems Michal forgot to pass api to util's copyfile routine:
Correct, and applied, thanks.
I'll add a call to buildiso in the tests for future testing, it runs
fast enough so that this is a reasonable thing to do.
--Michael
>From 9f23e2b2d8a5188360f8a7c9c0955ac23dd7fa1a Mon Sep 17 00:00:00
2001
From: Anton Arapov <aarapov(a)redhat.com>
Date: Wed, 17 Dec 2008 12:36:25 +0100
Subject: [PATCH] fix: pass api to utils.copyfile() routine.
---
cobbler/action_buildiso.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index de95afb..8b22e51 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -115,7 +115,7 @@ class BuildIso:
if not os.path.exists(f):
raise CX(_("Required file not found: %s") % f)
else:
- utils.copyfile(f, os.path.join(isolinuxdir, os.path.basename(f)))
+ utils.copyfile(f, os.path.join(isolinuxdir, os.path.basename(f)),
self.api)
print _("- copying kernels and initrds - for profiles")
# copy all images in included profiles to images dir