[RFC PATCH] ensure DHCP is current via sync
by Nishanth Aravamudan
Hi,
I encountered a rather annoying problem with cobbler for ppc64 systems.
The way these machines netboot is controlled by the SMS configuration,
and if the SMS menu receives a DHCP response, even if it eventually
fails, it will stay in an infinite loop within the netboot code. That
code is not modifiable by me (owned by system firmware). What I
encountered with Cobbler was that after an install succeeded, the DHCP
configuration file was left alone. So the DHCP server would respond on
the network on the next boot and the target server never booted from the
disk.
I worked around this by only generating the DHCP configuration if a
system does have netboot_enabled set and re-generating the DHCP files
via sync() whenever disable_netboot() is called.
Signed-off-by: Nishanth Aravamudan <nacc(a)us.ibm.com>
diff --git a/cobbler/modules/manage_isc.py b/cobbler/modules/manage_isc.py
index b8f857f..8681d94 100644
--- a/cobbler/modules/manage_isc.py
+++ b/cobbler/modules/manage_isc.py
@@ -161,6 +161,9 @@ class IscManager:
interface["owner"] = blended_system["name"]
interface["enable_gpxe"] = blended_system["enable_gpxe"]
+ if not interface["netboot_enabled"]:
+ continue
+
interface["filename"] = "/pxelinux.0"
# can't use pxelinux.0 anymore
if distro is not None:
diff --git a/cobbler/remote.py b/cobbler/remote.py
index 0035e34..28cf180 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -1166,6 +1166,8 @@ class CobblerXMLRPCInterface:
obj.set_netboot_enabled(0)
# disabling triggers and sync to make this extremely fast.
systems.add(obj,save=True,with_triggers=False,with_sync=False,quick_pxe_update=True)
+ # re-generate dhcp configuration
+ self.api.sync()
return True
def upload_log_data(self, sys_name, file, size, offset, data, token=None,**rest):
--
Nishanth Aravamudan <nacc(a)us.ibm.com>
IBM Linux Technology Center
12 years
[PATCH] fixed a bug in keep_ssh_host_keys snippet
by Leonid Flaks
I was bitten by the bug in keep_ssh_host_keys snippet while installing
Fedora-16 virtual guest system. The keys where not preserved. Did some
digging and came up with this attached fix. It turned out that anaconda
created temporary partition on /dev/dm-0 and it had an empty /etc/ssh
directory. On a virtual guest it was listed first in the output of 'cat
/proc/partitions' and original findkeys function was setting the
'keys_found' flag to yes although nothing was copied and no other
partitions were tried. Now I am setting this flag only on successful copy.
This was not an issue on a physical system as this partition was listed
last and never actually got mounted.
We use very similar snippets keep_files and keep_cfengine_keys which use
the same function. I have not changed those yet. If kickstart file uses
all of them together, then the same function is defined more then once
and I don't like it. It would make more sense to put it into separate
snippet , which should be loaded before any of those. I can easily do it
if anybody else likes this idea.
I made a fork on the github at github.com/lflaks/cobbler-ssh-keys for
this commit and pushed it.
Comments are welcomed,
Leon
12 years, 1 month
[PATCH] Fix issue with `cobbler system reboot'
by Nishanth Aravamudan
Commit 659a2e5b tried to fix a stack trace with cobbler system reboot
without a --name option, but instead completely disabled system reboot.
Rather than actually reboot the system, issuing `cobbler system reboot
--name=...' would result in the corresponding system being saved in the
backend.
Fix this by first obtaining all valid actions up-front. Then, re-order
the action conditionals to check the three that don't require a name
parameter first, followed by any valid action. If it's a valid
name-requiring action without a name option, quit with a warning.
Otherwise, fall down into the appropriate handler block, but actually do
'reboot' in the right place (not as a save operation).
Signed-off-by: Nishanth Aravamudan <nacc(a)us.ibm.com>
diff --git a/cobbler/cli.py b/cobbler/cli.py
index 198e481..9bcd336 100755
--- a/cobbler/cli.py
+++ b/cobbler/cli.py
@@ -38,8 +38,9 @@ import item_image
import item_mgmtclass
import item_package
import item_file
+from itertools import chain
-OBJECT_ACTIONS = {
+OBJECT_ACTIONS_MAP = {
"distro" : "add copy edit find list remove rename report".split(" "),
"profile" : "add copy dumpvars edit find getks list remove rename report".split(" "),
"system" : "add copy dumpvars edit find getks list remove rename report poweron poweroff powerstatus reboot".split(" "),
@@ -49,7 +50,8 @@ OBJECT_ACTIONS = {
"package" : "add copy edit find list remove rename report".split(" "),
"file" : "add copy edit find list remove rename report".split(" "),
}
-OBJECT_TYPES = OBJECT_ACTIONS.keys()
+OBJECT_TYPES = OBJECT_ACTIONS_MAP.keys()
+OBJECT_ACTIONS = chain.from_iterable(OBJECT_ACTIONS_MAP.values())
DIRECT_ACTIONS = "aclsetup buildiso import list replicate report reposync sync validateks version".split()
####################################################
@@ -142,7 +144,7 @@ class BootCLI:
"""
if object_type is None or len(args) < 3:
return None
- if args[2] in OBJECT_ACTIONS[object_type]:
+ if args[2] in OBJECT_ACTIONS_MAP[object_type]:
return args[2]
return None
@@ -275,38 +277,8 @@ class BootCLI:
self.parser.add_option("--name", dest="name", help="name of object")
(options, args) = self.parser.parse_args()
- if object_action in [ "add", "edit", "copy", "rename", "remove", "reboot" ]:
- if opt(options, "name") == "":
- print "--name is required"
- sys.exit(1)
- try:
- self.remote.xapi_object_edit(object_type, options.name, object_action, utils.strip_none(vars(options), omit_none=True), self.token)
- except xmlrpclib.Fault, (err):
- (etype, emsg) = err.faultString.split(":",1)
- print emsg[1:-1] # don't print the wrapping quotes
- sys.exit(1)
- elif object_action == "getks":
- if object_type == "profile":
- data = self.remote.generate_kickstart(options.name,"")
- elif object_type == "system":
- data = self.remote.generate_kickstart("",options.name)
- print data
- elif object_action == "dumpvars":
- if object_type == "profile":
- data = self.remote.get_blended_data(options.name,"")
- elif object_type == "system":
- data = self.remote.get_blended_data("",options.name)
- # FIXME: pretty-printing and sorting here
- keys = data.keys()
- keys.sort()
- for x in keys:
- print "%s : %s" % (x, data[x])
- elif object_action in [ "poweron", "poweroff", "powerstatus", "reboot" ]:
- power={}
- power["power"] = object_action.replace("power","")
- power["systems"] = [options.name]
- task_id = self.remote.background_power_system(power, self.token)
- elif object_action == "report":
+ # the first three don't require a name
+ if object_action == "report":
if options.name is not None:
report_item(self.remote,object_type,None,options.name)
else:
@@ -317,6 +289,40 @@ class BootCLI:
items = self.remote.find_items(object_type, utils.strip_none(vars(options), omit_none=True), "name", False)
for item in items:
print item
+ elif object_action in OBJECT_ACTIONS:
+ if opt(options, "name") == "":
+ print "--name is required"
+ sys.exit(1)
+ if object_action in [ "add", "edit", "copy", "rename", "remove" ]:
+ try:
+ self.remote.xapi_object_edit(object_type, options.name, object_action, utils.strip_none(vars(options), omit_none=True), self.token)
+ except xmlrpclib.Fault, (err):
+ (etype, emsg) = err.faultString.split(":",1)
+ print emsg[1:-1] # don't print the wrapping quotes
+ sys.exit(1)
+ elif object_action == "getks":
+ if object_type == "profile":
+ data = self.remote.generate_kickstart(options.name,"")
+ elif object_type == "system":
+ data = self.remote.generate_kickstart("",options.name)
+ print data
+ elif object_action == "dumpvars":
+ if object_type == "profile":
+ data = self.remote.get_blended_data(options.name,"")
+ elif object_type == "system":
+ data = self.remote.get_blended_data("",options.name)
+ # FIXME: pretty-printing and sorting here
+ keys = data.keys()
+ keys.sort()
+ for x in keys:
+ print "%s : %s" % (x, data[x])
+ elif object_action in [ "poweron", "poweroff", "powerstatus", "reboot" ]:
+ power={}
+ power["power"] = object_action.replace("power","")
+ power["systems"] = [options.name]
+ task_id = self.remote.background_power_system(power, self.token)
+ else:
+ raise exceptions.NotImplementedError()
else:
raise exceptions.NotImplementedError()
@@ -523,7 +529,7 @@ class BootCLI:
"""
Prints the subcommands for a given object, e.g. "cobbler distro --help"
"""
- commands = OBJECT_ACTIONS[object_type]
+ commands = OBJECT_ACTIONS_MAP[object_type]
commands.sort()
print "usage\n====="
for c in commands:
--
Nishanth Aravamudan <nacc(a)us.ibm.com>
IBM Linux Technology Center
12 years, 1 month
Plans for a new stable release
by Jörgen Maas
Hi all,
I agree with Michael that we need to start fixing bugs asap, i also think
we need to get a clear and better development/release process in place. So,
in order to get the ball rolling again i have created a milestone for the
2.2.3 release which is now scheduled for 1 may. The milestone consists of
about 10 bugs and no new features, so this should be very doable.
Discussion regarding what bugs to fix, release dates, what new features to
add, etc are all very much welcome, but let's try to squash these few bugs
first and get a better release out!
https://github.com/cobbler/cobbler/issues/milestones
--
Grtz,
Jörgen Maas
12 years, 1 month
PPC-RPM
by Wayne Facer
Team:
I normally have users who are on PPC systems who download PPC64 rpm's. I noticed that this isn't supported in Cobbler. Is this going to be supported anytime soon?
Thanks
WF
12 years, 1 month
Power templates
by James Cammarata
After digging into issue #71 (No semicolon allowd in "--power-pass="),
I have come to the conclusion that all of this stuff should be
rewritten in a more sane manner. All of the fence_* commands accept
input on STDIN, so I believe we should take advantage of that fact and
rewrite these templates to feed the data into the subprocess that way
rather than via command line options.
My reasoning is this - trying to cover every corner case for escaping
variables being passed to the sub_process module is going to be error
prone, and could expose a security hole. The utils.safe_filter()
function doesn't even filter things - it just throws an error if it
detects something. Using the capability provided by the fence agents
is easier and safer, so we should use it. The downside is that it
would be somewhat invasive for people who rely on these templates -
existing installations would have to manually transition to the new
templates. Maybe that's not such a huge deal, since really I'd imagine
people are only using one or two of them.
Anyway, thoughts? Not all the templates (out of 13) need to be
updated, even. The virsh and ether_wake templates don't even use all
of the power_* variables, so it would be possible to wrap some safety
into those templates directly (like putting single quotes around
variables). Even that's not error proof, as we'd have to guard against
someone putting single or double quotes in their variables too, but we
may be limited by what those commands require. There is a fence_virsh,
maybe we should modify that template to use it as well?
I know we can only protect users against themselves so much, but I do
think this should be addressed in some better way, and I'm definitely
open to suggestions.
12 years, 1 month