@@ -33,11 +33,12 @@ def check_repository():
33
33
current tracking branch."""
34
34
rep = Repo ("./" )
35
35
remote = rep .active_branch .tracking_branch ()
36
- fetches = rep .remotes [remote .remote_name ].fetch ()
37
- for fetch in fetches :
38
- if fetch .name == remote .name and fetch .commit != rep .commit ():
39
- logging .warning ("There are changes in remote repository, trying to pull" )
40
- rep .remotes [remote .remote_name ].pull ()
36
+ if remote :
37
+ fetches = rep .remotes [remote .remote_name ].fetch ()
38
+ for fetch in fetches :
39
+ if fetch .name == remote .name and fetch .commit != rep .commit ():
40
+ logging .warning ("There are changes in remote repository, trying to pull" )
41
+ rep .remotes [remote .remote_name ].pull ()
41
42
if rep .is_dirty ():
42
43
logging .warning ("There are not committed changes in your repository, please fix this" )
43
44
@@ -52,8 +53,8 @@ def write_changes(cluster_directory):
52
53
rep .index .add (cluster_directory )
53
54
logging .info ("Commiting installer changes for cluster %s" , cluster_directory )
54
55
rep .index .commit (f"[OCP Installer] installation files for { cluster_directory } added" )
55
-
56
- rep .remotes [remote .remote_name ].push ()
56
+ if remote :
57
+ rep .remotes [remote .remote_name ].push ()
57
58
58
59
59
60
def delete_directory (cluster_directory ):
@@ -63,4 +64,5 @@ def delete_directory(cluster_directory):
63
64
logging .info ("Removing cluster directory from git repository %s" , cluster_directory )
64
65
rep .index .remove (cluster_directory , working_tree = True , r = True , f = True )
65
66
rep .index .commit (f"[OCP Installer] removed installation files for { cluster_directory } " )
66
- rep .remotes [remote .remote_name ].push ()
67
+ if remote :
68
+ rep .remotes [remote .remote_name ].push ()
0 commit comments