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

No log file produced #42

Open
ilium007 opened this issue May 4, 2017 · 1 comment
Open

No log file produced #42

ilium007 opened this issue May 4, 2017 · 1 comment

Comments

@ilium007
Copy link

ilium007 commented May 4, 2017

I started looking through the script to try and work out why emails aren't being sent. The email code by itself works fine, so I looked further and realised no log file is being written. I can't figure out why though.

Path to DEFAULT_STATUS_LOG exists and is writable.

status_log = config['status_log'] is correctly assigned - the file is simply not being written.

This block should be the first place where the log file is written to:

def status_log_begin(server):
rec_begin = '%s,vmbackup.py,%s,begin\n' % (fmtDateTime(), server)
open(config['status_log'],'a',0).write(rec_begin)

But when I run this function in a python shell it all works fine - log file is written

@ilium007
Copy link
Author

ilium007 commented May 4, 2017

Found it.

There is a if statement that stops the log file being written:

if (os.path.exists(cfg_file)):
# config file exists
config_specified = 1

which causes the log to never be written:

if config_specified:
status_log_begin(server_name)

So.. to get a log file you have to be using a seperate config file and therefore to get emails sent you have to be using a config file. It's too late tonight for me to be submit a fix.

I don't understand why the external config file is the trigger as to whether we write a log file or not.

@ilium007 ilium007 changed the title Not getting a log file written No log file produced May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant