cobbler_api_hook_for_vm_creation
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cobbler_api_hook_for_vm_creation [2011/07/28 20:04] – jt | cobbler_api_hook_for_vm_creation [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | <code python> | ||
| - | #!/bin/env python | ||
| - | import sys | ||
| - | import re | ||
| - | import xmlrpclib | ||
| - | import cobbler.api as capi | ||
| - | automagick = xmlrpclib.Server(" | ||
| - | token = automagick.login(" | ||
| - | default_profile = ' | ||
| - | |||
| - | #Get required information from user for vm creation: | ||
| - | if len(sys.argv) < 3: | ||
| - | print (" | ||
| - | sys.exit(1) | ||
| - | |||
| - | ## Need to check if it is also a valid hostname with proper fqdn | ||
| - | def check_hostname (hostname): | ||
| - | if len(automagick.find_system({" | ||
| - | return hostname | ||
| - | else: | ||
| - | print " | ||
| - | sys.exit(1) | ||
| - | |||
| - | def build_system_definition(hostname): | ||
| - | host_id = automagick.new_system(token) | ||
| - | automagick.modify_system(host_id,' | ||
| - | automagick.modify_system(host_id,' | ||
| - | automagick.save_system(host_id, | ||
| - | | ||
| - | | ||
| - | hostname = check_hostname(sys.argv[1]) | ||
| - | print hostname | ||
| - | build_system_definition(hostname) | ||
| - | </ | ||
cobbler_api_hook_for_vm_creation.1311883456.txt.gz · Last modified: 2020/08/10 02:28 (external edit)
