Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include "special" _octodns values in Record.__repr__ #292

Open
wants to merge 1 commit into
base: master
from

Conversation

@ross
Copy link
Contributor

ross commented Nov 3, 2018

This includes the octodns bits in Record.__repr__. The upside of this is that you can see the special bits that may be pushed to your providers, downside is that it could be noisy and not all special things apply to all providers and things pulled out of providers will only include the things that provider knows about.

Example of the "good" case, CF proxied

'*.sub':
  octodns:
    cloudflare:
      proxied: True
  ttl: 144
  type: A
  values: 
  - 2.2.3.3
  - 3.3.4.4
  - 4.4.5.5
********************************************************************************
* githubtest.net.
********************************************************************************
* cloudflare (CloudflareProvider)
*   Update
*     <ARecord A 144, *.sub.githubtest.net., ['2.2.3.3', '3.3.4.4', '4.4.5.5'], cloudflare=cloudflare.proxied=False> ->
*     <ARecord A 144, *.sub.githubtest.net., ['2.2.3.3', '3.3.4.4', '4.4.5.5'], cloudflare=cloudflare.proxied=True> (config)
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=20
********************************************************************************

Example of the "bad" case, where things aren't super clear

'*.sub':
  octodns:
    cloudflare:
      other: False
      proxied: True
    something: True
  ttl: 144
  type: A
  values: 
  - 2.2.3.3
  - 3.3.4.4
  - 4.4.5.5
********************************************************************************
* githubtest.net.
********************************************************************************
* cloudflare (CloudflareProvider)
*   Update
*     <ARecord A 144, *.sub.githubtest.net., ['2.2.3.3', '3.3.4.4', '4.4.5.5'], cloudflare=cloudflare.proxied=False> ->
*     <ARecord A 144, *.sub.githubtest.net., ['2.2.3.3', '3.3.4.4', '4.4.5.5'], cloudflare=cloudflare.other=False, cloudflare.proxied=True, something=True> (config)
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=20
********************************************************************************

/cc #284
/cc @parkr @begincalendar

@ross
Copy link
Contributor Author

ross commented Nov 3, 2018

Btw, I'm not really sure about this PR. I'd like to show the special bits, but worried that it'll end up confusing things as much as helping...

@@ -10,6 +10,16 @@
import re


def _stringify(d, prefix=''):
buf = []
for k, v in sorted(d.items()):

This comment has been minimized.

@begincalendar

begincalendar Nov 3, 2018

I think this produces a clearer result:

        if isinstance(v, dict):
            buf.append(_stringify(v, '{}{}.'.format(prefix, k)))
        else:
            buf.append('{}{}={}'.format(prefix, k, v))

What do you think?

@begincalendar
Copy link

begincalendar commented Nov 3, 2018

I think it gets the job done.
Which part don't you like?

@ross ross self-assigned this Nov 9, 2018
@parkr
Copy link
Member

parkr commented Nov 21, 2018

I dig this! Here's an example:

********************************************************************************
* parkermakes.tools.
********************************************************************************
* cloudflare (CloudflareProvider)
*   Update
*     <AliasRecord ALIAS 1, parkermakes.tools., kondwani.parkermakes.tools.> ->
*     <AliasRecord ALIAS 1, parkermakes.tools., kondwani.parkermakes.tools.> (config)
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=15
********************************************************************************
* keltermoore.com.
********************************************************************************
* cloudflare (CloudflareProvider)
*   Update
*     <ARecord A 1, keltermoore.com., ['185.199.108.153'], cloudflare=cloudflare.proxied=True> ->
*     <ARecord A 1, keltermoore.com., ['185.199.108.153'], cloudflare=cloudflare.proxied=False> (config)
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=2
********************************************************************************
@parkr
Copy link
Member

parkr commented Nov 21, 2018

Hm; the AliasRecord there wasn't changed by me, so looks like a diff is found there when nothing was changed?

The keltermoore.com change was purposeful.

@parkr
Copy link
Member

parkr commented Nov 21, 2018

The AliasRecord diff doesn't get printed on master. Only:

********************************************************************************
* keltermoore.com.
********************************************************************************
* cloudflare (CloudflareProvider)
*   Update
*     <ARecord A 1, keltermoore.com., ['185.199.108.153']> ->
*     <ARecord A 1, keltermoore.com., ['185.199.108.153']> (config)
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=2
********************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.