3
# Copyright (C) 2014 Canonical Ltd.
5
# Author: Ben Howard <ben.howard@canonical.com>
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License version 3, as
9
# published by the Free Software Foundation.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
from cloudinit import util
23
from cloudinit.settings import PER_INSTANCE
25
frequency = PER_INSTANCE
27
SCRIPT_SUBDIR = 'vendor'
30
def handle(name, cfg, cloud, log, _args):
31
# This is written to by the vendor data handlers
32
# any vendor data shell scripts get placed in runparts_path
33
runparts_path = os.path.join(cloud.get_ipath_cur(), 'scripts',
36
prefix = util.get_cfg_by_path(cfg, ('vendor_data', 'prefix'), [])
39
util.runparts(runparts_path, exe_prefix=prefix)
41
log.warn("Failed to run module %s (%s in %s)",
42
name, SCRIPT_SUBDIR, runparts_path)