~mclehman/guestctl

634e46f08b3805a5ecf746f2b79b76c209eacd4a — Max Lehman 4 years ago f10c76d
Implement standalone commit operation.
3 files changed, 11 insertions(+), 2 deletions(-)

M META6.json
M bin/guestctl
M lib/App/Guestctl/Common.pm6
M META6.json => META6.json +1 -1
@@ 11,7 11,7 @@
        "templates/docker-compose.tmpl",
        "templates/sshd_config.tmpl"
    ],
    "version" : "0.0.3",
    "version" : "0.0.4",
    "production" : false,
    "perl" : "v6.*",
    "authors" : [

M bin/guestctl => bin/guestctl +8 -0
@@ 48,6 48,14 @@ multi MAIN($guest, GuestAction $action) {
            transparent-run <docker-compose restart>, cwd => $guest-dir;
        }

        when (Commit, Running) {
            my $container-id = run(<<docker-compose ps -q $guest>>, :out, cwd => $guest-dir).out.slurp.chomp;
            my $commit-epoch-time = now.to-posix.head.Int;
            my $committed-image = "guest-" ~ $guest ~ ":" ~ $commit-epoch-time;
            note qq{Committing guest "$guest" to image $committed-image.};
            transparent-run <<docker commit $container-id $committed-image>>, cwd => $guest-dir;
        }

        default {
            # Show status, either because it was requested or because the requested action is invalid.
            # Since type-checking MAIN guarantees that a valid command was received, this does not have to be an unknown command catch-all.

M lib/App/Guestctl/Common.pm6 => lib/App/Guestctl/Common.pm6 +2 -1
@@ 12,7 12,8 @@ enum GuestCommand is export
    (Up      => "up",
     Down    => "down",
     Restart => "restart",
     Status  => "status");
     Status  => "status",
	 Commit  => "commit");

enum ManageCommand is export
    (Update  => "update",