diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-01-04 16:23:21 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-01-04 16:23:21 +0100 |
commit | 3b1a9d1f8db031563903a493be755419d7ba6620 (patch) | |
tree | 867f8787864ef9d0fe5bf0868622d954b7fcd174 /src/report-python | |
parent | b1439e4900cdcdd75be608f8470b505e006d2d11 (diff) | |
download | abrt-3b1a9d1f8db031563903a493be755419d7ba6620.tar.gz abrt-3b1a9d1f8db031563903a493be755419d7ba6620.tar.xz abrt-3b1a9d1f8db031563903a493be755419d7ba6620.zip |
dump_dir: make chown'ing of new files optional - needed for non-root usage
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/report-python')
-rw-r--r-- | src/report-python/dump_dir.c | 4 | ||||
-rwxr-xr-x | src/report-python/test_dd_create | 2 | ||||
-rwxr-xr-x | src/report-python/test_run_event_state1 | 2 | ||||
-rwxr-xr-x | src/report-python/test_setroubleshoot_example2 | 27 |
4 files changed, 31 insertions, 4 deletions
diff --git a/src/report-python/dump_dir.c b/src/report-python/dump_dir.c index 249a9478..067b905b 100644 --- a/src/report-python/dump_dir.c +++ b/src/report-python/dump_dir.c @@ -243,8 +243,8 @@ PyObject *p_dd_opendir(PyObject *module, PyObject *args) PyObject *p_dd_create(PyObject *module, PyObject *args) { const char *dir; - int uid; - if (!PyArg_ParseTuple(args, "si", &dir, &uid)) + int uid = -1; + if (!PyArg_ParseTuple(args, "s|i", &dir, &uid)) return NULL; p_dump_dir *new_dd = PyObject_New(p_dump_dir, &p_dump_dir_type); if (!new_dd) diff --git a/src/report-python/test_dd_create b/src/report-python/test_dd_create index 2ac97924..4da29b11 100755 --- a/src/report-python/test_dd_create +++ b/src/report-python/test_dd_create @@ -2,7 +2,7 @@ from report import * -dd = dd_create("testdir", 0) +dd = dd_create("testdir") print dd if dd: diff --git a/src/report-python/test_run_event_state1 b/src/report-python/test_run_event_state1 index b30f8b55..6c3584fe 100755 --- a/src/report-python/test_run_event_state1 +++ b/src/report-python/test_run_event_state1 @@ -14,7 +14,7 @@ res = run_event_state() res.post_run_callback = post_run_callback res.logging_callback = logging_callback -dd = dd_create("testdir", 0) +dd = dd_create("testdir") if not dd: sys.exit(1) dd.save_text("analyzer", "foo") diff --git a/src/report-python/test_setroubleshoot_example2 b/src/report-python/test_setroubleshoot_example2 new file mode 100755 index 00000000..8aebcdfe --- /dev/null +++ b/src/report-python/test_setroubleshoot_example2 @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import report +import report.io +import report.io.GTKIO +import report.accountmanager + +accounts = report.accountmanager.AccountManager() + +signature = report.createAlertSignature("selinux-policy", + "setroubleshoot", + "self.siginfo.get_hash()", + "self.summary", + "content") + +# Won't send log anywhere: +#rc = report.report(signature, report.io.GTKIO.GTKIO(accounts)) + +# report.report() + logging: +def logging_callback(line): + print "LOG:", line + return +state = report.run_event_state() +state.logging_callback = logging_callback +rc = state.run_event_on_crash_data(signature, "report") + +print "rc:", rc |