Skip to content

Commit 3727632

Browse files
committed
feat: new command to migrate old folder to new ones
1 parent 206ec88 commit 3727632

File tree

4 files changed

+512
-2
lines changed

4 files changed

+512
-2
lines changed

agent-control/src/bin/main_agent_control_onhost_cli.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::process::ExitCode;
22

33
use clap::{CommandFactory, Parser, error::ErrorKind};
4+
use newrelic_agent_control::cli::on_host::migrate_folders;
45
use newrelic_agent_control::cli::{logs, on_host::config_gen};
56
use tracing::{Level, error};
67

@@ -16,9 +17,12 @@ struct Cli {
1617

1718
/// Commands supported by the cli
1819
#[derive(Debug, clap::Subcommand)]
20+
#[allow(clippy::large_enum_variant)]
1921
enum Commands {
2022
// Generate Agent Control configuration according to the provided configuration data.
2123
GenerateConfig(config_gen::Args),
24+
/// Migrate from the older on host folders to the new ones.
25+
MigrateFolders,
2226
}
2327

2428
fn main() -> ExitCode {
@@ -39,6 +43,7 @@ fn main() -> ExitCode {
3943
}
4044
config_gen::generate_config(args)
4145
}
46+
Commands::MigrateFolders => migrate_folders::migrate(),
4247
};
4348

4449
if let Err(err) = result {

agent-control/src/cli/error.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::process::ExitCode;
22

3-
use thiserror::Error;
4-
53
use crate::instrumentation::tracing::TracingError;
4+
use thiserror::Error;
65

76
#[derive(Debug, Error)]
87
pub enum CliError {
@@ -14,6 +13,9 @@ pub enum CliError {
1413

1514
#[error("{0}")]
1615
Command(String),
16+
17+
#[error("File system error: {0}")]
18+
FileSystemError(String),
1719
}
1820

1921
impl From<CliError> for ExitCode {
@@ -29,6 +31,7 @@ impl From<CliError> for ExitCode {
2931
CliError::Precondition(_) => Self::from(69),
3032
CliError::Tracing(_) => Self::from(70),
3133
CliError::Command(_) => Self::from(1),
34+
CliError::FileSystemError(_) => Self::from(1),
3235
}
3336
}
3437
}

agent-control/src/cli/on_host.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pub mod config_gen;
2+
pub mod migrate_folders;

0 commit comments

Comments
 (0)