9.1.4.1.3. cobbler.modules.installation package

9.1.4.1.3.1. Submodules

9.1.4.1.3.2. cobbler.modules.installation.post_log module

(C) 2008-2009, Red Hat Inc. Michael DeHaan <michael.dehaan AT gmail>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

cobbler.modules.installation.post_log.register() str[source]

The mandatory Cobbler module registration hook.

cobbler.modules.installation.post_log.run(api, args) int[source]
Parameters
  • api – This parameter is unused currently.

  • args – An array of three elements. Type (system/profile), name and ip. If no ip is present use a ?.

Returns

Always 0

9.1.4.1.3.3. cobbler.modules.installation.post_power module

class cobbler.modules.installation.post_power.reboot(api, target)[source]

Bases: threading.Thread

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

cobbler.modules.installation.post_power.register() str[source]

The mandatory Cobbler module registration hook.

cobbler.modules.installation.post_power.run(api, args) int[source]

Obligatory trigger hook.

Parameters
  • api – The api to resolve information with.

  • args – This is an array containing two objects. 0: String with the content “target” or “profile”. 1: The name of target or profile

Returns

0 on success.

9.1.4.1.3.4. cobbler.modules.installation.post_puppet module

This module signs newly installed client puppet certificates if the puppet master server is running on the same machine as the Cobbler server.

Based on: http://www.ithiriel.com/content/2010/03/29/writing-install-triggers-cobbler

cobbler.modules.installation.post_puppet.register() str[source]

The mandatory Cobbler module registration hook.

cobbler.modules.installation.post_puppet.run(api, args) int[source]

The obligatory Cobbler modules hook.

Parameters
  • api – The api to resolve all information with.

  • args – This is an array with two items. The first may be system or profile and the second is the name of this system or profile.

Returns

0 or nothing.

9.1.4.1.3.5. cobbler.modules.installation.post_report module

cobbler.modules.installation.post_report.register() str[source]

The mandatory Cobbler module registration hook.

Returns

Always /var/lib/cobbler/triggers/install/post/*.

cobbler.modules.installation.post_report.run(api, args) int[source]

This is the mandatory Cobbler module run trigger hook.

Parameters
  • api – The api to resolve information with.

  • args – This is an array with three elements. 0: “target” or “profile” 1: name of target or profile 2: ip or “?”

Returns

0 or 1.

Raises

CX – Raised if the blender result is empty.

9.1.4.1.3.6. cobbler.modules.installation.pre_clear_anamon_logs module

(C) 2008-2009, Red Hat Inc. James Laska <jlaska@redhat.com> Bill Peck <bpeck@redhat.com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

cobbler.modules.installation.pre_clear_anamon_logs.register() str[source]

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.

Returns

Always /var/lib/cobbler/triggers/install/pre/*

cobbler.modules.installation.pre_clear_anamon_logs.run(api, args) int[source]
The list of args should have one element:
  • 1: the name of the system or profile

Parameters
  • api – The api to resolve metadata with.

  • args – This should be a list as described above.

Returns

“0” on success.

Raises

CX – Raised in case of missing arguments.

9.1.4.1.3.7. cobbler.modules.installation.pre_log module

cobbler.modules.installation.pre_log.register() str[source]

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.

Returns

Always /var/lib/cobbler/triggers/install/pre/*

cobbler.modules.installation.pre_log.run(api, args: list) int[source]

The method runs the trigger, meaning this logs that an installation has started.

The list of args should have three elements:
  • 0: system or profile

  • 1: the name of the system or profile

  • 2: the ip or a “?”

Parameters
  • api – This parameter is currently unused.

  • args – Already described above.

Returns

A “0” on success.

9.1.4.1.3.8. cobbler.modules.installation.pre_puppet module

This module removes puppet certs from the puppet master prior to reinstalling a machine if the puppet master is running on the Cobbler server.

Based on: http://www.ithiriel.com/content/2010/03/29/writing-install-triggers-cobbler

cobbler.modules.installation.pre_puppet.register() str[source]

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.

Returns

Always /var/lib/cobbler/triggers/install/pre/*

cobbler.modules.installation.pre_puppet.run(api, args) int[source]

This method runs the trigger, meaning in this case that old puppet certs are automatically removed via puppetca.

The list of args should have two elements:
  • 0: system or profile

  • 1: the name of the system or profile

Parameters
  • api – The api to resolve external information with.

  • args – Already described above.

Returns

“0” on success. If unsuccessful this raises an exception.

9.1.4.1.3.9. Module contents

This module contains Python triggers for Cobbler. With Cobbler one is able to add custom actions and commands after many events happening in Cobbler. The Python modules presented here are an example of what can be done after certain events. Custom triggers may be added in any language as long as Cobbler is allowed to execute them. If implemented in Python they need to follow the following specification:

  • Expose a method called register() which returns a str and returns the path of the trigger in the filesystem.

  • Expose a method called run(api, args) of type int. The integer would represent the exit status of an e.g. shell script. Thus 0 means success and anything else a failure.