[Libguestfs] [PATCH v4 2/2] fish: add journal-view command
Pino Toscano
ptoscano at redhat.com
Thu Aug 27 17:27:44 UTC 2015
In data giovedì 27 agosto 2015 15:18:25, Maros Zatko ha scritto:
> Lets user view journald log from VM in a similar format as journalctl
> uses.
>
> Fixes RFE: journal reader in guestfish (RHBZ#988100)
The bug number should be put in the first line.
> ---
> fish/fish.h | 3 +++
> generator/Makefile.am | 6 ++++--
> generator/actions.ml | 22 ++++++++++++++++++++++
> generator/main.ml | 3 +++
> 4 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/fish/fish.h b/fish/fish.h
> index df22e34..8ae6454 100644
> --- a/fish/fish.h
> +++ b/fish/fish.h
> @@ -104,6 +104,9 @@ extern int rc_remote (int pid, const char *cmd, size_t argc, char *argv[],
> /* in tilde.c */
> extern char *try_tilde_expansion (char *path);
>
> +/* in journal.c */
> +extern int journal_view (const char *fields);
As said in patch #1, this should be in journal.h.
> /* This should just list all the built-in commands so they can
> * be added to the generated auto-completion code.
> */
> diff --git a/generator/Makefile.am b/generator/Makefile.am
> index a3fe50d..bd466c2 100644
> --- a/generator/Makefile.am
> +++ b/generator/Makefile.am
> @@ -37,6 +37,7 @@ sources = \
> haskell.ml \
> java.ml \
> lua.ml \
> + journal.ml \
> main.ml \
> ocaml.ml \
> optgroups.ml \
> @@ -60,13 +61,14 @@ sources = \
> objects = \
> types.cmo \
> utils.cmo \
> + pr.cmo \
> + docstrings.cmo \
> + journal.cmo \
> actions.cmo \
> structs.cmo \
> optgroups.cmo \
> prepopts.cmo \
> events.cmo \
> - pr.cmo \
> - docstrings.cmo \
> checks.cmo \
> c.cmo \
> xdr.cmo \
> diff --git a/generator/actions.ml b/generator/actions.ml
> index 13c8bc8..e914fd3 100644
> --- a/generator/actions.ml
> +++ b/generator/actions.ml
> @@ -21,6 +21,8 @@
> open Types
> open Utils
>
> +open Journal
> +
> (* Default settings for all action fields. So we copy and override
> * this struct by writing '{ defaults with name = &c }'
> *)
> @@ -12897,6 +12899,26 @@ environment variable.
> See also L</hexdump>." };
>
> { defaults with
> + name = "journal_view";
> + shortdesc = "view journald log";
> + longdesc = " journal-view [FORMAT]
> +
> +View journald log in format similar to journalctl.
> +
> +=over
> +
> +"
> +^ (Journal.ops_to_pod_string ()) ^
> +"
> +=back
> +
> +Default format is C<~3axv>
> +
> +For fields description see C<man SYSTEMD.JOURNAL-FIELDS>
> +
> +Use C<journal-open> first." };
> +
> + { defaults with
> name = "lcd";
> shortdesc = "change working directory";
> longdesc = " lcd directory
> diff --git a/generator/main.ml b/generator/main.ml
> index 1e0e7d6..639920d 100644
> --- a/generator/main.ml
> +++ b/generator/main.ml
> @@ -46,6 +46,7 @@ open Golang
> open Bindtests
> open Errnostring
> open Customize
> +open Journal
>
> let perror msg = function
> | Unix_error (err, _, _) ->
> @@ -212,6 +213,8 @@ Run it from the top source directory using the command
> output_to "customize/customize-synopsis.pod" generate_customize_synopsis_pod;
> output_to "customize/customize-options.pod" generate_customize_options_pod;
>
> + output_to "fish/journal.h" generate_journal_h;
> +
> (* Generate the list of files generated -- last. *)
> printf "generated %d lines of code\n" (get_lines_generated ());
> let files = List.sort compare (get_files_generated ()) in
It seems generator/journal.ml is missing in this patch.
--
Pino Toscano
More information about the Libguestfs
mailing list