Skip to content

Commit

Permalink
fix(rust): brokers port range warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbenavides authored and davide-baldo committed May 30, 2024
1 parent bd88c5d commit 9ea6110
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions implementations/rust/ockam/ockam_command/src/kafka/inlet/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ use std::sync::Arc;

use clap::{command, Args};
use colorful::Colorful;
use miette::miette;
use ockam_abac::PolicyExpression;
use ockam_api::colors::OckamColor;
use ockam_api::kafka::{ConsumerPublishing, ConsumerResolution};
use ockam_api::nodes::models::services::{StartKafkaInletRequest, StartServiceRequest};
use ockam_api::nodes::BackgroundNodeClient;
use ockam_api::{fmt_log, fmt_ok, fmt_warn};
use ockam_api::{fmt_log, fmt_ok};
use tokio::sync::Mutex;
use tokio::try_join;

Expand Down Expand Up @@ -101,19 +102,19 @@ impl Command for CreateCommand {
let brokers_port_range = self
.brokers_port_range
.unwrap_or_else(|| make_brokers_port_range(&self.from));
if (brokers_port_range.end() - brokers_port_range.start()) < 100 {
opts.terminal.write_line(fmt_warn!(
"The brokers ports range has been trimmed down to '{}-{}' because \
the max port number {} was exceeded",
brokers_port_range.start(),
brokers_port_range.end(),
u16::MAX
))?;
opts.terminal.write_line(fmt_log!(
"Consider changing the bootstrap server \
port to a lower value that has at least 100 free ports after it\n"
))?;

// The bootstrap port can't overlap with the brokers port range
if self.from.port() >= brokers_port_range.start()
&& self.from.port() <= brokers_port_range.end()
{
return Err(miette!(
"The bootstrap port {} can't overlap with the brokers port range {}",
self.from.port(),
brokers_port_range.to_string()
)
.into());
}

let at_node = self.node_opts.at_node.clone();
let addr = self.addr.clone();

Expand Down

0 comments on commit 9ea6110

Please sign in to comment.