Version 2.3.1, Bug fix paramater handling
This commit is contained in:
parent
9ab5b93fb8
commit
881c767571
@ -6,6 +6,7 @@ Version History:
|
|||||||
--
|
--
|
||||||
|Date|Version|Changes|
|
|Date|Version|Changes|
|
||||||
|----|-------|-------|
|
|----|-------|-------|
|
||||||
|
|2023/03/27|2.3.1|Fixed bugs in parameter handling|
|
||||||
|2023/03/23|2.2.1|Adjusted parameter handling|
|
|2023/03/23|2.2.1|Adjusted parameter handling|
|
||||||
|||Added check for "free space on disk" (incl. adjustable levels)|
|
|||Added check for "free space on disk" (incl. adjustable levels)|
|
||||||
|||Added adjustable levels for "number of files"|
|
|||Added adjustable levels for "number of files"|
|
||||||
|
@ -25,12 +25,14 @@ OPTIONS:
|
|||||||
-P, --port Port
|
-P, --port Port
|
||||||
-f, --folder Subfolder if not installed in web root
|
-f, --folder Subfolder if not installed in web root
|
||||||
-t, --token Token (recommended)
|
-t, --token Token (recommended)
|
||||||
--no-https Disable HTTPS, use HTTP (not recommended!)
|
--no-https True|False If "True": Disable HTTPS, use HTTP (not recommended!)
|
||||||
--no-cert-check Disable TLS certificate check (not recommended!)
|
--no-cert-check True|False If "True": Disable TLS certificate check (not recommended!)
|
||||||
-h, --help Show this help message and exit
|
-h, --help Show this help message and exit
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# set this to true to produce debug output (this clutters the agent output)
|
# set this to true to produce debug output (this clutters the agent output)
|
||||||
|
# be aware: activating this logs very sensitive information to debug files in ~/tmp
|
||||||
|
# !!DO NOT FORGET to delete these files after debugging is done!!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
nc_api_endpoint = "ocs/v2.php/apps/serverinfo/api/v1/info?format=json"
|
nc_api_endpoint = "ocs/v2.php/apps/serverinfo/api/v1/info?format=json"
|
||||||
@ -48,7 +50,7 @@ opt_no_cert_check = False
|
|||||||
|
|
||||||
short_options = 'hH:u:p:P:f:t:'
|
short_options = 'hH:u:p:P:f:t:'
|
||||||
long_options = [
|
long_options = [
|
||||||
'hostname=', 'username=', 'password=', 'port=', 'token=', 'folder=', 'no-https', 'no-cert-check', 'help'
|
'hostname=', 'username=', 'password=', 'port=', 'token=', 'folder=', 'no-https=', 'no-cert-check=', 'help'
|
||||||
]
|
]
|
||||||
|
|
||||||
def getOptions():
|
def getOptions():
|
||||||
@ -65,7 +67,7 @@ def getOptions():
|
|||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
if opt in ['-H', '--hostname']:
|
if opt in ['-H', '--hostname']:
|
||||||
opt_hostname = arg
|
opt_hostname = arg
|
||||||
if opt in ['-u', '--username']:
|
elif opt in ['-u', '--username']:
|
||||||
opt_username = arg
|
opt_username = arg
|
||||||
elif opt in ['-p', '--password']:
|
elif opt in ['-p', '--password']:
|
||||||
opt_password = arg
|
opt_password = arg
|
||||||
@ -76,28 +78,39 @@ def getOptions():
|
|||||||
elif opt in ['-t', '--token']:
|
elif opt in ['-t', '--token']:
|
||||||
opt_token = arg
|
opt_token = arg
|
||||||
elif opt in ['--no-https']:
|
elif opt in ['--no-https']:
|
||||||
|
if arg == 'True':
|
||||||
opt_no_https = True
|
opt_no_https = True
|
||||||
|
else:
|
||||||
|
opt_no_https = False
|
||||||
elif opt in ['--no-cert-check']:
|
elif opt in ['--no-cert-check']:
|
||||||
|
if arg == 'True':
|
||||||
opt_no_cert_check = True
|
opt_no_cert_check = True
|
||||||
|
else:
|
||||||
|
opt_no_cert_check = False
|
||||||
elif opt in ['-h', '--help']:
|
elif opt in ['-h', '--help']:
|
||||||
showUsage()
|
showUsage()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def showOptions():
|
|
||||||
print(f"Hostname: {opt_hostname}")
|
|
||||||
print(f"Username: {opt_username}")
|
|
||||||
#print(f"Password: {opt_password}")
|
|
||||||
print(f"Port: {opt_port}")
|
|
||||||
print(f"Folder: {opt_folder}")
|
|
||||||
#print(f"Token: {opt_token}")
|
|
||||||
print(f"No HTTPS: {opt_no_https}")
|
|
||||||
print(f"No TLS Check: {opt_no_cert_check}")
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
home_path = os.getenv("HOME")
|
home_path = os.getenv("HOME")
|
||||||
tmp_path = f"{home_path}/tmp"
|
tmp_path = f"{home_path}/tmp"
|
||||||
help_file = f"{tmp_path}/nextcloud_{opt_hostname}_debug.txt"
|
help_file = f"{tmp_path}/nextcloud_{opt_hostname}_debug.txt"
|
||||||
with open(help_file, "a") as file:
|
with open(help_file, "a") as file:
|
||||||
file.write(f"Hostname: {opt_hostname}, Port: {opt_port}, No HTTPS: {opt_no_https} \n")
|
file.write(f"Number of Arguments: {len(sys.argv)}, Argument List: {str(sys.argv)}\n")
|
||||||
|
|
||||||
|
def showOptions():
|
||||||
|
print(f"Hostname: {opt_hostname}")
|
||||||
|
print(f"Username: {opt_username}")
|
||||||
|
print(f"Password: {opt_password}")
|
||||||
|
print(f"Port: {opt_port}")
|
||||||
|
print(f"Folder: {opt_folder}")
|
||||||
|
print(f"Token: {opt_token}")
|
||||||
|
print(f"No HTTPS: {opt_no_https}")
|
||||||
|
print(f"No TLS Check: {opt_no_cert_check}")
|
||||||
|
home_path = os.getenv("HOME")
|
||||||
|
tmp_path = f"{home_path}/tmp"
|
||||||
|
help_file = f"{tmp_path}/nextcloud_{opt_hostname}_debug.txt"
|
||||||
|
with open(help_file, "a") as file:
|
||||||
|
file.write(f"Hostname: {opt_hostname}, Port: {opt_port}, No HTTPS: {opt_no_https}, No Cert Check: {opt_no_cert_check}\n")
|
||||||
|
|
||||||
def createUrl(endpoint, hostname, protocol, port, folder):
|
def createUrl(endpoint, hostname, protocol, port, folder):
|
||||||
if folder == "":
|
if folder == "":
|
||||||
@ -242,8 +255,6 @@ def doCmkOutputAllUsers(data, verify, hostname, protocol, port, folder):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
getOptions()
|
getOptions()
|
||||||
if DEBUG:
|
|
||||||
showOptions()
|
|
||||||
if (opt_hostname == ""):
|
if (opt_hostname == ""):
|
||||||
sys.stderr.write(f"No hostname given.\n")
|
sys.stderr.write(f"No hostname given.\n")
|
||||||
showUsage()
|
showUsage()
|
||||||
@ -266,6 +277,8 @@ def main():
|
|||||||
else:
|
else:
|
||||||
protocol = "https"
|
protocol = "https"
|
||||||
port = opt_port
|
port = opt_port
|
||||||
|
if DEBUG:
|
||||||
|
showOptions()
|
||||||
if (protocol == "http" and port == "443"):
|
if (protocol == "http" and port == "443"):
|
||||||
sys.stderr.write(f"Combining HTTP with port 443 is not supported.\n")
|
sys.stderr.write(f"Combining HTTP with port 443 is not supported.\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
BIN
mkp/Nextcloud-2.3.1.mkp
Executable file
BIN
mkp/Nextcloud-2.3.1.mkp
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user