Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rhythm-cb
Copy link

@rhythm-cb rhythm-cb commented Sep 28, 2023

Add diff command

This command generates a diff.json file that contains the assets and entities that have been changed (or added) locally. This diff file can then be used to push only assets and entities to the system using the cb-cli push -diff=${path/to/diff.json} command.

createDiff.go Outdated
}

// had to use pullAllEdges instead of pullEdge inside the for loop because pullEdge lacked some information
// like last_connect, last_disconnect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to diff on last_connect or last_disconnect so maybe we need to implement a blacklist of columns that we don't want to be considered in the diff. Would you mind sharing the full list of properties so that we can determine which ones belong in the blacklist?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, below is the list of properties we have access to for the edges:

  • broker_auth_port
  • broker_port
  • broker_tls_port
  • broker_ws_auth_port
  • broker_ws_port
  • broker_wss_port
  • description
  • edge_key
  • isConnected
  • last_connect
  • last_disconnect
  • last_edge_type
  • last_seen_architecture
  • last_seen_os
  • last_seen_version
  • local_addr
  • local_port
  • name
  • public_addr
  • public_port
  • token

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, here's the full list of read-only fields:

    broker_port
    broker_tls_port
    broker_ws_auth_port
    broker_ws_port
    broker_wss_port
    edge_key
    isConnected
    last_connect
    last_disconnect
    last_edge_type
    last_seen_architecture
    last_seen_os
    last_seen_version
    local_addr
    local_port
    name
    public_addr
    public_port
    token

The blacklist approach actually isn't ideal since we have to keep the cli in sync with the platform. Instead, let's only diff on the description field and any custom columns. Ethan recently made some changes to the cli to check for custom columns when determining whether a column should be added/removed. Can you reach out to him for a lead on how you can dynamically determine which columns are custom?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll connect with Ethan about this.

Copy link
Author

@rhythm-cb rhythm-cb Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the necessary changes. I used the schema for extracting the custom columns (see the image below). By iterating over this map, I found the custom columns (UserDefined : true).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants