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:
>
> >From 9f23e2b2d8a5188360f8a7c9c0955ac23dd7fa1a Mon Sep 17 00:00:00 2001
> From: Anton Arapov <[email protected]>
> 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
>   
Excellent - thanks for that - how about adding a check to "cobbler 
check" for the mkisofs binary? Here's a combined patch with yours to do 
that.

Subject: [PATCH] fix: pass api to utils.copyfile() routine and add check 
for mkisofs to cobbler check routine

---
cobbler/action_buildiso.py | 2 +-
cobbler/action_check.py | 8 ++++++++
2 files changed, 9 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
diff --git a/cobbler/action_check.py b/cobbler/action_check.py
index 99fffbb..3aad072 100644
--- a/cobbler/action_check.py
+++ b/cobbler/action_check.py
@@ -82,6 +82,7 @@ class BootCheck:
# self.check_vsftpd_bin(status)

self.check_for_cman(status)
+ self.check_mkisofs_bin(status)

return status

@@ -316,3 +317,10 @@ class BootCheck:
else:
status.append(_("missing file: %(file)s") % { "file" : 
self.settings.dhcpd_conf })

+ def check_mkisofs_bin(self, status):
+ """
+ Check if /usr/bin/mkisofs is installed
+ """
+ if not os.path.exists("/usr/bin/mkisofs"):
+ status.append("/usr/bin/mkisofs wasn't found and is required to use 
the (optional) buildiso feature. Install mkisofs to use buildiso 
functionality")
+ return True
-- 
1.5.5.1
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to