Skip to content

Commit

Permalink
daemon: Remove Manager.Run() dbus method
Browse files Browse the repository at this point in the history
Use the $cockpit.spawn() channel instead to run commands.

Closes #474
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
  • Loading branch information
stefwalter authored and mvollmer committed Apr 15, 2014
1 parent 6ee25bf commit 35b062a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
11 changes: 0 additions & 11 deletions data/com.redhat.Cockpit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,6 @@
<arg name="tz_offset_seconds" type="d" direction="out"/>
</signal>

<!--
Run:
Execute a arbitrary shell command as root and return its
output.
-->
<method name="Run">
<arg name="command" type="s" direction="in"/>
<arg name="output" type="s" direction="out"/>
</method>

<!--
GetAvatarDataURL:
Expand Down
18 changes: 0 additions & 18 deletions src/daemon/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,22 +828,6 @@ handle_cancel_shutdown (CockpitManager *object,

/* ---------------------------------------------------------------------------------------------------- */

static gboolean
handle_run (CockpitManager *object,
GDBusMethodInvocation *invocation,
const char *arg_command)
{
if (!auth_check_sender_role (invocation, COCKPIT_ROLE_ADMIN))
return TRUE;

gs_free char *output = NULL;
if (run_cmd_for_invocation (invocation, &output, "/bin/sh", "-c", arg_command, NULL))
cockpit_manager_complete_run (object, invocation, output);
return TRUE;
}

/* ---------------------------------------------------------------------------------------------------- */

static void
manager_iface_init (CockpitManagerIface *iface)
{
Expand All @@ -854,6 +838,4 @@ manager_iface_init (CockpitManagerIface *iface)
iface->handle_get_server_time = handle_get_server_time;
iface->handle_shutdown = handle_shutdown;
iface->handle_cancel_shutdown = handle_cancel_shutdown;

iface->handle_run = handle_run;
}
11 changes: 7 additions & 4 deletions src/web/cockpit-docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1387,10 +1387,13 @@ function DockerClient(machine) {
* TODO: We need a sane UI for showing that the resources can't be changed
* Showing unexpected error isn't it.
*/
manager.call('Run', command, function (error, output) {
if (error)
console.warn(error);
});
var options = {
host: cockpit_get_page_param ("machine", "server")
};
$cockpit.spawn(["/bin/sh", "-c", command], options).
fail(function(ex) {
console.warn(ex);
});
}

this.change_memory_limit = function change_memory_limit(id, value) {
Expand Down

0 comments on commit 35b062a

Please sign in to comment.