Hi

To fix the key error for missing valid commands I added some checks. Would that 
solve the bug? Or should we check if the host is ftp-master when dm is supplied?

./dput/command.py in invoke_dcut()

     command.validate(args)

+    if 'ftp-master' not in profile['name'] and 'dm' in command.cmd_name:
+       raise DcutError("Use DM command with ftp-master")
+
     if args.passive:
         force_passive_ftp_upload(profile)

Best
Tari
diff -Nru dput-ng-1.28/dput/command.py dput-ng-1.28+1/dput/command.py
--- dput-ng-1.28/dput/command.py	2018-08-25 10:39:16.000000000 +0200
+++ dput-ng-1.28+1/dput/command.py	2019-08-14 22:37:16.000000000 +0200
@@ -75,6 +75,10 @@
 
 def load_commands(profile):
     commands = []
+
+    if not 'valid_commands' in profile:
+        return []
+    
     for command in profile['valid_commands']:
         logger.debug("importing command: %s" % (command))
         try:
@@ -196,8 +200,13 @@
     if args.simulate:
         logger.warning("Not uploading for real - dry run")
 
-    command = args.command
-    assert(issubclass(type(command), AbstractCommand))
+    command = None
+    if hasattr(args,'command'):
+        command = args.command
+
+    if not command:
+       raise DcutError("No commands given")
+
     command.validate(args)
 
     if args.passive:
diff -Nru dput-ng-1.28/dput/profile.py dput-ng-1.28+1/dput/profile.py
--- dput-ng-1.28/dput/profile.py	2018-02-22 10:00:33.000000000 +0100
+++ dput-ng-1.28+1/dput/profile.py	2019-08-14 22:37:16.000000000 +0200
@@ -197,8 +197,8 @@
         return config.get_config(host)
 
     if host is not None:
-        raise DputConfigurationError("Error, was given host, "
-                                     "but we don't know about it.")
+        raise DputConfigurationError("Was given host, "
+                                     "but not found in the profile/config.")
 
     for block in configs:
         try:

Reply via email to