-
Notifications
You must be signed in to change notification settings - Fork 270
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
Repo: Repository.targets.add_target unexpected behavior implied in walkthrough #319
Comments
awwad
changed the title
Repository.targets.add_target unexpected behavior implied in walkthrough
Repo: Repository.targets.add_target unexpected behavior implied in walkthrough
Feb 29, 2016
This issue appears to be fixed in the latest "develop" branch: $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from tuf.repository_tool import *
>>> repository = load_repository('repository')
>>> repository.dirty_roles()
Dirty roles: []
>>> repository.status()
u'root' role contains 0 / 1 signatures.
>>> repository.targets.target_files
{u'/file1.txt': {u'file_permissions': u'664'}, u'/file2.txt': {}}
>>> target3_filepath = 'repository/targets/file3.txt'
>>> octal_file_permissions = oct(os.stat(target3_filepath).st_mode)[4:]
>>> custom_file_permissions = {'file_permissions': octal_file_permissions}
>>> repository.targets.add_target(target3_filepath, custom_file_permissions)
>>> repository.targets.target_files
{'/file3.txt': {'file_permissions': '664'}, u'/file1.txt': {u'file_permissions': u'664'}, u'/file2.txt': {}}
>>> repository.dirty_roles()
Dirty roles: [u'targets']
>>> |
Reopening. I need to verify the case for a replaced target path! |
vladimir-v-diaz
added a commit
that referenced
this issue
Nov 10, 2016
vladimir-v-diaz
added a commit
that referenced
this issue
Nov 10, 2016
This issue should now be fixed in #403. Note how the >>> from tuf.repository_tool import *
>>> repository = load_repository('repository')
>>> repository.dirty_roles()
Dirty roles: []
>>> repository.targets.target_files
{u'/file1.txt': {u'file_permissions': u'664'}, u'/file2.txt': {}}
>>> target2_filepath = 'repository/targets/file2.txt'
>>> octal_file_permissions = oct(os.stat(target2_filepath).st_mode)[4:]
>>> custom_file_permissions = {'file_permissions': octal_file_permissions}
>>> repository.targets.add_target(target2_filepath, custom_file_permissions)
>>> repository.targets.target_files
{u'/file1.txt': {u'file_permissions': u'664'}, u'/file2.txt': {'file_permissions': '664'}}
>>> repository.dirty_roles()
Dirty roles: [u'targets']
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The repository creation walkthrough leads you to believe that adding an existing target again replaces it, when it appears to do nothing.
In particular, midway through the add target files section:
The walkthrough instructs you to create a custom field for a target and add that target with the custom field. This target has already been added, though, in the walkthrough, and adding it again actually fails to incorporate the custom field. The user is not given a step showing them the result, either, so it leads the user to walk away thinking that the way to add custom fields to an existing target is to simply add the already-existing target back again with the custom field.
Example of the behavior:
TODO, then:
The text was updated successfully, but these errors were encountered: