Skip to content

Commit

Permalink
Rename --channel-id to --channelID in osadmin
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Castrence <[email protected]>
(cherry picked from commit 2a9251c)
  • Loading branch information
jrc-ibm authored and denyeart committed Jan 27, 2021
1 parent 410ba71 commit c29420c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 45 deletions.
3 changes: 3 additions & 0 deletions cmd/osnadmin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

osnadmin
8 changes: 4 additions & 4 deletions cmd/osnadmin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ func executeForArgs(args []string) (output string, exit int, err error) {
channel := app.Command("channel", "Channel actions")

join := channel.Command("join", "Join an Ordering Service Node (OSN) to a channel. If the channel does not yet exist, it will be created.")
joinChannelID := join.Flag("channel-id", "Channel ID").Short('c').Required().String()
joinChannelID := join.Flag("channelID", "Channel ID").Short('c').Required().String()
configBlockPath := join.Flag("config-block", "Path to the file containing an up-to-date config block for the channel").Short('b').Required().String()

list := channel.Command("list", "List channel information for an Ordering Service Node (OSN). If the channel-id flag is set, more detailed information will be provided for that channel.")
listChannelID := list.Flag("channel-id", "Channel ID").Short('c').String()
listChannelID := list.Flag("channelID", "Channel ID").Short('c').String()

remove := channel.Command("remove", "Remove an Ordering Service Node (OSN) from a channel.")
removeChannelID := remove.Flag("channel-id", "Channel ID").Short('c').Required().String()
removeChannelID := remove.Flag("channelID", "Channel ID").Short('c').Required().String()

command := kingpin.MustParse(app.Parse(args))

Expand Down Expand Up @@ -173,7 +173,7 @@ func validateBlockChannelID(blockBytes []byte, channelID string) error {
// quick sanity check that the orderer admin is joining
// the channel they think they're joining.
if channelID != blockChannelID {
return fmt.Errorf("specified --channel-id %s does not match channel ID %s in config block", channelID, blockChannelID)
return fmt.Errorf("specified --channelID %s does not match channel ID %s in config block", channelID, blockChannelID)
}

return nil
Expand Down
36 changes: 18 additions & 18 deletions cmd/osnadmin/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"list",
"--orderer-address", ordererURL,
"--channel-id", "tell-me-your-secrets",
"--channelID", "tell-me-your-secrets",
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
Expand All @@ -188,7 +188,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"list",
"--orderer-address", ordererURL,
"--channel-id", "tell-me-your-secrets",
"--channelID", "tell-me-your-secrets",
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
Expand Down Expand Up @@ -240,7 +240,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"list",
"--orderer-address", ordererURL,
"--channel-id", "tell-me-your-secrets",
"--channelID", "tell-me-your-secrets",
}
output, exit, err := executeForArgs(args)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -264,7 +264,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"remove",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
Expand All @@ -286,7 +286,7 @@ var _ = Describe("osnadmin", func() {
"remove",
"--ca-file", ordererCACert,
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--client-cert", clientCert,
"--client-key", clientKey,
}
Expand All @@ -308,7 +308,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"remove",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
}
output, exit, err := executeForArgs(args)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -343,7 +343,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--config-block", blockPath,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
Expand All @@ -370,7 +370,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--config-block", blockPath,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
Expand All @@ -382,7 +382,7 @@ var _ = Describe("osnadmin", func() {
})
})

Context("when the --channel-id does not match the channel ID in the block", func() {
Context("when the --channelID does not match the channel ID in the block", func() {
BeforeEach(func() {
channelID = "not-the-channel-youre-looking-for"
})
Expand All @@ -392,15 +392,15 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--config-block", blockPath,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
}
output, exit, err := executeForArgs(args)

checkFlagError(output, exit, err, "specified --channel-id not-the-channel-youre-looking-for does not match channel ID testing123 in config block")
checkFlagError(output, exit, err, "specified --channelID not-the-channel-youre-looking-for does not match channel ID testing123 in config block")
})
})

Expand Down Expand Up @@ -430,7 +430,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--config-block", blockPath,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
Expand All @@ -457,7 +457,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--config-block", blockPath,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
Expand All @@ -481,7 +481,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--config-block", blockPath,
}
output, exit, err := executeForArgs(args)
Expand All @@ -498,7 +498,7 @@ var _ = Describe("osnadmin", func() {
})

