Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions dev-tools/omicron-dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use nexus_config::NexusConfig;
use nexus_test_interface::NexusServer;
use nexus_test_utils::resource_helpers::DiskTest;
use signal_hook_tokio::Signals;
use std::fs;

fn main() -> anyhow::Result<()> {
oxide_tokio_rt::run(async {
Expand Down Expand Up @@ -50,6 +51,9 @@ struct RunAllArgs {
/// Override the gateway server configuration file.
#[clap(long, default_value = DEFAULT_SP_SIM_CONFIG)]
gateway_config: Utf8PathBuf,
/// Override the nexus configuration file.
#[clap(long, default_value = "./nexus/examples/config.toml")]
nexus_config: Utf8PathBuf,
}

impl RunAllArgs {
Expand All @@ -60,9 +64,10 @@ impl RunAllArgs {
let mut signal_stream = signals.fuse();

// Read configuration.
let config_str = include_str!("../../../nexus/examples/config.toml");
let mut config: NexusConfig =
toml::from_str(config_str).context("parsing example config")?;
let config_str = fs::read_to_string(&self.nexus_config)?;
let mut config: NexusConfig = toml::from_str(&config_str).context(
format!("parsing config: {}", self.nexus_config.as_str()),
)?;
config.pkg.log = dropshot::ConfigLogging::File {
// See LogContext::new(),
path: "UNUSED".to_string().into(),
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/omicron-dev/tests/test-omicron-dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async fn test_run_all() {
let cmd_path = path_to_omicron_dev();

let cmdstr = format!(
"( set -o monitor; {} run-all --nexus-listen-port 0 && true )",
"( set -o monitor; {} run-all --nexus-listen-port 0 --nexus-config ../../nexus/examples/config.toml && true )",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like the command itself has a default built into it so I feel like you shouldn't need this here? Or is the problem that the relative paths are wrong (e.g., they're different between this context and the common cargo xtask omicron-dev run-all context)? In that case should we figure out the right path based on CARGO_HOME?

This seems like not a big deal, I guess.

cmd_path.display()
);
let exec =
Expand Down
15 changes: 11 additions & 4 deletions tools/install_builder_prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ function usage

ASSUME_YES="false"
SKIP_PATH_CHECK="false"
OMIT_SUDO="false"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels sketchy to me. But I don't think it's a security issue (we were already running with sudo by default) and it's good that we don't have people run the whole script under sudo so I'm not sure what to do better.

RETRY_ATTEMPTS=3
while getopts ypr: flag
while getopts ypsr: flag
do
case "${flag}" in
y) ASSUME_YES="true" ;;
p) SKIP_PATH_CHECK="true" ;;
s) OMIT_SUDO="true" ;;
r) RETRY_ATTEMPTS=${OPTARG} ;;
*) usage
esac
Expand Down Expand Up @@ -130,11 +132,16 @@ function install_packages {
'libclang-dev'
'libsqlite3-dev'
)
sudo apt-get update
if [[ "${OMIT_SUDO}" == "false" ]]; then
maybe_sudo="sudo"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit, feel free to ignore: we could as well set the global SUDO="sudo" at L34 and have L41 set SUDO="" and then just use $SUDO at L142/L144. It would just avoid an extra boolean global and the logic at L135-139 (which is a little circuitous with a double negative -- "if we're not omitting sudo, then set maybe_sudo to include it")

else
maybe_sudo=""
fi
$maybe_sudo apt-get update
if [[ "${ASSUME_YES}" == "true" ]]; then
sudo apt-get install -y "${packages[@]}"
$maybe_sudo apt-get install -y "${packages[@]}"
else
confirm "Install (or update) [${packages[*]}]?" && sudo apt-get install "${packages[@]}"
confirm "Install (or update) [${packages[*]}]?" && $maybe_sudo apt-get install "${packages[@]}"
fi
elif [[ "${HOST_OS}" == "SunOS" ]]; then
CLANGVER=15
Expand Down
15 changes: 11 additions & 4 deletions tools/install_runner_prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ function usage
}

ASSUME_YES="false"
OMIT_SUDO="false"
RETRY_ATTEMPTS=3
while getopts ypr: flag
while getopts ypsr: flag
do
case "${flag}" in
y) ASSUME_YES="true" ;;
p) continue ;;
s) OMIT_SUDO="true" ;;
r) RETRY_ATTEMPTS=${OPTARG} ;;
*) usage
esac
Expand Down Expand Up @@ -139,11 +141,16 @@ function install_packages {
'libssl3'
'libxmlsec1-openssl'
)
sudo apt-get update
if [[ "${OMIT_SUDO}" == "false" ]]; then
maybe_sudo="sudo"
else
maybe_sudo=""
fi
$maybe_sudo apt-get update
if [[ "${ASSUME_YES}" == "true" ]]; then
sudo apt-get install -y "${packages[@]}"
$maybe_sudo apt-get install -y "${packages[@]}"
else
confirm "Install (or update) [${packages[*]}]?" && sudo apt-get install "${packages[@]}"
confirm "Install (or update) [${packages[*]}]?" && $maybe_sudo apt-get install "${packages[@]}"
fi
else
echo "Unsupported OS: ${HOST_OS}"
Expand Down
Loading