| 108 | |
| 109 | |
| 110 | def check(): |
| 111 | args = sys.argv[1:] |
| 112 | print() |
| 113 | if "-U" in args: |
| 114 | print("-U is deprecated, please use --mode upstream:SPEC instead") |
| 115 | |
| 116 | if "-T" in args: |
| 117 | print("-T is deprecated, please use --mode transparent instead") |
| 118 | |
| 119 | for option in ("-e", "--eventlog", "--norefresh"): |
| 120 | if option in args: |
| 121 | print(f"{option} has been removed.") |
| 122 | |
| 123 | for option in ("--nonanonymous", "--singleuser", "--htpasswd"): |
| 124 | if option in args: |
| 125 | print( |
| 126 | "{} is deprecated.\n" |
| 127 | "Please use `--proxyauth SPEC` instead.\n" |
| 128 | 'SPEC Format: "username:pass", "any" to accept any user/pass combination,\n' |
| 129 | '"@path" to use an Apache htpasswd file, or\n' |
| 130 | '"ldap[s]:url_server_ldap[:port]:dn_auth:password:dn_subtree[?search_filter_key=...]" ' |
| 131 | "for LDAP authentication.".format(option) |
| 132 | ) |
| 133 | |
| 134 | for option in REPLACED.splitlines(): |
| 135 | if option in args: |
| 136 | r = REPLACEMENTS.get(option) |
| 137 | if isinstance(r, list): |
| 138 | new_options = r |
| 139 | else: |
| 140 | new_options = [r] |
| 141 | print( |
| 142 | "{} is deprecated.\nPlease use `{}` instead.".format( |
| 143 | option, "` or `".join(new_options) |
| 144 | ) |
| 145 | ) |
| 146 | |
| 147 | for option in DEPRECATED.splitlines(): |
| 148 | if option in args: |
| 149 | print( |
| 150 | "{} is deprecated.\n" |
| 151 | "Please use `--set {}=value` instead.\n" |
| 152 | "To show all options and their default values use --options".format( |
| 153 | option, |
| 154 | REPLACEMENTS.get(option, None) |
| 155 | or option.lstrip("-").replace("-", "_"), |
| 156 | ) |
| 157 | ) |
| 158 | |
| 159 | # Check for underscores in the options. Options always follow '--'. |
| 160 | for argument in args: |
| 161 | underscoreParam = re.search(r"[-]{2}((.*?_)(.*?(\s|$)))+", argument) |
| 162 | if underscoreParam is not None: |
| 163 | print( |
| 164 | "{} uses underscores, please use hyphens {}".format( |
| 165 | argument, argument.replace("_", "-") |
| 166 | ) |
| 167 | ) |