3
# Copyright (C) 2009-2011 Canonical Ltd.
5
# Author: Scott Moser <scott.moser@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/>.
18
import cloudinit.util as util
22
def handle(name,cfg,cloud,log,args):
23
if not cfg.has_key("bootcmd"):
27
content = util.shellify(cfg["bootcmd"])
28
tmpf = tempfile.TemporaryFile()
32
log.warn("failed to shellify bootcmd")
36
subprocess.check_call(['/bin/sh'], stdin=tmpf)
39
log.warn("failed to run commands from bootcmd")