18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
# Ensure this is aliased to a name not 'distros'
22
# since the module attribute 'distros'
23
# is a list of distros that are supported, not a sub-module
24
from cloudinit import distros as ds
21
26
from cloudinit import util
23
28
distros = ['ubuntu', 'debian']
26
def handle(name, cfg, _cloud, log, args):
31
def handle(name, cfg, cloud, log, args):
59
user = util.get_cfg_option_str(cfg, "user", "ubuntu")
60
shcmd += " sudo -Hu \"%s\" byobu-launcher-%s" % (user, bl_inst)
61
shcmd += " || X=$(($X+1)); "
64
(users, _groups) = ds.normalize_users_groups(cfg, cloud.distro)
65
(user, _user_config) = ds.extract_default(users)
67
log.warn(("No default byobu user provided, "
68
"can not launch %s for the default user"), bl_inst)
70
shcmd += " sudo -Hu \"%s\" byobu-launcher-%s" % (user, bl_inst)
71
shcmd += " || X=$(($X+1)); "
63
73
shcmd += "echo \"%s\" | debconf-set-selections" % dc_val
64
74
shcmd += " && dpkg-reconfigure byobu --frontend=noninteractive"
65
75
shcmd += " || X=$(($X+1)); "
67
cmd = ["/bin/sh", "-c", "%s %s %s" % ("X=0;", shcmd, "exit $X")]
69
log.debug("Setting byobu to %s", value)
71
util.subp(cmd, capture=False)
78
cmd = ["/bin/sh", "-c", "%s %s %s" % ("X=0;", shcmd, "exit $X")]
79
log.debug("Setting byobu to %s", value)
80
util.subp(cmd, capture=False)