Skip to content

Commit

Permalink
F #6029: Fix xml handling in rsync backup actions (#2518)
Browse files Browse the repository at this point in the history
  • Loading branch information
sk4zuzu authored Feb 22, 2023
1 parent d8a65ad commit 0528055
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/datastore_mad/remotes/rsync/increment_flatten
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ begin

snaps = image.snapshots.first(image.snapshots.size - image.keep_last + 1)

xml = REXML::Document.new(action).root.elements
xml = REXML::Document.new(action).root

base_path = xml['DATASTORE/BASE_PATH'].text
rsync_user = xml['DATASTORE/TEMPLATE/RSYNC_USER']&.text || 'oneadmin'
rsync_host = xml['DATASTORE/TEMPLATE/RSYNC_HOST'].text
base_path = xml.elements['DATASTORE/BASE_PATH'].text
rsync_user = xml.elements['DATASTORE/TEMPLATE/RSYNC_USER']&.text || 'oneadmin'
rsync_host = xml.elements['DATASTORE/TEMPLATE/RSYNC_HOST'].text
rescue StandardError => e
STDERR.puts e.full_message
exit(-1)
Expand Down
14 changes: 7 additions & 7 deletions src/datastore_mad/remotes/rsync/restore
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ begin

image = TransferManager::BackupImage.new(action)

xml = REXML::Document.new(action).root.elements
xml = REXML::Document.new(action).root

ds_id = xml['DATASTORE/ID'].text.to_i
base_path = xml['DATASTORE/BASE_PATH'].text
rsync_user = xml['DATASTORE/TEMPLATE/RSYNC_USER']&.text || 'oneadmin'
rsync_host = xml['DATASTORE/TEMPLATE/RSYNC_HOST'].text
ds_id = xml.elements['DATASTORE/ID'].text.to_i
base_path = xml.elements['DATASTORE/BASE_PATH'].text
rsync_user = xml.elements['DATASTORE/TEMPLATE/RSYNC_USER']&.text || 'oneadmin'
rsync_host = xml.elements['DATASTORE/TEMPLATE/RSYNC_HOST'].text
rescue StandardError => e
STDERR.puts "Missing datastore or image attributes: #{e.message}"
exit(-1)
end

begin
username = xml['TEMPLATE/USERNAME'].text
dst_ds_id = xml['DESTINATION_DS_ID'].text.to_i
username = xml.elements['TEMPLATE/USERNAME'].text
dst_ds_id = xml.elements['DESTINATION_DS_ID'].text.to_i
rescue StandardError
STDERR.puts 'Cannot find USERNAME / DESTINATION_DS_ID'
exit(-1)
Expand Down
8 changes: 4 additions & 4 deletions src/datastore_mad/remotes/rsync/rm
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ begin

image = TransferManager::BackupImage.new action

xml = REXML::Document.new(action).root.elements
xml = REXML::Document.new(action).root

base_path = xml['DATASTORE/BASE_PATH'].text
rsync_user = xml['DATASTORE/TEMPLATE/RSYNC_USER']&.text || 'oneadmin'
rsync_host = xml['DATASTORE/TEMPLATE/RSYNC_HOST'].text
base_path = xml.elements['DATASTORE/BASE_PATH'].text
rsync_user = xml.elements['DATASTORE/TEMPLATE/RSYNC_USER']&.text || 'oneadmin'
rsync_host = xml.elements['DATASTORE/TEMPLATE/RSYNC_HOST'].text
rescue StandardError => e
STDERR.puts e.full_message
exit(-1)
Expand Down

0 comments on commit 0528055

Please sign in to comment.