diff options
| author | Scott Moser <smoser@ubuntu.com> | 2013-03-07 17:15:07 -0500 |
|---|---|---|
| committer | Scott Moser <smoser@ubuntu.com> | 2013-03-07 17:15:07 -0500 |
| commit | 973747b00af47c94ba0a719452aa823fb688e5ab (patch) | |
| tree | 647bbe6715ffd164726186a1fb4dfef7e6d483d9 /cloudinit/type_utils.py | |
| parent | 8013c284e82349246b2274f5475c138323fd7c55 (diff) | |
| parent | 5da3984c2ca9e94b2483ab89ecdb5c93b5afb9f8 (diff) | |
| download | vyos-cloud-init-973747b00af47c94ba0a719452aa823fb688e5ab.tar.gz vyos-cloud-init-973747b00af47c94ba0a719452aa823fb688e5ab.zip | |
support different and user-suppliable merging algorithms for cloud-config
This adds a very useful mechanism for merging cloud-config, allowing
the user to append to lists (ie, just add more 'run_cmd') or other
things.
See doc/merging.txt for more information, it is intended to be backwards
compatible by default.
LP: #1023179
Diffstat (limited to 'cloudinit/type_utils.py')
| -rw-r--r-- | cloudinit/type_utils.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cloudinit/type_utils.py b/cloudinit/type_utils.py new file mode 100644 index 00000000..2decbfc5 --- /dev/null +++ b/cloudinit/type_utils.py @@ -0,0 +1,34 @@ +# vi: ts=4 expandtab +# +# Copyright (C) 2012 Canonical Ltd. +# Copyright (C) 2012 Hewlett-Packard Development Company, L.P. +# Copyright (C) 2012 Yahoo! Inc. +# +# Author: Scott Moser <scott.moser@canonical.com> +# Author: Juerg Haefliger <juerg.haefliger@hp.com> +# Author: Joshua Harlow <harlowja@yahoo-inc.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, as +# published by the Free Software Foundation. +# +# 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, see <http://www.gnu.org/licenses/>. +# +# pylint: disable=C0302 + +import types + + +def obj_name(obj): + if isinstance(obj, (types.TypeType, + types.ModuleType, + types.FunctionType, + types.LambdaType)): + return str(obj.__name__) + return obj_name(obj.__class__) |
