Skip to content

Conversation

@schaabs
Copy link

@schaabs schaabs commented Jun 7, 2017


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • The PR has modified HISTORY.rst with an appropriate description of the change (see Modifying change log).

Command Guidelines

  • Each command and parameter has a meaningful description.
  • Each new command has a test.

(see Authoring Command Modules)

StoragePermissions.setsas,
StoragePermissions.listsas,
StoragePermissions.getsas,
StoragePermissions.deletesas])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get these options from SDK?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the permissions enumerations used here are defined in the SDK, we explicitly list out the values because the permissions granted by default are not all available permissions.

'azure-mgmt-authorization==0.30.0rc6',
'azure-graphrbac==0.30.0rc6',
'azure-keyvault==0.3.0',
'azure-keyvault==0.3.4',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derekbekoe raise any API profile issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the API versions of other command modules may break their tests depending on whether there were breaking changes between the different SDK versions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no breaking changes between azure-keyvault 0.3.0 and 0.3.4

Copy link
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests needed for the new commands.

help='Allow Resource Manager to retrieve secrets from the vault.',
**three_state_flag())
register_cli_argument('keyvault', 'enable_for_soft_delete',
help='Enable vault deletion recovery for the vault, and all contained entities',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend shortening the option name for this to "--enable-soft-delete".


# purge arguments
register_cli_argument('keyvault purge', 'vault_name', required=True, completer=None, validator=None)
register_cli_argument('keyvault purge', 'location', required=True, completer=None, validator=None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for these two registrations?

data_client_path.format('KeyVaultClient.get_keys'))
cli_keyvault_data_plane_command('keyvault key list-versions',
data_client_path.format('KeyVaultClient.get_key_versions'))
cli_keyvault_data_plane_command('keyvault key list-deleted',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could simply enhance the existing list command with a --deleted flag (or something similar) rather than have a completely separate command. This would be similar to list/list-all folding that many commands do

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list and list-deleted have some conflicting arguments in some cases and return different types in all, this is why I created them as separate commands

backup_secret.__doc__ = KeyVaultClient.backup_secret.__doc__


def restore_secret(client, vault_base_url, file_path):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a scenario tests that backs up and restores a secret successfully. From doing the original KV commands, I would be surprised if more edge cases didn't need to be covered on account of Python2 vs 3 and Linux vs Windows.

Copy link
Author

@schaabs schaabs Jun 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backup and restore has been added to the secret scenario

@schaabs
Copy link
Author

schaabs commented Jun 16, 2017

@tjprescott All the commands have tests, and I've made updates based on your comments. PTAL

@codecov-io
Copy link

codecov-io commented Jun 16, 2017

Codecov Report

Merging #3631 into master will decrease coverage by <.01%.
The diff coverage is 83.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3631      +/-   ##
==========================================
- Coverage   72.14%   72.13%   -0.01%     
==========================================
  Files         421      421              
  Lines       26010    26046      +36     
  Branches     3943     3943              
==========================================
+ Hits        18765    18789      +24     
- Misses       6026     6040      +14     
+ Partials     1219     1217       -2
Impacted Files Coverage Δ
...yvault/azure/cli/command_modules/keyvault/_help.py 100% <100%> (ø) ⬆️
...ult/azure/cli/command_modules/keyvault/commands.py 100% <100%> (ø) ⬆️
...ault/azure/cli/command_modules/keyvault/_params.py 86.25% <100%> (+0.1%) ⬆️
...vault/azure/cli/command_modules/keyvault/custom.py 69.56% <66.66%> (-1.56%) ⬇️
.../azure/cli/command_modules/keyvault/_validators.py 72.18% <0%> (-0.67%) ⬇️
...nent/azure/cli/command_modules/component/custom.py 16.23% <0%> (ø) ⬆️
src/azure-cli-core/azure/cli/core/util.py 70.06% <0%> (ø) ⬆️
...dback/azure/cli/command_modules/feedback/custom.py 31.25% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dff725f...5fef8c6. Read the comment docs.

@schaabs schaabs changed the title Recovery feature updates [KeyVault] adding recovery feature commands Jun 16, 2017
Copy link
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple small changes but otherwise LGTM.

Release History
===============
2.0.7 (2017-06-16)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just say "unreleased". Derek will fill this in later.

:param resource_group_name: The original resource group of the vault to recover
:param location: The original location of the vault to recover
:return: The properties of the recovered key vault
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This help text should be moved (and reformatted) to the help.py file for the module. This is because the live docs links to help.py if someone wants to make a change to help text. While this way of creating help text is still supported (for SDK reflection) we don't allow it in custom commands for new PRs.


byok_key_file = os.path.join(TEST_DIR, 'TestBYOK-NA.byok')
self.cmd(
'keyvault key import --vault-name {} -n import-key-byok --byok-file "{}"'.format(kv,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why you removed the BYOK test, but why the PEM file import?

kv, pfx_plain_file, pfx_policy_path))


class KeyVaultSoftDeleteScenarioTest(ResourceGroupVCRTestBase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would inherit from ScenarioTest, but I'm fine merging this as is.

@schaabs schaabs merged commit e0ee922 into Azure:master Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants