Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many small issues #1342

Merged
merged 6 commits into from
Dec 13, 2024
Merged
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
5 changes: 4 additions & 1 deletion sarracenia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,10 @@ def fromFileInfo(path, o, lstat=None):
# rename path given with no filename

if o.rename:
msg['retrievePath'] = msg['new_retrievePath']
# ensure we have the old name for retrieval usage.
if 'new_retrievePath' in msg:
msg['retrievePath'] = msg['new_retrievePath']

petersilva marked this conversation as resolved.
Show resolved Hide resolved
newname = o.variableExpansion(o.rename)
if o.rename[-1] == '/':
newname += os.path.basename(path)
Expand Down
15 changes: 12 additions & 3 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,8 @@ def work(self) -> None:
m['_deleteOnPost'] |= set(['old_retrievePath'])

# if new_file does not match relPath, then adjust relPath so it does.
if 'relPath' in m and m['new_file'] != m['relPath'].split('/')[-1]:
if ( 'relPath' in m ) and ('new_file' in m) and \
m['new_file'] != m['relPath'].split('/')[-1]:
if not 'new_relPath' in m:
if len(m['relPath']) > 1:
m['new_relPath'] = '/'.join( m['relPath'].split('/')[0:-1] + [ m['new_file'] ])
Expand All @@ -1236,11 +1237,15 @@ def work(self) -> None:
else:
m['new_relPath'] = m['new_file']

if ('new_relPath' in m) and (m['relPath'] != m['new_relPath']):
if ('new_relPath' in m) and ('relPath' in m) \
and (m['relPath'] != m['new_relPath']):
m['old_relPath'] = m['relPath']
m['_deleteOnPost'] |= set(['old_relPath'])

if 'new_relPath' in m:
m['relPath'] = m['new_relPath']
m['old_subtopic'] = m['subtopic']
if 'subtopic' in m:
m['old_subtopic'] = m['subtopic']
m['_deleteOnPost'] |= set(['old_subtopic','subtopic'])
m['subtopic'] = m['new_subtopic']

Expand Down Expand Up @@ -2726,6 +2731,10 @@ def send(self, msg, options) -> int:
else:
len_written = msg['size']

if msg['size'] > 0 and len_written == 0:
logger.error( f"failed to send inflight={inflight} {sendTo} {msg['new_dir']}/{new_file}" )
return 0

msg.setReport(201, 'file sent')
self.metrics['flow']['transferTxBytes'] += len_written
self.metrics['flow']['transferTxFiles'] += 1
Expand Down
3 changes: 2 additions & 1 deletion sarracenia/flowcb/work/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def after_accept(self, worklist):

#FIXME: there should be some reference to baseDir here... for url's that aren't file ones.
# just getting it to work for particular case for now 2021/12/09 - pas
sep = '/' if ( message['baseUrl'][-1] != '/' ) else ''
message['delete_source'] = message['baseUrl'].lstrip(
'file:') + message['relPath']
'file:') + sep + message['relPath']

def after_work(self, worklist):

Expand Down
Loading