summaryrefslogtreecommitdiffstats
path: root/base/common/python/pki/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'base/common/python/pki/util.py')
-rw-r--r--base/common/python/pki/util.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/base/common/python/pki/util.py b/base/common/python/pki/util.py
new file mode 100644
index 000000000..7db4fbe79
--- /dev/null
+++ b/base/common/python/pki/util.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+# Authors:
+# Endi S. Dewata <edewata@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2013 Red Hat, Inc.
+# All rights reserved.
+#
+
+import os
+import shutil
+
+
+def copyfile(source, dest):
+
+ dir = os.path.dirname(dest)
+ if not os.path.exists(dir):
+ os.makedirs(dir)
+
+ shutil.copy2(source, dest)
+ st = os.stat(source)
+ os.chown(dest, st.st_uid, st.st_gid)