funilrys / PyFunceble

The tool to check the availability or syntax of domain, IP or URL.
https://pyfunceble.github.io
Apache License 2.0
296 stars 44 forks source link

BUG: PyF in virtualvenv fails loading conf files #377

Open spirillen opened 3 weeks ago

spirillen commented 3 weeks ago

Description

If you follows https://pyfunceble.readthedocs.io/en/dev/installation/index.html#for-development

then Pyfunceble completely fails to use the files from ~/.config/PyFunceble/

Configuration

seems like none

Reproduction

  1. follow https://pyfunceble.readthedocs.io/en/dev/installation/index.html#for-development
  2. pyfunceble -f anyTestFile

Expected behavior

Using the usual path to search for config files, in this case ~/.config/PyFunceble/

Screenshots

image

image

image

image

Versions

OS: Ubuntu 24

Python Version: 3.12

PyFunceble Version: pyfunceble 4.2.26.dev (Blue Duckling: Ixora)

Additional context

Add CLI option to force a conf dir?

funilrys commented 2 weeks ago

See: https://pyfunceble.readthedocs.io/en/dev/configuration/index.html#repository-clone

funilrys commented 2 weeks ago

You can force/bypass the behavior by setting the PYFUNCEBLE_CONFIG_DIR environment variable.

spirillen commented 2 weeks ago

You can force/bypass the behavior by setting the PYFUNCEBLE_CONFIG_DIR environment variable.

Yes, If I modifies any files within the venv. but the suggestion goes to the global CLI command (Using cli is none persistent execution) So this could have been a test of what ever test setup.

