Skip to content
Permalink
Browse files

Updates to SCM tracker.

  • Loading branch information...
Michael DeHaan
Michael DeHaan committed Mar 11, 2009
1 parent 765756b commit 5e94a41b283f6491fc5ca60f5262e29cab557147
Showing with 77 additions and 0 deletions.
  1. +1 −0 CHANGELOG
  2. +62 −0 cobbler/modules/scm_track.py
  3. +2 −0 cobbler/settings.py
  4. +9 −0 installer_templates/settings.template
  5. +3 −0 setup.py
@@ -22,6 +22,7 @@ Cobbler CHANGELOG
- (FEAT) web UI search feature
- (FEAT) very simple "cobbler hardlink" command to optimize space in /var/www/cobbler
- (FEAT) new "change" trigger that runs on all adds/edits/removes/syncs
- (FEAT) an SCM trigger that knows about /var/lib/cobbler kickstarts, snippets, and config directories, and audits them for changes

- Tue Mar 3 2009 - 1.4.3
- (BUGF) fix OMAPI support's (note: deprecated) usage of subprocess
@@ -0,0 +1,62 @@
import distutils.sysconfig
import sys
import os
import traceback
from cobbler.cexceptions import *
import os
import sub_process
import sys
#import xmlrpclib
import cobbler.module_loader as module_loader

plib = distutils.sysconfig.get_python_lib()
mod_path="%s/cobbler" % plib
sys.path.insert(0, mod_path)

def register():
# this pure python trigger acts as if it were a legacy shell-trigger, but is much faster.
# the return of this method indicates the trigger type
return "/var/lib/cobbler/triggers/change/*"

def scall(args):
op = sub_process.Popen(args, shell=False, stdout=sub_process.PIPE, stderr=sub_process.PIPE)
op.communicate()


def run(api,args):


settings = api.settings()

scm_track_enabled = str(settings.scm_track_enabled).lower()
mode = str(settings.scm_track_mode).lower()

if scm_track_enabled not in [ "y", "yes", "1", "true" ]:
# feature disabled
return 0

if mode == "git":

old_dir = os.getcwd()
os.chdir("/var/lib/cobbler")
if os.getcwd() != "/var/lib/cobbler":
raise "danger will robinson"

if not os.path.exists("/var/lib/cobbler/.git"):
scall(["git","init"])

# FIXME: if we know the remote user of an XMLRPC call
# use them as the author

scall(["git","add","config"])
scall(["git","add","kickstarts"])
scall(["git","add","snippets"])

scall(["git","commit","-m",'API update',"--author","'cobbler <root@localhost.localdomain>'"])

os.chdir(old_dir)

return 0

else:
raise CX("currently unsupported SCM type: %s" % mode)
@@ -101,6 +101,8 @@
"restart_dhcp" : 1,
"restart_xinetd" : 1,
"run_install_triggers" : 1,
"scm_track_enabled" : 0,
"scm_track_mode" : "git",
"server" : "127.0.0.1",
"snippetsdir" : "/var/lib/cobbler/snippets",
"tftpd_bin" : "/usr/sbin/in.tftpd",
@@ -311,6 +311,15 @@ register_new_installs: 0
# uses a logging trigger to audit install progress.
run_install_triggers: 1

# enables a trigger which version controls all changes to /var/lib/cobbler
# when add, edit, or sync events are performed. This can be used
# to revert to previous database versions, generate RSS feeds, or for
# other auditing or backup purposes. git is the recommend SCM
# for use with this feature.

scm_track_enabled: 0
scm_track_mode: "git"

# this is the address of the cobbler server -- as it is used
# by systems during the install process, it must be the address
# or hostname of the system as those systems can see the server.
@@ -164,6 +164,9 @@ def gen_config():

# for --version support across distros
(libpath, ['config/version']),

# for version control tracking feature
(libpath, ['config/gitignore']),

# bootloaders and syslinux support files
(libpath, ['loaders/elilo-3.8-ia64.efi']),

0 comments on commit 5e94a41

Please sign in to comment.
You can’t perform that action at this time.