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
4 changes: 2 additions & 2 deletions .github/workflows/nifi_migrate_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- "Cargo.*"

env:
RUST_VERSION: 1.87.0
RUST_VERSION: 1.97.1

jobs:
# This job is always run to ensure we don't miss any new upstream advisories
Expand All @@ -33,7 +33,7 @@ jobs:
persist-credentials: false

- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@f2ba7abc2abebaf185c833c3961145a3c275caad # v2.0.13
uses: EmbarkStudios/cargo-deny-action@bb137d7af7e4fb67e5f82a49c4fce4fad40782fe # v2.0.20
with:
command: check ${{ matrix.checks }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nifi_migrate_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "rel/nifi-migrate-[0-9]+.[0-9]+.[0-9]+**"

env:
RUST_VERSION: 1.87.0
RUST_VERSION: 1.97.1

jobs:
create-release:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
RUST_TOOLCHAIN_VERSION: "1.87.0"
RUST_TOOLCHAIN_VERSION: "1.97.1"

jobs:
pre-commit:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0

[toolchain]
channel = "1.87.0"
channel = "1.97.1"
profile = "default"
21 changes: 11 additions & 10 deletions src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ impl Migrator {
.canonicalize()
.with_context(|| format!("Failed to resolve input path: {}", input_path.display()))?;

if let Ok(canonical_output) = output_path.canonicalize() {
if canonical_input == canonical_output {
anyhow::bail!(
"Input and output paths are the same. This would overwrite the original file."
);
}
if let Ok(canonical_output) = output_path.canonicalize()
&& canonical_input == canonical_output
{
anyhow::bail!(
"Input and output paths are the same. This would overwrite the original file."
);
}

// Validate output directory exists
if let Some(parent) = output_path.parent() {
if !parent.as_os_str().is_empty() && !parent.exists() {
anyhow::bail!("Output directory does not exist: {}", parent.display());
}
if let Some(parent) = output_path.parent()
&& !parent.as_os_str().is_empty()
&& !parent.exists()
{
anyhow::bail!("Output directory does not exist: {}", parent.display());
}

let file = fs::File::open(input_path)
Expand Down
16 changes: 8 additions & 8 deletions src/migration/rules/distributed_cache_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ impl MigrationRule for DistributedCacheServicesMigration {
fn apply(&self, component: &mut Value) -> bool {
let mut changed = false;

if let Some(type_field) = component.get_mut("type") {
if let Some(current_type) = type_field.as_str() {
for (old_type, new_type) in CACHE_SERVICE_MIGRATIONS {
if current_type == old_type {
*type_field = Value::String(new_type.to_string());
changed = true;
break;
}
if let Some(type_field) = component.get_mut("type")
&& let Some(current_type) = type_field.as_str()
{
for (old_type, new_type) in CACHE_SERVICE_MIGRATIONS {
if current_type == old_type {
*type_field = Value::String(new_type.to_string());
changed = true;
break;
}
}
}
Expand Down
26 changes: 12 additions & 14 deletions src/migration/rules/jolt_transform_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,21 @@ impl MigrationRule for JoltTransformJsonMigration {
let mut changed = false;

// Update the type field
if let Some(type_field) = processor.get_mut("type") {
if type_field.as_str() == Some("org.apache.nifi.processors.standard.JoltTransformJSON")
{
*type_field =
Value::String("org.apache.nifi.processors.jolt.JoltTransformJSON".to_owned());
changed = true;
}
if let Some(type_field) = processor.get_mut("type")
&& type_field.as_str() == Some("org.apache.nifi.processors.standard.JoltTransformJSON")
{
*type_field =
Value::String("org.apache.nifi.processors.jolt.JoltTransformJSON".to_owned());
changed = true;
}

// Update the bundle artifact field
if let Some(bundle) = processor.get_mut("bundle") {
if let Some(artifact) = bundle.get_mut("artifact") {
if artifact.as_str() == Some("nifi-standard-nar") {
*artifact = Value::String("nifi-jolt-nar".to_owned());
changed = true;
}
}
if let Some(bundle) = processor.get_mut("bundle")
&& let Some(artifact) = bundle.get_mut("artifact")
&& artifact.as_str() == Some("nifi-standard-nar")
{
*artifact = Value::String("nifi-jolt-nar".to_owned());
changed = true;
}

// Migrate properties: rename old property keys to new ones
Expand Down
26 changes: 12 additions & 14 deletions src/migration/rules/jolt_transform_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,22 @@ impl MigrationRule for JoltTransformRecordMigration {
let mut changed = false;

// Update the type field
if let Some(type_field) = processor.get_mut("type") {
if type_field.as_str()
if let Some(type_field) = processor.get_mut("type")
&& type_field.as_str()
== Some("org.apache.nifi.processors.jolt.record.JoltTransformRecord")
{
*type_field =
Value::String("org.apache.nifi.processors.jolt.JoltTransformRecord".to_owned());
changed = true;
}
{
*type_field =
Value::String("org.apache.nifi.processors.jolt.JoltTransformRecord".to_owned());
changed = true;
}

// Update the bundle artifact field
if let Some(bundle) = processor.get_mut("bundle") {
if let Some(artifact) = bundle.get_mut("artifact") {
if artifact.as_str() == Some("nifi-jolt-record-nar") {
*artifact = Value::String("nifi-jolt-nar".to_owned());
changed = true;
}
}
if let Some(bundle) = processor.get_mut("bundle")
&& let Some(artifact) = bundle.get_mut("artifact")
&& artifact.as_str() == Some("nifi-jolt-record-nar")
{
*artifact = Value::String("nifi-jolt-nar".to_owned());
changed = true;
}

// Migrate properties: rename old property keys to new ones
Expand Down
Loading