I just happen to come through the situation here, however, I actually do have a other use case where this would be of a huge help (https://github.com/if-you-want-peace-prepare-for-war/proxmox/blob/master/ct/pyfunceble.sh) as it is running as root on a qemu hosts. have a CLI option to load from ie a network location or even maybe a url 👍🏻

spirillen commented 5 days ago

Failure seems to be the only option...

pyfunceble --config-file /home/$USER/.config/PyFunceble/ -d mypdns.org
usage: pyfunceble [--show-completion {bash,zsh,tcsh}] [-d DOMAINS [DOMAINS ...]] [-u URLS [URLS ...]] [-f FILES [FILES ...]] [-uf URL_FILES [URL_FILES ...]] [--adblock] [--cidr] [--complements] [--preload]
                  [--filter CLI_TESTING__FILE_FILTER] [--mining] [--rpz] [--wildcard] [--chancy] [-c] [--cooldown-time CLI_TESTING__COOLDOWN_TIME] [--local] [--platform-preferred-origin {frequent,latest,recommended}]
                  [--platform-lookup] [--platform-lookup-only] [--dns-lookup] [--dns-lookup-only] [--http] [--http-only] [--netinfo-lookup] [--netinfo-lookup-only] [--special-lookup] [--special-lookup-only] [--whois-lookup]
                  [--whois-lookup-only] [--reputation-lookup] [--reputation-lookup-only] [--reputation] [--syntax] [-t LOOKUP__TIMEOUT] [--max-http-retries MAX_HTTP_RETRIES] [-ua USER_AGENT__CUSTOM] [-vsc]
                  [--dns DNS__SERVER [DNS__SERVER ...]] [--dns-protocol {UDP,TCP,HTTPS,TLS}] [--follow-server-order] [--trust-dns-server] [--dns-delay DNS__DELAY] [--http-proxy PROXY__GLOBAL__HTTP] [--https-proxy PROXY__GLOBAL__HTTPS]
                  [--inactive-db] [--database-type {csv,mariadb,mysql,postgresql}] [-dbr CLI_TESTING__DAYS_BETWEEN__DB_RETEST] [-wdb] [-a] [-ex] [--colour]
                  [--display-status {all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} [{all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} ...]] [--dots] [--hierarchical] [-h] [-ip CLI_TESTING__HOSTS_IP] [--merge-output] [--no-files]
                  [--output-location OUTPUT_LOCATION] [--unified-results] [--percentage] [--registrar] [--max-registrar CLI_TESTING__DISPLAY_MODE__MAX_REGISTRAR] [--plain] [-q] [--push-platform] [-s] [-w CLI_TESTING__MAX_WORKERS]
                  [--ci-max-minutes CLI_TESTING__CI__MAX_EXEC_MINUTES] [--ci] [--ci-branch CLI_TESTING__CI__BRANCH] [--ci-distribution-branch CLI_TESTING__CI__DISTRIBUTION_BRANCH] [--ci-command CLI_TESTING__CI__COMMAND]
                  [--ci-end-command CLI_TESTING__CI__END_COMMAND] [--ci-commit-message CLI_TESTING__CI__COMMIT_MESSAGE] [--ci-end-commit-message CLI_TESTING__CI__END_COMMIT_MESSAGE] [--help] [-v]
pyfunceble: error: argument command: invalid choice: '/home/$USER/.config/PyFunceble/' (choose from 'platform')
(venv) $:~/Projects/github/funilrys/PyFunceble$ pyfunceble --config-file /home/$USER/.config/PyFunceble/ -d mypdns.org
dir_structure.json                .idea/                            ipv4_reputation.data              .pyfunceble-env                   .PyFunceble.overwrite.yaml        user_agents.json
iana-domains-db.json              inactive.csv                      public-suffix.json                .pyfunceble_intern_downtime.json  .PyFunceble.yaml                  whois.csv
(venv) $:~/Projects/github/funilrys/PyFunceble$ pyfunceble --config-file /home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml -d mypdns.org
usage: pyfunceble [--show-completion {bash,zsh,tcsh}] [-d DOMAINS [DOMAINS ...]] [-u URLS [URLS ...]] [-f FILES [FILES ...]] [-uf URL_FILES [URL_FILES ...]] [--adblock] [--cidr] [--complements] [--preload]
                  [--filter CLI_TESTING__FILE_FILTER] [--mining] [--rpz] [--wildcard] [--chancy] [-c] [--cooldown-time CLI_TESTING__COOLDOWN_TIME] [--local] [--platform-preferred-origin {frequent,latest,recommended}]
                  [--platform-lookup] [--platform-lookup-only] [--dns-lookup] [--dns-lookup-only] [--http] [--http-only] [--netinfo-lookup] [--netinfo-lookup-only] [--special-lookup] [--special-lookup-only] [--whois-lookup]
                  [--whois-lookup-only] [--reputation-lookup] [--reputation-lookup-only] [--reputation] [--syntax] [-t LOOKUP__TIMEOUT] [--max-http-retries MAX_HTTP_RETRIES] [-ua USER_AGENT__CUSTOM] [-vsc]
                  [--dns DNS__SERVER [DNS__SERVER ...]] [--dns-protocol {UDP,TCP,HTTPS,TLS}] [--follow-server-order] [--trust-dns-server] [--dns-delay DNS__DELAY] [--http-proxy PROXY__GLOBAL__HTTP] [--https-proxy PROXY__GLOBAL__HTTPS]
                  [--inactive-db] [--database-type {csv,mariadb,mysql,postgresql}] [-dbr CLI_TESTING__DAYS_BETWEEN__DB_RETEST] [-wdb] [-a] [-ex] [--colour]
                  [--display-status {all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} [{all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} ...]] [--dots] [--hierarchical] [-h] [-ip CLI_TESTING__HOSTS_IP] [--merge-output] [--no-files]
                  [--output-location OUTPUT_LOCATION] [--unified-results] [--percentage] [--registrar] [--max-registrar CLI_TESTING__DISPLAY_MODE__MAX_REGISTRAR] [--plain] [-q] [--push-platform] [-s] [-w CLI_TESTING__MAX_WORKERS]
                  [--ci-max-minutes CLI_TESTING__CI__MAX_EXEC_MINUTES] [--ci] [--ci-branch CLI_TESTING__CI__BRANCH] [--ci-distribution-branch CLI_TESTING__CI__DISTRIBUTION_BRANCH] [--ci-command CLI_TESTING__CI__COMMAND]
                  [--ci-end-command CLI_TESTING__CI__END_COMMAND] [--ci-commit-message CLI_TESTING__CI__COMMIT_MESSAGE] [--ci-end-commit-message CLI_TESTING__CI__END_COMMIT_MESSAGE] [--help] [-v]
pyfunceble: error: argument command: invalid choice: '/home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml' (choose from 'platform')
(venv) $:~/Projects/github/funilrys/PyFunceble$ pyfunceble --config-file /home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml platform
usage: pyfunceble [--show-completion {bash,zsh,tcsh}] [-d DOMAINS [DOMAINS ...]] [-u URLS [URLS ...]] [-f FILES [FILES ...]] [-uf URL_FILES [URL_FILES ...]] [--adblock] [--cidr] [--complements] [--preload]
                  [--filter CLI_TESTING__FILE_FILTER] [--mining] [--rpz] [--wildcard] [--chancy] [-c] [--cooldown-time CLI_TESTING__COOLDOWN_TIME] [--local] [--platform-preferred-origin {frequent,latest,recommended}]
                  [--platform-lookup] [--platform-lookup-only] [--dns-lookup] [--dns-lookup-only] [--http] [--http-only] [--netinfo-lookup] [--netinfo-lookup-only] [--special-lookup] [--special-lookup-only] [--whois-lookup]
                  [--whois-lookup-only] [--reputation-lookup] [--reputation-lookup-only] [--reputation] [--syntax] [-t LOOKUP__TIMEOUT] [--max-http-retries MAX_HTTP_RETRIES] [-ua USER_AGENT__CUSTOM] [-vsc]
                  [--dns DNS__SERVER [DNS__SERVER ...]] [--dns-protocol {UDP,TCP,HTTPS,TLS}] [--follow-server-order] [--trust-dns-server] [--dns-delay DNS__DELAY] [--http-proxy PROXY__GLOBAL__HTTP] [--https-proxy PROXY__GLOBAL__HTTPS]
                  [--inactive-db] [--database-type {csv,mariadb,mysql,postgresql}] [-dbr CLI_TESTING__DAYS_BETWEEN__DB_RETEST] [-wdb] [-a] [-ex] [--colour]
                  [--display-status {all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} [{all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} ...]] [--dots] [--hierarchical] [-h] [-ip CLI_TESTING__HOSTS_IP] [--merge-output] [--no-files]
                  [--output-location OUTPUT_LOCATION] [--unified-results] [--percentage] [--registrar] [--max-registrar CLI_TESTING__DISPLAY_MODE__MAX_REGISTRAR] [--plain] [-q] [--push-platform] [-s] [-w CLI_TESTING__MAX_WORKERS]
                  [--ci-max-minutes CLI_TESTING__CI__MAX_EXEC_MINUTES] [--ci] [--ci-branch CLI_TESTING__CI__BRANCH] [--ci-distribution-branch CLI_TESTING__CI__DISTRIBUTION_BRANCH] [--ci-command CLI_TESTING__CI__COMMAND]
                  [--ci-end-command CLI_TESTING__CI__END_COMMAND] [--ci-commit-message CLI_TESTING__CI__COMMIT_MESSAGE] [--ci-end-commit-message CLI_TESTING__CI__END_COMMIT_MESSAGE] [--help] [-v]
pyfunceble: error: argument command: invalid choice: '/home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml' (choose from 'platform')
(venv) $:~/Projects/github/funilrys/PyFunceble$ pyfunceble platform --config-file /home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml
usage: pyfunceble [--show-completion {bash,zsh,tcsh}] [-d DOMAINS [DOMAINS ...]] [-u URLS [URLS ...]] [-f FILES [FILES ...]] [-uf URL_FILES [URL_FILES ...]] [--adblock] [--cidr] [--complements] [--preload]
                  [--filter CLI_TESTING__FILE_FILTER] [--mining] [--rpz] [--wildcard] [--chancy] [-c] [--cooldown-time CLI_TESTING__COOLDOWN_TIME] [--local] [--platform-preferred-origin {frequent,latest,recommended}]
                  [--platform-lookup] [--platform-lookup-only] [--dns-lookup] [--dns-lookup-only] [--http] [--http-only] [--netinfo-lookup] [--netinfo-lookup-only] [--special-lookup] [--special-lookup-only] [--whois-lookup]
                  [--whois-lookup-only] [--reputation-lookup] [--reputation-lookup-only] [--reputation] [--syntax] [-t LOOKUP__TIMEOUT] [--max-http-retries MAX_HTTP_RETRIES] [-ua USER_AGENT__CUSTOM] [-vsc]
                  [--dns DNS__SERVER [DNS__SERVER ...]] [--dns-protocol {UDP,TCP,HTTPS,TLS}] [--follow-server-order] [--trust-dns-server] [--dns-delay DNS__DELAY] [--http-proxy PROXY__GLOBAL__HTTP] [--https-proxy PROXY__GLOBAL__HTTPS]
                  [--inactive-db] [--database-type {csv,mariadb,mysql,postgresql}] [-dbr CLI_TESTING__DAYS_BETWEEN__DB_RETEST] [-wdb] [-a] [-ex] [--colour]
                  [--display-status {all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} [{all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} ...]] [--dots] [--hierarchical] [-h] [-ip CLI_TESTING__HOSTS_IP] [--merge-output] [--no-files]
                  [--output-location OUTPUT_LOCATION] [--unified-results] [--percentage] [--registrar] [--max-registrar CLI_TESTING__DISPLAY_MODE__MAX_REGISTRAR] [--plain] [-q] [--push-platform] [-s] [-w CLI_TESTING__MAX_WORKERS]
                  [--ci-max-minutes CLI_TESTING__CI__MAX_EXEC_MINUTES] [--ci] [--ci-branch CLI_TESTING__CI__BRANCH] [--ci-distribution-branch CLI_TESTING__CI__DISTRIBUTION_BRANCH] [--ci-command CLI_TESTING__CI__COMMAND]
                  [--ci-end-command CLI_TESTING__CI__END_COMMAND] [--ci-commit-message CLI_TESTING__CI__COMMIT_MESSAGE] [--ci-end-commit-message CLI_TESTING__CI__END_COMMIT_MESSAGE] [--help] [-v]
pyfunceble: error: unrecognized arguments: --config-file /home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml
(venv) $:~/Projects/github/funilrys/PyFunceble$ pyfunceble -d mypdns.org --config-file /home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml
usage: pyfunceble [--show-completion {bash,zsh,tcsh}] [-d DOMAINS [DOMAINS ...]] [-u URLS [URLS ...]] [-f FILES [FILES ...]] [-uf URL_FILES [URL_FILES ...]] [--adblock] [--cidr] [--complements] [--preload]
                  [--filter CLI_TESTING__FILE_FILTER] [--mining] [--rpz] [--wildcard] [--chancy] [-c] [--cooldown-time CLI_TESTING__COOLDOWN_TIME] [--local] [--platform-preferred-origin {frequent,latest,recommended}]
                  [--platform-lookup] [--platform-lookup-only] [--dns-lookup] [--dns-lookup-only] [--http] [--http-only] [--netinfo-lookup] [--netinfo-lookup-only] [--special-lookup] [--special-lookup-only] [--whois-lookup]
                  [--whois-lookup-only] [--reputation-lookup] [--reputation-lookup-only] [--reputation] [--syntax] [-t LOOKUP__TIMEOUT] [--max-http-retries MAX_HTTP_RETRIES] [-ua USER_AGENT__CUSTOM] [-vsc]
                  [--dns DNS__SERVER [DNS__SERVER ...]] [--dns-protocol {UDP,TCP,HTTPS,TLS}] [--follow-server-order] [--trust-dns-server] [--dns-delay DNS__DELAY] [--http-proxy PROXY__GLOBAL__HTTP] [--https-proxy PROXY__GLOBAL__HTTPS]
                  [--inactive-db] [--database-type {csv,mariadb,mysql,postgresql}] [-dbr CLI_TESTING__DAYS_BETWEEN__DB_RETEST] [-wdb] [-a] [-ex] [--colour]
                  [--display-status {all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} [{all,ACTIVE,INACTIVE,VALID,INVALID,MALICIOUS,SANE} ...]] [--dots] [--hierarchical] [-h] [-ip CLI_TESTING__HOSTS_IP] [--merge-output] [--no-files]
                  [--output-location OUTPUT_LOCATION] [--unified-results] [--percentage] [--registrar] [--max-registrar CLI_TESTING__DISPLAY_MODE__MAX_REGISTRAR] [--plain] [-q] [--push-platform] [-s] [-w CLI_TESTING__MAX_WORKERS]
                  [--ci-max-minutes CLI_TESTING__CI__MAX_EXEC_MINUTES] [--ci] [--ci-branch CLI_TESTING__CI__BRANCH] [--ci-distribution-branch CLI_TESTING__CI__DISTRIBUTION_BRANCH] [--ci-command CLI_TESTING__CI__COMMAND]
                  [--ci-end-command CLI_TESTING__CI__END_COMMAND] [--ci-commit-message CLI_TESTING__CI__COMMIT_MESSAGE] [--ci-end-commit-message CLI_TESTING__CI__END_COMMIT_MESSAGE] [--help] [-v]
pyfunceble: error: argument command: invalid choice: '/home/$USER/.config/PyFunceble/.PyFunceble.overwrite.yaml' (choose from 'platform')