Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewmeconry committed Aug 14, 2018
1 parent bc00ed5 commit cf252e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions icinga2-aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ def writeTemplate(template, targetFile, targetFolder):
with open(icinga2ConfigDir + 'conf.d/hosts/' + targetFolder + '/' + targetFile + '.conf', 'w') as out:
template = template
template = template.replace('{HOST}', instance.id)
template = template.replace('{PublicIP}', instance.public_ip_address)
template = template.replace('{PrivateIP}', instance.private_ip_address)
# Backwards compatibility
template = template.replace('{IP}', instance.public_ip_address)

if instance.public_ip_address:
template = template.replace('{PublicIP}', instance.public_ip_address)
# Backwards compatibility
template = template.replace('{IP}', instance.public_ip_address)
out.write(template)
out.flush()

Expand Down Expand Up @@ -40,7 +42,7 @@ def cleanupHosts(instances):
shutil.rmtree(x[0])
for directory in os.listdir(config['Default']['php4nagiosPerfDataFolder']):
if(directory.find(instance.id) > -1):
if os.path.exists(config['Default']['php4nagiosPerfDataFolder'] + directory):
if os.path.exists(config['Default']['php4nagiosPerfDataFolder'] + directory) and os.path.exists(config['Default']['php4nagiosPerfDataFolder'] + instance.id):
shutil.rmtree(config['Default']['php4nagiosPerfDataFolder'] + instance.id)


Expand Down

0 comments on commit cf252e5

Please sign in to comment.