pawelsikora / mkdocs-with-confluence

MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API
MIT License
67 stars 33 forks source link

AttributeError: 'MkdocsWithConfluence' object has no attribute 'dryrun' #20

Open theD1360 opened 1 year ago

theD1360 commented 1 year ago

First off, thank you for writing this plugin. This is going to help me greatly.

Unfortunately when trying to get this plugin running I am encountering the following error:

ERROR    -  Error reading page 'index.md': 'MkdocsWithConfluence' object has no attribute 'dryrun'
Traceback (most recent call last):
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/mkdocs/__main__.py", line 250, in build_command
    build.build(cfg, dirty=not clean)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/mkdocs/commands/build.py", line 308, in build
    _populate_page(file.page, config, files, dirty)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/mkdocs/commands/build.py", line 177, in _populate_page
    page.markdown = config.plugins.run_event(
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/mkdocs/plugins.py", line 520, in run_event
    result = method(item, **kwargs)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/mkdocs_with_confluence/plugin.py", line 274, in on_page_markdown
    self.update_page(page.title, confluence_body)
  File "/Users/theD1360/Library/Caches/pypoetry/virtualenvs/docs-project-A5zrhKJ8-py3.9/lib/python3.9/site-packages/mkdocs_with_confluence/plugin.py", line 571, in update_page
    if not self.dryrun:
AttributeError: 'MkdocsWithConfluence' object has no attribute 'dryrun'

Environment:

Software Version
python 3.9
poetry 1.4.0
mkdocs ^1.4.2
mkdocs-material ^9.1.5
mkdocs-with-confluence ^0.2.7

mkdocs.yaml

plugins:
  - mkdocs-with-confluence:
      host_url: https://<confluence domain>/wiki/rest/api/content
      space: ""
      parent_page_name: Qualification Engine (Qual-E)
      username: myuser@myorg.com
      password: mypassword
      dryrun: true
      verbose: true
      debug: true

One interesting thing to note is that the error seems to be limited to just that config key. All other config items seem to be loaded properly. It seems the self.dryrun property is not getting set properly in plugin.py.

plugin.py Line 141

 if self.config["dryrun"]:
            print("WARNING -  Mkdocs With Confluence - DRYRUN MODE turned ON")
            self.dryrun = True
        else:
            self.dryrun = False
pawelsikora commented 1 year ago

@theD1360 First of all: I am happy that my plugin is helpful for you!

Yep, thanks for pointing this out! It will be fixed soon🙂

jrwpatterson commented 11 months ago

Any update on this?

voodooGQ commented 10 months ago

Any update on this? Running into the same problem.