#!/usr/bin/python3

"""
This script copies important files to a machine

something like:
copy ~/.aws ~/.ssh ~/.s3cfg ~/.gitconfig ~/.passwd-s3fs to it
"""


import subprocess
import sys
import os.path

folders_to_copy = [
    "~/.aws",
    "~/.ssh",
    "~/.s3cfg",
    "~/.gitconfig",
    "~/.passwd-s3fs",
]

assert len(sys.argv) == 2
machine_name = sys.argv[1]
args = [
    "scp",
    "-r",
]
args.extend(map(os.path.expanduser, folders_to_copy))
args.append("ubuntu@{}:~".format(machine_name))
# subprocess.check_call(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.check_call(args)

@@ -68,87 +68,33 @@
 hine
-%0A%0Asomething like:%0Acopy ~/.aws ~/.ssh ~/.s3cfg ~/.gitconfig ~/.passwd-s3fs to it
+ like key files and such.
 %0A%22%22%22
@@ -141,16 +141,33 @@
 s.path%0A%0A
+%0Adef main():%0A    
 folders_
@@ -174,24 +174,28 @@
 to_copy = %5B%0A
+    
     %22~/.aws%22
@@ -196,24 +196,28 @@
 /.aws%22,%0A    
+   
+ 
 %22~/.ssh%22,%0A  
@@ -214,24 +214,28 @@
 /.ssh%22,%0A    
+   
+ 
 %22~/.s3cfg%22,%0A
@@ -234,24 +234,28 @@
 s3cfg%22,%0A    
+  
+  
 %22~/.gitconfi
@@ -258,24 +258,28 @@
 onfig%22,%0A    
+  
+  
 %22~/.passwd-s
@@ -288,11 +288,19 @@
 s%22,%0A
-%5D%0A%0A
+    %5D%0A%0A    
 asse
@@ -321,16 +321,20 @@
 v) == 2%0A
+    
 machine_
@@ -352,16 +352,20 @@
 argv%5B1%5D%0A
+    
 args = %5B
@@ -361,24 +361,28 @@
    args = %5B%0A
+    
     %22scp%22,%0A 
@@ -388,16 +388,28 @@
     
+   
+ 
 %22-r%22,%0A
-%5D%0A
+    %5D%0A    
 args
@@ -458,16 +458,20 @@
 _copy))%0A
+    
 args.app
@@ -479,16 +479,21 @@
 nd(%22
-ubuntu@%7B
+%7Bmachine_name
 %7D:~%22
@@ -512,19 +512,36 @@
 ine_name
-))%0A
+=machine_name))%0A    
 # subpro
@@ -616,16 +616,20 @@
 EVNULL)%0A
+    
 subproce
@@ -648,8 +648,48 @@
 l(args)%0A
+%0A%0Aif __name__ == '__main__':%0A    main()%0A

refactor code