]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
Remove pakfire keyring installation stuff.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Apr 2012 22:42:26 +0000 (00:42 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Apr 2012 22:42:26 +0000 (00:42 +0200)
This is not a very handy idea to generate random keys.

python/pakfire/api.py
python/pakfire/builder.py
python/pakfire/cli.py
python/pakfire/keyring.py

index 9e57edd7a1c6819e55df786ec60cfb94762c11e8..5203c5fdbd95b6b23b2fc335cf8015b29d8c9d2c 100644 (file)
@@ -135,11 +135,6 @@ def cache_create(**pakfire_args):
 
 # Key functions.
 
-def key_init(**pakfire_args):
-       pakfire = Pakfire(**pakfire_args)
-
-       return pakfire.keyring.init()
-
 def key_generate(realname, email, **pakfire_args):
        pakfire = Pakfire(**pakfire_args)
 
index 6123b4d9365d914913e6a0c098fbcc61fc8050ce..8661dc16bcb2b80dd2ca5162dd50c628b2b5e7a8 100644 (file)
@@ -276,14 +276,7 @@ class BuildEnviron(object):
        def keyring(self):
                """
                        Shortcut to access the pakfire keyring.
-
-                       (Makes also sure that it is properly initialized.)
                """
-               assert self.pakfire
-
-               if not self.pakfire.keyring.initialized:
-                       self.pakfire.keyring.init()
-
                return self.pakfire.keyring
 
        def lock(self):
index 2275ded31fd33a23355c2a2842bcbff07ea6665e..cccd9868fc816de292090b91302b2f74c0cbe334 100644 (file)
@@ -1145,7 +1145,6 @@ class CliKey(Cli):
                # Add sub-commands.
                self.sub_commands = self.parser.add_subparsers()
 
-               self.parse_command_init()
                self.parse_command_generate()
                self.parse_command_import()
                self.parse_command_export()
@@ -1161,7 +1160,6 @@ class CliKey(Cli):
                self.pakfire = pakfire.Pakfire(**self.pakfire_args)
 
                self.action2func = {
-                       "init"        : self.handle_init,
                        "generate"    : self.handle_generate,
                        "import"      : self.handle_import,
                        "export"      : self.handle_export,
@@ -1179,12 +1177,6 @@ class CliKey(Cli):
 
                return ret
 
-       def parse_command_init(self):
-               # Parse "init" command.
-               sub_init = self.sub_commands.add_parser("init",
-                       help=_("Initialize the local keyring."))
-               sub_init.add_argument("action", action="store_const", const="init")
-
        def parse_command_generate(self):
                # Parse "generate" command.
                sub_gen = self.sub_commands.add_parser("generate",
@@ -1247,10 +1239,6 @@ class CliKey(Cli):
                        help=_("Package(s) to verify."))
                sub_verify.add_argument("action", action="store_const", const="verify")
 
-       def handle_init(self):
-               # Initialize the keyring...
-               pakfire.key_init(**self.pakfire_args)
-
        def handle_generate(self):
                realname = self.args.realname[0]
                email    = self.args.email[0]
index c7da4b3508ce1f17886848641ace9035dd3591c9..8e78e9d1786acf96e2b7ec639a3929289a805b9e 100644 (file)
@@ -54,42 +54,24 @@ class Keyring(object):
                return KEYRING_DIR
 
        def create_path(self):
+               if os.path.exists(self.path):
+                       os.chmod(self.path, 700)
+               else:
+                       os.makedirs(self.path, 700)
+
                filename = os.path.join(self.path, "gnupg.conf")
 
                if os.path.exists(filename):
+                       os.chmod(filename, 600)
                        return
 
-               if not os.path.exists(self.path):
-                       os.makedirs(self.path)
-                       # XXX chmod 700
-
                # Create a default gnupg.conf.
                f = open(filename, "w")
                f.write("# This is a default gnupg configuration file created by\n")
                f.write("# Pakfire %s.\n" % PAKFIRE_VERSION)
                f.close()
-               # XXX chmod 600
-
-       @property
-       def initialized(self):
-               """
-                       Returns true if the local keyring was already initialized.
-               """
-               if self.get_host_key():
-                       return True
-
-               return False
-
-       def init(self):
-               # If the host key is already present, we break up.
-               if self.initialized:
-                       log.error(_("The local keyring is already initialized. Aborting."))
-                       return
-
-               log.info(_("Initializing local keyring..."))
 
-               hostname, domainname = system.hostname.split(".", 1)
-               self.gen_key(system.hostname, "%s@%s" % (hostname, domainname))
+               os.chmod(filename, 600)
 
        def dump_key(self, keyfp):
                ret = []