[PATCH] Setup to create a separate cobbler-puppet pacakge for enabling cobbler as a puppet external node.
by Greg Swift
Hi all. This is a patch I put together that might be useful for letting
puppet access cobbler using the ext-nodes script without having to move
files (binary and config) from your cobbler server to install on your puppet
server, most specifically with an RPM. I made the script search for the
config file, so that should help make it work in several use cases.
I'm using this script in my environment now, and seems to be more than
adequate, however this is just one use case.
-greg
13 years
[PATCH] import modules
by James Cammarata
Tested against Fedora {11..14}-{i386,x86_64} so far, one minor issue
but it was in F11 so I doubt anyone would notice. Just merged master
into my feature branch (import-modules) on github so if anyone wants
to help test imports feel free.
https://github.com/jimi1283/cobbler/commit/3df2746ef3d3f6e9146d0a8c8c1352...
This seems to be getting pretty solid, so more help testing would be
appreciated. I'm going to grab some Centos 4 and 5 DVDs next, but
probably just the most recent (4.8/5.5) for both i386/x86_64 and test
those. So, if anyone has old Centos or any RHEL versions (I don't
have the RHEL isos at home where I do devel), that's where I'm looking
for testing help.
Once I get Centos tested, I'll start working on fixing VMware (ESX and
ESXi) support, and I'll start looking for the Ubuntu stuff too.
Enjoy!
13 years
[PATCH] first commit for vmware import module
by James Cammarata
Pushed to my github in the import-modules branch:
commit 8826d50ac30f43d372d9bebfefa04432d7e3c6a1
Author: James Cammarata <jimi(a)sngx.net>
Date: Sat Dec 18 10:06:36 2010 -0600
Initial commit for the VMWare import module
* tested against esx4 update 1, which imported successfully
TODO:
* more ESX testing
* ESXi support
* better os_version detection for all of the above
13 years, 1 month
Patch and question about bash completion
by Konrad Scherer
Hello all,
I found a bug in the import functionality when using the --available-as command
line parameter. The function path_tail was not fully moved into utils. The
attached patch fixes the version in utils and all import code now uses that
function. The commit is also in my github repo
https://github.com/kscherer/cobbler on branch wrs.
I also noticed that there is an incomplete bash completion file. The Makefile
references a missing file called mkbash.py and the completion file references
"cobbler-completion". I have often missed completion when using cobbler on the
command line and was about to write my own. Any pointers to get this working
would be appreciated.
Konrad
--
Konrad Scherer, Sr. Engineer, Linux Products Group, Wind River
direct 613-963-1342 fax 613-592-2283
13 years, 2 months
Cobbler in Ubuntu!
by Clint Byrum
So, a snapshot of the Cobbler git repository was packaged and uploaded
into Ubuntu Natty-Narwhal (the future 11.04) universe archive today.
This was a big effort involving multiple members of the Ubuntu Server
Team.
So, you should be able to
'apt-get install cobbler'
and get a working cobbler install on Natty. It should be fully capable
of installing Fedora and Ubuntu (I believe we tested back to 10.04, not
sure if 8.04 or 6.06 are deployable).
We're ok with shipping a pre-release version as our "tech preview" in
11.04, but it raises the question as to when 2.1.0 will actually be
released.
I remember asking this before and it seemed like the set of desired
features and changes was up for discussion. Seeing as we've added
Debian/Ubuntu support now, what else would people like to see in 2.1.0
that isn't already in git?
13 years, 2 months
[PATCH] Implement system power status API method and CLI command
by Cleber Rosa
Autotest (autotest.kernel.org) is beggining to leverage Cobbler to
auto install host systems. It happens to be valuable to our project
to be able to determine the power status of systems, so that we can
better determine if the systems are unresponsive or shut off.
This patch was tested using only APC power switches. Behavior and
command output is expected to be the same on other fencing agents.
The API call return values are probably the big disruption
point comparing it to the other power related calls. I find the
proposal (on this patch) to provide more clear and meaninful
information, but I do acknowledge it's disruptive. Feedback welcome.
Signed-off-by: Cleber Rosa <crosa(a)redhat.com>
---
cobbler/action_power.py | 15 ++++++++++++++-
cobbler/api.py | 9 +++++++++
cobbler/cli.py | 4 ++--
cobbler/remote.py | 6 ++++--
4 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/cobbler/action_power.py b/cobbler/action_power.py
index 8c3083b..dc48da9 100644
--- a/cobbler/action_power.py
+++ b/cobbler/action_power.py
@@ -30,6 +30,7 @@ import os
import os.path
import traceback
import time
+import re
import utils
import func_utils
@@ -108,8 +109,20 @@ class PowerTool:
# Try the power command 5 times before giving up.
# Some power switches are flakey
for x in range(0,5):
- rc = utils.subprocess_call(self.logger, cmd, shell=False)
+ output, rc = utils.subprocess_sp(self.logger, cmd, shell=False)
if rc == 0:
+ # If the desired state is actually a query for the status
+ # return different information than command return code
+ if desired_state == 'status':
+ match = re.match('(^Status:\s)(ON|OFF)', output)
+ if match:
+ power_status = match.groups()[1]
+ if power_status == 'ON':
+ return True
+ else:
+ return False
+ utils.die(self.logger,"command succeeded (rc=%s), but output ('%s') was not understood" % (rc, output))
+ return None
break
else:
time.sleep(2)
diff --git a/cobbler/api.py b/cobbler/api.py
index cb94995..3a1c5a4 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -921,6 +921,15 @@ class BootAPI:
time.sleep(5)
return self.power_on(system, user, password, logger=logger)
+ def power_status(self, system, user=None, password=None, logger=None):
+ """
+ Returns the power status for a system that has power management configured.
+
+ @return: 0 the system is powered on, False if it's not or None on error
+ """
+ return action_power.PowerTool(self._config, system, self, user, password, logger = logger).power("status")
+
+
# ==========================================================================
def clear_logs(self, system, logger=None):
diff --git a/cobbler/cli.py b/cobbler/cli.py
index 3b3efa7..99da153 100755
--- a/cobbler/cli.py
+++ b/cobbler/cli.py
@@ -42,7 +42,7 @@ import item_file
OBJECT_ACTIONS = {
"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 reboot".split(" "),
+ "system" : "add copy dumpvars edit find getks list remove rename report poweron poweroff powerstatus reboot".split(" "),
"image" : "add copy edit find list remove rename report".split(" "),
"repo" : "add copy edit find list remove rename report".split(" "),
"mgmtclass" : "add copy edit find list remove rename report".split(" "),
@@ -295,7 +295,7 @@ class BootCLI:
keys.sort()
for x in keys:
print "%s : %s" % (x, data[x])
- elif object_action in [ "poweron", "poweroff", "reboot" ]:
+ elif object_action in [ "poweron", "poweroff", "powerstatus", "reboot" ]:
power={}
power["power"] = object_action.replace("power","")
power["systems"] = [options.name]
diff --git a/cobbler/remote.py b/cobbler/remote.py
index f88451e..88523e1 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -1862,7 +1862,7 @@ class CobblerXMLRPCInterface:
"""
Internal implementation used by background_power, do not call
directly if possible.
- Allows poweron/poweroff/reboot of a system specified by object_id.
+ Allows poweron/poweroff/powerstatus/reboot of a system specified by object_id.
"""
obj = self.__get_object(object_id)
self.check_access(token, "power_system", obj)
@@ -1870,10 +1870,12 @@ class CobblerXMLRPCInterface:
rc=self.api.power_on(obj, user=None, password=None, logger=logger)
elif power=="off":
rc=self.api.power_off(obj, user=None, password=None, logger=logger)
+ elif power=="status":
+ rc=self.api.power_status(obj, user=None, password=None, logger=logger)
elif power=="reboot":
rc=self.api.reboot(obj, user=None, password=None, logger=logger)
else:
- utils.die(self.logger, "invalid power mode '%s', expected on/off/reboot" % power)
+ utils.die(self.logger, "invalid power mode '%s', expected on/off/status/reboot" % power)
return rc
def get_config_data(self,hostname):
--
1.7.1
13 years, 3 months
[PATCH] Add two more tags to whitelist when using safe_templating
by Ian Ward Comfort
Cheetah's #unless and #echo tags are safe, and should be permitted even when
safe_templating is enforced. Add them to the whitelist of enabled directives.
---
Our local kickstarts and snippets use these tags, and broke when we upgraded
to 2.0.9 recently. I'm not entirely clear about what base to use for patches
these days, but this commit is on top of today's stable. It can also be pulled
from:
git://github.com/icomfort/cobbler.git add-safe-template-tags
cobbler/template_api.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/cobbler/template_api.py b/cobbler/template_api.py
index 1a478da..9076727 100644
--- a/cobbler/template_api.py
+++ b/cobbler/template_api.py
@@ -78,11 +78,13 @@ class CobblerCompiler(Cheetah.Compiler.ModuleCompiler):
'if',
'elif',
'else',
+ 'unless',
'def',
'block',
'end',
'for',
'include',
+ 'echo',
'set',
'snippet',
'errorcatcher',
--
1.7.3.2
13 years, 3 months
Debian support patches
by Konrad Scherer
I recently tried to get cobbler running on debian squeeze/sid and have a bunch
of small bug fixes/patches for review. The process to get cobbler running is as
follows:
1) aptitude install git apache2 python-setuptools python-yaml \
libapache2-mod-python python-django python-netaddr \
python-cheetah libapache2-mod-wsgi
2) a2enmod proxy_http
3) ln -s /var/log/apache2/ /etc/apache2/logs
4) In git tree: python setup.py install --install-layout deb
After this cobbler check and the web interface (with proper authentication
module) are working. I haven't had time to test further, but since there have
been a few queries about Debian and Ubuntu support and the patches are very
simple, I thought I would post my changes here.
The patches have been applied to my up to date cobbler tree on github on the wrs
branch.
https://github.com/kscherer/cobbler
Next step would be to complete the deb packaging scripts.
Thanks
Konrad
13 years, 3 months
removal of #try and #except since cobbler 2.0.5 ?
by Stuart Sears
Hi,
Having just updated our testing cobbler2 server to 2.0.9 (from 2.0.5),
it seems that cheetah templates no longer support the use of the #try
and #except directives.
Is there a particular reason for this?
Or is it an unintended consequence of the changes to support later
releases of cheetah?
The snippets here use try and except quite regularly (as do examples on
the cobbler wiki). Going through them all and coding around this is not
an attractive option.
The culprit appears to be the 'whitelist' in template_api.py
Is there a way to override this without editing that file, which I'd
rather not do if possible?
As an aside, how do i track down which bugs the (BUGF) entries in the
changelog refer to? some have BZ or trac numbers, but most don't.
thanks,
Stuart
--
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.
13 years, 3 months