Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versions of deps, error handling for mkdir , use os.sep #27

Merged
merged 3 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions ansible_deploy/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ def create_workdir(timestamp: str, base_dir: str):
seq_path = os.path.join(date_dir, f"{conf['file_naming']['sequence_prefix']}"
f"{new_sequence:04d}")

#TODO: Add error handling
os.makedirs(seq_path)
os.chdir(seq_path)
try:
os.makedirs(seq_path)
os.chdir(seq_path)
except Exception as e:
logger.error("Failed to create work dir:%s error was:%s", seq_path, e)
sys.exit(90)

logger.info("Successfully created workdir: %s", seq_path)
return seq_path

Expand Down Expand Up @@ -469,7 +473,7 @@ def main():
else:
lockdir = os.path.join(conf["global_paths"]["work_dir"], "locks")
inv_file = get_inventory_file(config, options)
lockpath = os.path.join(lockdir, inv_file.replace("/", "_"))
lockpath = os.path.join(lockdir, inv_file.replace(os.sep, "_"))
if subcommand == "run":
workdir = create_workdir(start_ts, conf["global_paths"]["work_dir"])
setup_ansible(config["tasks"]["setup_hooks"], options["commit"], workdir)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(fname):
# This call to setup() does all the work
setup(
name="ansible-deploy",
version="0.0.11",
version="0.0.15",
description="Wrapper around ansible-playbook allowing configurable tasks and permissions",
long_description=README,
long_description_content_type="text/markdown",
Expand All @@ -30,7 +30,7 @@ def read(fname):
],
packages=["ansible_deploy"],
include_package_data=True,
install_requires=["pyyaml", "cerberus"],
install_requires=["pyyaml>=5.3.1", "cerberus>=1.3.4"],
entry_points={
"console_scripts": [
"ansible-deploy = ansible_deploy.command_line:main",
Expand Down