"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cobbler/modules/install_pre_puppet.py" between
cobbler-2.8.4.tar.gz and cobbler-3.0.0.tar.gz

About: cobbler is a Linux installation and deployment server that allows for rapid setup of network installation environments. It can help with installation, DNS, DHCP, package updates, power management, configuration management orchestration, and much more.

install_pre_puppet.py  (cobbler-2.8.4):install_pre_puppet.py  (cobbler-3.0.0)
""" """
This module removes puppet certs from the puppet master prior to This module removes puppet certs from the puppet master prior to
reinstalling a machine if the puppet master is running on the cobbler reinstalling a machine if the puppet master is running on the cobbler
server. server.
Based on: Based on:
http://www.ithiriel.com/content/2010/03/29/writing-install-triggers-cobbler http://www.ithiriel.com/content/2010/03/29/writing-install-triggers-cobbler
""" """
from builtins import str
import re import re
import cobbler.utils as utils import cobbler.utils as utils
def register(): def register():
# this pure python trigger acts as if it were a legacy shell-trigger, but is much faster. # 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 # the return of this method indicates the trigger type
return "/var/lib/cobbler/triggers/install/pre/*" return "/var/lib/cobbler/triggers/install/pre/*"
def run(api, args, logger): def run(api, args, logger):
objtype = args[0] # "system" or "profile" objtype = args[0] # "system" or "profile"
name = args[1] # name of system or profile name = args[1] # name of system or profile
# ip = args[2] # ip or "?" # ip = args[2] # ip or "?"
if objtype != "system": if objtype != "system":
return 0 return 0
settings = api.settings() settings = api.settings()
if not str(settings.puppet_auto_setup).lower() in [ "1", "yes", "y", "true"] : if not str(settings.puppet_auto_setup).lower() in ["1", "yes", "y", "true"]:
return 0 return 0
if not str(settings.remove_old_puppet_certs_automatically).lower() in [ "1", "yes", "y", "true"]: if not str(settings.remove_old_puppet_certs_automatically).lower() in ["1", "yes", "y", "true"]:
return 0 return 0
system = api.find_system(name) system = api.find_system(name)
system = utils.blender(api, False, system) system = utils.blender(api, False, system)
hostname = system[ "hostname" ] hostname = system["hostname"]
if not re.match(r'[\w-]+\..+', hostname): if not re.match(r'[\w-]+\..+', hostname):
search_domains = system['name_servers_search'] search_domains = system['name_servers_search']
if search_domains: if search_domains:
hostname += '.' + search_domains[0] hostname += '.' + search_domains[0]
if not re.match(r'[\w-]+\..+', hostname): if not re.match(r'[\w-]+\..+', hostname):
default_search_domains = system['default_name_servers_search'] default_search_domains = system['default_name_servers_search']
if default_search_domains: if default_search_domains:
hostname += '.' + default_search_domains[0] hostname += '.' + default_search_domains[0]
puppetca_path = settings.puppetca_path puppetca_path = settings.puppetca_path
cmd = [puppetca_path, 'cert', 'clean', hostname] cmd = [puppetca_path, 'cert', 'clean', hostname]
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)