denshoproject / ddr-cmdln

Command-line tools for automating the Densho Digital Repository's various processes.
Other
0 stars 2 forks source link

deleting any File binary attached to a child Entity results uncommitted/unstaged changes #140

Closed pkikawa closed 5 years ago

pkikawa commented 5 years ago

deleting a binary from any role results in a failure message in the gitstatus update:

admin binary delete traceback.txt

running git fetch;git status:

admin binary delete git fetch status.txt

binary is deleted but it leaves unstaged changes, and uncommitted changes

gjost commented 5 years ago

I can't replicate this in my current dev environment. I strongly suspect this is dealt with in the 141-entity-children branch. Please try ddrlocal-develop_2.8.3a.

pkikawa commented 5 years ago

2.8.3b DEV

Still getting failure messages on binary deletion.

Could not delete file <a href="/ui/file/ddr-testing-40219-1-2-mezzanine-684e15e967/">ddr-testing-40219-1-2-mezzanine-684e15e967.tif</a> from <a href="/ui/entity/ddr-testing-40219-1-2/">ddr-testing-40219-1-2</a>.

(ddrlocal) ddr@DDREditor:/media/qnfs/kinkura/gold/ddr-testing-40219$ git fetch;git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    files/ddr-testing-40219-1/files/ddr-testing-40219-1-2/files/ddr-testing-40219-1-2-mezzanine-684e15e967-a.jpg
        deleted:    files/ddr-testing-40219-1/files/ddr-testing-40219-1-2/files/ddr-testing-40219-1-2-mezzanine-684e15e967.json
        deleted:    files/ddr-testing-40219-1/files/ddr-testing-40219-1-2/files/ddr-testing-40219-1-2-mezzanine-684e15e967.tif

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   files/ddr-testing-40219-1/files/ddr-testing-40219-1-2/changelog
        modified:   files/ddr-testing-40219-1/files/ddr-testing-40219-1-2/control
        modified:   files/ddr-testing-40219-1/files/ddr-testing-40219-1-2/entity.json
pkikawa commented 5 years ago

forgot to mention that the binary is deleted, just with the failure message and unstaged commits

gjost commented 5 years ago

Should be fixed as of ddr-local commit 5fd7a55.

pkikawa commented 5 years ago

behavior still present, though only when deleting child segment binaries.

pkikawa commented 5 years ago

tested on 284MA

pkikawa commented 5 years ago

Traceback (most recent call last):

  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/opt/ddr-local/ddrlocal/webui/tasks/files.py", line 289, in delete_file
    git_name, git_mail, agent
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/models/files.py", line 305, in delete
    commit=commit
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/commands.py", line 51, in wrapper
    return f(*args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/commands.py", line 41, in wrapper
    return f(*args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/commands.py", line 634, in file_destroy
    dvcs.stage(repo, git_files)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/dvcs.py", line 464, in stage
    repo.git.add([git_files])
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/git/cmd.py", line 440, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/git/cmd.py", line 834, in _call_process
    return self.execute(make_call(), **_kwargs)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/git/cmd.py", line 627, in execute
    raise GitCommandError(command, status, stderr_value)
GitCommandError: 'git add files/ddr-testing-40225-1-1/entity.json files/ddr-testing-40225-1-1/control files/ddr-testing-40225-1/files/ddr-testing-40225-1-1/changelog' returned with exit code 128
stderr: 'fatal: pathspec 'files/ddr-testing-40225-1-1/entity.json' did not match any files'

(The git status of the repo looked similar to the output in https://github.com/densho/ddr-cmdln/issues/140#issuecomment-488333327)

gjost commented 5 years ago

@pkikawa Reading through this again, just curious, why are you doing git fetch before git status? fetch hits the remote repository to see if there are any updates.

gjost commented 5 years ago

@pkikawa Regarding your Traceback (most recent call last): comment, it would really help me if you could provide a description of what you're doing that provoked the traceback. If you're doing something at the commandline then the actual command you tried to execute is absolutely necessary.

pkikawa commented 5 years ago

@pkikawa Reading through this again, just curious, why are you doing git fetch before git status? fetch hits the remote repository to see if there are any updates.

ahhh, force of habit i guess.

pkikawa commented 5 years ago

@pkikawa Regarding your Traceback (most recent call last): comment, it would really help me if you could provide a description of what you're doing that provoked the traceback. If you're doing something at the commandline then the actual command you tried to execute is absolutely necessary.

ah sorry, thought i had included that at the top. (ddrlocal) ddr@DDREditor:/media/qnfs/kinkura/gold/ddr-testing-40226$ ddrimport entity -U philip.kikawa -P REDACTED /media/sf_ddrshared/test\ csv/ddr-testing-40226-objects.csv /media/qnfs/kinkura/gold/ddr-testing-40226 | tee -a /media/sf_ddrshared/test\ csv/ddr-testing-40226ObjImp.log

this is the copy-paste of the command i used to get this error

gjost commented 5 years ago

thx, the more context the better

gjost commented 5 years ago

New problem though: This issue is supposed to be about problems with deleting binaries, but the command and traceback from the last couple comments are issues when running ddrimport entity which is a totally different operation. We need to keep these issues on-topic, otherwise it's incredibly confusing.

pkikawa commented 5 years ago

New problem though: This issue is supposed to be about problems with deleting binaries, but the command and traceback from the last couple comments are issues when running ddrimport entity which is a totally different operation. We need to keep these issues on-topic, otherwise it's incredibly confusing.

homersimpson.DOH gah yeah my fault, i was thinking of the wrong issue. all that i did to generate this error was clicking on the delete button and checking the yes i am sure i want to delete this file checkbox. the collection was in a clean state beforehand (no tracked changes, no unstaged commits)

gjost commented 5 years ago

OK thx will check it out.

pkikawa commented 5 years ago

sorry about that xP

pkikawa commented 5 years ago

version 2.8.4 MAster

gjost commented 5 years ago

Unable to duplicate the error when deleting a binary. Used ddrlocal-master_2.8.4.

pkikawa commented 5 years ago

you're unable to replicate this from deleting segment binaries?

gjost commented 5 years ago

I was able to delete a file along with its binaries with no errors, no leftover files in the repo.

On May 15, 2019 12:37:22 PM PDT, Philip Kikawa notifications@github.com wrote:

you're unable to replicate this from deleting segment binaries?

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/densho/ddr-cmdln/issues/140#issuecomment-492794665

-- "Work as if you live in the early days of a better national. --Alasdair Gray

pkikawa commented 5 years ago

do you want the VM that i've been working with?

gjost commented 5 years ago

NOTE: this happens when deleting segment child binaries.

gjost commented 5 years ago

Duplicated in the shell:

>>> fid = 'ddr-testing-40204-1-1-mezzanine-3c4f516e3a'
>>> from DDR import config, identifier
>>> o = identifier.Identifier(fid, config.MEDIA_BASE).object()
>>> o.delete('gjost', 'gjost@densho.org', 'cli', commit=0)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    o.delete('gjost', 'gjost@densho.org', 'cli', commit=0)
...
GitCommandError: 'git add files/ddr-testing-40204-1-1/entity.json files/ddr-testing-40204-1-1/control files/ddr-testing-40204-1/files/ddr-testing-40204-1-1/changelog' returned with exit code 128
stderr: 'fatal: pathspec 'files/ddr-testing-40204-1-1/entity.json' did not match any files'
gjost commented 5 years ago

Fixed in ddr-cmdln commit 696e93d for package ddrlocal-develop_2.8.4b.

pkikawa commented 5 years ago

resolved in 284b dev

pkikawa commented 5 years ago

working in 286MA