Commit Graph

190 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 6b3d378331 Merge pull request #4879 from poettering/systemd 2017-01-14 21:29:27 -05:00
Lennart Poettering 4b2419165c machinectl: make sure that inability to get OS version isn't consider fatal for machine list (#4972)
Fixes: #4918
2016-12-29 12:09:54 +01:00
Graeme Lawes 3a0a40d166 machinectl: handle EOPNOTSUPP from print_addresses (#4979)
Print addresses returns EOPNOTSUPP, not ENOSYS, when trying to print
addresses for non-container machines.
2016-12-25 12:14:41 +01:00
Lennart Poettering fc2288f0be machinectl: minor indentation fix 2016-12-21 19:09:31 +01:00
Lennart Poettering 61f638e544 machinectl: make "machinectl -E … shell" work
Fixes: #4823
2016-12-14 18:29:30 +01:00
Lennart Poettering 9153b02bb5 machined: add API for querying the OS release of a machine image
This adds a bus call GetImageOSRelease() to the Manager interface that
retrieves the /etc/os-release file of a machine image. It matches the existing
GetMachineOSRelease() call, however operates on a disk image rather than a
running container.

The backend for this call on .raw images is implemented via the generalized
image dissector, which makes this scheme relatively easy to implement.
2016-12-07 18:38:41 +01:00
Viktar Vaŭčkievič f9b1947f9b machinectl: don't output "No machines." with --no-legend option (#4593) 2016-11-06 09:19:57 -05:00
0xAX 084f580557 machinectl: enable pager on help (#4313)
as its output is fairly long.
2016-10-08 17:49:33 -04:00
Zbigniew Jędrzejewski-Szmek bc3bb330b8 machinectl: prefer user@ to --uid=user for shell (#4006)
It seems to me that the explicit positional argument should have higher
priority than "an option".
2016-09-26 11:45:31 -04:00
Wilhelm Schuster fbdec7923f machine: Disable more output when quiet flag is set (#4196) 2016-09-22 15:49:22 -04:00
Seraphime Kirkovski 07b0b339d6 machinectl: split OS field in two; print ip addresses (#4058)
This splits the OS field in two : one for the distribution name
and one for the the version id.
Dashes are written for missing fields.
This also prints ip addresses of known machines. The `--max-addresses`
option specifies how much ip addresses we want to see. The default is 1.
When more than one address is written for a machine, a `,` follows it.
If there are more ips than `--max-addresses`, `...` follows the last
address.
2016-08-31 20:06:57 +02:00
Seraphime e3fc2b025e machinectl: print OS release in `machinectl list` (#3975) 2016-08-20 23:39:07 -04:00
0xAX a912ab0474 machinectl: hide legend in a case when no data (#3839)
For this moment machinectl prints legend and count of machines/images/etc.
But in a case when we have no images,machines,etc., there is no sense to
show legend:

~$ machinectl
MACHINE CLASS SERVICE

0 machines listed.

Let's print only 'No machines', 'No images', 'No transfers' in this case.
2016-08-01 11:39:27 -04:00
Lennart Poettering 3bbaff3e08 tree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate
It's a bit easier to read because shorter. Also, most likely a tiny bit faster.
2016-07-22 12:38:08 +02:00
Thomas Hindoe Paaboel Andersen ba19c6e181 treewide: remove unused variables 2016-07-18 22:32:08 +02:00
Martin Pitt f15461b2b2 Merge pull request #3596 from poettering/machine-clean
make "machinectl clean" asynchronous, and open it up via PolicyKit
2016-06-30 21:30:35 +02:00
Martin Pitt bed48d6655 Merge pull request #3572 from poettering/machinectl-shell-fix
machinectl: interpret options placed between "shell" verb and machine name
2016-06-26 17:46:23 +02:00
Lennart Poettering 68ce459f2f machinectl: verify image existance on "start" and "enable" (#3579)
Let's make sure we catch early when a machine doesn't exist that is attempted
to be started or enabled as system service.
2016-06-26 17:41:33 +02:00
Lennart Poettering 03c2b2889f machined: "machinectl clean" can take a while, do it asynchronously from a background process
This is a follow-up to 5d2036b5f3, and also makes
the "machinectl clean" verb asynchronous, after all it's little more than a
series of image removals.

The changes required to make this happen are a bit more comprehensive as we
need to pass information about deleted images back to the client, as well as
information about the image we failed on if we failed on one. Hence, create a
temporary file in /tmp, serialize that data into, and read it from the parent
after the operation is complete.
2016-06-24 16:01:14 +02:00
Elias Probst 1e9707d495 machinectl: do not escape the unit name (#3554)
Otherwise starting a machine named `foo-bar-baz` will end up in
machinectl attempting to start the service unit
`systemd-nspawn@foo\x2dbar\x2dbaz` instead of
`systemd-nspawn@foo-bar-baz`.
2016-06-22 17:10:52 +02:00
Lennart Poettering 768c1decf9 machinectl: interpret options placed between "shell" verb and machine name
Previously, we'd stop processing of the argument list immediately when hitting
the "shell" verb. However, we really should continue processing options then,
until we hit the machine name.

Fixes: #3472
2016-06-21 21:30:20 +02:00
Lennart Poettering cf647b69ba systemctl: make sure we terminate the bus connection first, and then close the pager (#3550)
If "systemctl -H" is used, let's make sure we first terminate the bus
connection, and only then close the pager. If done in this order ssh will get
an EOF on stdin (as we speak D-Bus through ssh's stdin/stdout), and then
terminate. This makes sure the standard error we were invoked on is released by
ssh, and only that makes sure we don't deadlock on the pager which waits for
all clients closing its input pipe.

(Similar fixes for the various other xyzctl tools that support both pagers and
-H)

Fixes: #3543
2016-06-16 09:29:16 -04:00
Christian Rebischke b2bb19bbda machinectl: Added stop as alias for poweroff (#3406) 2016-06-06 17:06:20 +02:00
Christian Hesse acc0269cad {machine,system}ctl: always pass &changes and &n_changes (#3350)
We have to pass addresses of changes and n_changes to
bus_deserialize_and_dump_unit_file_changes(). Otherwise we are hit by
missing information (subsequent calls to unit_file_changes_add() to
not add anything).

Also prevent null pointer dereference in
bus_deserialize_and_dump_unit_file_changes() by asserting.

Fixes #3339
2016-05-26 15:57:37 +02:00
Lennart Poettering 3d87174db4 machinectl: since clone/remove/copy verbs are possibly slow, turn off bus call timeout
By default we timeout all bus calls, but if we know that these bus calls might
be slow, let's explicitly turn the timeouts off.
2016-05-02 11:17:06 +02:00
Zbigniew Jędrzejewski-Szmek 0bf5096049 machinectl: simplify option string assignment
It's better to avoid having the option string duplicated, lest we forget
to modify them in sync in the future.
2016-04-27 09:05:42 -04:00
Lennart Poettering 368d264387 machinectl: don't parse command line switches after "shell" verb (#3095)
Fixes: #2420
2016-04-22 21:01:55 -04:00
Zbigniew Jędrzejewski-Szmek 86ec5e5e29 Merge pull request #3094 from poettering/run-slice
systemd-run: fix --slice= in conjunction with --scope
2016-04-22 14:04:38 -04:00
Lennart Poettering 5bda1f47b3 machinectl: fix misplaced newline in --help output 2016-04-22 17:14:30 +02:00
Lennart Poettering 0ff308c8de shared: drop kernel_thread bool from cgroups show code
Make this an output flag instead, so that our function prototypes can lose one
parameter
2016-04-22 16:06:20 +02:00
Lennart Poettering a0e270198a loginctl,machinectl: also make use of new GetProcesses() bus call
This ports over machinectl and loginctl to also use the new GetProcesses() bus
call to show the process tree of a container or login session. This is similar
to how systemctl already has been ported over in a previous commit.
2016-04-22 16:06:20 +02:00
Zbigniew Jędrzejewski-Szmek 4d46e5db15 machinectl: add -E as alias for --setenv 2016-04-20 09:00:39 -04:00
Lennart Poettering d94c2b06f9 machinectl: add new "machinectl clean" command
This new command removes all, or all hidden container images that have been
downloaded.
2016-04-12 13:43:33 +02:00
Zbigniew Jędrzejewski-Szmek e138e7d7fc machinectl: indentation fix 2016-04-05 23:03:58 -04:00
Zbigniew Jędrzejewski-Szmek 855005230b machinectl: add --value option 2016-04-05 23:03:58 -04:00
Zbigniew Jędrzejewski-Szmek 06fb28b16e Merge pull request #2671 from 0xAX/move-pager-open-to-one-place
tree-wide: merge pager_open_if_enabled() to the pager_open()
2016-02-25 15:29:59 -05:00
Alexander Kuleshov ea4b98e657 tree-wide: merge pager_open_if_enabled() to the pager_open()
Many subsystems define own pager_open_if_enabled() function which
checks '--no-pager' command line argument and open pager depends
on its value. All implementations of pager_open_if_enabled() are
the same. Let's merger this function with pager_open() from the
shared/pager.c and remove pager_open_if_enabled() from all subsytems
to prevent code duplication.
2016-02-26 01:13:23 +06:00
Lennart Poettering 0ab0c01490 Merge pull request #2717 from keszybz/networkctl-prettification
Networkctl prettification
2016-02-23 16:54:52 +01:00
Zbigniew Jędrzejewski-Szmek 953d28cc21 Fix two typos 2016-02-23 08:48:22 -05:00
Vito Caputo 313cefa1d9 tree-wide: make ++/-- usage consistent WRT spacing
Throughout the tree there's spurious use of spaces separating ++ and --
operators from their respective operands.  Make ++ and -- operator
consistent with the majority of existing uses; discard the spaces.
2016-02-22 20:32:04 -08:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Jan Synacek 40c9fe4c08 basic/terminal-util: introduce SYSTEMD_COLORS environment variable
... to determine if color output should be enabled. If the variable is not set,
fall back to using on_tty(). Also, rewrite existing code to use
colors_enabled() where appropriate.
2016-01-20 10:12:41 +01:00
WaLyong Cho 10ba483504 bus-util: print "systemctl --user" on user service manager
When a unit was started with "systemctl --user" and it failed, error
messages is printed as "systemctl status". But it should be "systemctl
--user status".
2016-01-14 15:33:43 +09:00
Lennart Poettering b43d75c378 importd: drop dkr support
The current code is not compatible with current dkr protocols anyway,
and dkr has a different focus ("microservices") than nspawn anyway
("whole machine containers"), hence drop support for it, we cannot
reasonably keep this up to date, and it creates the impression we'd
actually care for the microservices usecase.
2015-12-10 16:54:41 +01:00
Lennart Poettering 4afd3348c7 tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.

With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.

The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).

This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.

Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:

       #define _cleanup_(function) __attribute__((cleanup(function)))

Or similar, to make the gcc feature easier to use.

Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.

See #2008.
2015-11-27 19:19:36 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 49cf4170d0 util-lib: move web-related calls into web-util.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 6bedfcbb29 util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 0f47436510 util-lib: get_current_dir_name() can return errors other than ENOMEM
get_current_dir_name() can return a variety of errors, not just ENOMEM,
hence don't blindly turn its errors to ENOMEM, but return correct errors
in path_make_absolute_cwd().

This trickles down into a couple of other functions, some of which
receive unrelated minor fixes too with this commit.
2015-10-24 23:03:49 +02:00