Skip to content

Commit

Permalink
Update check-wordpress
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenspille authored Oct 17, 2022
1 parent fb6106d commit 219a516
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions check-wordpress
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ wp_config = {
}
}

# cmd = f"sudo -u {conf['wp_user']} -i -- /usr/bin/wp --format=json --path={conf['wp_path'}} core check-update"

def check_wordpress(name: str, conf: dict):
printout(name, "Core", core_check_update(conf))
printout(name, "Plugins", addon_status(conf, 'plugin'))
Expand Down Expand Up @@ -73,7 +71,7 @@ def addon_status(conf: dict, type: str):
return f"status={state};1;2;; up-to-date"

def wp(command: str, wp_user: str, wp_path: str, outformat: str = '', return_stderr: bool = False):
cmd = f"sudo -u {wp_user} -i -- wp --path={wp_path} {command}"
cmd = f"sudo -u {wp_user} wp --path={wp_path} {command}"
if outformat != "":
cmd += f" --format={outformat}"

Expand All @@ -90,7 +88,7 @@ def wp(command: str, wp_user: str, wp_path: str, outformat: str = '', return_std

def wp_check(name: str, conf: dict):
try:
subprocess.run([f"sudo -u {conf['wp_user']} -i -- wp --path={conf['wp_path']} core version > /dev/null"], shell=True, check=True)
subprocess.run([f"sudo -u {conf['wp_user']} wp --path={conf['wp_path']} core version > /dev/null"], shell=True, check=True)
except:
print (f'2 "{name}" - Dependency failed: Please check if wp_path is configured correctly in /etc/checkmk/wordpress.conf')
os._exit(1)
Expand Down

0 comments on commit 219a516

Please sign in to comment.