diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2018-03-19 14:33:19 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2018-03-19 14:33:19 -0400 |
commit | f21ff5c40499139eb6daf5e1d711dd1e2b6141f0 (patch) | |
tree | 233755442518b4bcad89485d8647eae04ed40d10 | |
parent | 1fb49c587e439503dd747c71bae11d723b98766d (diff) | |
download | pipeline-backup-f21ff5c40499139eb6daf5e1d711dd1e2b6141f0.tar.gz |
Replace on explicit string match
-rwxr-xr-x | pipeline_backup.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pipeline_backup.py b/pipeline_backup.py index e1f5e2e..5399e99 100755 --- a/pipeline_backup.py +++ b/pipeline_backup.py @@ -22,8 +22,11 @@ class PipelineSpec: def replace(self, old, new): for idx, record in enumerate(self.data): - if old in record: - self.data[idx] = record.replace(old, new) + parts = record.split('/') + for part in parts: + if part == old: + self.data[idx] = record.replace(old, new) + break def search(self, pattern): for record in self.data: |