This repository has been archived by the owner on Sep 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jsabo
committed
May 26, 2011
1 parent
ecc6856
commit fa030c2
Showing
6 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
export VMWARE_USERNAME='root' | ||
export VMWARE_PASSWORD='supsup' | ||
. /etc/profile.d/vijava.sh | ||
/usr/local/bin/vmware_cli.py -s $1 -Vc --name $2 --master $3 --prune | ||
/usr/local/bin/vmware_cli.py -s $1 -mP --on --name $2 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
Create VMware images on firstboot based on data in Cobbler | ||
""" | ||
|
||
import distutils.sysconfig | ||
import utils | ||
import sys | ||
|
||
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/install/firstboot/*" | ||
|
||
def run(api,args,logger): | ||
# FIXME: make everything use the logger, no prints, use util.subprocess_call, etc | ||
|
||
objtype = args[0] # "system" or "profile" | ||
name = args[1] # name of system or profile | ||
ip = args[2] # ip or "?" | ||
|
||
if objtype == "system": | ||
target = api.find_system(name) | ||
else: | ||
target = api.find_profile(name) | ||
|
||
# collapse the object down to a rendered datastructure | ||
target = utils.blender(api, False, target) | ||
|
||
if target == {}: | ||
logger.info("unable to locate %s " % name) | ||
raise CX("failure looking up target") | ||
|
||
if target['ks_meta']['vms']: | ||
for vm in target['ks_meta']['vms'].split(','): | ||
try: | ||
arglist = ["/usr/local/bin/createvm",target['ip_address_vmnic1'],vm,target['server']] | ||
logger.info("creating virtual guest %s" % vm) | ||
rc = utils.subprocess_call(logger, arglist, shell=False) | ||
except Exception, reason: | ||
logger.error("unable to create %s: %s" % (name,reason)) | ||
if rc != 0: | ||
raise CX("cobbler trigger failed: %(file)s returns ") | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export CLASSPATH="$CLASSPATH:/opt/vijava/dom4j-1.6.1.jar:/opt/vijava/vijava2120100824.jar" | ||
export PATH="$PATH:/opt/jython/bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.