Skip to content

Commit e26290d

Browse files
committed
Minor error handling changes
1 parent 749e1b6 commit e26290d

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

Diff for: osia/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def _setup_parser():
189189

190190
def main_cli():
191191
"""Function represents main entrypoint for the
192-
osia intaller
192+
osia installer
193193
194194
It sets up the cli and starts the executor."""
195195
parser = _setup_parser()

Diff for: osia/config/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _resolve_cloud_name(args: argparse.Namespace) -> Optional[Dict]:
4141
for env in defaults['CLOUD'][args.cloud]['environments']:
4242
if env['name'] == default_env:
4343
return env
44-
logging.debug("No environment found, maybe all variables are passed from command line")
44+
logging.warning("No environment found, maybe all variables are passed from command line")
4545
return None
4646

4747

Diff for: osia/installer/downloader/install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,5 @@ def download_installer(installer_version: str,
150150
if root.exists() and root.joinpath('openshift-install').exists():
151151
logging.info('Found installer at %s', root.as_posix())
152152
return root.joinpath('openshift-install').as_posix()
153-
root.mkdir(parents=True)
153+
root.mkdir(parents=True, exist_ok=True)
154154
return get_installer(url, root.as_posix())

Diff for: osia/installer/storage.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ def check_repository():
3333
current tracking branch."""
3434
rep = Repo("./")
3535
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()
4142
if rep.is_dirty():
4243
logging.warning("There are not committed changes in your repository, please fix this")
4344

@@ -52,8 +53,8 @@ def write_changes(cluster_directory):
5253
rep.index.add(cluster_directory)
5354
logging.info("Commiting installer changes for cluster %s", cluster_directory)
5455
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()
5758

5859

5960
def delete_directory(cluster_directory):

0 commit comments

Comments
 (0)