|
Packit Service |
a04d08 |
# Copyright (C) 2009-2010 Canonical Ltd.
|
|
Packit Service |
a04d08 |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
|
|
Packit Service |
a04d08 |
#
|
|
Packit Service |
a04d08 |
# Author: Scott Moser <scott.moser@canonical.com>
|
|
Packit Service |
a04d08 |
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
|
|
Packit Service |
a04d08 |
#
|
|
Packit Service |
a04d08 |
# This file is part of cloud-init. See LICENSE file for license information.
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
"""
|
|
Packit Service |
a04d08 |
Foo
|
|
Packit Service |
a04d08 |
---
|
|
Packit Service |
a04d08 |
**Summary:** example module
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
Example to show module structure. Does not do anything.
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
**Internal name:** ``cc_foo``
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
**Module frequency:** per instance
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
**Supported distros:** all
|
|
Packit Service |
a04d08 |
"""
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
from cloudinit.settings import PER_INSTANCE
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# Modules are expected to have the following attributes.
|
|
Packit Service |
a04d08 |
# 1. A required 'handle' method which takes the following params.
|
|
Packit Service |
a04d08 |
# a) The name will not be this files name, but instead
|
|
Packit Service |
a04d08 |
# the name specified in configuration (which is the name
|
|
Packit Service |
a04d08 |
# which will be used to find this module).
|
|
Packit Service |
a04d08 |
# b) A configuration object that is the result of the merging
|
|
Packit Service |
a04d08 |
# of cloud configs configuration with legacy configuration
|
|
Packit Service |
a04d08 |
# as well as any datasource provided configuration
|
|
Packit Service |
a04d08 |
# c) A cloud object that can be used to access various
|
|
Packit Service |
a04d08 |
# datasource and paths for the given distro and data provided
|
|
Packit Service |
a04d08 |
# by the various datasource instance types.
|
|
Packit Service |
a04d08 |
# d) A argument list that may or may not be empty to this module.
|
|
Packit Service |
a04d08 |
# Typically those are from module configuration where the module
|
|
Packit Service |
a04d08 |
# is defined with some extra configuration that will eventually
|
|
Packit Service |
a04d08 |
# be translated from yaml into arguments to this module.
|
|
Packit Service |
a04d08 |
# 2. A optional 'frequency' that defines how often this module should be run.
|
|
Packit Service |
a04d08 |
# Typically one of PER_INSTANCE, PER_ALWAYS, PER_ONCE. If not
|
|
Packit Service |
a04d08 |
# provided PER_INSTANCE will be assumed.
|
|
Packit Service |
a04d08 |
# See settings.py for these constants.
|
|
Packit Service |
a04d08 |
# 3. A optional 'distros' array/set/tuple that defines the known distros
|
|
Packit Service |
a04d08 |
# this module will work with (if not all of them). This is used to write
|
|
Packit Service |
a04d08 |
# a warning out if a module is being ran on a untested distribution for
|
|
Packit Service |
a04d08 |
# informational purposes. If non existent all distros are assumed and
|
|
Packit Service |
a04d08 |
# no warning occurs.
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
frequency = PER_INSTANCE
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
def handle(name, _cfg, _cloud, log, _args):
|
|
Packit Service |
a04d08 |
log.debug("Hi from module %s", name)
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# vi: ts=4 expandtab
|