consul icon indicating copy to clipboard operation
consul copied to clipboard

Add `consul session <subcommand>` commands to the CLI

Open remilapeyre opened this issue 2 years ago • 4 comments

This patch adds a set of commands to the CLI to make it easier for operators to interact with sessions:

 $ consul session create -lock-delay=15s \
                         -name=my-service-lock \
                         -behavior=release \
                         -ttl=30s
 e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67
 $ consul session list
 ID:          e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67
 Name:        my-service-lock
 Node:        Remis-MacBook-Pro.local
 LockDelay:   15s
 Behavior:    release
 TTL:         30s
 Node Checks: serfHealth

 $ consul session list -format=json
 [
     {
         "CreateIndex": 1613,
         "ID": "e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67",
         "Name": "my-service-lock",
         "Node": "Remis-MacBook-Pro.local",
         "LockDelay": 15000000000,
         "Behavior": "release",
         "TTL": "30s",
         "Checks": null,
         "NodeChecks": [
             "serfHealth"
         ],
         "ServiceChecks": null
     }
 ]
 $ consul session renew e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67
 $ consul session read e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67
 ID:          e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67
 Name:        my-service-lock
 Node:        Remis-MacBook-Pro.local
 LockDelay:   15s
 Behavior:    release
 TTL:         30s
 Node Checks: serfHealth

 $ consul session delete e32f7ac2-b617-6c8d-3a91-00c4b0fa9f67

remilapeyre avatar May 28 '22 13:05 remilapeyre

🤔 This PR has changes in the website/ directory but does not have a type/docs-cherrypick label. If the changes are for the next version, this can be ignored. If they are updates to current docs, attach the label to auto cherrypick to the stable-website branch after merging.

hashicorp-ci avatar May 28 '22 13:05 hashicorp-ci

Thanks for the docs review @trujillo-adam

@remilapeyre

Thanks for raising this PR! We had a general acceptance discussion on this PR a couple days ago and agreed that this would be a great change to improve the UX for dealing with sessions. Taking a quick glance the implementation looks pretty straight-forward, but since we have a couple other PRs in the queue right now this might take us a bit to do a full code review.

Amier3 avatar Jun 02 '22 13:06 Amier3

This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.

github-actions[bot] avatar Aug 07 '22 01:08 github-actions[bot]

Hi bot, this is not staled and should not be closed.

remilapeyre avatar Aug 08 '22 12:08 remilapeyre