diff options
Diffstat (limited to 'cloudinit/transforms/cc_foo.py')
-rw-r--r-- | cloudinit/transforms/cc_foo.py | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/cloudinit/transforms/cc_foo.py b/cloudinit/transforms/cc_foo.py index 35ec3fa7..8007f981 100644 --- a/cloudinit/transforms/cc_foo.py +++ b/cloudinit/transforms/cc_foo.py @@ -18,12 +18,35 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -#import cloudinit -#import cloudinit.util as util -from cloudinit.CloudConfig import per_instance +from cloudinit.settings import PER_INSTANCE -frequency = per_instance +# Modules are expected to have the following attributes. +# 1. A required 'handle' method which takes the following params. +# a) The name will not be this files name, but instead +# the name specified in configuration (which is the name +# which will be used to find this module). +# b) A configuration object that is the result of the merging +# of cloud configs configuration with legacy configuration +# as well as any datasource provided configuration +# c) A cloud object that can be used to access various +# datasource and paths for the given distro and data provided +# by the various datasource instance types. +# d) A argument list that may or may not be empty to this module. +# Typically those are from module configuration where the module +# is defined with some extra configuration that will eventually +# be translated from yaml into arguments to this module. +# 2. A optional 'frequency' that defines how often this module should be ran. +# Typically one of PER_INSTANCE, PER_ALWAYS, PER_ONCE. If not +# provided PER_INSTANCE will be assumed. +# See settings.py for these constants. +# 3. A optional 'distros' array/set/tuple that defines the known distros +# this module will work with (if not all of them). This is used to write +# a warning out if a module is being ran on a untested distribution for +# informational purposes. If non existent all distros are assumed and +# no warning occurs. +frequency = settings.PER_INSTANCE -def handle(_name, _cfg, _cloud, _log, _args): - print "hi" + +def handle(name, _cfg, _cloud, _log, _args): + print("Hi from %s" % (name)) |