vitabaks/autobase

edit-config error

Closed this issue · 5 comments

HI!
When trying to edit any postgresql parameter, patroni throws the following error at the stage of saving changes
With sincere respect,
Damir

root@pgvdooh03:/home/dchibilyaev#` patronictl edit-config
Traceback (most recent call last):
  File "/usr/local/bin/patronictl", line 8, in <module>
    sys.exit(ctl())
             ^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 2135, in edit_config
    show_diff(before_editing, after_editing)
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 1930, in show_diff
    markup_to_pager(PatchStream(buf), opts)
  File "/usr/local/lib/python3.11/dist-packages/ydiff.py", line 639, in markup_to_pager
    theme=opts.theme)
          ^^^^^^^^^^
AttributeError: type object 'opts' has no attribute 'theme'
root@pgvdooh03:/home/dchibilyaev# patronictl edit-config
Traceback (most recent call last):
  File "/usr/local/bin/patronictl", line 8, in <module>
    sys.exit(ctl())
             ^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 2135, in edit_config
    show_diff(before_editing, after_editing)
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 1930, in show_diff
    markup_to_pager(PatchStream(buf), opts)
  File "/usr/local/lib/python3.11/dist-packages/ydiff.py", line 639, in markup_to_pager
    theme=opts.theme)
          ^^^^^^^^^^
AttributeError: type object 'opts' has no attribute 'theme'
root@pgvdooh03:/home/dchibilyaev# patronictl edit-config
Not changed

The error seems to occur due to the incompatibility of Patroni and the ydiff dependency, where the theme attribute is missing in the opt object.

which version of autobase are you using?

You can also change the parameters using automation - https://autobase.tech/docs/management/configuration

HI! When trying to edit any postgresql parameter, patroni throws the following error at the stage of saving changes With sincere respect, Damir

root@pgvdooh03:/home/dchibilyaev#` patronictl edit-config
Traceback (most recent call last):
  File "/usr/local/bin/patronictl", line 8, in <module>
    sys.exit(ctl())
             ^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 2135, in edit_config
    show_diff(before_editing, after_editing)
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 1930, in show_diff
    markup_to_pager(PatchStream(buf), opts)
  File "/usr/local/lib/python3.11/dist-packages/ydiff.py", line 639, in markup_to_pager
    theme=opts.theme)
          ^^^^^^^^^^
AttributeError: type object 'opts' has no attribute 'theme'
root@pgvdooh03:/home/dchibilyaev# patronictl edit-config
Traceback (most recent call last):
  File "/usr/local/bin/patronictl", line 8, in <module>
    sys.exit(ctl())
             ^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 2135, in edit_config
    show_diff(before_editing, after_editing)
  File "/usr/local/lib/python3.11/dist-packages/patroni/ctl.py", line 1930, in show_diff
    markup_to_pager(PatchStream(buf), opts)
  File "/usr/local/lib/python3.11/dist-packages/ydiff.py", line 639, in markup_to_pager
    theme=opts.theme)
          ^^^^^^^^^^
AttributeError: type object 'opts' has no attribute 'theme'
root@pgvdooh03:/home/dchibilyaev# patronictl edit-config
Not changed

downgrade version ydiff:
pip3 install --force-reinstall -v "ydiff==1.3"

Try ydiff==1.4.2 and patroni==4.0.4

Related: patroni/patroni#3216

Thanks for the help!
There was an incompatibility with version 3.3.2 and we updated it to 4.0.4

Made remove_cluster:
ansible-playbook remove_cluster.yml -e "remove_postgres=true remove_etcd=true" -i inventory"

We went to VS code from where we opened cluster and in /vars/main.yml
We changed the parameter and specified the version
patroni_install_version: 4.0.4

And re-deployed the cluster
ansible-playbook deploy_pgcluster.yml -i inventory
Everything worked, thanks!