NAME
App::CharmKit::Sys - hook utilities
SYNOPSIS
use charm;
or
use App::CharmKit::Sys;
apt_update;
apt_upgrade;
apt_install ['nginx-common', 'redis-server'];
DESCRIPTION
Provides system utilities such as installing packages, managing files, and more.
- log($message)
-
Utilizies juju-log for any additional logging
- spew(SCALAR $path, SCALAR $contents)
-
writes to a file, defaults to utf8
- slurp(SCALAR $path)
-
reads a file, defaults to utf8
- sh(SCALAR $command)
-
runs a local command:
my $ret = sh 'juju-log a message'; print $ret;
Arguments command: command to run
Returns output of command
- sh2(SCALAR $command)
-
Runs a local command but returning Capture::Tiny
my ($stdout, $stderr, $exit) = sh2 'juju-log a message'; chomp($stdout); print $stdout;
Arguments command: command to run
Returns ($stdout, $stderr, $exitcode)
- apt_add_repo(SCALAR $repo, SCALAR $key, BOOL $update)
-
Adds a archive repository or ppa. key is required if adding http source.
source can be in the format of:
ppa:charmers/example deb https://stub:key@private.example.com/ubuntu trusty main
- apt_install(ARRAYREF $pkgs)
-
Installs packages via apt-get
apt_install(['nginx']);
- apt_upgrade
-
Upgrades system
apt_upgrade();
- apt_update
-
Update repository sources
apt_update();
1;