Request for x509 user auth in cobblerd/WUI & logging questions?
by Michael DeHaan
I've had a request for x509 user auth in cobblerd.
I'll admit I don't know a tremendous amount about this, would someone
like to share thoughts on whether they see this as being useful and what
they might want? What auth options are you using in Cobbler? I take
it some folks are using the LDAP/Kerb options, but has anyone written
their own custom options to cover organization-specific security
requirements?
One thing that has come up is having extended logging options on who
does what -- which we mostly do for the API now.
I'd also welcome any comments on logging granularity and whether what we
have is enough or where people might like to see more.
--Michael
15 years, 10 months
Fix bash-completion so that filenames will complete after a subcommand is in
by John Villalovos
This will fix it so that filenames will also be completed.
diff --git a/cobbler/commands.py b/cobbler/commands.py
index 4a620a3..f65438b 100644
--- a/cobbler/commands.py
+++ b/cobbler/commands.py
@@ -172,20 +172,17 @@ class CobblerFunction:
"""
pass
- def helpbash(self, parser, args):
+ def helpbash(self, parser, args, print_options = True, print_subs = False):
"""
Print out the arguments in an easily parseable format
"""
# We only want to print either the subcommands available or the
# options, but not both
option_list = []
- for sub in self.subcommands():
- if sub.__str__() in args:
- # Subcommand has already been entered so lets show the options
- option_list = []
- break
- option_list.append(sub.__str__())
- if not option_list:
+ if print_subs:
+ for sub in self.subcommands():
+ option_list.append(sub.__str__())
+ elif print_options:
for opt in parser.option_list:
option_list.extend(opt.__str__().split('/'))
print ' '.join(option_list)
@@ -204,8 +201,11 @@ class CobblerFunction:
break
p = optparse.OptionParser(usage="cobbler %s [ARGS]" % accum)
self.add_options(p, args)
- if "--helpbash" in args:
- self.helpbash(p, args)
+ if "--helpsubs" in args:
+ self.helpbash(p, args, False, True)
+ sys.exit(0)
+ elif "--helpopts" in args:
+ self.helpbash(p, args, True, False)
sys.exit(0)
# if using subcommands, ensure one and only one is used
subs = self.subcommands()
diff --git a/config/cobbler_bash b/config/cobbler_bash
index 46aadbb..3540bb7 100644
--- a/config/cobbler_bash
+++ b/config/cobbler_bash
@@ -24,7 +24,7 @@
_cobbler()
{
- local cur prev special specialsub SPECIAL_CMDS SPECIALSUB_CMDS
+ local cur prev special specialsub SPECIAL_CMDS SPECIALSUB_CMDS FILEREPLY
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
@@ -42,16 +42,28 @@ _cobbler()
if [ -n "$special" ]
then
# Take care of sub commands
- SPECIALSUB_CMDS=`cobbler $special --helpbash | sed "s/ /|/g"`
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(${SPECIALSUB_CMDS}) ]]; then
- specialsub=${COMP_WORDS[i]}
- break
- fi
- done
+ SPECIALSUB_CMDS=`cobbler $special --helpsubs | sed "s/ /|/g"`
+ if [ -n "${SPECIALSUB_CMDS}" ] ; then
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(${SPECIALSUB_CMDS}) ]]; then
+ specialsub=${COMP_WORDS[i]}
+ break
+ fi
+ done
+ else
+ # This command has no subcommands
+ COMPREPLY=( $( compgen -f -W '$( cobbler $special --helpopts )'
-- $cur ) )
+ return 0
+ fi
- COMPREPLY=( $( compgen -W '$( cobbler $special $specialsub
--helpbash )' -- $cur ) )
- return 0
+ if [ -n "$specialsub" ]
+ then
+ COMPREPLY=( $( compgen -f -W '$( cobbler $special $specialsub
--helpopts )' -- $cur ) )
+ return 0
+ else
+ COMPREPLY=( $( compgen -W '$( cobbler $special --helpsubs )' -- $cur ) )
+ return 0
+ fi
fi
case $cur in
@@ -71,16 +83,6 @@ _cobbler()
1)
COMPREPLY=( $( compgen -W '$( cobbler --helpbash )' -- $cur ) )
;;
- *)
- case $prev in
- distro|profile|repo|system)
- COMPREPLY=( $( compgen -W 'add edit copy list rename remove
report' -- $cur ) )
- ;;
- *)
- _filedir
- ;;
- esac
- ;;
esac
}
complete -F _cobbler cobbler
15 years, 10 months
More bash-completion work
by John Villalovos
This patch adds support to cobbler for --helpbash in the sub modules.
Then the bash-completion script takes advantage of the --helpbash
command to generate completions
diff --git a/cobbler/commands.py b/cobbler/commands.py
index a774360..a3e3994 100644
--- a/cobbler/commands.py
+++ b/cobbler/commands.py
@@ -172,6 +172,21 @@ class CobblerFunction:
"""
pass
+ def helpbash(self, parser, args):
+ """
+ Print out the arguments in an easily parseable format
+ """
+ option_list = []
+ for sub in self.subcommands():
+ if sub.__str__() in args:
+ option_list = []
+ break
+ option_list.append(sub.__str__())
+ for opt in parser.option_list:
+ option_list.extend(opt.__str__().split('/'))
+ print ' '.join(option_list)
+
+
def parse_args(self,args):
"""
Processes arguments, called prior to run ... do not override.
@@ -185,7 +200,9 @@ class CobblerFunction:
break
p = optparse.OptionParser(usage="cobbler %s [ARGS]" % accum)
self.add_options(p, args)
-
+ if "--helpbash" in args:
+ self.helpbash(p, args)
+ sys.exit(0)
# if using subcommands, ensure one and only one is used
subs = self.subcommands()
if len(subs) > 0:
@@ -199,7 +216,6 @@ class CobblerFunction:
for x in subs:
print "cobbler %s %s [ARGS|--help]" %
(self.command_name(), x)
sys.exit(1)
-
(self.options, self.args) = p.parse_args(args)
return True
diff --git a/config/cobbler_bash b/config/cobbler_bash
index c4f7864..0b1dd8c 100644
--- a/config/cobbler_bash
+++ b/config/cobbler_bash
@@ -24,12 +24,35 @@
_cobbler()
{
- local cur prev
+ local cur prev special specialsub SPECIAL_CMDS SPECIALSUB_CMDS
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
+ # Let's only run it once
+ SPECIAL_CMDS=`cobbler --helpbash | sed "s/ /|/g"`
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(${SPECIAL_CMDS}) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
+ done
+
+ if [ -n "$special" ]
+ then
+ # Take care of sub commands
+ SPECIALSUB_CMDS=`cobbler $special --helpbash | sed "s/-[^ ]\+//g;s/
*$//" | tr -s " " | sed "s/ /|/g"`
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ # We want to remove any -* commands from the list, because we are
trying to figure out if we have a subcommand
+ if [[ ${COMP_WORDS[i]} == @(${SPECIALSUB_CMDS}) ]]; then
+ specialsub=${COMP_WORDS[i]}
+ fi
+ done
+
+ COMPREPLY=( $( compgen -W '$( cobbler $special $specialsub
--helpbash )' -- $cur ) )
+ return 0
+ fi
+
case $cur in
--*)
COMPREPLY=( $( compgen -W 'help' -- $cur ) )
@@ -45,9 +68,7 @@ _cobbler()
case $args in
1)
- COMPREPLY=( $( compgen -W 'buildiso check distro import list \
- profile replicate repo report reposync status sync system \
- validateks' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( cobbler --helpbash )' -- $cur ) )
;;
*)
case $prev in
15 years, 10 months
Koan not enough arguments for format string
by Demetri Mouratis
Hi,
I'm having some trouble with koan and (I suspect) LVM.
One problem seems to be that VolGroups created at the domU layer are
somehow visible back at dom0. There is a namespace conflict between
the two.
Here's my invocation:
[root@lncxenproddb1 ~]# koan --virt --virt-path=VolGroup01
--profile=centos4virt --server=sccbuild --nogfx --virt-name=test
- reading URL: http://sccbuild.scc.rnmd.net/cblr/kickstarts/centos4virt/ks.cfg
libvirt_qemud (pid 5658) is running...
downloading initrd initrd.img to /var/lib/xen/initrd.img
url=http://sccbuild/cobbler/images/centos4-i386-virt/initrd.img
- reading URL: http://sccbuild/cobbler/images/centos4-i386-virt/initrd.img
downloading kernel vmlinuz to /var/lib/xen/vmlinuz
url=http://sccbuild/cobbler/images/centos4-i386-virt/vmlinuz
- reading URL: http://sccbuild/cobbler/images/centos4-i386-virt/vmlinuz
/usr/sbin/vgs -o vg_name
File descriptor 3 left open
WARNING: Duplicate VG name VolGroup01:
7pK0P0-n7VN-d9gQ-6dQe-Y6bq-RIYy-qS95cc (created here) takes precedence
over Dxepi2-ACYE-fehB-jaun-KBz1-YBML-o7JNWZ
VG
VolGroup00
VolGroup01
VolGroup01
VolGroup02
orukproddb1-oradata
/usr/sbin/vgs --noheadings -o vg_free --units g VolGroup01
File descriptor 3 left open
WARNING: Duplicate VG name VolGroup01:
7pK0P0-n7VN-d9gQ-6dQe-Y6bq-RIYy-qS95cc (created here) takes precedence
over Dxepi2-ACYE-fehB-jaun-KBz1-YBML-o7JNWZ
(19.65)
not enough arguments for format string
I have since worked around the namespace issue for future boxes but
this is a prod server and I need to create a new domU on it.
Thanks.
-D
15 years, 10 months
cobbler-1.0.1-2 - kickstart error on 1 host
by Tom Brown
Hi
This seems to only happen on 1 host but in the apache logs of cobbler i
see this
/./cblr/svc/op/ks/system/devbgb020
and yet the name of the system is devbgb0205 - if i do a cobbler report
on devbgb0205 i get the expected result.
The install fails with it sitting waiting for a kickstart file as it
seems to be truncating the machine name - Has anyone seen this before?
thanks
15 years, 10 months
Patch to add a --helpbash option to cobbler
by John Villalovos
This patch adds a --helpbash option to cobbler. Which will make
things easier for bash-completion.
# cobbler --helpbash
aclsetup buildiso check distro image import list profile replicate
repo report reposync reserialize status sync system validateks
diff --git a/cobbler/commands.py b/cobbler/commands.py
index 985e7e9..a774360 100644
--- a/cobbler/commands.py
+++ b/cobbler/commands.py
@@ -54,7 +54,10 @@ class FunctionLoader:
# also show avail options if command name is bogus
if not called_name in self.functions.keys():
- return self.show_options()
+ if "--helpbash" in args:
+ return self.show_options_bashcompletion()
+ else:
+ return self.show_options()
fn = self.functions[called_name]
# some functions require args, if none given, show subcommands
@@ -126,6 +129,15 @@ class FunctionLoader:
if help != "":
print help
+ def show_options_bashcompletion(self):
+ """
+ Prints out all loaded functions in an easily parseable form for
+ bash-completion
+ """
+ names = self.functions.keys()
+ names.sort()
+ print ' '.join(names)
+
#=============================================================
class CobblerFunction:
15 years, 10 months
Findks.cgi now back, now runs from mod_python
by Michael DeHaan
One of the nicer things we did in 1.0 was replace a lot of static file
and CGI infrastructure with a lot simpler mod_python code.
One feature some custom-built tools relied on in pre-1.0 was findks.cgi,
which was a script that, when visited, returned the kickstart
that corresponded to the IP or MAC of the requester. For instance,
you could build a boot image that automatically simulated PXE
(like the old koan live CD), but just used a modified rescue image to
get the job done.
I've ported findks.cgi to mod python on the devel branch and the stable
branch, so if you would like this feature, you can rebuild the RPMs
from there.
This logic doesn't really fit into buildiso because you must first pick
which Anaconda you want, but I figured I would let people know in case
they could think of a use for this.
--Michael
15 years, 10 months
Booting Live CD from Cobbler?
by Mark Brandis
Hi!
We - the company were I work - are using cobbler a lot and I really like the memtest feature. My question is, is it possible to integrate a Linux live CD or live USB Image (Fedora, Knoppix, grml, ...) into cobbler?
I have to test many hard drives and that would be much easier with a live CD from net instead of real CDs. The rescue mode that I can add to the boot options isn't the thing I need.
Thanks in advance for any info
Mark
15 years, 10 months
koan --virt error
by drew einhorn
$ sudo koan --server=localhost --system=ctl01 --virt
- reading URL: http://172.20.0.22/cblr/svc/op/ks/system/ctl01
install_tree: http://127.0.0.1/cblr/links/RHEL5-x86_64
libvirtd (pid 4111) is running...
- fullvirt mode
libvir: error : configuration file syntax error: expecting an assignment
libvir: error : configuration file syntax error: expecting a name
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByUUID
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByName
use virt-manager or reconnect with virsh console ctl01
>From the troubleshooting wiki page I know to ignore some of the
error messages.
All attempts to connect to the console either fail, or perhaps there is
nothing happening on the console. Not sure which.
--
Drew Einhorn
15 years, 10 months