Describe("Flags", func() {
It("accepts short versions of the --orderer-address, --channel-id, and --config-block flags", func() {
It("accepts short versions of the --orderer-address, --channelID, and --config-block flags", func() {
configBlock := blockWithGroups(
map[string]*cb.ConfigGroup{
"Application": {},
Expand Down Expand Up @@ -544,7 +544,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"list",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
Expand All @@ -564,7 +564,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"remove",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
Expand Down Expand Up @@ -605,7 +605,7 @@ var _ = Describe("osnadmin", func() {
"channel",
"join",
"--orderer-address", ordererURL,
"--channel-id", channelID,
"--channelID", channelID,
"--ca-file", ordererCACert,
"--client-cert", clientCert,
"--client-key", clientKey,
Expand Down
22 changes: 11 additions & 11 deletions docs/source/commands/osnadminchannel.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Flags:
OSN
Subcommands:
channel join --channel-id=CHANNEL-ID --config-block=CONFIG-BLOCK
channel join --channelID=CHANNEL-ID --config-block=CONFIG-BLOCK
Join an Ordering Service Node (OSN) to a channel. If the channel does not
yet exist, it will be created.
Expand All @@ -48,14 +48,14 @@ Subcommands:
channel-id flag is set, more detailed information will be provided for that
channel.
channel remove --channel-id=CHANNEL-ID
channel remove --channelID=CHANNEL-ID
Remove an Ordering Service Node (OSN) from a channel.
```


## osnadmin channel join
```
usage: osnadmin channel join --channel-id=CHANNEL-ID --config-block=CONFIG-BLOCK
usage: osnadmin channel join --channelID=CHANNEL-ID --config-block=CONFIG-BLOCK
Join an Ordering Service Node (OSN) to a channel. If the channel does not yet
exist, it will be created.
Expand All @@ -73,7 +73,7 @@ Flags:
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
-c, --channel-id=CHANNEL-ID Channel ID
-c, --channelID=CHANNEL-ID Channel ID
-b, --config-block=CONFIG-BLOCK
Path to the file containing an up-to-date
config block for the channel
Expand All @@ -100,13 +100,13 @@ Flags:
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
-c, --channel-id=CHANNEL-ID Channel ID
-c, --channelID=CHANNEL-ID Channel ID
```


## osnadmin channel remove
```
usage: osnadmin channel remove --channel-id=CHANNEL-ID
usage: osnadmin channel remove --channelID=CHANNEL-ID
Remove an Ordering Service Node (OSN) from a channel.
Expand All @@ -123,7 +123,7 @@ Flags:
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
-c, --channel-id=CHANNEL-ID Channel ID
-c, --channelID=CHANNEL-ID Channel ID
```

## Example Usage
Expand All @@ -138,7 +138,7 @@ Here's an example of the `osnadmin channel join` command.

```
osnadmin channel join -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel --config-block mychannel-genesis-block.pb
osnadmin channel join -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel --config-block mychannel-genesis-block.pb
Status: 201
{
Expand Down Expand Up @@ -179,10 +179,10 @@ Here are some examples of the `osnadmin channel list` command.

Status 200 and the list of channels are returned.

* Using the `--channel-id` flag to list more details for `mychannel`.
* Using the `--channelID` flag to list more details for `mychannel`.

```
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
Status: 200
{
Expand All @@ -204,7 +204,7 @@ Here's an example of the `osnadmin channel remove` command.
* Removing channel `mychannel` from the orderer at `orderer.example.com:9443`.

```
osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel
osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
Status: 204
```
Expand Down
16 changes: 8 additions & 8 deletions docs/source/create_channel/create_channel_participation.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ Before you can take advantage of this feature on a deployed ordering service, yo
Now you can run `osnadmin channel remove` to remove the system channel from the node configuration:
```
osnadmin channel remove -o [ORDERER_ADMIN_LISTENADDRESS] --channel-id syschannel --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel remove -o [ORDERER_ADMIN_LISTENADDRESS] --channelID syschannel --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
For example:
```
osnadmin channel remove -o HOST1:7081 --channel-id syschannel --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel remove -o HOST1:7081 --channelID syschannel --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
When successful you see:
```
Expand Down Expand Up @@ -388,7 +388,7 @@ export OSN_TLS_CA_ROOT_CERT=../config/organizations/ordererOrganizations/orderer
export ADMIN_TLS_SIGN_CERT=../config/admin-client/client-tls-cert.pem
export ADMIN_TLS_PRIVATE_KEY=../config/admin-client/client-tls-key.pem

osnadmin channel join --channel-id [CHANNEL_NAME] --config-block [CHANNEL_CONFIG_BLOCK] -o [ORDERER_ADMIN_LISTENADDRESS] --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel join --channelID [CHANNEL_NAME] --config-block [CHANNEL_CONFIG_BLOCK] -o [ORDERER_ADMIN_LISTENADDRESS] --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
Replace:
Expand All @@ -401,7 +401,7 @@ Replace:
For example:
```
osnadmin channel join --channel-id channel1 --config-block genesis_block.pb -o OSN1.example.com:7050 --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel join --channelID channel1 --config-block genesis_block.pb -o OSN1.example.com:7050 --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
**Note:** Because the connection between the `osnadmin` CLI and the orderer requires mutual TLS, you need to pass the `--client-cert` and `--client-key` parameters on each `osadmin` command. The `--client-cert` parameter points to the admin client certificate and `--client-key` refers to the admin client private key, both issued by the admin client TLS CA.
Expand Down Expand Up @@ -429,15 +429,15 @@ INFO 089 Start accepting requests as Raft leader at block [0] channel=channel1 n
After the first orderer is added to the channel, subsequent nodes can join from either the genesis block or from the latest config block. When an orderer joins from a config block, its status is always "onboarding" while its ledger catches up to the config block that was specified in the join command, after which the status is automatically updated to "active".
Use the `osnadmin channel list` command with the `--channel-id` flag to view the detailed `status` and `consensusRelation` of any **channel** on any ordering node:
Use the `osnadmin channel list` command with the `--channelID` flag to view the detailed `status` and `consensusRelation` of any **channel** on any ordering node:
```
osnadmin channel list --channel-id [CHANNEL_NAME] -o [ORDERER_ADMIN_LISTENADDRESS] --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel list --channelID [CHANNEL_NAME] -o [ORDERER_ADMIN_LISTENADDRESS] --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
For example:
```
osnadmin channel list --channel-id channel1 -o HOST2:7081 --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel list --channelID channel1 -o HOST2:7081 --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
Replace:
Expand Down Expand Up @@ -479,7 +479,7 @@ To simplify the tutorial, we assume this additional orderer is part of the same
For this tutorial, the new orderer is not part of the consenter set. Run the following command to join the new orderer to the channel:
```
osnadmin channel join --channel-id [CHANNEL_NAME] --config-block [CHANNEL_CONFIG_BLOCK] -o [ORDERER_ADMIN_LISTENADDRESS] --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
osnadmin channel join --channelID [CHANNEL_NAME] --config-block [CHANNEL_CONFIG_BLOCK] -o [ORDERER_ADMIN_LISTENADDRESS] --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
```
An orderer can join the channel by providing the genesis block, or the latest config block. But the value of `consensusRelation` will always be "follower" until this orderer is added to the channel's consenter set, by submitting an update to the channel configuration.
Expand Down
8 changes: 4 additions & 4 deletions docs/wrappers/osnadmin_channel_postscript.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Here's an example of the `osnadmin channel join` command.

```
osnadmin channel join -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel --config-block mychannel-genesis-block.pb
osnadmin channel join -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel --config-block mychannel-genesis-block.pb
Status: 201
{
Expand Down Expand Up @@ -51,10 +51,10 @@ Here are some examples of the `osnadmin channel list` command.

Status 200 and the list of channels are returned.

* Using the `--channel-id` flag to list more details for `mychannel`.
* Using the `--channelID` flag to list more details for `mychannel`.

```
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
Status: 200
{
Expand All @@ -76,7 +76,7 @@ Here's an example of the `osnadmin channel remove` command.
* Removing channel `mychannel` from the orderer at `orderer.example.com:9443`.

```
osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel
osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
Status: 204
```
Expand Down

0 comments on commit c29420c

Please sign in to comment.