instance_id
stringlengths
10
57
base_commit
stringlengths
40
40
created_at
stringdate
2014-04-30 14:58:36
2025-04-30 20:14:11
environment_setup_commit
stringlengths
40
40
hints_text
stringlengths
0
273k
patch
stringlengths
251
7.06M
problem_statement
stringlengths
11
52.5k
repo
stringlengths
7
53
test_patch
stringlengths
231
997k
meta
dict
version
stringclasses
851 values
install_config
dict
requirements
stringlengths
93
34.2k
environment
stringlengths
760
20.5k
FAIL_TO_PASS
listlengths
1
9.39k
FAIL_TO_FAIL
listlengths
0
2.69k
PASS_TO_PASS
listlengths
0
7.87k
PASS_TO_FAIL
listlengths
0
192
license_name
stringclasses
55 values
__index_level_0__
int64
0
21.4k
before_filepaths
listlengths
1
105
after_filepaths
listlengths
1
105
ESSS__conda-devenv-46
f23bec79139cbb9e59e4e2bdafb27385afcee192
2017-04-10 19:18:28
7867067acadb89f7da61af330d85caa31b284dd8
diff --git a/HISTORY.rst b/HISTORY.rst index a808c8c..796bf32 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,15 @@ History ======= + +0.9.3 (2017-04-10) +------------------ + +* ``conda-devenv`` no longer requires ``conda`` to be on ``PATH`` to work (`#45`_). + +.. _`#45`: https://github.com/ESSS/conda-devenv/issues/45 + + 0.9.2 (2017-03-27) ------------------ diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 356c4f1..66b6bf9 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -247,7 +247,7 @@ def __write_conda_environment_file(args, filename, rendered_contents): def __call_conda_env_update(args, output_filename): - import subprocess + import sys command = [ "conda", "env", @@ -265,7 +265,23 @@ def __call_conda_env_update(args, output_filename): if not args.quiet: print("> Executing: %s" % ' '.join(command)) - return subprocess.call(command) + old_argv = sys.argv[:] + try: + del command[0] + sys.argv = command + return _call_conda() + finally: + sys.argv = old_argv + + +def _call_conda(): + """ + Calls conda-env directly using its internal API. ``sys.argv`` must already be configured at this point. + + We have this indirection here so we can mock this function during testing. + """ + from conda_env.cli.main import main + return main() def write_activate_deactivate_scripts(args, conda_yaml_dict, environment):
devenv command fails if conda is not on path I was just updating an env in a linux machine with `/full/path/to/conda devenv -f environment.devenv.yml` and got this traceback: ``` Traceback (most recent call last): File "/home/company/Work/miniconda/bin/conda-devenv", line 11, in <module> load_entry_point('conda-devenv==0.9.0', 'console_scripts', 'conda-devenv')() File "/home/company/Work/miniconda/lib/python2.7/site-packages/conda_devenv/devenv.py", line 356, in main retcode = __call_conda_env_update(args, output_filename) File "/home/company/Work/miniconda/lib/python2.7/site-packages/conda_devenv/devenv.py", line 268, in __call_conda_env_update return subprocess.call(command) File "/home/company/Work/miniconda/lib/python2.7/subprocess.py", line 168, in call return Popen(*popenargs, **kwargs).wait() File "/home/company/Work/miniconda/lib/python2.7/subprocess.py", line 390, in _init_ errread, errwrite) File "/home/company/Work/miniconda/lib/python2.7/subprocess.py", line 1024, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory ``` After some time investigating I found out it was because I didn't have conda on PATH. I think it should either not require it to be on path (using absolute path instead) or give a better error message.
ESSS/conda-devenv
diff --git a/tests/test_main.py b/tests/test_main.py index cc20b26..3fd56e2 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, division, print_function, unicode_literals +import sys import textwrap import pytest @@ -12,8 +13,7 @@ def patch_conda_calls(mocker): Patches all necessary functions so that we can do integration testing without actually calling conda. """ - import subprocess - mocker.patch.object(subprocess, 'call', autospec=True, return_value=0) + mocker.patch.object(devenv, '_call_conda', autospec=True, return_value=0) mocker.patch.object(devenv, 'write_activate_deactivate_scripts', autospec=True) @@ -22,11 +22,17 @@ def patch_conda_calls(mocker): ('environment.yml', 'environment.yml'), ]) @pytest.mark.usefixtures('patch_conda_calls') -def test_handle_input_file(tmpdir, patch_conda_calls, input_name, expected_output_name): +def test_handle_input_file(tmpdir, input_name, expected_output_name): """ Test how conda-devenv handles input files: devenv.yml and pure .yml files. """ - import subprocess + argv = [] + def call_conda_mock(): + argv[:] = sys.argv[:] + return 0 + + devenv._call_conda.side_effect = call_conda_mock + filename = tmpdir.join(input_name) filename.write(textwrap.dedent('''\ name: a @@ -34,10 +40,9 @@ def test_handle_input_file(tmpdir, patch_conda_calls, input_name, expected_outpu - a_dependency ''')) assert devenv.main(['--file', str(filename), '--quiet']) == 0 - assert subprocess.call.call_count == 1 - args, kwargs = subprocess.call.call_args - cmdline = 'conda env update --file {} --prune --quiet'.format(tmpdir.join(expected_output_name)) - assert args == (cmdline.split(),) + assert devenv._call_conda.call_count == 1 + cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join(expected_output_name)) + assert argv == cmdline.split() @pytest.mark.parametrize('input_name', ['environment.devenv.yml', 'environment.yml'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 2 }
0.9
{ "env_vars": null, "env_yml_path": [], "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-datadir" ], "pre_install": [], "python": "3.6", "reqs_path": [ "requirements_dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 bump2version==1.0.1 bumpversion==0.6.0 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 -e git+https://github.com/ESSS/conda-devenv.git@f23bec79139cbb9e59e4e2bdafb27385afcee192#egg=conda_devenv coverage==6.2 cryptography==40.0.2 distlib==0.3.9 docutils==0.17.1 filelock==3.4.1 flake8==5.0.4 idna==3.10 imagesize==1.4.1 importlib-metadata==4.2.0 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mccabe==0.7.0 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pycparser==2.21 pyflakes==2.5.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytest-datadir==1.4.1 pytest-mock==3.6.1 pytz==2025.2 PyYAML==6.0.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==4.3.2 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 virtualenv==20.16.2 watchdog==2.3.1 zipp==3.6.0
name: conda-devenv channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - bump2version==1.0.1 - bumpversion==0.6.0 - cffi==1.15.1 - charset-normalizer==2.0.12 - coverage==6.2 - cryptography==40.0.2 - distlib==0.3.9 - docutils==0.17.1 - filelock==3.4.1 - flake8==5.0.4 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.2.0 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mccabe==0.7.0 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pycparser==2.21 - pyflakes==2.5.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-datadir==1.4.1 - pytest-mock==3.6.1 - pytz==2025.2 - pyyaml==6.0.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==4.3.2 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - virtualenv==20.16.2 - watchdog==2.3.1 - zipp==3.6.0 prefix: /opt/conda/envs/conda-devenv
[ "tests/test_main.py::test_handle_input_file[environment.yml-environment.yml]", "tests/test_main.py::test_print[environment.yml]" ]
[ "tests/test_main.py::test_handle_input_file[environment.devenv.yml-environment.yml]", "tests/test_main.py::test_print[environment.devenv.yml]", "tests/test_main.py::test_print_full" ]
[]
[]
MIT License
1,172
[ "HISTORY.rst", "conda_devenv/devenv.py" ]
[ "HISTORY.rst", "conda_devenv/devenv.py" ]
aws__aws-cli-2537
4c6e728030f2288fea70973ad719260d49d99e6b
2017-04-10 19:23:17
13cbb3a7e1403aec24c1d022193cbb4aa43eaf41
codecov-io: # [Codecov](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=h1) Report > Merging [#2537](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=desc) into [develop](https://codecov.io/gh/aws/aws-cli/commit/da8f5be25693108c68c63567e4cdc5436c715aa3?src=pr&el=desc) will **increase** coverage by `0.02%`. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/aws/aws-cli/pull/2537/graphs/tree.svg?src=pr&token=aKPbq1EbIm&width=650&height=150)](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## develop #2537 +/- ## =========================================== + Coverage 95.54% 95.57% +0.02% =========================================== Files 150 150 Lines 11732 11741 +9 =========================================== + Hits 11209 11221 +12 + Misses 523 520 -3 ``` | [Impacted Files](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [awscli/customizations/configure/get.py](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=tree#diff-YXdzY2xpL2N1c3RvbWl6YXRpb25zL2NvbmZpZ3VyZS9nZXQucHk=) | `98.36% <100%> (+6.05%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=footer). Last update [da8f5be...16c88fb](https://codecov.io/gh/aws/aws-cli/pull/2537?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/.changes/next-release/bugfix-configure-87594.json b/.changes/next-release/bugfix-configure-87594.json new file mode 100644 index 000000000..28b624d02 --- /dev/null +++ b/.changes/next-release/bugfix-configure-87594.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "configure", + "description": "Properly use the default profile in ``configure get``" +} diff --git a/awscli/customizations/configure/get.py b/awscli/customizations/configure/get.py index 99f1bee08..a98d95585 100644 --- a/awscli/customizations/configure/get.py +++ b/awscli/customizations/configure/get.py @@ -11,17 +11,21 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. import sys +import logging from awscli.customizations.commands import BasicCommand +from awscli.compat import six from . import PREDEFINED_SECTION_NAMES +LOG = logging.getLogger(__name__) + class ConfigureGetCommand(BasicCommand): NAME = 'get' DESCRIPTION = BasicCommand.FROM_FILE('configure', 'get', '_description.rst') - SYNOPSIS = ('aws configure get varname [--profile profile-name]') + SYNOPSIS = 'aws configure get varname [--profile profile-name]' EXAMPLES = BasicCommand.FROM_FILE('configure', 'get', '_examples.rst') ARG_TABLE = [ {'name': 'varname', @@ -30,13 +34,14 @@ class ConfigureGetCommand(BasicCommand): 'cli_type_name': 'string', 'positional_arg': True}, ] - def __init__(self, session, stream=sys.stdout): + def __init__(self, session, stream=sys.stdout, error_stream=sys.stderr): super(ConfigureGetCommand, self).__init__(session) self._stream = stream + self._error_stream = error_stream def _run_main(self, args, parsed_globals): varname = args.varname - value = None + if '.' not in varname: # get_scoped_config() returns the config variables in the config # file (not the logical_var names), which is what we want. @@ -44,17 +49,30 @@ class ConfigureGetCommand(BasicCommand): value = config.get(varname) else: value = self._get_dotted_config_value(varname) - if value is not None: + + LOG.debug(u'Config value retrieved: %s' % value) + + if isinstance(value, six.string_types): self._stream.write(value) self._stream.write('\n') return 0 + elif isinstance(value, dict): + # TODO: add support for this. We would need to print it off in + # the same format as the config file. + self._error_stream.write( + 'varname (%s) must reference a value, not a section or ' + 'sub-section.' % varname + ) + return 1 else: return 1 def _get_dotted_config_value(self, varname): parts = varname.split('.') num_dots = varname.count('.') - # Logic to deal with predefined sections like [preview], [plugin] and etc. + + # Logic to deal with predefined sections like [preview], [plugin] and + # etc. if num_dots == 1 and parts[0] in PREDEFINED_SECTION_NAMES: full_config = self._session.full_config section, config_name = varname.split('.') @@ -64,18 +82,23 @@ class ConfigureGetCommand(BasicCommand): value = full_config['profiles'].get( section, {}).get(config_name) return value + if parts[0] == 'profile': profile_name = parts[1] config_name = parts[2] remaining = parts[3:] - # Check if varname starts with 'default' profile (e.g. default.emr-dev.emr.instance_profile) - # If not, go further to check if varname starts with a known profile name - elif parts[0] == 'default' or (parts[0] in self._session.full_config['profiles']): + # Check if varname starts with 'default' profile (e.g. + # default.emr-dev.emr.instance_profile) If not, go further to check + # if varname starts with a known profile name + elif parts[0] == 'default' or ( + parts[0] in self._session.full_config['profiles']): profile_name = parts[0] config_name = parts[1] remaining = parts[2:] else: profile_name = self._session.get_config_variable('profile') + if profile_name is None: + profile_name = 'default' config_name = parts[0] remaining = parts[1:]
Reading/writing EMR key_pair_file configuration options behaves oddly Version: ``` $ aws --version aws-cli/1.11.75 Python/2.7.10 Darwin/15.6.0 botocore/1.5.38 ``` [It's suggested that one can set a default key_pair_file argument here](https://github.com/aws/aws-cli/blob/master/awscli/customizations/emr/ssh.py#L25) by running `aws configure set emr.key_pair_file <value>` By that token, I would expect `aws configure get emr.key_pair_file` to retrieve this item and to exit with a exit code of 0. ``` $ aws configure set emr.key_pair_file /tmp/foo $ cat config [default] emr = key_pair_file = /tmp/foo $ aws configure get emr.key_pair_file $ echo $? 1 ``` As you can see, setting this and trying to retrieve it exits with a non-zero exit code which makes it a pain to check for this config item being set as part of shell scripts prior to do other EMR-based commands (such as create-cluster). As an aside, trying to get the top level `emr` config item fails too; ``` $ aws configure get emr expected a character buffer object ``` Additionally this item doesn't show up when `aws configure list` is run either; ``` $ aws configure list Name Value Type Location ---- ----- ---- -------- profile <not set> None None access_key REDACTED shared-credentials-file secret_key REDACTED shared-credentials-file region <not set> None None ```
aws/aws-cli
diff --git a/tests/unit/customizations/configure/test_get.py b/tests/unit/customizations/configure/test_get.py index c2db9815e..cf34fbb4a 100644 --- a/tests/unit/customizations/configure/test_get.py +++ b/tests/unit/customizations/configure/test_get.py @@ -20,11 +20,16 @@ from . import FakeSession class TestConfigureGetCommand(unittest.TestCase): + def create_command(self, session): + stdout = six.StringIO() + stderr = six.StringIO() + command = ConfigureGetCommand(session, stdout, stderr) + return stdout, stderr, command + def test_configure_get_command(self): session = FakeSession({}) session.config['region'] = 'us-west-2' - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) config_get(args=['region'], parsed_globals=None) rendered = stream.getvalue() self.assertEqual(rendered.strip(), 'us-west-2') @@ -32,8 +37,7 @@ class TestConfigureGetCommand(unittest.TestCase): def test_configure_get_command_no_exist(self): no_vars_defined = {} session = FakeSession(no_vars_defined) - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) rc = config_get(args=['region'], parsed_globals=None) rendered = stream.getvalue() # If a config value does not exist, we don't print any output. @@ -44,8 +48,7 @@ class TestConfigureGetCommand(unittest.TestCase): def test_dotted_get(self): session = FakeSession({}) session.full_config = {'preview': {'emr': 'true'}} - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) config_get(args=['preview.emr'], parsed_globals=None) rendered = stream.getvalue() self.assertEqual(rendered.strip(), 'true') @@ -55,16 +58,16 @@ class TestConfigureGetCommand(unittest.TestCase): session.full_config = {'profiles': {'emr-dev': { 'emr': {'instance_profile': 'my_ip'}}}} session.config = {'emr': {'instance_profile': 'my_ip'}} - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) config_get(args=['emr-dev.emr.instance_profile'], parsed_globals=None) rendered = stream.getvalue() self.assertEqual(rendered.strip(), 'my_ip') def test_get_from_profile(self): session = FakeSession({}) - session.full_config = {'profiles': {'testing': {'aws_access_key_id': 'access_key'}}} - stream = six.StringIO() + session.full_config = { + 'profiles': {'testing': {'aws_access_key_id': 'access_key'}}} + stream, error_stream, config_get = self.create_command(session) config_get = ConfigureGetCommand(session, stream) config_get(args=['profile.testing.aws_access_key_id'], parsed_globals=None) @@ -75,8 +78,7 @@ class TestConfigureGetCommand(unittest.TestCase): session = FakeSession({}) session.full_config = { 'profiles': {'testing': {'s3': {'signature_version': 's3v4'}}}} - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) config_get(args=['profile.testing.s3.signature_version'], parsed_globals=None) rendered = stream.getvalue() @@ -86,8 +88,7 @@ class TestConfigureGetCommand(unittest.TestCase): session = FakeSession({}) session.full_config = { 'profiles': {'default': {'s3': {'signature_version': 's3v4'}}}} - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) config_get(args=['default.s3.signature_version'], parsed_globals=None) rendered = stream.getvalue() @@ -96,9 +97,46 @@ class TestConfigureGetCommand(unittest.TestCase): def test_get_nested_attribute_from_default_does_not_exist(self): session = FakeSession({}) session.full_config = {'profiles': {}} - stream = six.StringIO() - config_get = ConfigureGetCommand(session, stream) + stream, error_stream, config_get = self.create_command(session) config_get(args=['default.s3.signature_version'], parsed_globals=None) rendered = stream.getvalue() - self.assertEqual(rendered.strip(), '') \ No newline at end of file + self.assertEqual(rendered.strip(), '') + + def test_get_nested_attribute_from_implicit_default(self): + session = FakeSession({}) + session.full_config = { + 'profiles': {'default': {'s3': {'signature_version': 's3v4'}}}} + stream, error_stream, config_get = self.create_command(session) + config_get(args=['s3.signature_version'], + parsed_globals=None) + rendered = stream.getvalue() + self.assertEqual(rendered.strip(), 's3v4') + + def test_get_section_returns_error(self): + session = FakeSession({}) + session.full_config = { + 'profiles': {'default': {'s3': {'signature_version': 's3v4'}}}} + session.config = {'s3': {'signature_version': 's3v4'}} + stream, error_stream, config_get = self.create_command(session) + rc = config_get(args=['s3'], parsed_globals=None) + self.assertEqual(rc, 1) + + error_message = error_stream.getvalue() + expected_message = ( + 'varname (s3) must reference a value, not a section or ' + 'sub-section.') + self.assertEqual(error_message, expected_message) + self.assertEqual(stream.getvalue(), '') + + def test_get_non_string_returns_error(self): + # This should never happen, but we handle this case so we should + # test it. + session = FakeSession({}) + session.full_config = { + 'profiles': {'default': {'foo': object()}}} + stream, error_stream, config_get = self.create_command(session) + rc = config_get(args=['foo'], parsed_globals=None) + self.assertEqual(rc, 1) + self.assertEqual(stream.getvalue(), '') + self.assertEqual(error_stream.getvalue(), '')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_added_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
1.11
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/aws/aws-cli.git@4c6e728030f2288fea70973ad719260d49d99e6b#egg=awscli botocore==1.5.39 colorama==0.3.7 coverage==7.8.0 docutils==0.21.2 exceptiongroup==1.2.2 execnet==2.1.1 iniconfig==2.1.0 jmespath==0.10.0 packaging==24.2 pluggy==1.5.0 pyasn1==0.6.1 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 python-dateutil==2.9.0.post0 PyYAML==3.12 rsa==3.4.2 s3transfer==0.1.13 six==1.17.0 tomli==2.2.1 typing_extensions==4.13.0
name: aws-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - botocore==1.5.39 - colorama==0.3.7 - coverage==7.8.0 - docutils==0.21.2 - exceptiongroup==1.2.2 - execnet==2.1.1 - iniconfig==2.1.0 - jmespath==0.10.0 - packaging==24.2 - pluggy==1.5.0 - pyasn1==0.6.1 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - python-dateutil==2.9.0.post0 - pyyaml==3.12 - rsa==3.4.2 - s3transfer==0.1.13 - six==1.17.0 - tomli==2.2.1 - typing-extensions==4.13.0 prefix: /opt/conda/envs/aws-cli
[ "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_configure_get_command", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_configure_get_command_no_exist", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_dotted_get", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_dotted_get_with_profile", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_from_profile", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_nested_attribute", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_nested_attribute_from_default", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_nested_attribute_from_default_does_not_exist", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_nested_attribute_from_implicit_default", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_non_string_returns_error", "tests/unit/customizations/configure/test_get.py::TestConfigureGetCommand::test_get_section_returns_error" ]
[]
[]
[]
Apache License 2.0
1,173
[ ".changes/next-release/bugfix-configure-87594.json", "awscli/customizations/configure/get.py" ]
[ ".changes/next-release/bugfix-configure-87594.json", "awscli/customizations/configure/get.py" ]
swistakm__graceful-49
957a1c3164b91c64f4b0e64e1901536aeb2aeecd
2017-04-11 13:55:19
d7679ac81be5e8c16f17467fe27efbaabc3ac4c8
coveralls: [![Coverage Status](https://coveralls.io/builds/11035390/badge)](https://coveralls.io/builds/11035390) Coverage remained the same at 100.0% when pulling **1ff658e188518d178c0fd584f68598ce998c71bf on fix/issue-48-fix-many-fields-deserialization** into **957a1c3164b91c64f4b0e64e1901536aeb2aeecd on master**.
diff --git a/src/graceful/serializers.py b/src/graceful/serializers.py index 7af5fc3..14a0d4e 100644 --- a/src/graceful/serializers.py +++ b/src/graceful/serializers.py @@ -1,7 +1,7 @@ from collections import OrderedDict from collections.abc import Mapping, MutableMapping -from graceful.errors import DeserializationError, ValidationError +from graceful.errors import DeserializationError from graceful.fields import BaseField @@ -168,12 +168,25 @@ class BaseSerializer(metaclass=MetaSerializer): continue try: - # if field has explicitly specified source then use it - # else fallback to field name. - # Note: field does not know its name - object_dict[_source(name, field)] = field.from_representation( - representation[name] - ) + if ( + # note: we cannot check for any sequence or iterable + # because of strings and nested dicts. + not isinstance(representation[name], (list, tuple)) and + field.many + ): + raise ValueError("field should be sequence") + + source = _source(name, field) + value = representation[name] + + if field.many: + object_dict[source] = [ + field.from_representation(single_value) + for single_value in value + ] + else: + object_dict[source] = field.from_representation(value) + except ValueError as err: failed[name] = str(err) @@ -229,10 +242,17 @@ class BaseSerializer(metaclass=MetaSerializer): ] invalid = {} - for name, value in object_dict.items(): + for index, (name, value) in enumerate(object_dict.items()): try: - sources[name].validate(value) - except ValidationError as err: + field = sources[name] + + if field.many: + for single_value in value: + field.validate(single_value) + else: + field.validate(value) + + except ValueError as err: invalid[name] = str(err) if any([missing, forbidden, invalid]):
Improperly handled fields with many=True Restrict "many" field handling to lists in similar way we handle serialization.
swistakm/graceful
diff --git a/tests/test_serializers.py b/tests/test_serializers.py index 7ec4804..5e7b353 100644 --- a/tests/test_serializers.py +++ b/tests/test_serializers.py @@ -3,7 +3,9 @@ All tested serializer classes should be defined within tests because we test how whole framework for defining new serializers works. """ -from graceful.fields import BaseField +import pytest + +from graceful.fields import BaseField, StringField from graceful.serializers import BaseSerializer @@ -245,15 +247,46 @@ def test_serializer_describe(): ]) -def test_serialiser_representation_with_field_many(): +def test_serialiser_with_field_many(): class UpperField(BaseField): def to_representation(self, value): return value.upper() + def from_representation(self, data): + return data.upper() + class ExampleSerializer(BaseSerializer): up = UpperField(details='multiple values field', many=True) serializer = ExampleSerializer() - instance = {'up': ["aa", "bb", "cc"]} + obj = {'up': ["aa", "bb", "cc"]} + desired = {'up': ["AA", "BB", "CC"]} + + assert serializer.to_representation(obj) == desired + assert serializer.from_representation(obj) == desired + + with pytest.raises(ValueError): + serializer.from_representation({"up": "definitely not a sequence"}) + + +def test_serializer_many_validation(): + def is_upper(value): + if value.upper() != value: + raise ValueError("should be upper") + + class ExampleSerializer(BaseSerializer): + up = StringField( + details='multiple values field', + many=True, + validators=[is_upper] + ) + + invalid = {'up': ["aa", "bb", "cc"]} + valid = {'up': ["AA", "BB", "CC"]} + + serializer = ExampleSerializer() + + with pytest.raises(ValueError): + serializer.validate(invalid) - assert serializer.to_representation(instance) == {"up": ["AA", "BB", "CC"]} + serializer.validate(valid)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 1 }
0.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [], "python": "3.6", "reqs_path": [ "requirements-docs.txt", "requirements-tests.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.9 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 docutils==0.12 falcon==3.1.3 -e git+https://github.com/swistakm/graceful.git@957a1c3164b91c64f4b0e64e1901536aeb2aeecd#egg=graceful imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 Pygments==2.14.0 pypandoc==1.14 pyparsing==3.1.4 pytest==7.0.1 pytz==2025.2 singledispatch==3.7.0 six==1.17.0 snowballstemmer==2.2.0 Sphinx==1.4.8 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: graceful channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.9 - attrs==22.2.0 - babel==2.11.0 - docutils==0.12 - falcon==3.1.3 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pygments==2.14.0 - pypandoc==1.14 - pyparsing==3.1.4 - pytest==7.0.1 - pytz==2025.2 - singledispatch==3.7.0 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==1.4.8 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/graceful
[ "tests/test_serializers.py::test_serialiser_with_field_many", "tests/test_serializers.py::test_serializer_many_validation" ]
[]
[ "tests/test_serializers.py::test_simple_serializer_definition", "tests/test_serializers.py::test_empty_serializer_definition", "tests/test_serializers.py::test_serializer_inheritance", "tests/test_serializers.py::test_serializer_field_overriding", "tests/test_serializers.py::test_serialiser_simple_representation", "tests/test_serializers.py::test_serialiser_sources_representation", "tests/test_serializers.py::test_serializer_set_attribute", "tests/test_serializers.py::test_serializer_get_attribute", "tests/test_serializers.py::test_serializer_source_wildcard", "tests/test_serializers.py::test_serializer_source_field_with_wildcard", "tests/test_serializers.py::test_serializer_describe" ]
[]
BSD 3-Clause "New" or "Revised" License
1,174
[ "src/graceful/serializers.py" ]
[ "src/graceful/serializers.py" ]
scieloorg__packtools-122
2144acd27d2e306994515bde1321ffbeee0c4bbf
2017-04-11 20:51:49
2144acd27d2e306994515bde1321ffbeee0c4bbf
diff --git a/HISTORY.rst b/HISTORY.rst index f991788..0af685a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -13,6 +13,9 @@ History ``packtools.domain.SchematronValidator``). * The stylechecker utility exits 0 on success, and >0 if an error occurs [https://github.com/scieloorg/packtools/issues/118]. +* The values in attribute ``@country`` are checked against ISO3166 alpha-2 + list. + 1.5 (2017-04-03) diff --git a/packtools/catalogs/__init__.py b/packtools/catalogs/__init__.py index 24d655e..94ecc89 100644 --- a/packtools/catalogs/__init__.py +++ b/packtools/catalogs/__init__.py @@ -36,3 +36,6 @@ XML_CATALOG = os.path.join(_CWD, 'scielo-publishing-schema.xml') XSLTS = { 'root-html-1.2.xslt': os.path.join(_CWD, 'htmlgenerator/root-html-1.2.xslt'), } + +ISO3166_CODES = os.path.join(_CWD, 'iso3166-codes.json') + diff --git a/packtools/catalogs/iso3166-codes.json b/packtools/catalogs/iso3166-codes.json new file mode 100644 index 0000000..b9aa006 --- /dev/null +++ b/packtools/catalogs/iso3166-codes.json @@ -0,0 +1,1 @@ +["FM", "CD", "YU", "BR", "NH", "SH", "MD", "EC", "PK", "LU", "TD", "IT", "WS", "CI", "GI", "AS", "NI", "AW", "AI", "BM", "BF", "BU", "WK", "UA", "ZA", "YD", "NA", "GF", "CX", "BO", "MX", "AU", "MR", "DK", "SA", "CG", "BN", "IQ", "VG", "SS", "CY", "AE", "OM", "MF", "TP", "RH", "AM", "TN", "AT", "NF", "BE", "GG", "IM", "MZ", "SX", "PM", "ER", "GL", "PY", "PL", "RS", "SL", "KY", "JE", "MV", "FK", "SE", "GB", "VE", "NQ", "LY", "PG", "UZ", "NZ", "MO", "LA", "GN", "ML", "MH", "TF", "MC", "KI", "TK", "GR", "HV", "AX", "PT", "JO", "HU", "BI", "MQ", "YT", "PH", "LC", "SM", "SN", "CU", "AZ", "CF", "LI", "MU", "DO", "MM", "ZM", "DM", "UY", "LT", "SC", "NO", "GU", "SB", "TZ", "LV", "NU", "BL", "LS", "FQ", "JP", "MT", "PE", "IR", "QA", "KE", "VU", "HT", "KR", "ME", "RO", "EH", "ZR", "GA", "PN", "CC", "PS", "BD", "TC", "AG", "AD", "GQ", "RW", "HR", "ZW", "AQ", "BB", "DJ", "VA", "BH", "HM", "GM", "SR", "BS", "VN", "BW", "CW", "NR", "AL", "PU", "WF", "SD", "GE", "AN", "EE", "MK", "CK", "PZ", "ST", "KN", "SG", "SZ", "UM", "KH", "GY", "VD", "MI", "NP", "KW", "ES", "NG", "TJ", "KM", "PC", "SI", "SK", "TG", "FI", "PW", "IE", "TL", "TO", "JM", "TH", "IN", "TW", "TT", "CR", "UG", "VI", "KG", "BG", "IL", "DD", "ID", "KZ", "NC", "MW", "TR", "GD", "IS", "LB", "PA", "US", "JT", "GP", "CL", "KP", "MA", "LK", "BQ", "BV", "GH", "DE", "NL", "BJ", "FJ", "CH", "SO", "EG", "CM", "FO", "DY", "YE", "FR", "BT", "MS", "IO", "BY", "GW", "AF", "CS", "HN", "RU", "VC", "HK", "BZ", "PR", "SJ", "MY", "SY", "SV", "BA", "GT", "TV", "RE", "DZ", "MG", "AO", "CO", "PF", "LR", "CA", "AR", "CZ", "NE", "ET", "TM", "CT", "MP", "NT", "GS", "CV", "CN", "MN"] \ No newline at end of file diff --git a/packtools/checks.py b/packtools/checks.py index 19ce822..2d2cf4d 100644 --- a/packtools/checks.py +++ b/packtools/checks.py @@ -2,15 +2,21 @@ from __future__ import unicode_literals import logging import itertools +import json import plumber from .style_errors import StyleError +from . import catalogs LOGGER = logging.getLogger(__name__) +with open(catalogs.ISO3166_CODES) as f: + ISO3166_CODES_SET = set(json.load(f)) + + # -------------------------------- # Basic functionality # -------------------------------- @@ -36,7 +42,7 @@ def teardown(message): def StyleCheckingPipeline(): """Factory for style checking pipelines. """ - return plumber.Pipeline(setup, funding_group, doctype, teardown) + return plumber.Pipeline(setup, funding_group, doctype, country_code, teardown) # -------------------------------- @@ -135,3 +141,21 @@ def doctype(message): return message + [email protected] +def country_code(message): + """Check country codes against iso3166 alpha-2 list. + """ + et, err_list = message + + elements = et.findall('//*[@country]') + for elem in elements: + value = elem.attrib['country'] + if value not in ISO3166_CODES_SET: + err = StyleError() + err.line = elem.sourceline + err.message = "Element '%s', attribute country: Invalid country code \"%s\"." % (elem.tag, value) + err_list.append(err) + + return message +
Acusar erro quando atributo de @country estiver em minúsculo Style não acusa erro quando atributo de @country="br".
scieloorg/packtools
diff --git a/tests/test_checks.py b/tests/test_checks.py index def4e34..5c59f5e 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -419,3 +419,89 @@ class DoctypePipeTests(unittest.TestCase): self.assertEqual(len(err_list), 0) + +class CountryCodesTests(unittest.TestCase): + + def test_valid_code(self): + sample = io.BytesIO(b""" + <article> + <front> + <article-meta> + <aff id="aff1"> + <label>I</label> + <institution content-type="orgdiv2">Departamento de Fonoaudiologia</institution> + <institution content-type="orgdiv1">Faculdade de Medicina</institution> + <institution content-type="orgname">Universidade Federal do Rio de Janeiro</institution> + <addr-line> + <named-content content-type="city">Rio de Janeiro</named-content> + <named-content content-type="state">RJ</named-content> + </addr-line> + <country country="BR">Brasil</country> + <institution content-type="original">Departamento de Fonoaudiologia. Faculdade de Medicina. Universidade Federal do Rio de Janeiro. Rio de Janeiro, RJ, Brasil</institution> + </aff> + </article-meta> + </front> + </article> + """) + + et = etree.parse(sample) + _, err_list = checks.country_code((et, [])) + + self.assertEqual(len(err_list), 0) + + def test_valid_code_in_lowercase(self): + sample = io.BytesIO(b""" + <article> + <front> + <article-meta> + <aff id="aff1"> + <label>I</label> + <institution content-type="orgdiv2">Departamento de Fonoaudiologia</institution> + <institution content-type="orgdiv1">Faculdade de Medicina</institution> + <institution content-type="orgname">Universidade Federal do Rio de Janeiro</institution> + <addr-line> + <named-content content-type="city">Rio de Janeiro</named-content> + <named-content content-type="state">RJ</named-content> + </addr-line> + <country country="br">Brasil</country> + <institution content-type="original">Departamento de Fonoaudiologia. Faculdade de Medicina. Universidade Federal do Rio de Janeiro. Rio de Janeiro, RJ, Brasil</institution> + </aff> + </article-meta> + </front> + </article> + """) + + et = etree.parse(sample) + _, err_list = checks.country_code((et, [])) + + self.assertEqual(len(err_list), 1) + self.assertTrue("country" in err_list[0].message) + + def test_invalid_code(self): + sample = io.BytesIO(b""" + <article> + <front> + <article-meta> + <aff id="aff1"> + <label>I</label> + <institution content-type="orgdiv2">Departamento de Fonoaudiologia</institution> + <institution content-type="orgdiv1">Faculdade de Medicina</institution> + <institution content-type="orgname">Universidade Federal do Rio de Janeiro</institution> + <addr-line> + <named-content content-type="city">Rio de Janeiro</named-content> + <named-content content-type="state">RJ</named-content> + </addr-line> + <country country="INVALID">Brasil</country> + <institution content-type="original">Departamento de Fonoaudiologia. Faculdade de Medicina. Universidade Federal do Rio de Janeiro. Rio de Janeiro, RJ, Brasil</institution> + </aff> + </article-meta> + </front> + </article> + """) + + et = etree.parse(sample) + _, err_list = checks.country_code((et, [])) + + self.assertEqual(len(err_list), 1) + self.assertTrue("country" in err_list[0].message) +
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 3 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work lxml==5.3.1 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work -e git+https://github.com/scieloorg/packtools.git@2144acd27d2e306994515bde1321ffbeee0c4bbf#egg=packtools picles.plumber==0.11 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: packtools channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - lxml==5.3.1 - picles-plumber==0.11 prefix: /opt/conda/envs/packtools
[ "tests/test_checks.py::CountryCodesTests::test_invalid_code", "tests/test_checks.py::CountryCodesTests::test_valid_code", "tests/test_checks.py::CountryCodesTests::test_valid_code_in_lowercase" ]
[]
[ "tests/test_checks.py::SetupTests::test_message_is_splitted", "tests/test_checks.py::TeardownTests::test_returns_errorlist", "tests/test_checks.py::FundingGroupPipeTests::test_fn_p_and_awardid_with_no_content", "tests/test_checks.py::FundingGroupPipeTests::test_fn_p_with_no_content", "tests/test_checks.py::FundingGroupPipeTests::test_fn_p_with_no_content_with_funding_group", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_1_case_1", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_1_case_2", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_1_case_3", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_1_case_4", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_3_case_1", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_3_case_2", "tests/test_checks.py::FundingGroupPipeTests::test_proposition_3_case_3", "tests/test_checks.py::FundingGroupPipeTests::test_valid_with_contractno_after_formatting_markup", "tests/test_checks.py::FundingGroupPipeTests::test_valid_with_contractno_after_formatting_markup_as_first_element", "tests/test_checks.py::DoctypePipeTests::test_doctype", "tests/test_checks.py::DoctypePipeTests::test_missing_doctype" ]
[]
BSD 2-Clause "Simplified" License
1,175
[ "HISTORY.rst", "packtools/catalogs/iso3166-codes.json", "packtools/checks.py", "packtools/catalogs/__init__.py" ]
[ "HISTORY.rst", "packtools/catalogs/iso3166-codes.json", "packtools/checks.py", "packtools/catalogs/__init__.py" ]
mailgun__talon-135
0b55e8fa778ef3927b68a542ee4f3e289549cd83
2017-04-12 04:08:10
0b55e8fa778ef3927b68a542ee4f3e289549cd83
diff --git a/talon/quotations.py b/talon/quotations.py index 6016310..9286209 100644 --- a/talon/quotations.py +++ b/talon/quotations.py @@ -146,6 +146,14 @@ RE_ANDROID_WROTE = re.compile(u'[\s]*[-]+.*({})[ ]*[-]+'.format( 'wrote' ))), re.I) +# Support polymail.io reply format +# On Tue, Apr 11, 2017 at 10:07 PM John Smith +# +# < +# mailto:John Smith <[email protected]> +# > wrote: +RE_POLYMAIL = re.compile('On.*\s{2}<\smailto:.*\s> wrote:', re.I) + SPLITTER_PATTERNS = [ RE_ORIGINAL_MESSAGE, RE_ON_DATE_SMB_WROTE, @@ -162,7 +170,8 @@ SPLITTER_PATTERNS = [ '( \S+){3,6}@\S+:'), # Sent from Samsung MobileName <[email protected]> wrote: re.compile('Sent from Samsung .*@.*> wrote'), - RE_ANDROID_WROTE + RE_ANDROID_WROTE, + RE_POLYMAIL ] RE_LINK = re.compile('<(http://[^>]*)>') @@ -170,7 +179,7 @@ RE_NORMALIZED_LINK = re.compile('@@(http://[^>@]*)@@') RE_PARENTHESIS_LINK = re.compile("\(https?://") -SPLITTER_MAX_LINES = 4 +SPLITTER_MAX_LINES = 6 MAX_LINES_COUNT = 1000 # an extensive research shows that exceeding this limit # leads to excessive processing time
Quotes extraction failed with Polymail replies Replies initiated from [polymail](https://polymail.io/) do not extract the quoted text. Steps to reproduce: 1. Send a message to yourself using polymail 2. Read that message in gmail and reply to it 3. Read the message in polymail and reply to it 4. Get the original message and test on [talon testing site](http://talon.mailgun.net/). Example: ``` Return-Path: <[email protected]> Received: from localhost (ec2-54-158-139-194.compute-1.amazonaws.com. [54.158.139.194]) by smtp.gmail.com with ESMTPSA id q32sm10037057qtd.5.2017.04.11.19.08.54 for <[email protected]> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 19:08:55 -0700 (PDT) Mime-Version: 1.0 X-Mailer: Polymail Message-ID: <[email protected]> Subject: Re: Test From: Ethan Setnik <xxxxgmail.com> To: Ethan Setnik <[email protected]> Date: Tue, 11 Apr 2017 19:08:45 -0700 In-Reply-To: <CAKzr07V771zMRYAE9m9yU1NqnGGtkbmUSOvWWz84J2O+i5-ubg@mail.gmail.com> References: <CAKzr07V771zMRYAE9m9yU1NqnGGtkbmUSOvWWz84J2O+i5-ubg@mail.gmail.com> Content-Type: multipart/alternative; boundary=379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a --379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 This is the reply from Polymail On Tue, Apr 11, 2017 at 10:07 PM Ethan Setnik < mailto:Ethan Setnik <[email protected]> > wrote: a, pre, code, a:link, body { word-wrap: break-word !important; } This is the reply On Tue, Apr 11, 2017 at 10:07 PM Ethan Setnik < mailto:[email protected] > wrote: This is the initial message --379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8 <img style=3D"border: none; background:none; width: 0; height: 0;" src=3D"h= ttps://share.polymail.io/v2/z/a/NThlZDhjMDcwMGJm/y6ry9vAsZIPxUbBfihWq6SToKm= 8ok2BlbhzkP296GDPgMIHiWWU4BGEw66uif81ucgL4a8UOrQQwwC_UjBeGCbM9In5alO4MMVE8t= vBv8AZYGvniUINmkwConAMIHC8HJqpDarTqW6RRpNOc.png" alt=3D"" width=3D"0px" hei= ght=3D"0px" border=3D"0" /><div></div> <div> This is the reply from Polymail<br><br> </div> <div id=3D"psignature"><br></div> <div class=3D"gmail_extra"><br><div class=3D"gmail_quote"><div dir=3D"ltr">= On Tue, Apr 11, 2017 at 10:07 PM Ethan Setnik <[email protected]> &lt;<a hr= ef=3D"mailto:Ethan Setnik <[email protected]>">Ethan Setnik <xxxxx@gmail.= com></a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar= gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><!DOCTYPE html>= <html><head><meta name=3D"viewport" content=3D"width=3Ddevice-width"><style= >a, pre, code, a:link, body { word-wrap: break-word !important; }</style></= head><body> <div dir=3D"ltr">This is the reply</div> <br><div class=3D"gmail_quote"></div> </body></html><div dir=3D"ltr">On Tue, Apr 11, 2017 at 10:07 PM Ethan Setni= k &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:= <br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord= er-left:1px #ccc solid;padding-left:1ex"><img style=3D"border:none;backgrou= nd:none;width:0;height:0" src=3D"https://ci4.googleusercontent.com/proxy/JX= XTuFue-6g3aDYP_klLyNmTSWdgpANzRviNIzs2xpEC3ZMdoU8vXxg9DwFJpUnjRTFU6s4roA3f7= IW_t3ZahYdgJo_3GAl4qZoNqEse6VsyfI6rmoLF5dB2iRmlV1GUNQgdinzLxOFTi_ycHjBzJQ-r= vKcMqnQAw3tD9GyeqniSbhysEgK2xMhP4OakJkFptqHAzVbC3TClDGj_UN617anYUW0043qgREP= JDoT0wBMyTqNruExX68G_alPEZjE-VN3Xr_X3sb4EwxlEoIEU30xD9KHS7tnGwkB9BN0=3Ds0-d= -e1-ft#https://share.polymail.io/v2/z/a/NThlZDhiYjVjZDU1/OoigMTRZhepebW8cok= gLWKlfeOn7lYi8eweMZ5IXUoacBlsPJJOLaoXSc0u1N-c2QTywVrJgUzzUmzFmBx1UwiHWkaj_W= gHTH6qG4m-Eo_t1ETpIvzwZKvwaUKsm_3VFDUQj4i5HZZojujdK.png" alt=3D"" width=3D"= 0px" height=3D"0px" border=3D"0" class=3D"gmail_msg">This is the initial me= ssage</blockquote></div></div></blockquote></div><br></div> --379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a-- ```
mailgun/talon
diff --git a/tests/text_quotations_test.py b/tests/text_quotations_test.py index 7a81c99..c02c375 100644 --- a/tests/text_quotations_test.py +++ b/tests/text_quotations_test.py @@ -35,6 +35,19 @@ On 11-Apr-2011, at 6:54 PM, Roman Tkachenko <[email protected]> wrote: eq_("Test reply", quotations.extract_from_plain(msg_body)) +def test_pattern_on_date_polymail(): + msg_body = """Test reply + +On Tue, Apr 11, 2017 at 10:07 PM John Smith + +< +mailto:John Smith <[email protected]> +> wrote: +Test quoted data +""" + + eq_("Test reply", quotations.extract_from_plain(msg_body)) + def test_pattern_sent_from_samsung_smb_wrote(): msg_body = """Test reply @@ -54,7 +67,7 @@ def test_pattern_on_date_wrote_somebody(): """Lorem Op 13-02-2014 3:18 schreef Julius Caesar <[email protected]>: - + Veniam laborum mlkshk kale chips authentic. Normcore mumblecore laboris, fanny pack readymade eu blog chia pop-up freegan enim master cleanse. """)) @@ -256,7 +269,7 @@ def test_with_indent(): ------On 12/29/1987 17:32 PM, Julius Caesar wrote----- -Brunch mumblecore pug Marfa tofu, irure taxidermy hoodie readymade pariatur. +Brunch mumblecore pug Marfa tofu, irure taxidermy hoodie readymade pariatur. """ eq_("YOLO salvia cillum kogi typewriter mumblecore cardigan skateboard Austin.", quotations.extract_from_plain(msg_body)) @@ -381,11 +394,11 @@ Veniam laborum mlkshk kale chips authentic. Normcore mumblecore laboris, fanny p def test_dutch_from_block(): eq_('Gluten-free culpa lo-fi et nesciunt nostrud.', quotations.extract_from_plain( - """Gluten-free culpa lo-fi et nesciunt nostrud. + """Gluten-free culpa lo-fi et nesciunt nostrud. Op 17-feb.-2015, om 13:18 heeft Julius Caesar <[email protected]> het volgende geschreven: - -Small batch beard laboris tempor, non listicle hella Tumblr heirloom. + +Small batch beard laboris tempor, non listicle hella Tumblr heirloom. """))
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_media" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 1 }, "num_modified_files": 1 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "lxml>=2.3.3 regex>=1 numpy scipy scikit-learn>=0.16.1 chardet>=1.0.1 cchardet>=0.3.5 cssselect six>=1.10.0 html5lib mock nose>=1.2.1 coverage", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
cchardet @ file:///croot/cchardet_1736182485390/work chardet @ file:///tmp/build/80754af9/chardet_1607706775000/work coverage @ file:///croot/coverage_1734018327576/work cssselect @ file:///croot/cssselect_1707339882883/work exceptiongroup==1.2.2 html5lib @ file:///Users/ktietz/demo/mc3/conda-bld/html5lib_1629144453894/work iniconfig==2.1.0 joblib @ file:///croot/joblib_1718217211762/work lxml @ file:///croot/lxml_1737039601731/work mock @ file:///tmp/build/80754af9/mock_1607622725907/work nose @ file:///opt/conda/conda-bld/nose_1642704612149/work numpy @ file:///croot/numpy_and_numpy_base_1736283260865/work/dist/numpy-2.0.2-cp39-cp39-linux_x86_64.whl#sha256=3387e3e62932fa288bc18e8f445ce19e998b418a65ed2064dd40a054f976a6c7 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 regex @ file:///croot/regex_1736540786412/work scikit-learn @ file:///croot/scikit-learn_1737988764076/work scipy @ file:///croot/scipy_1733756309941/work/dist/scipy-1.13.1-cp39-cp39-linux_x86_64.whl#sha256=3b247b926209f2d9f719ebae39faf3ff891b2596150ed8f8349adfc3eb19441c six @ file:///tmp/build/80754af9/six_1644875935023/work -e git+https://github.com/mailgun/talon.git@0b55e8fa778ef3927b68a542ee4f3e289549cd83#egg=talon threadpoolctl @ file:///croot/threadpoolctl_1719407800858/work tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work webencodings==0.5.1
name: talon channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - blas=1.0=openblas - ca-certificates=2025.2.25=h06a4308_0 - cchardet=2.1.7=py39h6a678d5_1 - chardet=4.0.0=py39h06a4308_1003 - coverage=7.6.9=py39h5eee18b_0 - cssselect=1.2.0=py39h06a4308_0 - html5lib=1.1=pyhd3eb1b0_0 - icu=73.1=h6a678d5_0 - joblib=1.4.2=py39h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgfortran-ng=11.2.0=h00389a5_1 - libgfortran5=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libopenblas=0.3.21=h043d6bf_0 - libstdcxx-ng=11.2.0=h1234567_1 - libxml2=2.13.5=hfdd30dd_0 - libxslt=1.1.41=h097e994_0 - lxml=5.3.0=py39h57af460_1 - mock=4.0.3=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - nose=1.3.7=pyhd3eb1b0_1008 - numpy=2.0.2=py39heeff2f4_0 - numpy-base=2.0.2=py39h8a23956_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - pybind11-abi=4=hd3eb1b0_1 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - regex=2024.11.6=py39h5eee18b_0 - scikit-learn=1.6.1=py39h6a678d5_0 - scipy=1.13.1=py39heeff2f4_1 - setuptools=72.1.0=py39h06a4308_0 - six=1.16.0=pyhd3eb1b0_1 - sqlite=3.45.3=h5eee18b_0 - threadpoolctl=3.5.0=py39h2f386ee_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - webencodings=0.5.1=py39h06a4308_1 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 prefix: /opt/conda/envs/talon
[ "tests/text_quotations_test.py::test_pattern_on_date_polymail" ]
[]
[ "tests/text_quotations_test.py::test_too_many_lines", "tests/text_quotations_test.py::test_pattern_on_date_somebody_wrote", "tests/text_quotations_test.py::test_pattern_sent_from_samsung_smb_wrote", "tests/text_quotations_test.py::test_pattern_on_date_wrote_somebody", "tests/text_quotations_test.py::test_pattern_on_date_somebody_wrote_date_with_slashes", "tests/text_quotations_test.py::test_date_time_email_splitter", "tests/text_quotations_test.py::test_pattern_on_date_somebody_wrote_allows_space_in_front", "tests/text_quotations_test.py::test_pattern_on_date_somebody_sent", "tests/text_quotations_test.py::test_line_starts_with_on", "tests/text_quotations_test.py::test_reply_and_quotation_splitter_share_line", "tests/text_quotations_test.py::test_english_original_message", "tests/text_quotations_test.py::test_german_original_message", "tests/text_quotations_test.py::test_danish_original_message", "tests/text_quotations_test.py::test_reply_after_quotations", "tests/text_quotations_test.py::test_android_wrote", "tests/text_quotations_test.py::test_reply_wraps_quotations", "tests/text_quotations_test.py::test_reply_wraps_nested_quotations", "tests/text_quotations_test.py::test_quotation_separator_takes_2_lines", "tests/text_quotations_test.py::test_quotation_separator_takes_3_lines", "tests/text_quotations_test.py::test_short_quotation", "tests/text_quotations_test.py::test_with_indent", "tests/text_quotations_test.py::test_short_quotation_with_newline", "tests/text_quotations_test.py::test_pattern_date_email_with_unicode", "tests/text_quotations_test.py::test_english_from_block", "tests/text_quotations_test.py::test_german_from_block", "tests/text_quotations_test.py::test_french_multiline_from_block", "tests/text_quotations_test.py::test_french_from_block", "tests/text_quotations_test.py::test_polish_from_block", "tests/text_quotations_test.py::test_danish_from_block", "tests/text_quotations_test.py::test_swedish_from_block", "tests/text_quotations_test.py::test_swedish_from_line", "tests/text_quotations_test.py::test_norwegian_from_line", "tests/text_quotations_test.py::test_dutch_from_block", "tests/text_quotations_test.py::test_quotation_marker_false_positive", "tests/text_quotations_test.py::test_link_closed_with_quotation_marker_on_new_line", "tests/text_quotations_test.py::test_link_breaks_quotation_markers_sequence", "tests/text_quotations_test.py::test_from_block_starts_with_date", "tests/text_quotations_test.py::test_bold_from_block", "tests/text_quotations_test.py::test_weird_date_format_in_date_block", "tests/text_quotations_test.py::test_dont_parse_quotations_for_forwarded_messages", "tests/text_quotations_test.py::test_forwarded_message_in_quotations", "tests/text_quotations_test.py::test_mark_message_lines", "tests/text_quotations_test.py::test_process_marked_lines", "tests/text_quotations_test.py::test_preprocess", "tests/text_quotations_test.py::test_preprocess_postprocess_2_links", "tests/text_quotations_test.py::test_split_email" ]
[]
Apache License 2.0
1,176
[ "talon/quotations.py" ]
[ "talon/quotations.py" ]
dask__dask-2205
0d741d79e02281c3c145636c2cad972fb247de7d
2017-04-12 12:32:12
bdb021c7dcd94ae1fa51c82fae6cf4cf7319aa14
mrocklin: OK with the assert_eq change? pitrou: Yes, of course.
diff --git a/dask/array/rechunk.py b/dask/array/rechunk.py index de5da0f68..eea5470ff 100644 --- a/dask/array/rechunk.py +++ b/dask/array/rechunk.py @@ -18,6 +18,7 @@ from toolz import accumulate, reduce from ..base import tokenize from .core import concatenate3, Array, normalize_chunks +from .wrap import empty from .. import sharedict @@ -484,6 +485,10 @@ def plan_rechunk(old_chunks, new_chunks, itemsize, def _compute_rechunk(x, chunks): """ Compute the rechunk of *x* to the given *chunks*. """ + if x.size == 0: + # Special case for empty array, as the algorithm below does not behave correctly + return empty(x.shape, chunks=chunks, dtype=x.dtype) + ndim = x.ndim crossed = intersect_chunks(x.chunks, chunks) x2 = dict()
Reshape with empty dimensions Reshaping with zero dimensions fails ```python def test_reshape_empty(): x = da.ones((0, 10), chunks=(5, 5)) y = x.reshape((0, 5, 2)) assert_eq(x, x) ``` I've tracked this down to the fact that this line returns a list with one empty list ```python def intersect_chunks(...): ... old_to_new = [_intersect_1d(_breakpoints(old, new)) for old, new in zip(cmo, cmn)] ``` So the subsequent call to `itertools.product` returns an empty result. I tried diving into `_intersect_1d` but had difficulty understanding the intent or the expected output. @pitrou if you feel like looking this I would appreciate it. Totally OK if not. Otherwise I will resolve it later today.
dask/dask
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py index 86686843b..a68e45d72 100644 --- a/dask/array/tests/test_array_core.py +++ b/dask/array/tests/test_array_core.py @@ -788,6 +788,10 @@ def test_roll(chunks, shift, axis): ((4, 64), (4, 8, 4, 2), (2, 16)), ((4, 8, 4, 2), (2, 1, 2, 32, 2), (2, 4, 2, 2)), ((4, 1, 4), (4, 4), (2, 1, 2)), + ((0, 10), (0, 5, 2), (5, 5)), + ((5, 0, 2), (0, 10), (5, 2, 2)), + ((0,), (2, 0, 2), (4,)), + ((2, 0, 2), (0,), (4, 4, 4)), ]) def test_reshape(original_shape, new_shape, chunks): x = np.random.randint(10, size=original_shape) diff --git a/dask/array/tests/test_rechunk.py b/dask/array/tests/test_rechunk.py index 01fdcee7a..967f6ce9c 100644 --- a/dask/array/tests/test_rechunk.py +++ b/dask/array/tests/test_rechunk.py @@ -6,6 +6,7 @@ np = pytest.importorskip('numpy') import dask from dask.utils import funcname +from dask.array.utils import assert_eq from dask.array.rechunk import intersect_chunks, rechunk, normalize_chunks from dask.array.rechunk import cumdims_label, _breakpoints, _intersect_1d from dask.array.rechunk import plan_rechunk, divide_to_width, merge_to_number @@ -184,6 +185,13 @@ def test_rechunk_0d(): assert y.compute() == a +def test_rechunk_empty(): + x = da.ones((0, 10), chunks=(5, 5)) + y = x.rechunk((2, 2)) + assert y.chunks == ((0,), (2,) * 5) + assert_eq(x, y) + + def test_rechunk_same(): x = da.ones((24, 24), chunks=(4, 8)) y = x.rechunk(x.chunks)
{ "commit_name": "merge_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
1.16
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[complete]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "moto", "mock" ], "pre_install": null, "python": "3.6", "reqs_path": [ "docs/requirements-docs.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiobotocore==2.1.2 aiohttp==3.8.6 aioitertools==0.11.0 aiosignal==1.2.0 alabaster==0.7.13 async-timeout==4.0.2 asynctest==0.13.0 attrs==22.2.0 Babel==2.11.0 boto3==1.23.10 botocore==1.23.24 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 click==8.0.4 cloudpickle==2.2.1 cryptography==40.0.2 -e git+https://github.com/dask/dask.git@0d741d79e02281c3c145636c2cad972fb247de7d#egg=dask dataclasses==0.8 distributed==1.19.3 docutils==0.18.1 frozenlist==1.2.0 fsspec==2022.1.0 HeapDict==1.0.1 idna==3.10 idna-ssl==1.1.0 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 jmespath==0.10.0 locket==1.0.0 MarkupSafe==2.0.1 mock==5.2.0 moto==4.0.13 msgpack-python==0.5.6 multidict==5.2.0 numpy==1.19.5 numpydoc==1.1.0 packaging==21.3 pandas==1.1.5 partd==1.2.0 pluggy==1.0.0 psutil==7.0.0 py==1.11.0 pycparser==2.21 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 requests==2.27.1 responses==0.17.0 s3fs==2022.1.0 s3transfer==0.5.2 six==1.17.0 snowballstemmer==2.2.0 sortedcontainers==2.4.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tblib==1.7.0 tomli==1.2.3 toolz==0.12.0 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 Werkzeug==2.0.3 wrapt==1.16.0 xmltodict==0.14.2 yarl==1.7.2 zict==2.1.0 zipp==3.6.0
name: dask channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiobotocore==2.1.2 - aiohttp==3.8.6 - aioitertools==0.11.0 - aiosignal==1.2.0 - alabaster==0.7.13 - async-timeout==4.0.2 - asynctest==0.13.0 - attrs==22.2.0 - babel==2.11.0 - boto3==1.23.10 - botocore==1.23.24 - cffi==1.15.1 - charset-normalizer==2.0.12 - click==8.0.4 - cloudpickle==2.2.1 - cryptography==40.0.2 - dataclasses==0.8 - distributed==1.19.3 - docutils==0.18.1 - frozenlist==1.2.0 - fsspec==2022.1.0 - heapdict==1.0.1 - idna==3.10 - idna-ssl==1.1.0 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - jmespath==0.10.0 - locket==1.0.0 - markupsafe==2.0.1 - mock==5.2.0 - moto==4.0.13 - msgpack-python==0.5.6 - multidict==5.2.0 - numpy==1.19.5 - numpydoc==1.1.0 - packaging==21.3 - pandas==1.1.5 - partd==1.2.0 - pluggy==1.0.0 - psutil==7.0.0 - py==1.11.0 - pycparser==2.21 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - requests==2.27.1 - responses==0.17.0 - s3fs==2022.1.0 - s3transfer==0.5.2 - six==1.17.0 - snowballstemmer==2.2.0 - sortedcontainers==2.4.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tblib==1.7.0 - tomli==1.2.3 - toolz==0.12.0 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - werkzeug==2.0.3 - wrapt==1.16.0 - xmltodict==0.14.2 - yarl==1.7.2 - zict==2.1.0 - zipp==3.6.0 prefix: /opt/conda/envs/dask
[ "dask/array/tests/test_array_core.py::test_reshape[original_shape31-new_shape31-chunks31]", "dask/array/tests/test_rechunk.py::test_rechunk_empty" ]
[ "dask/array/tests/test_array_core.py::test_field_access", "dask/array/tests/test_array_core.py::test_field_access_with_shape", "dask/array/tests/test_array_core.py::test_setitem_mixed_d" ]
[ "dask/array/tests/test_array_core.py::test_getem", "dask/array/tests/test_array_core.py::test_top", "dask/array/tests/test_array_core.py::test_top_supports_broadcasting_rules", "dask/array/tests/test_array_core.py::test_concatenate3_on_scalars", "dask/array/tests/test_array_core.py::test_chunked_dot_product", "dask/array/tests/test_array_core.py::test_chunked_transpose_plus_one", "dask/array/tests/test_array_core.py::test_transpose", "dask/array/tests/test_array_core.py::test_broadcast_dimensions_works_with_singleton_dimensions", "dask/array/tests/test_array_core.py::test_broadcast_dimensions", "dask/array/tests/test_array_core.py::test_Array", "dask/array/tests/test_array_core.py::test_uneven_chunks", "dask/array/tests/test_array_core.py::test_numblocks_suppoorts_singleton_block_dims", "dask/array/tests/test_array_core.py::test_keys", "dask/array/tests/test_array_core.py::test_Array_computation", "dask/array/tests/test_array_core.py::test_stack", "dask/array/tests/test_array_core.py::test_short_stack", "dask/array/tests/test_array_core.py::test_stack_scalars", "dask/array/tests/test_array_core.py::test_stack_rechunk", "dask/array/tests/test_array_core.py::test_concatenate", "dask/array/tests/test_array_core.py::test_concatenate_rechunk", "dask/array/tests/test_array_core.py::test_concatenate_fixlen_strings", "dask/array/tests/test_array_core.py::test_vstack", "dask/array/tests/test_array_core.py::test_hstack", "dask/array/tests/test_array_core.py::test_dstack", "dask/array/tests/test_array_core.py::test_take", "dask/array/tests/test_array_core.py::test_compress", "dask/array/tests/test_array_core.py::test_binops", "dask/array/tests/test_array_core.py::test_isnull", "dask/array/tests/test_array_core.py::test_isclose", "dask/array/tests/test_array_core.py::test_broadcast_shapes", "dask/array/tests/test_array_core.py::test_elemwise_on_scalars", "dask/array/tests/test_array_core.py::test_partial_by_order", "dask/array/tests/test_array_core.py::test_elemwise_with_ndarrays", "dask/array/tests/test_array_core.py::test_elemwise_differently_chunked", "dask/array/tests/test_array_core.py::test_operators", "dask/array/tests/test_array_core.py::test_operator_dtype_promotion", "dask/array/tests/test_array_core.py::test_tensordot", "dask/array/tests/test_array_core.py::test_tensordot_2[0]", "dask/array/tests/test_array_core.py::test_tensordot_2[1]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes2]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes3]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes4]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes5]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes6]", "dask/array/tests/test_array_core.py::test_dot_method", "dask/array/tests/test_array_core.py::test_T", "dask/array/tests/test_array_core.py::test_norm", "dask/array/tests/test_array_core.py::test_choose", "dask/array/tests/test_array_core.py::test_where", "dask/array/tests/test_array_core.py::test_where_has_informative_error", "dask/array/tests/test_array_core.py::test_coarsen", "dask/array/tests/test_array_core.py::test_coarsen_with_excess", "dask/array/tests/test_array_core.py::test_insert", "dask/array/tests/test_array_core.py::test_multi_insert", "dask/array/tests/test_array_core.py::test_broadcast_to", "dask/array/tests/test_array_core.py::test_ravel", "dask/array/tests/test_array_core.py::test_roll[None-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_reshape[original_shape0-new_shape0-chunks0]", "dask/array/tests/test_array_core.py::test_reshape[original_shape1-new_shape1-5]", "dask/array/tests/test_array_core.py::test_reshape[original_shape2-new_shape2-5]", "dask/array/tests/test_array_core.py::test_reshape[original_shape3-new_shape3-12]", "dask/array/tests/test_array_core.py::test_reshape[original_shape4-new_shape4-12]", "dask/array/tests/test_array_core.py::test_reshape[original_shape5-new_shape5-chunks5]", "dask/array/tests/test_array_core.py::test_reshape[original_shape6-new_shape6-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape7-new_shape7-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape8-new_shape8-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape9-new_shape9-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape10-new_shape10-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape11-new_shape11-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape12-new_shape12-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape13-new_shape13-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape14-new_shape14-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape15-new_shape15-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape16-new_shape16-chunks16]", "dask/array/tests/test_array_core.py::test_reshape[original_shape17-new_shape17-3]", "dask/array/tests/test_array_core.py::test_reshape[original_shape18-new_shape18-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape19-new_shape19-chunks19]", "dask/array/tests/test_array_core.py::test_reshape[original_shape20-new_shape20-1]", "dask/array/tests/test_array_core.py::test_reshape[original_shape21-new_shape21-1]", "dask/array/tests/test_array_core.py::test_reshape[original_shape22-new_shape22-24]", "dask/array/tests/test_array_core.py::test_reshape[original_shape23-new_shape23-6]", "dask/array/tests/test_array_core.py::test_reshape[original_shape24-new_shape24-6]", "dask/array/tests/test_array_core.py::test_reshape[original_shape25-new_shape25-6]", "dask/array/tests/test_array_core.py::test_reshape[original_shape26-new_shape26-chunks26]", "dask/array/tests/test_array_core.py::test_reshape[original_shape27-new_shape27-chunks27]", "dask/array/tests/test_array_core.py::test_reshape[original_shape28-new_shape28-chunks28]", "dask/array/tests/test_array_core.py::test_reshape[original_shape29-new_shape29-chunks29]", "dask/array/tests/test_array_core.py::test_reshape[original_shape30-new_shape30-chunks30]", "dask/array/tests/test_array_core.py::test_reshape[original_shape32-new_shape32-chunks32]", "dask/array/tests/test_array_core.py::test_reshape[original_shape33-new_shape33-chunks33]", "dask/array/tests/test_array_core.py::test_reshape[original_shape34-new_shape34-chunks34]", "dask/array/tests/test_array_core.py::test_reshape_exceptions", "dask/array/tests/test_array_core.py::test_reshape_splat", "dask/array/tests/test_array_core.py::test_reshape_fails_for_dask_only", "dask/array/tests/test_array_core.py::test_reshape_unknown_dimensions", "dask/array/tests/test_array_core.py::test_full", "dask/array/tests/test_array_core.py::test_map_blocks", "dask/array/tests/test_array_core.py::test_map_blocks2", "dask/array/tests/test_array_core.py::test_map_blocks_with_constants", "dask/array/tests/test_array_core.py::test_map_blocks_with_kwargs", "dask/array/tests/test_array_core.py::test_map_blocks_with_chunks", "dask/array/tests/test_array_core.py::test_map_blocks_dtype_inference", "dask/array/tests/test_array_core.py::test_fromfunction", "dask/array/tests/test_array_core.py::test_from_function_requires_block_args", "dask/array/tests/test_array_core.py::test_repr", "dask/array/tests/test_array_core.py::test_slicing_with_ellipsis", "dask/array/tests/test_array_core.py::test_slicing_with_ndarray", "dask/array/tests/test_array_core.py::test_dtype", "dask/array/tests/test_array_core.py::test_blockdims_from_blockshape", "dask/array/tests/test_array_core.py::test_coerce", "dask/array/tests/test_array_core.py::test_store_delayed_target", "dask/array/tests/test_array_core.py::test_store", "dask/array/tests/test_array_core.py::test_store_regions", "dask/array/tests/test_array_core.py::test_store_compute_false", "dask/array/tests/test_array_core.py::test_store_locks", "dask/array/tests/test_array_core.py::test_np_array_with_zero_dimensions", "dask/array/tests/test_array_core.py::test_unique", "dask/array/tests/test_array_core.py::test_dtype_complex", "dask/array/tests/test_array_core.py::test_astype", "dask/array/tests/test_array_core.py::test_arithmetic", "dask/array/tests/test_array_core.py::test_elemwise_consistent_names", "dask/array/tests/test_array_core.py::test_optimize", "dask/array/tests/test_array_core.py::test_slicing_with_non_ndarrays", "dask/array/tests/test_array_core.py::test_getarray", "dask/array/tests/test_array_core.py::test_squeeze", "dask/array/tests/test_array_core.py::test_size", "dask/array/tests/test_array_core.py::test_nbytes", "dask/array/tests/test_array_core.py::test_itemsize", "dask/array/tests/test_array_core.py::test_Array_normalizes_dtype", "dask/array/tests/test_array_core.py::test_from_array_with_lock", "dask/array/tests/test_array_core.py::test_from_array_slicing_results_in_ndarray", "dask/array/tests/test_array_core.py::test_asarray", "dask/array/tests/test_array_core.py::test_from_func", "dask/array/tests/test_array_core.py::test_topk", "dask/array/tests/test_array_core.py::test_topk_k_bigger_than_chunk", "dask/array/tests/test_array_core.py::test_bincount", "dask/array/tests/test_array_core.py::test_bincount_with_weights", "dask/array/tests/test_array_core.py::test_bincount_raises_informative_error_on_missing_minlength_kwarg", "dask/array/tests/test_array_core.py::test_digitize", "dask/array/tests/test_array_core.py::test_histogram", "dask/array/tests/test_array_core.py::test_histogram_alternative_bins_range", "dask/array/tests/test_array_core.py::test_histogram_return_type", "dask/array/tests/test_array_core.py::test_histogram_extra_args_and_shapes", "dask/array/tests/test_array_core.py::test_concatenate3_2", "dask/array/tests/test_array_core.py::test_map_blocks3", "dask/array/tests/test_array_core.py::test_from_array_with_missing_chunks", "dask/array/tests/test_array_core.py::test_cache", "dask/array/tests/test_array_core.py::test_take_dask_from_numpy", "dask/array/tests/test_array_core.py::test_normalize_chunks", "dask/array/tests/test_array_core.py::test_raise_on_no_chunks", "dask/array/tests/test_array_core.py::test_chunks_is_immutable", "dask/array/tests/test_array_core.py::test_raise_on_bad_kwargs", "dask/array/tests/test_array_core.py::test_long_slice", "dask/array/tests/test_array_core.py::test_ellipsis_slicing", "dask/array/tests/test_array_core.py::test_point_slicing", "dask/array/tests/test_array_core.py::test_point_slicing_with_full_slice", "dask/array/tests/test_array_core.py::test_slice_with_floats", "dask/array/tests/test_array_core.py::test_vindex_errors", "dask/array/tests/test_array_core.py::test_vindex_merge", "dask/array/tests/test_array_core.py::test_empty_array", "dask/array/tests/test_array_core.py::test_array", "dask/array/tests/test_array_core.py::test_cov", "dask/array/tests/test_array_core.py::test_corrcoef", "dask/array/tests/test_array_core.py::test_memmap", "dask/array/tests/test_array_core.py::test_to_npy_stack", "dask/array/tests/test_array_core.py::test_view", "dask/array/tests/test_array_core.py::test_view_fortran", "dask/array/tests/test_array_core.py::test_map_blocks_with_changed_dimension", "dask/array/tests/test_array_core.py::test_broadcast_chunks", "dask/array/tests/test_array_core.py::test_chunks_error", "dask/array/tests/test_array_core.py::test_array_compute_forward_kwargs", "dask/array/tests/test_array_core.py::test_dont_fuse_outputs", "dask/array/tests/test_array_core.py::test_dont_dealias_outputs", "dask/array/tests/test_array_core.py::test_timedelta_op", "dask/array/tests/test_array_core.py::test_to_delayed", "dask/array/tests/test_array_core.py::test_cumulative", "dask/array/tests/test_array_core.py::test_eye", "dask/array/tests/test_array_core.py::test_diag", "dask/array/tests/test_array_core.py::test_tril_triu", "dask/array/tests/test_array_core.py::test_tril_triu_errors", "dask/array/tests/test_array_core.py::test_atop_names", "dask/array/tests/test_array_core.py::test_atop_new_axes", "dask/array/tests/test_array_core.py::test_atop_kwargs", "dask/array/tests/test_array_core.py::test_atop_chunks", "dask/array/tests/test_array_core.py::test_from_delayed", "dask/array/tests/test_array_core.py::test_A_property", "dask/array/tests/test_array_core.py::test_copy_mutate", "dask/array/tests/test_array_core.py::test_npartitions", "dask/array/tests/test_array_core.py::test_astype_gh1151", "dask/array/tests/test_array_core.py::test_elemwise_name", "dask/array/tests/test_array_core.py::test_map_blocks_name", "dask/array/tests/test_array_core.py::test_from_array_names", "dask/array/tests/test_array_core.py::test_array_picklable", "dask/array/tests/test_array_core.py::test_swapaxes", "dask/array/tests/test_array_core.py::test_from_array_raises_on_bad_chunks", "dask/array/tests/test_array_core.py::test_concatenate_axes", "dask/array/tests/test_array_core.py::test_atop_concatenate", "dask/array/tests/test_array_core.py::test_common_blockdim", "dask/array/tests/test_array_core.py::test_uneven_chunks_that_fit_neatly", "dask/array/tests/test_array_core.py::test_elemwise_uneven_chunks", "dask/array/tests/test_array_core.py::test_uneven_chunks_atop", "dask/array/tests/test_array_core.py::test_warn_bad_rechunking", "dask/array/tests/test_array_core.py::test_optimize_fuse_keys", "dask/array/tests/test_array_core.py::test_round", "dask/array/tests/test_array_core.py::test_repeat", "dask/array/tests/test_array_core.py::test_tile[0-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[0-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[1-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[1-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[2-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[2-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[3-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[3-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[5-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[5-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_concatenate_stack_dont_warn", "dask/array/tests/test_array_core.py::test_map_blocks_delayed", "dask/array/tests/test_array_core.py::test_no_chunks", "dask/array/tests/test_array_core.py::test_no_chunks_2d", "dask/array/tests/test_array_core.py::test_no_chunks_yes_chunks", "dask/array/tests/test_array_core.py::test_raise_informative_errors_no_chunks", "dask/array/tests/test_array_core.py::test_no_chunks_slicing_2d", "dask/array/tests/test_array_core.py::test_index_array_with_array_1d", "dask/array/tests/test_array_core.py::test_index_array_with_array_2d", "dask/array/tests/test_array_core.py::test_setitem_1d", "dask/array/tests/test_array_core.py::test_setitem_2d", "dask/array/tests/test_array_core.py::test_setitem_errs", "dask/array/tests/test_array_core.py::test_zero_slice_dtypes", "dask/array/tests/test_array_core.py::test_zero_sized_array_rechunk", "dask/array/tests/test_array_core.py::test_atop_zero_shape", "dask/array/tests/test_array_core.py::test_atop_zero_shape_new_axes", "dask/array/tests/test_array_core.py::test_broadcast_against_zero_shape", "dask/array/tests/test_array_core.py::test_fast_from_array", "dask/array/tests/test_array_core.py::test_random_from_array", "dask/array/tests/test_array_core.py::test_concatenate_errs", "dask/array/tests/test_array_core.py::test_stack_errs", "dask/array/tests/test_array_core.py::test_transpose_negative_axes", "dask/array/tests/test_array_core.py::test_atop_with_numpy_arrays", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-100]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-6]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-100]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-6]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-100]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-6]", "dask/array/tests/test_array_core.py::test_constructor_plugin", "dask/array/tests/test_rechunk.py::test_rechunk_internals_1", "dask/array/tests/test_rechunk.py::test_intersect_1", "dask/array/tests/test_rechunk.py::test_intersect_2", "dask/array/tests/test_rechunk.py::test_rechunk_1d", "dask/array/tests/test_rechunk.py::test_rechunk_2d", "dask/array/tests/test_rechunk.py::test_rechunk_4d", "dask/array/tests/test_rechunk.py::test_rechunk_expand", "dask/array/tests/test_rechunk.py::test_rechunk_expand2", "dask/array/tests/test_rechunk.py::test_rechunk_method", "dask/array/tests/test_rechunk.py::test_rechunk_blockshape", "dask/array/tests/test_rechunk.py::test_dtype", "dask/array/tests/test_rechunk.py::test_rechunk_with_dict", "dask/array/tests/test_rechunk.py::test_rechunk_with_empty_input", "dask/array/tests/test_rechunk.py::test_rechunk_with_null_dimensions", "dask/array/tests/test_rechunk.py::test_rechunk_with_integer", "dask/array/tests/test_rechunk.py::test_rechunk_0d", "dask/array/tests/test_rechunk.py::test_rechunk_same", "dask/array/tests/test_rechunk.py::test_rechunk_intermediates", "dask/array/tests/test_rechunk.py::test_divide_to_width", "dask/array/tests/test_rechunk.py::test_merge_to_number", "dask/array/tests/test_rechunk.py::test_plan_rechunk", "dask/array/tests/test_rechunk.py::test_plan_rechunk_5d", "dask/array/tests/test_rechunk.py::test_plan_rechunk_heterogenous", "dask/array/tests/test_rechunk.py::test_rechunk_warning", "dask/array/tests/test_rechunk.py::test_dont_concatenate_single_chunks[shape0-chunks0]", "dask/array/tests/test_rechunk.py::test_dont_concatenate_single_chunks[shape1-chunks1]", "dask/array/tests/test_rechunk.py::test_dont_concatenate_single_chunks[shape2-chunks2]" ]
[]
BSD 3-Clause "New" or "Revised" License
1,177
[ "dask/array/rechunk.py" ]
[ "dask/array/rechunk.py" ]
typesafehub__conductr-cli-409
7f4c27073a64f2c16ee891b3bb359f910ae70381
2017-04-12 17:14:05
39719b38ec6fc0f598756700a8a815b56bd8bc59
diff --git a/conductr_cli/bndl_create.py b/conductr_cli/bndl_create.py index 1e40b09..050f089 100644 --- a/conductr_cli/bndl_create.py +++ b/conductr_cli/bndl_create.py @@ -1,15 +1,18 @@ -from conductr_cli.bndl_oci import oci_image_bundle_conf, oci_image_extract_manifest_config, oci_image_unpack +from conductr_cli import bndl_oci +from conductr_cli.bndl_oci import oci_image_bundle_conf, oci_image_unpack from conductr_cli.bndl_docker import docker_unpack -from conductr_cli.bndl_utils import detect_format_dir, detect_format_stream +from conductr_cli.bndl_utils import detect_format_dir, detect_format_stream, first_mtime from conductr_cli.constants import BNDL_PEEK_SIZE, IO_CHUNK_SIZE from conductr_cli.shazar_main import dir_to_zip, write_with_digest from io import BufferedReader, BytesIO +import arrow import logging import os import shutil import sys import tarfile import tempfile +import time import zipfile @@ -21,7 +24,7 @@ def bndl_create(args): return 2 - buff_in = BufferedReader(sys.stdin.buffer, IO_CHUNK_SIZE) + buff_in = BufferedReader(sys.stdin.buffer, IO_CHUNK_SIZE) if args.source is None else None if args.format is None: if args.source is None: @@ -100,18 +103,27 @@ def bndl_create(args): return 2 - oci_manifest, oci_config = oci_image_extract_manifest_config(oci_image_dir, args.tag) + oci_manifest, oci_config = bndl_oci.oci_image_extract_manifest_config(oci_image_dir, args.tag) bundle_conf = oci_image_bundle_conf(args, component_name, oci_manifest, oci_config) bundle_conf_name = os.path.join(args.name, 'bundle.conf') bundle_conf_data = bundle_conf.encode('UTF-8') + # bundle data timestamps can vary based on how it's acquired (docker save, our own resolver, etc) so we + # deterministically set the mtime of the files to be based on the OCI config 'created' value if available + + if oci_config and 'created' in oci_config: + mtime = arrow.get(oci_config['created']).timestamp + else: + mtime = first_mtime(temp_dir) + # bundle.conf must be written first, so we explicitly do that for zip and tar if args.use_shazar: with tempfile.NamedTemporaryFile() as zip_file_data: with zipfile.ZipFile(zip_file_data, 'w') as zip_file: - zip_file.writestr(bundle_conf_name, bundle_conf_data) - dir_to_zip(temp_dir, zip_file, args.name) + bundle_conf_zinfo = zipfile.ZipInfo(filename=bundle_conf_name, date_time=time.localtime(mtime)[:6]) + zip_file.writestr(bundle_conf_zinfo, bundle_conf_data) + dir_to_zip(temp_dir, zip_file, args.name, mtime) zip_file_data.flush() zip_file_data.seek(0) @@ -121,12 +133,14 @@ def bndl_create(args): with tarfile.open(fileobj=output, mode='w|') as tar: info = tarfile.TarInfo(name=bundle_conf_name) info.size = len(bundle_conf_data) + info.mtime = mtime tar.addfile(tarinfo=info, fileobj=BytesIO(bundle_conf_data)) for (dir_path, dir_names, file_names) in os.walk(temp_dir): for file_name in file_names: path = os.path.join(dir_path, file_name) name = os.path.join(args.name, os.path.relpath(path, start=temp_dir)) + os.utime(path, (mtime, mtime)) tar.add(path, arcname=name) output.flush() diff --git a/conductr_cli/bndl_docker.py b/conductr_cli/bndl_docker.py index def7abe..8435aca 100644 --- a/conductr_cli/bndl_docker.py +++ b/conductr_cli/bndl_docker.py @@ -218,7 +218,7 @@ def docker_unpack(destination, data, is_dir, maybe_name, maybe_tag): # bundles are packaged into zips, so we don't want to compress, but OCI tooling # as of 2017-03-14 is broken for plain tar files; they must be gzip - with gzip.GzipFile(fileobj=dest_file_digest, mode='wb', compresslevel=0) as dest: + with gzip.GzipFile(fileobj=dest_file_digest, mode='wb', compresslevel=0, mtime=0) as dest: shutil.copyfileobj(fileobj, dest) dest_file_hexdigest = dest_file_digest.digest_out.hexdigest() diff --git a/conductr_cli/bndl_utils.py b/conductr_cli/bndl_utils.py index 064080b..dba2f3c 100644 --- a/conductr_cli/bndl_utils.py +++ b/conductr_cli/bndl_utils.py @@ -137,6 +137,14 @@ def file_write_bytes(path, bs): file.write(bs) +def first_mtime(path): + for (dir_path, dir_names, file_names) in os.walk(path): + for file_name in file_names: + return os.path.getmtime(os.path.join(dir_path, file_name)) + + return 0 + + class DigestReaderWriter(object): def __init__(self, fileobj): self.digest_in = hashlib.sha256() diff --git a/conductr_cli/conduct_dcos.py b/conductr_cli/conduct_dcos.py index 65e4abc..a91dcef 100755 --- a/conductr_cli/conduct_dcos.py +++ b/conductr_cli/conduct_dcos.py @@ -2,22 +2,12 @@ from dcos import constants import logging import os import shutil -import sys def setup(args): """`conduct setup-dcos` command""" log = logging.getLogger(__name__) - - if sys.executable.endswith(os.path.sep + 'conduct'): - src = sys.executable - else: - src = shutil.which('conduct') - - if src is None: - log.error('Unable to determine location of \'conduct\'; is it on the PATH?') - return False - + src = shutil.which("conduct") dst = os.path.join(os.path.expanduser('~'), constants.DCOS_DIR, constants.DCOS_SUBCOMMAND_SUBDIR, @@ -25,11 +15,10 @@ def setup(args): constants.DCOS_SUBCOMMAND_ENV_SUBDIR, 'bin', constants.DCOS_COMMAND_PREFIX + 'conduct') - - if os.path.exists(dst) or os.path.islink(dst): + if os.path.exists(dst): os.remove(dst) - - os.makedirs(os.path.dirname(dst), exist_ok=True) + else: + os.makedirs(os.path.dirname(dst), exist_ok=True) os.symlink(src, dst) log.screen('The DC/OS CLI is now configured.\n' 'Prefix \'conduct\' with \'dcos\' when you want to contact ConductR on DC/OS e.g. \'dcos conduct info\'') diff --git a/conductr_cli/shazar_main.py b/conductr_cli/shazar_main.py index e9e02e8..e4e92ca 100755 --- a/conductr_cli/shazar_main.py +++ b/conductr_cli/shazar_main.py @@ -107,11 +107,15 @@ def shazar(args): sys.stdout.write(dest + os.linesep) -def dir_to_zip(dir, zip_file, source_base_name): +def dir_to_zip(dir, zip_file, source_base_name, mtime=None): for (dir_path, dir_names, file_names) in os.walk(dir): for file_name in file_names: path = os.path.join(dir_path, file_name) name = os.path.join(source_base_name, os.path.relpath(path, start=dir)) + + if mtime is not None: + os.utime(path, (mtime, mtime)) + zip_file.write(path, name)
`bndl` produces bundles with differing digests despite same input. Given the same input, we should produce a bundle with a constant digest. I believe the bug here is around timestamps. See below. ```bash $ docker save nginx | sha256sum bd4f716f157c4f0e7e4d3007fc38572a4b946884f1908d68520b88d8758caa4a - -> 0 ~ $ docker save nginx | sha256sum bd4f716f157c4f0e7e4d3007fc38572a4b946884f1908d68520b88d8758caa4a - -> 0 # Note digests are the same for two executions ``` -vs- ```bash $ docker save nginx | bndl --no-shazar | sha256sum 72493678617a8c4588ba98c64adb4649853ad914a130b147977a5e381cf5d54c - -> 0 $ docker save nginx | bndl --no-shazar | sha256sum 5e42b7b441d9a2dbda9343047b59446de9b6ce2616e97baef3d13b037ec92382 - -> 0 # Note digests are different for two executions ```
typesafehub/conductr-cli
diff --git a/conductr_cli/test/test_bndl_create.py b/conductr_cli/test/test_bndl_create.py index 33daf03..43a085c 100644 --- a/conductr_cli/test/test_bndl_create.py +++ b/conductr_cli/test/test_bndl_create.py @@ -4,7 +4,9 @@ from io import BytesIO from unittest.mock import patch, MagicMock import os import shutil +import tarfile import tempfile +import time import zipfile @@ -60,33 +62,181 @@ class TestBndlCreate(CliTestCase): def test_no_ref(self): tmpdir = tempfile.mkdtemp() - with tempfile.NamedTemporaryFile() as output: + try: + with tempfile.NamedTemporaryFile() as output: + attributes = create_attributes_object({ + 'name': 'test', + 'source': tmpdir, + 'format': 'oci-image', + 'tag': 'latest', + 'output': output.name + }) + + stdout_mock = MagicMock() + stderr_mock = MagicMock() + logging_setup.configure_logging(MagicMock(), stdout_mock, stderr_mock) + + os.mkdir(os.path.join(tmpdir, 'refs')) + open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + + with \ + patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ + patch('sys.stdout.buffer.write', stdout_mock): + bndl_create.bndl_create(attributes) + + self.assertEqual( + self.output(stderr_mock), + as_error('Error: bndl: Invalid OCI Image. Cannot find requested tag "latest" in OCI Image\n') + ) + finally: + shutil.rmtree(tmpdir) + + def test_with_shazar(self): + stdout_mock = MagicMock() + tmpdir = tempfile.mkdtemp() + tmpfile = os.path.join(tmpdir, 'output') + + try: attributes = create_attributes_object({ 'name': 'test', 'source': tmpdir, 'format': 'oci-image', 'tag': 'latest', - 'output': output.name + 'output': tmpfile, + 'component_description': '', + 'use_shazar': True, + 'use_default_endpoints': True, + 'annotations': [] }) + os.mkdir(os.path.join(tmpdir, 'refs')) + open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir, 'oci-layout'), (1234567890, 1234567890)) + refs = open(os.path.join(tmpdir, 'refs/latest'), 'w') + refs.write('{}') + refs.close() + os.utime(os.path.join(tmpdir, 'refs/latest'), (1234567890, 1234567890)) + + with \ + patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ + patch('sys.stdout.buffer.write', stdout_mock): + self.assertEqual(bndl_create.bndl_create(attributes), 0) + + self.assertTrue(zipfile.is_zipfile(tmpfile)) + + with zipfile.ZipFile(tmpfile) as zip: + infos = zip.infolist() + + self.assertEqual(infos[0].date_time, time.localtime(1234567890)[:6]) + finally: + shutil.rmtree(tmpdir) + + def test_without_shazar(self): stdout_mock = MagicMock() - stderr_mock = MagicMock() - logging_setup.configure_logging(MagicMock(), stdout_mock, stderr_mock) + tmpdir = tempfile.mkdtemp() + tmpfile = os.path.join(tmpdir, 'output') - os.mkdir(os.path.join(tmpdir, 'refs')) - open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + try: + attributes = create_attributes_object({ + 'name': 'test', + 'source': tmpdir, + 'format': 'oci-image', + 'tag': 'latest', + 'output': tmpfile, + 'component_description': '', + 'use_shazar': False, + 'use_default_endpoints': True, + 'annotations': [] + }) - with \ - patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ - patch('sys.stdout.buffer.write', stdout_mock): - bndl_create.bndl_create(attributes) + os.mkdir(os.path.join(tmpdir, 'refs')) + open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir, 'oci-layout'), (1234567890, 1234567890)) + refs = open(os.path.join(tmpdir, 'refs/latest'), 'w') + refs.write('{}') + refs.close() + os.utime(os.path.join(tmpdir, 'refs/latest'), (1234567890, 1234567890)) - self.assertEqual( - self.output(stderr_mock), - as_error('Error: bndl: Invalid OCI Image. Cannot find requested tag "latest" in OCI Image\n') - ) + with \ + patch('conductr_cli.bndl_oci.oci_image_extract_manifest_config', lambda a, b: ({}, {})), \ + patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ + patch('sys.stdout.buffer.write', stdout_mock): + self.assertEqual(bndl_create.bndl_create(attributes), 0) - def test_with_shazar(self): + self.assertFalse(zipfile.is_zipfile(tmpfile)) + + with tarfile.TarFile.open(tmpfile) as tar: + for entry in tar: + self.assertEqual(entry.mtime, 1234567890) + break + finally: + shutil.rmtree(tmpdir) + + def test_deterministic_with_shazar(self): + stdout_mock = MagicMock() + tmpdir = tempfile.mkdtemp() + tmpdir2 = tempfile.mkdtemp() + tmpfile = os.path.join(tmpdir, 'output') + tmpfile2 = os.path.join(tmpdir2, 'output') + + try: + attributes = create_attributes_object({ + 'name': 'test', + 'source': tmpdir, + 'format': 'oci-image', + 'tag': 'latest', + 'output': tmpfile, + 'component_description': '', + 'use_shazar': True, + 'use_default_endpoints': True, + 'annotations': [] + }) + + os.mkdir(os.path.join(tmpdir, 'refs')) + open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir, 'oci-layout'), (1234567890, 1234567890)) + refs = open(os.path.join(tmpdir, 'refs/latest'), 'w') + refs.write('{}') + refs.close() + os.utime(os.path.join(tmpdir, 'refs/latest'), (1234567890, 1234567890)) + + attributes2 = create_attributes_object({ + 'name': 'test', + 'source': tmpdir2, + 'format': 'oci-image', + 'tag': 'latest', + 'output': tmpfile2, + 'component_description': '', + 'use_shazar': True, + 'use_default_endpoints': True, + 'annotations': [] + }) + + os.mkdir(os.path.join(tmpdir2, 'refs')) + open(os.path.join(tmpdir2, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir2, 'oci-layout'), (1234567890, 1234567890)) + refs2 = open(os.path.join(tmpdir2, 'refs/latest'), 'w') + refs2.write('{}') + refs2.close() + os.utime(os.path.join(tmpdir2, 'refs/latest'), (1234567890, 1234567890)) + + with \ + patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ + patch('sys.stdout.buffer.write', stdout_mock): + bndl_create.bndl_create(attributes) + bndl_create.bndl_create(attributes2) + + with open(tmpfile, 'rb') as fileobj, open(tmpfile2, 'rb') as fileobj2: + self.assertEqual(fileobj.read(), fileobj2.read()) + + finally: + shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir2) + + def test_mtime_from_config(self): + config = { + 'created': '2017-02-27T19:42:10.522384312Z' + } stdout_mock = MagicMock() tmpdir = tempfile.mkdtemp() tmpfile = os.path.join(tmpdir, 'output') @@ -106,24 +256,32 @@ class TestBndlCreate(CliTestCase): os.mkdir(os.path.join(tmpdir, 'refs')) open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir, 'oci-layout'), (1234567890, 1234567890)) refs = open(os.path.join(tmpdir, 'refs/latest'), 'w') refs.write('{}') refs.close() + os.utime(os.path.join(tmpdir, 'refs/latest'), (1234567890, 1234567890)) with \ + patch('conductr_cli.bndl_oci.oci_image_extract_manifest_config', lambda a, b: ({}, config)), \ patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ patch('sys.stdout.buffer.write', stdout_mock): self.assertEqual(bndl_create.bndl_create(attributes), 0) - self.assertTrue(zipfile.is_zipfile(tmpfile)) + with zipfile.ZipFile(tmpfile) as zip: + infos = zip.infolist() + + self.assertEqual(infos[0].date_time, time.localtime(1488224530)[:6]) + finally: shutil.rmtree(tmpdir) - def test_without_shazar(self): + def test_deterministic_without_shazar(self): stdout_mock = MagicMock() - extract_config_mock = MagicMock() tmpdir = tempfile.mkdtemp() + tmpdir2 = tempfile.mkdtemp() tmpfile = os.path.join(tmpdir, 'output') + tmpfile2 = os.path.join(tmpdir2, 'output') try: attributes = create_attributes_object({ @@ -140,16 +298,41 @@ class TestBndlCreate(CliTestCase): os.mkdir(os.path.join(tmpdir, 'refs')) open(os.path.join(tmpdir, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir, 'oci-layout'), (1234567890, 1234567890)) refs = open(os.path.join(tmpdir, 'refs/latest'), 'w') refs.write('{}') refs.close() + os.utime(os.path.join(tmpdir, 'refs/latest'), (1234567890, 1234567890)) + + attributes2 = create_attributes_object({ + 'name': 'test', + 'source': tmpdir2, + 'format': 'oci-image', + 'tag': 'latest', + 'output': tmpfile2, + 'component_description': '', + 'use_shazar': False, + 'use_default_endpoints': True, + 'annotations': [] + }) + + os.mkdir(os.path.join(tmpdir2, 'refs')) + open(os.path.join(tmpdir2, 'oci-layout'), 'w').close() + os.utime(os.path.join(tmpdir2, 'oci-layout'), (1234567890, 1234567890)) + refs2 = open(os.path.join(tmpdir2, 'refs/latest'), 'w') + refs2.write('{}') + refs2.close() + os.utime(os.path.join(tmpdir2, 'refs/latest'), (1234567890, 1234567890)) with \ - patch('conductr_cli.bndl_oci.oci_image_extract_manifest_config', extract_config_mock), \ patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \ patch('sys.stdout.buffer.write', stdout_mock): - self.assertEqual(bndl_create.bndl_create(attributes), 0) + bndl_create.bndl_create(attributes) + bndl_create.bndl_create(attributes2) + + with open(tmpfile, 'rb') as fileobj, open(tmpfile2, 'rb') as fileobj2: + self.assertEqual(fileobj.read(), fileobj2.read()) - self.assertFalse(zipfile.is_zipfile(tmpfile)) finally: shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir2) diff --git a/conductr_cli/test/test_bndl_utils.py b/conductr_cli/test/test_bndl_utils.py index 279d0ad..5851faf 100644 --- a/conductr_cli/test/test_bndl_utils.py +++ b/conductr_cli/test/test_bndl_utils.py @@ -97,6 +97,18 @@ class TestBndlUtils(CliTestCase): self.assertEqual(writer.size_in, 0) self.assertEqual(writer.size_out, 9) + def test_first_mtime(self): + tmpdir = tempfile.mkdtemp() + + try: + open(os.path.join(tmpdir, 'one'), 'w').close() + os.mkdir(os.path.join(tmpdir, 'sub')) + open(os.path.join(tmpdir, 'sub', 'two'), 'w').close() + os.utime(os.path.join(tmpdir, 'one'), (1234, 1234)) + self.assertEqual(bndl_utils.first_mtime(os.path.join(tmpdir)), 1234) + finally: + shutil.rmtree(tmpdir) + def test_load_bundle_args_into_conf(self): base_args = create_attributes_object({ 'name': 'world', diff --git a/conductr_cli/test/test_conduct_dcos.py b/conductr_cli/test/test_conduct_dcos.py index 0b4ea94..db29460 100644 --- a/conductr_cli/test/test_conduct_dcos.py +++ b/conductr_cli/test/test_conduct_dcos.py @@ -7,7 +7,7 @@ import os class TestConductDcosCommand(CliTestCase): - def test_success_which(self): + def test_success(self): args = MagicMock() stdout = MagicMock() makedirs = MagicMock() @@ -16,7 +16,6 @@ class TestConductDcosCommand(CliTestCase): logging_setup.configure_logging(args, stdout) with patch('shutil.which', lambda x: '/somefile'), \ - patch('sys.executable', '/usr/bin/python3'), \ patch('os.path.exists', lambda x: True), \ patch('os.remove', lambda x: True), \ patch('os.makedirs', makedirs), \ @@ -24,10 +23,7 @@ class TestConductDcosCommand(CliTestCase): result = conduct_dcos.setup(args) self.assertTrue(result) - makedirs.assert_called_once_with( - '{}/.dcos/subcommands/conductr/env/bin'.format(os.path.expanduser('~')), - exist_ok=True - ) + makedirs.assert_not_called() symlink.assert_called_with('/somefile', '{}/.dcos/subcommands/conductr/env/bin/dcos-conduct'.format(os.path.expanduser('~'))) @@ -38,27 +34,6 @@ class TestConductDcosCommand(CliTestCase): |"""), self.output(stdout)) - def test_success_executable(self): - args = MagicMock() - stdout = MagicMock() - makedirs = MagicMock() - symlink = MagicMock() - - logging_setup.configure_logging(args, stdout) - - with \ - patch('shutil.which', lambda x: '/somefile'), \ - patch('sys.executable', '/path/to/conduct'), \ - patch('os.path.exists', lambda x: True), \ - patch('os.remove', lambda x: True), \ - patch('os.makedirs', makedirs), \ - patch('os.symlink', symlink): - result = conduct_dcos.setup(args) - self.assertTrue(result) - - symlink.assert_called_with('/path/to/conduct', - '{}/.dcos/subcommands/conductr/env/bin/dcos-conduct'.format(os.path.expanduser('~'))) - def test_create_dir(self): args = MagicMock() stdout = MagicMock() @@ -68,10 +43,8 @@ class TestConductDcosCommand(CliTestCase): logging_setup.configure_logging(args, stdout) - with \ - patch('shutil.which', lambda x: '/somefile'), \ + with patch('shutil.which', lambda x: '/somefile'), \ patch('os.path.exists', lambda x: False), \ - patch('os.path.islink', lambda x: False), \ patch('os.remove', remove), \ patch('os.makedirs', makedirs), \ patch('os.symlink', symlink):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 5 }
1.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "tox", "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
argcomplete==3.1.2 arrow==1.2.3 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 charset-normalizer==2.0.12 colorama==0.4.5 -e git+https://github.com/typesafehub/conductr-cli.git@7f4c27073a64f2c16ee891b3bb359f910ae70381#egg=conductr_cli distlib==0.3.9 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work jsonschema==2.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pager==3.3 platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work prettytable==0.7.2 psutil==5.9.8 py @ file:///opt/conda/conda-bld/py_1644396412707/work Pygments==2.14.0 pyhocon==0.3.35 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pyreadline==2.1 pytest==6.2.4 python-dateutil==2.9.0.post0 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tox==3.28.0 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: conductr-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - argcomplete==3.1.2 - arrow==1.2.3 - charset-normalizer==2.0.12 - colorama==0.4.5 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - jsonschema==2.4.0 - pager==3.3 - platformdirs==2.4.0 - prettytable==0.7.2 - psutil==5.9.8 - pygments==2.14.0 - pyhocon==0.3.35 - pyreadline==2.1 - python-dateutil==2.9.0.post0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tox==3.28.0 - urllib3==1.26.20 - virtualenv==20.17.1 prefix: /opt/conda/envs/conductr-cli
[ "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_with_shazar", "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_without_shazar", "conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_first_mtime", "conductr_cli/test/test_conduct_dcos.py::TestConductDcosCommand::test_success" ]
[ "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_mtime_from_config" ]
[ "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_deterministic_with_shazar", "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_deterministic_without_shazar", "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_no_format", "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_no_ref", "conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_not_oci", "conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_detect_format_dir", "conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_detect_format_stream", "conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_digest_reader_writer", "conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_load_bundle_args_into_conf", "conductr_cli/test/test_conduct_dcos.py::TestConductDcosCommand::test_create_dir" ]
[]
Apache License 2.0
1,178
[ "conductr_cli/bndl_docker.py", "conductr_cli/bndl_create.py", "conductr_cli/bndl_utils.py", "conductr_cli/conduct_dcos.py", "conductr_cli/shazar_main.py" ]
[ "conductr_cli/bndl_docker.py", "conductr_cli/bndl_create.py", "conductr_cli/bndl_utils.py", "conductr_cli/conduct_dcos.py", "conductr_cli/shazar_main.py" ]
Azure__azure-cli-2844
a8395ea70322dbf535d474d52ebf3d625a6cbdf0
2017-04-12 18:02:44
eb12ac454cbe1ddb59c86cdf2045e1912660e750
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=h1) Report > Merging [#2844](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/a8395ea70322dbf535d474d52ebf3d625a6cbdf0?src=pr&el=desc) will **increase** coverage by `0.04%`. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/2844/graphs/tree.svg?token=2pog0TKvF8&src=pr&height=150&width=650)](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2844 +/- ## ========================================== + Coverage 62.88% 62.92% +0.04% ========================================== Files 464 464 Lines 25901 25899 -2 Branches 3944 3943 -1 ========================================== + Hits 16288 16298 +10 + Misses 8594 8567 -27 - Partials 1019 1034 +15 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...etwork/azure/cli/command\_modules/network/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvY3VzdG9tLnB5) | `63.46% <ø> (+1.08%)` | :arrow_up: | | [...twork/azure/cli/command\_modules/network/\_params.py](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvX3BhcmFtcy5weQ==) | `92.51% <100%> (ø)` | :arrow_up: | | [...ure-cli-core/azure/cli/core/commands/parameters.py](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL2NvbW1hbmRzL3BhcmFtZXRlcnMucHk=) | `70.96% <0%> (-2.16%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=footer). Last update [a8395ea...9d6c9c2](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/src/command_modules/azure-cli-network/HISTORY.rst b/src/command_modules/azure-cli-network/HISTORY.rst index 93cd59cca..3be0480e2 100644 --- a/src/command_modules/azure-cli-network/HISTORY.rst +++ b/src/command_modules/azure-cli-network/HISTORY.rst @@ -10,6 +10,7 @@ unreleased * BC: Fix bug in the output of `vpn-connection create` * Fix bug where '--key-length' argument of 'vpn-connection create' was not parsed correctly. * Fix bug in `dns zone import` where records were not imported correctly. +* Fix bug where `traffic-manager endpoint update` did not work. 2.0.2 (2017-04-03) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py index 7cfbe5f1f..4621edb01 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py @@ -21,7 +21,7 @@ from azure.cli.core.commands import \ (CliArgumentType, register_cli_argument, register_extra_cli_argument) from azure.cli.core.commands.parameters import (location_type, get_resource_name_completion_list, enum_choice_list, tags_type, ignore_type, - get_generic_completion_list, file_type) + file_type) from azure.cli.core.commands.validators import \ (MarkSpecifiedAction, get_default_location_from_resource_group) from azure.cli.core.commands.template_create import get_folded_parameter_help_string @@ -537,7 +537,7 @@ register_cli_argument('network traffic-manager profile check-dns', 'type', help= # Traffic manager endpoints endpoint_types = ['azureEndpoints', 'externalEndpoints', 'nestedEndpoints'] register_cli_argument('network traffic-manager endpoint', 'endpoint_name', name_arg_type, id_part='child_name', help='Endpoint name.', completer=get_tm_endpoint_completion_list()) -register_cli_argument('network traffic-manager endpoint', 'endpoint_type', options_list=('--type',), help='Endpoint type. Values include: {}.'.format(', '.join(endpoint_types)), completer=get_generic_completion_list(endpoint_types)) +register_cli_argument('network traffic-manager endpoint', 'endpoint_type', options_list=['--type', '-t'], help='Endpoint type.', id_part='child_name', **enum_choice_list(endpoint_types)) register_cli_argument('network traffic-manager endpoint', 'profile_name', help='Name of parent profile.', completer=get_resource_name_completion_list('Microsoft.Network/trafficManagerProfiles'), id_part='name') register_cli_argument('network traffic-manager endpoint', 'endpoint_location', help="Location of the external or nested endpoints when using the 'Performance' routing method.") register_cli_argument('network traffic-manager endpoint', 'endpoint_monitor_status', help='The monitoring status of the endpoint.') diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py index bb5e9ba90..282e7eaec 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py @@ -1673,8 +1673,6 @@ def update_traffic_manager_endpoint(instance, endpoint_type=None, endpoint_locat endpoint_status=None, endpoint_monitor_status=None, priority=None, target=None, target_resource_id=None, weight=None, min_child_endpoints=None): - if endpoint_type is not None: - instance.type = endpoint_type if endpoint_location is not None: instance.endpoint_location = endpoint_location if endpoint_status is not None:
traffic-manager command failed to update endpoint ### Environment summary **Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly) apt-get **CLI Version:** What version of the CLI and modules are installed? (Use `az --version`) azure-cli (2.0.0) network (2.0.0) **OS Version:** What OS and version are you using? Windows 10 **Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows) Bash on Windows --- ### Description Cannot update endpoint settings. '--type' parameter seems to be used setting resource rul as below ``` $ az network traffic-manager endpoint update -g DEMO-FTAPP --profile-name ilkimftapptm --name endpoint1 --priority 3 --type "Microsoft.Network/trafficManagerProfiles/azureEndpoints" Operation failed with status: 'Bad Request'. Details: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/<subs>/resourceGroups/DEMO-FTAPP/providers/Microsoft.Network/trafficmanagerprofiles/ilkimftapptm/Microsoft.Network%2FtrafficManagerProfiles%2FazureEndpoints/endpoint1?api-version=2015-11-01 ``` url should be: ``` https://management.azure.com/subscriptions/<subs>/resourceGroups/DEMO-FTAPP/providers/Microsoft.Network/trafficmanagerprofiles/ilkimftapptm/azureEndpoints/endpoint1?api-version=2015-11-01 ``` I tried below command and it didn't work too! ``` $ az network traffic-manager endpoint update -g DEMO-FTAPP --profile-name ilkimftapptm --name endpoint1 --priority 3 --type "azureEndpoints" The value 'azureEndpoints' provided for field 'type' is invalid. Expected value is 'Microsoft.Network/trafficManagerProfiles/azureendpoints'. ```
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml b/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml index a751cb376..993f92d1e 100644 --- a/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml +++ b/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml @@ -1,17 +1,17 @@ interactions: - request: - body: '{"name": "myfoobar1", "type": "Microsoft.Network/trafficManagerProfiles"}' + body: '{"type": "Microsoft.Network/trafficManagerProfiles", "name": "myfoobar1"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['73'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python - AZURECLI/TEST/2.0.0+dev] + AZURECLI/TEST/2.0.2+dev] accept-language: [en-US] - x-ms-client-request-id: [dea79918-fd3d-11e6-9c5e-a0b3ccf7272a] + x-ms-client-request-id: [c35bd93a-1fa8-11e7-a57c-a0b3ccf7272a] method: POST uri: https://management.azure.com/providers/Microsoft.Network/checkTrafficManagerNameAvailability?api-version=2015-11-01 response: @@ -19,7 +19,7 @@ interactions: headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Mon, 27 Feb 2017 22:41:25 GMT'] + Date: ['Wed, 12 Apr 2017 17:52:14 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -31,35 +31,35 @@ interactions: x-ms-ratelimit-remaining-tenant-writes: ['1199'] status: {code: 200, message: OK} - request: - body: '{"location": "global", "properties": {"monitorConfig": {"protocol": "http", - "path": "/", "port": 80}, "dnsConfig": {"ttl": 30, "relativeName": "mytrafficmanager001100a"}, - "profileStatus": "enabled", "trafficRoutingMethod": "weighted"}}' + body: '{"properties": {"dnsConfig": {"ttl": 30, "relativeName": "mytrafficmanager001100a"}, + "trafficRoutingMethod": "Priority", "profileStatus": "Enabled", "monitorConfig": + {"protocol": "http", "port": 80, "path": "/"}}, "location": "global"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['235'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python - AZURECLI/TEST/2.0.0+dev] + AZURECLI/TEST/2.0.2+dev] accept-language: [en-US] - x-ms-client-request-id: [df4a990c-fd3d-11e6-a2cf-a0b3ccf7272a] + x-ms-client-request-id: [c3b8fbe4-1fa8-11e7-b827-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Priority","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} headers: Cache-Control: [private] Content-Length: ['567'] Content-Type: [application/json; charset=utf-8] - Date: ['Mon, 27 Feb 2017 22:41:27 GMT'] + Date: ['Wed, 12 Apr 2017 17:52:17 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-resource-requests: ['10799'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10798'] status: {code: 201, message: Created} - request: body: null @@ -68,19 +68,19 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python - AZURECLI/TEST/2.0.0+dev] + AZURECLI/TEST/2.0.2+dev] accept-language: [en-US] - x-ms-client-request-id: [e099279e-fd3d-11e6-b940-a0b3ccf7272a] + x-ms-client-request-id: [c4b1e446-1fa8-11e7-b47a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 response: - body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Priority","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Mon, 27 Feb 2017 22:41:28 GMT'] + Date: ['Wed, 12 Apr 2017 17:52:17 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -98,19 +98,53 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python - AZURECLI/TEST/2.0.0+dev] + AZURECLI/TEST/2.0.2+dev] accept-language: [en-US] - x-ms-client-request-id: [e1235ef0-fd3d-11e6-ae3c-a0b3ccf7272a] + x-ms-client-request-id: [c516762e-1fa8-11e7-bcf9-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 + response: + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Priority","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} + headers: + Cache-Control: [private] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:17 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['567'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10799'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"dnsConfig": {"ttl": 30, "fqdn": "mytrafficmanager001100a.trafficmanager.net", + "relativeName": "mytrafficmanager001100a"}, "trafficRoutingMethod": "Weighted", + "profileStatus": "Enabled", "endpoints": [], "monitorConfig": {"profileMonitorStatus": + "Inactive", "protocol": "HTTP", "port": 80, "path": "/"}}, "location": "global"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['342'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c577fe92-1fa8-11e7-8040-a0b3ccf7272a] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 response: body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Mon, 27 Feb 2017 22:41:28 GMT'] + Date: ['Wed, 12 Apr 2017 17:52:18 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -121,6 +155,66 @@ interactions: content-length: ['567'] x-ms-ratelimit-remaining-subscription-resource-requests: ['10799'] status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c63f854a-1fa8-11e7-bd49-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles?api-version=2015-11-01 + response: + body: {string: '{"value":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":null,"protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}]}'} + headers: + Cache-Control: [private] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:20 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['573'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10799'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c6acd7a2-1fa8-11e7-a232-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 + response: + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} + headers: + Cache-Control: [private] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:21 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['567'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10798'] + status: {code: 200, message: OK} - request: body: '{"properties": {"weight": 50, "target": "www.microsoft.com"}}' headers: @@ -129,11 +223,11 @@ interactions: Connection: [keep-alive] Content-Length: ['61'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python - AZURECLI/TEST/2.0.0+dev] + AZURECLI/TEST/2.0.2+dev] accept-language: [en-US] - x-ms-client-request-id: [e16d6200-fd3d-11e6-ae5b-a0b3ccf7272a] + x-ms-client-request-id: [c7251738-1fa8-11e7-ac77-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01 response: @@ -142,13 +236,13 @@ interactions: Cache-Control: [private] Content-Length: ['461'] Content-Type: [application/json; charset=utf-8] - Date: ['Mon, 27 Feb 2017 22:41:30 GMT'] + Date: ['Wed, 12 Apr 2017 17:52:21 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] X-AspNet-Version: [4.0.30319] X-Content-Type-Options: [nosniff] X-Powered-By: [ASP.NET] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 201, message: Created} - request: body: null @@ -157,11 +251,11 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python - AZURECLI/TEST/2.0.0+dev] + AZURECLI/TEST/2.0.2+dev] accept-language: [en-US] - x-ms-client-request-id: [e2782a3e-fd3d-11e6-a760-a0b3ccf7272a] + x-ms-client-request-id: [c7bce5c6-1fa8-11e7-84a1-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01 response: @@ -169,7 +263,7 @@ interactions: headers: Cache-Control: [private] Content-Type: [application/json; charset=utf-8] - Date: ['Mon, 27 Feb 2017 22:41:31 GMT'] + Date: ['Wed, 12 Apr 2017 17:52:22 GMT'] Server: [Microsoft-IIS/8.5] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] @@ -179,4 +273,181 @@ interactions: X-Powered-By: [ASP.NET] content-length: ['461'] status: {code: 200, message: OK} +- request: + body: '{"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficManagerProfiles/mytmprofile/externalEndpoints/myendpoint", + "name": "myendpoint", "properties": {"weight": 25, "endpointMonitorStatus": + "CheckingEndpoint", "priority": 1, "endpointStatus": "Enabled", "target": "www.contoso.com"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['439'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c81c2818-1fa8-11e7-9c66-a0b3ccf7272a] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01 + response: + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile\/externalEndpoints\/myendpoint","name":"myendpoint","type":"Microsoft.Network\/trafficManagerProfiles\/externalEndpoints","properties":{"endpointStatus":"Enabled","endpointMonitorStatus":"CheckingEndpoint","target":"www.contoso.com","weight":25,"priority":1,"endpointLocation":null}}'} + headers: + Cache-Control: [private] + Content-Length: ['459'] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:24 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c9292fdc-1fa8-11e7-9ad6-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01 + response: + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile\/externalEndpoints\/myendpoint","name":"myendpoint","type":"Microsoft.Network\/trafficManagerProfiles\/externalEndpoints","properties":{"endpointStatus":"Enabled","endpointMonitorStatus":"CheckingEndpoint","target":"www.contoso.com","weight":25,"priority":1,"endpointLocation":null}}'} + headers: + Cache-Control: [private] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:24 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['459'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c960dc38-1fa8-11e7-b153-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 + response: + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"CheckingEndpoints","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile\/externalEndpoints\/myendpoint","name":"myendpoint","type":"Microsoft.Network\/trafficManagerProfiles\/externalEndpoints","properties":{"endpointStatus":"Enabled","endpointMonitorStatus":"CheckingEndpoint","target":"www.contoso.com","weight":25,"priority":1,"endpointLocation":null}}]}}'} + headers: + Cache-Control: [private] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:24 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['1035'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10797'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [c9d5ce4c-1fa8-11e7-a218-a0b3ccf7272a] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01 + response: + body: {string: ''} + headers: + Cache-Control: [private] + Content-Length: ['0'] + Date: ['Wed, 12 Apr 2017 17:52:26 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [caae0382-1fa8-11e7-a75e-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 + response: + body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'} + headers: + Cache-Control: [private] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 12 Apr 2017 17:52:27 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['567'] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10798'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.2+dev] + accept-language: [en-US] + x-ms-client-request-id: [caf1f406-1fa8-11e7-9880-a0b3ccf7272a] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01 + response: + body: {string: ''} + headers: + Cache-Control: [private] + Content-Length: ['0'] + Date: ['Wed, 12 Apr 2017 17:52:28 GMT'] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + x-ms-ratelimit-remaining-subscription-resource-requests: ['10799'] + status: {code: 200, message: OK} version: 1 diff --git a/src/command_modules/azure-cli-network/tests/test_network_commands.py b/src/command_modules/azure-cli-network/tests/test_network_commands.py index 09b8c1029..b2df51b2f 100644 --- a/src/command_modules/azure-cli-network/tests/test_network_commands.py +++ b/src/command_modules/azure-cli-network/tests/test_network_commands.py @@ -1301,15 +1301,30 @@ class NetworkTrafficManagerScenarioTest(ResourceGroupVCRTestBase): unique_dns_name = 'mytrafficmanager001100a' self.cmd('network traffic-manager profile check-dns -n myfoobar1') - self.cmd('network traffic-manager profile create -n {} -g {} --routing-method weighted --unique-dns-name {}'.format(tm_name, self.resource_group, unique_dns_name), - checks=JMESPathCheck('TrafficManagerProfile.trafficRoutingMethod', 'Weighted')) + self.cmd('network traffic-manager profile create -n {} -g {} --routing-method priority --unique-dns-name {}'.format(tm_name, self.resource_group, unique_dns_name), + checks=JMESPathCheck('TrafficManagerProfile.trafficRoutingMethod', 'Priority')) self.cmd('network traffic-manager profile show -g {} -n {}'.format(self.resource_group, tm_name), checks=JMESPathCheck('dnsConfig.relativeName', unique_dns_name)) + self.cmd('network traffic-manager profile update -n {} -g {} --routing-method weighted'.format(tm_name, self.resource_group), + checks=JMESPathCheck('trafficRoutingMethod', 'Weighted')) + self.cmd('network traffic-manager profile list -g {}'.format(self.resource_group)) + # Endpoint tests self.cmd('network traffic-manager endpoint create -n {} --profile-name {} -g {} --type externalEndpoints --weight 50 --target www.microsoft.com'.format(endpoint_name, tm_name, self.resource_group), checks=JMESPathCheck('type', 'Microsoft.Network/trafficManagerProfiles/externalEndpoints')) - self.cmd('network traffic-manager endpoint show --profile-name {} --type externalEndpoints -n {} -g {}'.format(tm_name, endpoint_name, self.resource_group), - checks=JMESPathCheck('target', 'www.microsoft.com')) + self.cmd('network traffic-manager endpoint update -n {} --profile-name {} -g {} --type externalEndpoints --weight 25 --target www.contoso.com'.format(endpoint_name, tm_name, self.resource_group), checks=[ + JMESPathCheck('weight', 25), + JMESPathCheck('target', 'www.contoso.com') + ]) + self.cmd('network traffic-manager endpoint show -g {} --profile-name {} -t externalEndpoints -n {}'.format(self.resource_group, tm_name, endpoint_name)) + self.cmd('network traffic-manager endpoint list -g {} --profile-name {} -t externalEndpoints'.format(self.resource_group, tm_name), + checks=JMESPathCheck('length(@)', 1)) + self.cmd('network traffic-manager endpoint delete -g {} --profile-name {} -t externalEndpoints -n {}'.format(self.resource_group, tm_name, endpoint_name)) + self.cmd('network traffic-manager endpoint list -g {} --profile-name {} -t externalEndpoints'.format(self.resource_group, tm_name), + checks=JMESPathCheck('length(@)', 0)) + + self.cmd('network traffic-manager profile delete -g {} -n {}'.format(self.resource_group, tm_name)) + class NetworkDnsScenarioTest(ResourceGroupVCRTestBase):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 3 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.0 -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-datalake-store==0.0.6 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.0 azure-mgmt-compute==0.33.1rc1 azure-mgmt-containerregistry==0.2.0 azure-mgmt-datalake-analytics==0.1.3 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.3 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.1 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-monitor==0.1.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.4.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-monitor==0.2.0 azure-nspkg==3.0.2 azure-storage==0.34.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-datalake-store==0.0.6 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.0 - azure-mgmt-compute==0.33.1rc1 - azure-mgmt-containerregistry==0.2.0 - azure-mgmt-datalake-analytics==0.1.3 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.3 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.1 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-monitor==0.1.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-monitor==0.2.0 - azure-nspkg==3.0.2 - azure-storage==0.34.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkTrafficManagerScenarioTest::test_network_traffic_manager" ]
[]
[ "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkMultiIdsShowScenarioTest::test_multi_id_show", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkUsageListScenarioTest::test_network_usage_list", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayDefaultScenarioTest::test_network_app_gateway_with_defaults", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayExistingSubnetScenarioTest::test_network_app_gateway_with_existing_subnet", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayNoWaitScenarioTest::test_network_app_gateway_no_wait", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayPrivateIpScenarioTest::test_network_app_gateway_with_private_ip", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayPublicIpScenarioTest::test_network_app_gateway_with_public_ip", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayWafScenarioTest::test_network_app_gateway_waf", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkPublicIpScenarioTest::test_network_public_ip", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkExpressRouteScenarioTest::test_network_express_route", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerScenarioTest::test_network_load_balancer", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerIpConfigScenarioTest::test_network_load_balancer_ip_config", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerSubresourceScenarioTest::test_network_load_balancer_subresources", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLocalGatewayScenarioTest::test_network_local_gateway", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicScenarioTest::test_network_nic", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicSubresourceScenarioTest::test_network_nic_subresources", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicConvenienceCommandsScenarioTest::test_network_nic_convenience_commands", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkSecurityGroupScenarioTest::test_network_nsg", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkRouteTableOperationScenarioTest::test_network_route_table_operation", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVNetScenarioTest::test_network_vnet", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVNetPeeringScenarioTest::test_network_vnet_peering", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkSubnetSetScenarioTest::test_network_subnet_set", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkActiveActiveCrossPremiseScenarioTest::test_network_active_active_cross_premise_connection", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkActiveActiveVnetVnetScenarioTest::test_network_active_active_vnet_vnet_connection", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVpnGatewayScenarioTest::test_network_vpn_gateway", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkDnsScenarioTest::test_network_dns", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkZoneImportExportTest::test_network_dns_zone_import_export" ]
[]
MIT License
1,179
[ "src/command_modules/azure-cli-network/HISTORY.rst", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py" ]
[ "src/command_modules/azure-cli-network/HISTORY.rst", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py" ]
Azure__azure-cli-2848
f6b3c18535cf9d1753213311cfe686a7d8f1295d
2017-04-12 22:16:35
eb12ac454cbe1ddb59c86cdf2045e1912660e750
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=h1) Report > Merging [#2848](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/f6b3c18535cf9d1753213311cfe686a7d8f1295d?src=pr&el=desc) will **increase** coverage by `0.01%`. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/2848/graphs/tree.svg?height=150&width=650&token=2pog0TKvF8&src=pr)](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2848 +/- ## ========================================== + Coverage 62.92% 62.94% +0.01% ========================================== Files 464 464 Lines 25899 25899 Branches 3943 3943 ========================================== + Hits 16298 16302 +4 + Misses 8567 8563 -4 Partials 1034 1034 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/azure-cli-core/azure/cli/core/\_profile.py](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL19wcm9maWxlLnB5) | `85.25% <100%> (+1.07%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=footer). Last update [f6b3c18...d27d58a](https://codecov.io/gh/Azure/azure-cli/pull/2848?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/.gitignore b/.gitignore index fc479e986..7346003bc 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,6 @@ test_results/ # Code coverage .coverage + +# CI output +artifacts/ \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..a6f8e4dd9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,29 @@ +pipeline { + agent none + triggers { pollSCM('H/3 * * * *') } + stages { + stage ('Build') { + agent any + steps { + sh 'pip install -U virtualenv' + sh 'python -m virtualenv --clear env' + sh './scripts/jenkins_build.sh' + sh './scripts/jenkins_archive.sh' + } + post { + always { deleteDir() } + } + } + stage ('Performance-Test') { + agent { label 'perf-ubuntu-a0' } + steps { + sh 'pip install -U virtualenv' + sh 'python -m virtualenv --clear env' + sh './scripts/jenkins_perf.sh' + } + post { + always { deleteDir() } + } + } + } +} diff --git a/scripts/jenkins_archive.sh b/scripts/jenkins_archive.sh new file mode 100755 index 000000000..4422c60bd --- /dev/null +++ b/scripts/jenkins_archive.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Archive build + +set -x + +if [ -z $BUILD_NUMBER ]; then + echo "Environment variable BUILD_NUMBER is missing." + exit 1 +fi + +export +echo "build branch $BRANCH_NAME" + +version=$(printf '%.8d' $BUILD_NUMBER) +echo "Version number: $version" + +if [ -d /var/build_share ]; then + echo 'Directory /var/build_share is found. The artifacts will be archived there.' + mkdir -p /var/build_share/$BRANCH_NAME/$version + cp -R ./artifacts/ /var/build_share/$BRANCH_NAME/$version +else + echo 'Directory /var/build_share is not found. Exit without taking any actions.' +fi diff --git a/scripts/jenkins_build.sh b/scripts/jenkins_build.sh new file mode 100755 index 000000000..b12e2e093 --- /dev/null +++ b/scripts/jenkins_build.sh @@ -0,0 +1,26 @@ +# Build packages in Jenkins server. +# The script expects a virtualenv created under ./env folder as prerequisite + +set -x # do not echo command to prevent accidentally expose secrets + +. ./env/bin/activate + +echo 'Build Azure CLI and its command modules ' + +if [ -d ./artifacts ]; then + rm -rf ./artifacts +fi + +mkdir -p ./artifacts/build +artifacts=$(cd ./artifacts/build && pwd) + +working_dir=$(pwd) +for setup_file in $(find src -name 'setup.py'); do + cd $(dirname $setup_file) + echo "" + echo "Components at $(pwd) is being built ..." + python setup.py sdist -d $artifacts bdist_wheel -d $artifacts + cd $working_dir +done + +echo 'Build completed.' \ No newline at end of file diff --git a/scripts/jenkins_perf.sh b/scripts/jenkins_perf.sh new file mode 100755 index 000000000..355b34eec --- /dev/null +++ b/scripts/jenkins_perf.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Run performance in jenkins build + +. ./env/bin/activate + +echo "Run performance test on $(hostname)" + +if [ -z %BUILD_NUMBER ]; then + echo "Environment variable BUILD_NUMBER is missing." + exit 1 +fi + +version=$(printf '%.8d' $BUILD_NUMBER) +echo "Version number: $version" + +echo 'Before install' +which az +pip list + +build_folder=/var/build_share/$BRANCH_NAME/$version +echo "Install build from $build_folder" + +python -m pip install azure-cli --find-links file://$build_folder/artifacts/build -v +python -m pip freeze + +python ./scripts/performance/measure.py diff --git a/scripts/performance/measure.py b/scripts/performance/measure.py new file mode 100644 index 000000000..8cf6ad2b5 --- /dev/null +++ b/scripts/performance/measure.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import sys +from subprocess import check_output, STDOUT + +def mean(data): + """Return the sample arithmetic mean of data.""" + n = len(data) + if n < 1: + raise ValueError('len < 1') + return sum(data)/float(n) + + +def sq_deviation(data): + """Return sum of square deviations of sequence data.""" + c = mean(data) + return sum((x-c)**2 for x in data) + + +def pstdev(data): + """Calculates the population standard deviation.""" + n = len(data) + if n < 2: + raise ValueError('len < 2') + ss = sq_deviation(data) + return (ss/n) ** 0.5 + + +real = [] +user = [] +syst = [] +loop = 100 + +for i in range(loop): + lines = check_output(['time -p az'], shell=True, stderr=STDOUT).split('\n') + real_time = float(lines[-4].split()[1]) + real.append(float(lines[-4].split()[1])) + user.append(float(lines[-3].split()[1])) + syst.append(float(lines[-2].split()[1])) + sys.stdout.write('Loop {} => {} \n'.format(i, real_time)) + sys.stdout.flush() + +print('Real: mean => {} \t pstdev => {}'.format(mean(real), pstdev(real))) +print('User: mean => {} \t pstdev => {}'.format(mean(user), pstdev(user))) +print('Syst: mean => {} \t pstdev => {}'.format(mean(syst), pstdev(syst))) diff --git a/src/azure-cli-core/HISTORY.rst b/src/azure-cli-core/HISTORY.rst index 031f1ad08..edd7d5713 100644 --- a/src/azure-cli-core/HISTORY.rst +++ b/src/azure-cli-core/HISTORY.rst @@ -4,6 +4,7 @@ Release History =============== 2.0.3 (unreleased) ^^^^^^^^^^^^^^^^^^ +*core: fix a failure when login using a service principal twice (#2800) *core: Allow file path of accessTokens.json to be configurable through an env var(#2605) *core: Allow configured defaults to apply on optional args(#2703) *core: Improved performance diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index 2773418ad..aafb00f25 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -499,7 +499,7 @@ class CredsCache(object): # pylint: disable=line-too-long if (sp_entry.get(_ACCESS_TOKEN, None) != getattr(matched[0], _ACCESS_TOKEN, None) or sp_entry.get(_SERVICE_PRINCIPAL_CERT_FILE, None) != getattr(matched[0], _SERVICE_PRINCIPAL_CERT_FILE, None)): - self._service_principal_creds.pop(matched[0]) + self._service_principal_creds.remove(matched[0]) self._service_principal_creds.append(matched[0]) state_changed = True else:
Weird error on login - 'dict' object cannot be interpreted as an integer ### Environment summary **Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly) ``` rm -rf $HOME/.local/lib/python3.6 mkdir $HOME/.local/lib/python3.6/site-packages pip install --no-cache-dir --user --upgrade --pre azure-cli --extra-index-url https://azureclinightly.blob.core.windows.net/packages pip install --user --upgrade --pre azure-cli-acr azure-cli-keyvault --extra-index-url https://azureclinightly.blob.core.windows.net/packages ``` **CLI Version:** What version of the CLI and modules are installed? (Use `az --version`) ``` azure-cli (2.0.2+1.dev20170406) acr (2.0.0+1.dev20170406) acs (2.0.2+1.dev20170406) appservice (0.1.2+1.dev20170406) batch (2.0.0+1.dev20170406) cloud (2.0.0+1.dev20170406) component (2.0.0+1.dev20170406) configure (2.0.2+1.dev20170406) container (0.1.2+1.dev20170406) core (2.0.2+1.dev20170406) documentdb (0.1.2+1.dev20170406) feedback (2.0.0+1.dev20170406) find (0.1.2rc1+1.dev20170312) iot (0.1.2+1.dev20170406) keyvault (2.0.0+1.dev20170406) lab (0.0.1+1.dev20170406) monitor (0.0.1+1.dev20170406) network (2.0.2+1.dev20170406) nspkg (2.0.0+1.dev20170406) profile (2.0.2+1.dev20170406) redis (0.1.1b3+1.dev20170406) resource (2.0.2+1.dev20170406) role (2.0.1+1.dev20170406) sql (2.0.0+1.dev20170406) storage (2.0.2+1.dev20170406) vm (2.0.2+1.dev20170406) Python (Linux) 3.6.1 (default, Mar 27 2017, 00:27:06) [GCC 6.3.1 20170306] ``` **OS Version:** What OS and version are you using? Arch Linux, up to date **Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows) `zsh` --- ### Description ``` $ az login --service-principal --username xxx --password xxx --tenant xxx 'dict' object cannot be interpreted as an integer Traceback (most recent call last): File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/main.py", line 37, in main cmd_result = APPLICATION.execute(args) File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/core/application.py", line 157, in execute result = expanded_arg.func(params) File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 367, in _execute_command raise ex File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 362, in _execute_command result = op(client, **kwargs) if client else op(**kwargs) File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/command_modules/profile/custom.py", line 79, in login tenant) File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 135, in find_subscriptions_on_login tenant)) File "/home/cole/.local/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 500, in save_service_principal_cred self._service_principal_creds.pop(matched[0]) TypeError: 'dict' object cannot be interpreted as an integer ``` If I `rm -rf ~/.azure` first, it goes away. Maybe a bug in merging stuff together? ~~Also, weird though, since my script sets `AZURE_CONFIG_DIR` to a temp dir, so it should be like new every time...~~ I wasn't properly exporting it, when I do, I avoid this issue since each script run gets its own config directory.
Azure/azure-cli
diff --git a/src/azure-cli-core/tests/test_profile.py b/src/azure-cli-core/tests/test_profile.py index bbb63cd5f..a78211b84 100644 --- a/src/azure-cli-core/tests/test_profile.py +++ b/src/azure-cli-core/tests/test_profile.py @@ -581,6 +581,25 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method self.assertEqual(creds_cache._service_principal_creds, [test_sp, test_sp2]) mock_open_for_write.assert_called_with(mock.ANY, 'w+') + @mock.patch('azure.cli.core._profile._load_tokens_from_file', autospec=True) + @mock.patch('os.fdopen', autospec=True) + @mock.patch('os.open', autospec=True) + def test_credscache_add_preexisting_sp_creds(self, _, mock_open_for_write, mock_read_file): + test_sp = { + "servicePrincipalId": "myapp", + "servicePrincipalTenant": "mytenant", + "accessToken": "Secret" + } + mock_open_for_write.return_value = FileHandleStub() + mock_read_file.return_value = [test_sp] + creds_cache = CredsCache() + + # action + creds_cache.save_service_principal_cred(test_sp) + + # assert + self.assertEqual(creds_cache._service_principal_creds, [test_sp]) + @mock.patch('azure.cli.core._profile._load_tokens_from_file', autospec=True) @mock.patch('os.fdopen', autospec=True) @mock.patch('os.open', autospec=True)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_added_files", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 3 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.0 -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@f6b3c18535cf9d1753213311cfe686a7d8f1295d#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.4 azure-core==1.24.2 azure-datalake-store==0.0.6 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.0 azure-mgmt-compute==0.33.1rc1 azure-mgmt-containerregistry==0.2.0 azure-mgmt-datalake-analytics==0.1.3 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.3 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.1 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-monitor==0.1.0 azure-mgmt-network==0.30.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.30.2 azure-mgmt-sql==0.4.0 azure-mgmt-storage==0.31.0 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-monitor==0.2.0 azure-nspkg==3.0.2 azure-storage==0.34.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.0 - azure-common==1.1.4 - azure-core==1.24.2 - azure-datalake-store==0.0.6 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.0 - azure-mgmt-compute==0.33.1rc1 - azure-mgmt-containerregistry==0.2.0 - azure-mgmt-datalake-analytics==0.1.3 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.3 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.1 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-monitor==0.1.0 - azure-mgmt-network==0.30.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==0.30.2 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==0.31.0 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-monitor==0.2.0 - azure-nspkg==3.0.2 - azure-storage==0.34.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_add_preexisting_sp_creds" ]
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_using_cert", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_service_principal_auth_client_cert" ]
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_create_token_cache", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_add_new_sp_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds_with_cert", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds_with_secret", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_new_token_added_by_adal", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_remove_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_default_active_subscription_to_non_disabled_one", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_particular_tenent", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_id", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_interactive_from_particular_tenent", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_through_interactive_flow", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password_with_account_disabled", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_current_account_user", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info_for_logged_in_service_principal", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_login_credentials", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_login_credentials_for_graph_client", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_subscription", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_load_cached_tokens", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_logout", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_logout_all", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_normalize", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_service_principal_auth_client_secret", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_set_active_subscription", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_update_add_two_different_subscriptions", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_update_with_same_subscription_added_twice" ]
[]
MIT License
1,180
[ "src/azure-cli-core/azure/cli/core/_profile.py", "src/azure-cli-core/HISTORY.rst", ".gitignore", "scripts/jenkins_perf.sh", "scripts/jenkins_build.sh", "scripts/jenkins_archive.sh", "scripts/performance/measure.py", "Jenkinsfile" ]
[ "src/azure-cli-core/azure/cli/core/_profile.py", "src/azure-cli-core/HISTORY.rst", ".gitignore", "scripts/jenkins_perf.sh", "scripts/jenkins_build.sh", "scripts/jenkins_archive.sh", "scripts/performance/measure.py", "Jenkinsfile" ]
elastic__elasticsearch-py-569
fe897ebe0d2167e91ea19fa9a81f448a861d58d1
2017-04-13 11:28:46
fe897ebe0d2167e91ea19fa9a81f448a861d58d1
diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index c735b70a..488cf8be 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -3,7 +3,7 @@ import logging from ..transport import Transport from ..exceptions import TransportError -from ..compat import string_types, urlparse +from ..compat import string_types, urlparse, unquote from .indices import IndicesClient from .ingest import IngestClient from .cluster import ClusterClient @@ -49,7 +49,8 @@ def _normalize_hosts(hosts): h['scheme'] = parsed_url.scheme if parsed_url.username or parsed_url.password: - h['http_auth'] = '%s:%s' % (parsed_url.username, parsed_url.password) + h['http_auth'] = '%s:%s' % (unquote(parsed_url.username), + unquote(parsed_url.password)) if parsed_url.path and parsed_url.path != '/': h['url_prefix'] = parsed_url.path diff --git a/elasticsearch/compat.py b/elasticsearch/compat.py index deee3c52..a5b615d2 100644 --- a/elasticsearch/compat.py +++ b/elasticsearch/compat.py @@ -4,10 +4,10 @@ PY2 = sys.version_info[0] == 2 if PY2: string_types = basestring, - from urllib import quote_plus, urlencode + from urllib import quote_plus, urlencode, unquote from urlparse import urlparse from itertools import imap as map else: string_types = str, bytes - from urllib.parse import quote_plus, urlencode, urlparse + from urllib.parse import quote_plus, urlencode, urlparse, unquote map = map
user:password in hosts are not url decoded Hello, If I have a character like "]" in my username or password I must urlencode it or `urlparse` will interpret the host as IPv6. Unfortunately, `urlparse` does not urldecode fragments : ``` The components are not broken up in smaller parts (for example, the network location is a single string), and % escapes are not expanded. ``` (https://docs.python.org/3/library/urllib.parse.html) `_normalize_hosts` should urldecode explicitely, which I will propose in a PR.
elastic/elasticsearch-py
diff --git a/test_elasticsearch/test_client/__init__.py b/test_elasticsearch/test_client/__init__.py index 4bf2978c..ec01145e 100644 --- a/test_elasticsearch/test_client/__init__.py +++ b/test_elasticsearch/test_client/__init__.py @@ -13,8 +13,8 @@ class TestNormalizeHosts(TestCase): def test_strings_are_parsed_for_port_and_user(self): self.assertEquals( - [{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secret"}], - _normalize_hosts(["elastic.co:42", "user:[email protected]"]) + [{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secre]"}], + _normalize_hosts(["elastic.co:42", "user:secre%[email protected]"]) ) def test_strings_are_parsed_for_scheme(self):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
5.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 -e git+https://github.com/elastic/elasticsearch-py.git@fe897ebe0d2167e91ea19fa9a81f448a861d58d1#egg=elasticsearch exceptiongroup==1.2.2 execnet==2.1.1 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 tomli==2.2.1 typing_extensions==4.13.0 urllib3==1.26.20
name: elasticsearch-py channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - exceptiongroup==1.2.2 - execnet==2.1.1 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - tomli==2.2.1 - typing-extensions==4.13.0 - urllib3==1.26.20 prefix: /opt/conda/envs/elasticsearch-py
[ "test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_strings_are_parsed_for_port_and_user" ]
[]
[ "test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_dicts_are_left_unchanged", "test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_none_uses_defaults", "test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_single_string_is_wrapped_in_list", "test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_strings_are_parsed_for_scheme", "test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_strings_are_used_as_hostnames", "test_elasticsearch/test_client/__init__.py::TestClient::test_from_in_search", "test_elasticsearch/test_client/__init__.py::TestClient::test_index_uses_post_if_id_is_empty", "test_elasticsearch/test_client/__init__.py::TestClient::test_index_uses_put_if_id_is_not_empty", "test_elasticsearch/test_client/__init__.py::TestClient::test_params_is_copied_when", "test_elasticsearch/test_client/__init__.py::TestClient::test_repr_contains_hosts", "test_elasticsearch/test_client/__init__.py::TestClient::test_repr_contains_hosts_passed_in", "test_elasticsearch/test_client/__init__.py::TestClient::test_repr_truncates_host_to_10", "test_elasticsearch/test_client/__init__.py::TestClient::test_request_timeout_is_passed_through_unescaped" ]
[]
Apache License 2.0
1,182
[ "elasticsearch/compat.py", "elasticsearch/client/__init__.py" ]
[ "elasticsearch/compat.py", "elasticsearch/client/__init__.py" ]
globus__globus-sdk-python-185
4cf08b26180d62ecef6b605c9df10ede9ebef681
2017-04-13 16:06:34
28cd0e3a3a45858ec1b2cd04a3fc2cc52db50382
diff --git a/docs/examples/native_app.rst b/docs/examples/native_app.rst index 27b0b239..9f39b8ec 100644 --- a/docs/examples/native_app.rst +++ b/docs/examples/native_app.rst @@ -1,3 +1,5 @@ +.. _examples_native_app_login: + Native App Login ---------------- diff --git a/docs/examples/three_legged_oauth.rst b/docs/examples/three_legged_oauth.rst index 5a98e408..ca36ef65 100644 --- a/docs/examples/three_legged_oauth.rst +++ b/docs/examples/three_legged_oauth.rst @@ -1,3 +1,5 @@ +.. _examples_three_legged_oauth_login: + Three Legged OAuth with Flask ----------------------------- diff --git a/globus_sdk/auth/client_types/confidential_client.py b/globus_sdk/auth/client_types/confidential_client.py index 6126ada7..fa920c42 100644 --- a/globus_sdk/auth/client_types/confidential_client.py +++ b/globus_sdk/auth/client_types/confidential_client.py @@ -1,4 +1,6 @@ import logging +import six + from globus_sdk.base import merge_params from globus_sdk.authorizers import BasicAuthorizer from globus_sdk.auth.oauth2_constants import DEFAULT_REQUESTED_SCOPES @@ -72,6 +74,9 @@ class ConfidentialAppAuthClient(AuthClient): """ self.logger.info('Fetching token(s) using client credentials') requested_scopes = requested_scopes or DEFAULT_REQUESTED_SCOPES + # convert scopes iterable to string immediately on load + if not isinstance(requested_scopes, six.string_types): + requested_scopes = " ".join(requested_scopes) return self.oauth2_token({ 'grant_type': 'client_credentials', @@ -81,12 +86,43 @@ class ConfidentialAppAuthClient(AuthClient): self, redirect_uri, requested_scopes=None, state='_default', refresh_tokens=False): """ - Starts an Authorization Code OAuth2 flow by instantiating a + Starts or resumes an Authorization Code OAuth2 flow. + + Under the hood, this is done by instantiating a :class:`GlobusAuthorizationCodeFlowManager <globus_sdk.auth.GlobusAuthorizationCodeFlowManager>` - All of the parameters to this method are passed to that class's - initializer verbatim. + **Parameters** + + ``redirect_uri`` (*string*) + The page that users should be directed to after authenticating at + the authorize URL. Required. + + ``requested_scopes`` (*iterable* or *string*) + The scopes on the token(s) being requested, as a space-separated + string or an iterable of strings. Defaults to ``openid profile + email urn:globus:auth:scope:transfer.api.globus.org:all`` + + ``state`` (*string*) + This is a way of your application passing information back to + itself in the course of the OAuth flow. Because the user will + navigate away from your application to complete the flow, this + parameter lets you pass an arbitrary string from the starting + page to the ``redirect_uri`` + + ``refresh_tokens`` (*bool*) + When True, request refresh tokens in addition to access tokens + + **Examples** + + You can see an example of this flow :ref:`in the usage examples + <examples_three_legged_oauth_login>` + + **External Documentation** + + The Authorization Code Grant flow is described + `in the Globus Auth Specification \ + <https://docs.globus.org/api/auth/developer-guide/#obtaining-authorization>`_ """ self.logger.info('Starting OAuth2 Authorization Code Grant Flow') self.current_oauth2_flow_manager = GlobusAuthorizationCodeFlowManager( diff --git a/globus_sdk/auth/client_types/native_client.py b/globus_sdk/auth/client_types/native_client.py index 818269ab..20f55c58 100644 --- a/globus_sdk/auth/client_types/native_client.py +++ b/globus_sdk/auth/client_types/native_client.py @@ -40,14 +40,59 @@ class NativeAppAuthClient(AuthClient): state='_default', verifier=None, refresh_tokens=False, prefill_named_grant=None): """ - Starts a Native App OAuth2 flow by instantiating a + Starts a Native App OAuth2 flow. + + This is done internally by instantiating a :class:`GlobusNativeAppFlowManager <globus_sdk.auth.GlobusNativeAppFlowManager>` - All of the parameters to this method are passed to that class's - initializer verbatim. + While the flow is in progress, the ``NativeAppAuthClient`` becomes + non thread-safe as temporary state is stored during the flow. + + **Parameters** + + ``requested_scopes`` (*iterable* or *string*) + The scopes on the token(s) being requested, as a space-separated + string or iterable of strings. Defaults to ``openid profile email + urn:globus:auth:scope:transfer.api.globus.org:all`` + + ``redirect_uri`` (*string*) + The page that users should be directed to after authenticating at + the authorize URL. Defaults to + 'https://auth.globus.org/v2/web/auth-code', which displays the + resulting ``auth_code`` for users to copy-paste back into your + application (and thereby be passed back to the + ``GlobusNativeAppFlowManager``) + + ``state`` (*string*) + Typically is not meaningful in the Native App Grant flow, but you + may have a specialized use case for it. The ``redirect_uri`` page + will have this included in a query parameter, so you can use it + to pass information to that page. It defaults to the string + '_default' + + ``verifier`` (*string*) + A secret used for the Native App flow. It will by default be a + freshly generated random string, known only to this + ``GlobusNativeAppFlowManager`` instance + + ``refresh_tokens`` (*bool*) + When True, request refresh tokens in addition to access tokens + + ``prefill_named_grant`` (*string*) + Optionally prefill the named grant label on the consent page + + **Examples** + + You can see an example of this flow :ref:`in the usage examples + <examples_native_app_login>` + + **External Documentation** - #notthreadsafe + The Globus Auth specification for Native App grants details the + modifications to the Authorization Code grant flow as + `The PKCE Security Protocol \ + <https://docs.globus.org/api/auth/developer-guide/#pkce>`_ """ self.logger.info('Starting Native App Grant Flow') self.current_oauth2_flow_manager = GlobusNativeAppFlowManager( diff --git a/globus_sdk/auth/oauth2_authorization_code.py b/globus_sdk/auth/oauth2_authorization_code.py index df5141a0..8a9b312b 100644 --- a/globus_sdk/auth/oauth2_authorization_code.py +++ b/globus_sdk/auth/oauth2_authorization_code.py @@ -1,4 +1,5 @@ import logging +import six from six.moves.urllib.parse import urlencode from globus_sdk.base import slash_join @@ -34,9 +35,9 @@ class GlobusAuthorizationCodeFlowManager(GlobusOAuthFlowManager): The page that users should be directed to after authenticating at the authorize URL. Required. - ``requested_scopes`` (*string*) + ``requested_scopes`` (*iterable* or *string*) The scopes on the token(s) being requested, as a space-separated - string. Defaults to ``openid profile email + string or an iterable of strings. Defaults to ``openid profile email urn:globus:auth:scope:transfer.api.globus.org:all`` ``state`` (*string*) @@ -55,6 +56,9 @@ class GlobusAuthorizationCodeFlowManager(GlobusOAuthFlowManager): refresh_tokens=False): # default to the default requested scopes self.requested_scopes = requested_scopes or DEFAULT_REQUESTED_SCOPES + # convert scopes iterable to string immediately on load + if not isinstance(self.requested_scopes, six.string_types): + self.requested_scopes = " ".join(self.requested_scopes) # store the remaining parameters directly, with no transformation self.client_id = auth_client.client_id diff --git a/globus_sdk/auth/oauth2_constants.py b/globus_sdk/auth/oauth2_constants.py index e92902eb..fb3fce16 100644 --- a/globus_sdk/auth/oauth2_constants.py +++ b/globus_sdk/auth/oauth2_constants.py @@ -2,5 +2,5 @@ __all__ = ['DEFAULT_REQUESTED_SCOPES'] DEFAULT_REQUESTED_SCOPES = ( - 'openid profile email ' + 'openid', 'profile', 'email', 'urn:globus:auth:scope:transfer.api.globus.org:all') diff --git a/globus_sdk/auth/oauth2_native_app.py b/globus_sdk/auth/oauth2_native_app.py index af646d6d..f42b38dc 100644 --- a/globus_sdk/auth/oauth2_native_app.py +++ b/globus_sdk/auth/oauth2_native_app.py @@ -3,6 +3,7 @@ import hashlib import base64 import re import os +import six from six.moves.urllib.parse import urlencode from globus_sdk.base import slash_join @@ -72,9 +73,9 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): used to extract default values for the flow, and also to make calls to the Auth service. This SHOULD be a ``NativeAppAuthClient`` - ``requested_scopes`` (*string*) + ``requested_scopes`` (*iterable* or *string*) The scopes on the token(s) being requested, as a space-separated - string. Defaults to ``openid profile email + string or iterable of strings. Defaults to ``openid profile email urn:globus:auth:scope:transfer.api.globus.org:all`` ``redirect_uri`` (*string*) @@ -99,7 +100,7 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): ``refresh_tokens`` (*bool*) When True, request refresh tokens in addition to access tokens - ``prefill_named_grant`` (*string*) + ``prefill_named_grant`` (*string*) Optionally prefill the named grant label on the consent page """ @@ -119,6 +120,9 @@ class GlobusNativeAppFlowManager(GlobusOAuthFlowManager): # default to the default requested scopes self.requested_scopes = requested_scopes or DEFAULT_REQUESTED_SCOPES + # convert scopes iterable to string immediately on load + if not isinstance(self.requested_scopes, six.string_types): + self.requested_scopes = " ".join(self.requested_scopes) # default to `/v2/web/auth-code` on whatever environment we're looking # at -- most typically it will be `https://auth.globus.org/`
Make requested_scopes accept (in all contexts) an iterable of strings Right now, we're requiring that people give us a space-delimited string. Many people have pointed out that it's awkward / uncomfortable. Wouldn't it be great if we could take tuples and lists? Yes, yes it would. This shouldn't be too hard.
globus/globus-sdk-python
diff --git a/tests/integration/test_auth_client_flow.py b/tests/integration/test_auth_client_flow.py index c6e8ffa3..4ca019d8 100644 --- a/tests/integration/test_auth_client_flow.py +++ b/tests/integration/test_auth_client_flow.py @@ -27,7 +27,8 @@ class AuthClientIntegrationTests(CapturedIOTestCase): "client_id=" + ac.client_id, "redirect_uri=" + quote_plus(ac.base_url + "v2/web/auth-code"), - "scope=" + quote_plus(DEFAULT_REQUESTED_SCOPES), + "scope=" + quote_plus( + " ".join(DEFAULT_REQUESTED_SCOPES)), "state=" + "_default", "response_type=" + "code", "code_challenge=" + @@ -76,7 +77,8 @@ class AuthClientIntegrationTests(CapturedIOTestCase): expected_vals = [ac.base_url + "v2/oauth2/authorize?", "client_id=" + ac.client_id, "redirect_uri=" + "uri", - "scope=" + quote_plus(DEFAULT_REQUESTED_SCOPES), + "scope=" + quote_plus( + " ".join(DEFAULT_REQUESTED_SCOPES)), "state=" + "_default", "response_type=" + "code", "access_type=" + "online"] diff --git a/tests/integration/test_confidential_client_flow.py b/tests/integration/test_confidential_client_flow.py index e7039e44..d713c741 100644 --- a/tests/integration/test_confidential_client_flow.py +++ b/tests/integration/test_confidential_client_flow.py @@ -31,7 +31,8 @@ class ConfidentialAppAuthClientIntegrationTests(CapturedIOTestCase): flow = self.cac.oauth2_start_flow("uri") self.assertIsInstance(flow, GlobusAuthorizationCodeFlowManager) self.assertEqual(flow.redirect_uri, "uri") - self.assertEqual(flow.requested_scopes, DEFAULT_REQUESTED_SCOPES) + self.assertEqual(flow.requested_scopes, + " ".join(DEFAULT_REQUESTED_SCOPES)) self.assertEqual(flow.state, "_default") self.assertFalse(flow.refresh_tokens) @@ -40,7 +41,8 @@ class ConfidentialAppAuthClientIntegrationTests(CapturedIOTestCase): expected_vals = [self.cac.base_url + "v2/oauth2/authorize?", "client_id=" + self.cac.client_id, "redirect_uri=" + "uri", - "scope=" + quote_plus(DEFAULT_REQUESTED_SCOPES), + "scope=" + quote_plus( + " ".join(DEFAULT_REQUESTED_SCOPES)), "state=" + "_default", "access_type=" + "online"] for val in expected_vals: diff --git a/tests/integration/test_native_client_flow.py b/tests/integration/test_native_client_flow.py index c07a8c40..6d7d42a2 100644 --- a/tests/integration/test_native_client_flow.py +++ b/tests/integration/test_native_client_flow.py @@ -31,7 +31,8 @@ class NativeAppAuthClientIntegrationTests(CapturedIOTestCase): self.assertIsInstance(flow, GlobusNativeAppFlowManager) self.assertEqual(flow.redirect_uri, self.nac.base_url + "v2/web/auth-code") - self.assertEqual(flow.requested_scopes, DEFAULT_REQUESTED_SCOPES) + self.assertEqual(flow.requested_scopes, + " ".join(DEFAULT_REQUESTED_SCOPES)) self.assertEqual(flow.state, "_default") self.assertFalse(flow.refresh_tokens) @@ -41,7 +42,8 @@ class NativeAppAuthClientIntegrationTests(CapturedIOTestCase): "client_id=" + self.nac.client_id, "redirect_uri=" + quote_plus(self.nac.base_url + "v2/web/auth-code"), - "scope=" + quote_plus(DEFAULT_REQUESTED_SCOPES), + "scope=" + quote_plus( + " ".join(DEFAULT_REQUESTED_SCOPES)), "state=" + "_default", "code_challenge=" + quote_plus(flow.challenge), "access_type=" + "online"] diff --git a/tests/unit/test_confidential_client.py b/tests/unit/test_confidential_client.py index 3346ba96..a6b1059d 100644 --- a/tests/unit/test_confidential_client.py +++ b/tests/unit/test_confidential_client.py @@ -1,3 +1,8 @@ +try: + import mock +except ImportError: + from unittest import mock + import globus_sdk from tests.framework import CapturedIOTestCase, get_client_data from globus_sdk.exc import GlobusAPIError @@ -28,7 +33,14 @@ class ConfidentialAppAuthClientTests(CapturedIOTestCase): Confirm tokens allow use of userinfo for the client Returns access_token for testing """ - token_res = self.cac.oauth2_client_credentials_tokens() + with mock.patch.object(self.cac, 'oauth2_token', + side_effect=self.cac.oauth2_token) as m: + token_res = self.cac.oauth2_client_credentials_tokens( + requested_scopes="openid profile") + m.assert_called_once_with( + {"grant_type": "client_credentials", + "scope": "openid profile"}) + # validate results self.assertIn("access_token", token_res) self.assertIn("expires_in", token_res) diff --git a/tests/unit/test_oauth2_authorization_code.py b/tests/unit/test_oauth2_authorization_code.py index 5c531719..5c634b91 100644 --- a/tests/unit/test_oauth2_authorization_code.py +++ b/tests/unit/test_oauth2_authorization_code.py @@ -18,10 +18,16 @@ class GlobusAuthorizationCodeFlowManagerTests(CapturedIOTestCase): self.ac = mock.Mock() self.ac.client_id = "client_id" self.ac.base_url = "base_url/" - self.flow_manager = globus_sdk.auth.GlobusNativeAppFlowManager( + self.flow_manager = globus_sdk.auth.GlobusAuthorizationCodeFlowManager( self.ac, requested_scopes="scopes", redirect_uri="uri", state="state") + def test_init_handles_iterable_scopes(self): + flow_manager = globus_sdk.auth.GlobusAuthorizationCodeFlowManager( + self.ac, requested_scopes=["scope1", "scope2"], redirect_uri="uri", + state="state") + self.assertEquals(flow_manager.requested_scopes, "scope1 scope2") + def test_get_authorize_url(self): """ Creates an authorize url, confirms results match object values @@ -55,9 +61,7 @@ class GlobusAuthorizationCodeFlowManagerTests(CapturedIOTestCase): auth_code = "code" self.flow_manager.exchange_code_for_tokens(auth_code) - expected = {"client_id": self.ac.client_id, - "grant_type": "authorization_code", + expected = {"grant_type": "authorization_code", "code": auth_code.encode("utf-8"), - "code_verifier": self.flow_manager.verifier, "redirect_uri": self.flow_manager.redirect_uri} self.ac.oauth2_token.assert_called_with(expected) diff --git a/tests/unit/test_oauth2_native_app.py b/tests/unit/test_oauth2_native_app.py index fb060c90..0782c1ae 100644 --- a/tests/unit/test_oauth2_native_app.py +++ b/tests/unit/test_oauth2_native_app.py @@ -26,6 +26,13 @@ class GlobusNativeAppFlowManagerTests(CapturedIOTestCase): self.ac, requested_scopes="scopes", redirect_uri="uri", state="state") + def test_init_handles_iterable_scopes(self): + flow_manager = globus_sdk.auth.GlobusNativeAppFlowManager( + self.ac, requested_scopes=set(("scope1", "scope2")), + redirect_uri="uri", state="state") + self.assertIn(flow_manager.requested_scopes, ("scope1 scope2", + "scope2 scope1")) + def test_make_native_app_challenge(self): """ Makes native app challenge with and without verifier,
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 7 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[jwt]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio", "pytest" ], "pre_install": [], "python": "3.6", "reqs_path": [ "test-requirements.txt", "docs-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 docutils==0.18.1 ecdsa==0.19.1 execnet==1.9.0 flake8==3.9.2 future==0.18.3 -e git+https://github.com/globus/globus-sdk-python.git@4cf08b26180d62ecef6b605c9df10ede9ebef681#egg=globus_sdk guzzle-sphinx-theme==0.7.11 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mccabe==0.6.1 mock==2.0.0 nose2==0.6.5 packaging==21.3 pbr==6.1.1 pluggy==1.0.0 py==1.11.0 pycodestyle==2.7.0 pycrypto==2.6.1 pyflakes==2.3.1 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytest-asyncio==0.16.0 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 python-jose==1.4.0 pytz==2025.2 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==1.4.1 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: globus-sdk-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - coverage==6.2 - docutils==0.18.1 - ecdsa==0.19.1 - execnet==1.9.0 - flake8==3.9.2 - future==0.18.3 - guzzle-sphinx-theme==0.7.11 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mccabe==0.6.1 - mock==2.0.0 - nose2==0.6.5 - packaging==21.3 - pbr==6.1.1 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.7.0 - pycrypto==2.6.1 - pyflakes==2.3.1 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-asyncio==0.16.0 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - python-jose==1.4.0 - pytz==2025.2 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==1.4.1 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/globus-sdk-python
[ "tests/integration/test_auth_client_flow.py::AuthClientIntegrationTests::test_oauth2_get_authorize_url_confidential", "tests/integration/test_auth_client_flow.py::AuthClientIntegrationTests::test_oauth2_get_authorize_url_native", "tests/unit/test_oauth2_authorization_code.py::GlobusAuthorizationCodeFlowManagerTests::test_init_handles_iterable_scopes", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_init_handles_iterable_scopes" ]
[ "tests/integration/test_auth_client_flow.py::AuthClientIntegrationTests::test_oauth2_exchange_code_for_tokens_native", "tests/integration/test_confidential_client_flow.py::ConfidentialAppAuthClientIntegrationTests::test_oauth2_start_flow_default", "tests/integration/test_confidential_client_flow.py::ConfidentialAppAuthClientIntegrationTests::test_oauth2_start_flow_specified", "tests/integration/test_native_client_flow.py::NativeAppAuthClientIntegrationTests::test_oauth2_start_flow_default", "tests/integration/test_native_client_flow.py::NativeAppAuthClientIntegrationTests::test_oauth2_start_flow_specified" ]
[ "tests/integration/test_auth_client_flow.py::AuthClientIntegrationTests::test_oauth2_exchange_code_for_tokens_confidential", "tests/unit/test_confidential_client.py::ConfidentialAppAuthClientTests::test_oauth2_client_credentials_tokens", "tests/unit/test_confidential_client.py::ConfidentialAppAuthClientTests::test_oauth2_get_dependent_tokens", "tests/unit/test_confidential_client.py::ConfidentialAppAuthClientTests::test_oauth2_token_introspect", "tests/unit/test_oauth2_authorization_code.py::GlobusAuthorizationCodeFlowManagerTests::test_exchange_code_for_tokens", "tests/unit/test_oauth2_authorization_code.py::GlobusAuthorizationCodeFlowManagerTests::test_get_authorize_url", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_exchange_code_for_tokens", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_get_authorize_url", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_make_native_app_challenge", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_make_native_app_challenge_invalid_verifier", "tests/unit/test_oauth2_native_app.py::GlobusNativeAppFlowManagerTests::test_prefill_named_grant" ]
[]
Apache License 2.0
1,183
[ "globus_sdk/auth/client_types/native_client.py", "docs/examples/three_legged_oauth.rst", "globus_sdk/auth/client_types/confidential_client.py", "globus_sdk/auth/oauth2_native_app.py", "docs/examples/native_app.rst", "globus_sdk/auth/oauth2_authorization_code.py", "globus_sdk/auth/oauth2_constants.py" ]
[ "globus_sdk/auth/client_types/native_client.py", "docs/examples/three_legged_oauth.rst", "globus_sdk/auth/client_types/confidential_client.py", "globus_sdk/auth/oauth2_native_app.py", "docs/examples/native_app.rst", "globus_sdk/auth/oauth2_authorization_code.py", "globus_sdk/auth/oauth2_constants.py" ]
pydap__pydap-93
caf29ed33a4d96b0fc0f166863e1eea425b200eb
2017-04-13 18:30:31
eb8ee96bdf150642bf2e0603f406d2053af02424
diff --git a/src/pydap/handlers/dap.py b/src/pydap/handlers/dap.py index 8e8f6c5..72c44f1 100644 --- a/src/pydap/handlers/dap.py +++ b/src/pydap/handlers/dap.py @@ -26,11 +26,13 @@ from pydap.model import (BaseType, from ..net import GET, raise_for_status from ..lib import ( encode, combine_slices, fix_slice, hyperslab, - START_OF_SEQUENCE, walk, StreamReader, BytesReader) + START_OF_SEQUENCE, walk, StreamReader, BytesReader, + DAP2_ARRAY_LENGTH_NUMPY_TYPE) from .lib import ConstraintExpression, BaseHandler, IterData from ..parsers.dds import build_dataset from ..parsers.das import parse_das, add_attributes from ..parsers import parse_ce +from ..responses.dods import DAP2_response_dtypemap logger = logging.getLogger('pydap') logger.addHandler(logging.NullHandler()) @@ -354,15 +356,19 @@ def unpack_children(stream, template): return out -def convert_stream_to_list(stream, dtype, shape, id): +def convert_stream_to_list(stream, parser_dtype, shape, id): out = [] + response_dtype = DAP2_response_dtypemap(parser_dtype) if shape: - n = np.fromstring(stream.read(4), ">I")[0] - count = dtype.itemsize * n - if dtype.char in "SU": + n = np.fromstring(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] + count = response_dtype.itemsize * n + if response_dtype.char in 'S': + # Consider on 'S' and not 'SU' because + # response_dtype.char should never be data = [] for _ in range(n): - k = np.fromstring(stream.read(4), ">I")[0] + k = np.fromstring(stream.read(4), + DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] data.append(stream.read(k)) stream.read(-k % 4) out.append(np.array([text_type(x.decode('ascii')) @@ -372,7 +378,8 @@ def convert_stream_to_list(stream, dtype, shape, id): try: out.append( np.fromstring( - stream.read(count), dtype).reshape(shape)) + stream.read(count), response_dtype) + .astype(parser_dtype).reshape(shape)) except ValueError as e: if str(e) == 'total size of new array must be unchanged': # server-side failure. @@ -384,22 +391,26 @@ def convert_stream_to_list(stream, dtype, shape, id): 'output_grid=False).').format(quote(id))) else: raise - if dtype.char == "B": + if response_dtype.char == "B": + # Unsigned Byte type is packed to multiples of 4 bytes: stream.read(-n % 4) # special types: strings and bytes - elif dtype.char in 'SU': - k = np.fromstring(stream.read(4), '>I')[0] + elif response_dtype.char in 'S': + # Consider on 'S' and not 'SU' because + # response_dtype.char should never be + # 'U' + k = np.fromstring(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] out.append(text_type(stream.read(k).decode('ascii'))) stream.read(-k % 4) - elif dtype.char == 'B': - data = np.fromstring(stream.read(1), dtype)[0] - stream.read(3) - out.append(data) # usual data else: out.append( - np.fromstring(stream.read(dtype.itemsize), dtype)[0]) + np.fromstring(stream.read(response_dtype.itemsize), response_dtype) + .astype(parser_dtype)[0]) + if response_dtype.char == "B": + # Unsigned Byte type is packed to multiples of 4 bytes: + stream.read(3) return out @@ -427,9 +438,9 @@ def dump(): # pragma: no cover """ dods = sys.stdin.read() dds, xdrdata = dods.split(b'\nData:\n', 1) - xdr_stream = io.BytesIO(xdrdata) - dds = dds.decode('ascii') dataset = build_dataset(dds) + xdr_stream = io.BytesIO(xdrdata) data = unpack_data(xdr_stream, dataset) + data = dataset.data pprint.pprint(data) diff --git a/src/pydap/lib.py b/src/pydap/lib.py index 6321a7d..916b9aa 100644 --- a/src/pydap/lib.py +++ b/src/pydap/lib.py @@ -17,6 +17,95 @@ START_OF_SEQUENCE = b'\x5a\x00\x00\x00' END_OF_SEQUENCE = b'\xa5\x00\x00\x00' STRING = '|S128' +NUMPY_TO_DAP2_TYPEMAP = { + 'd': 'Float64', + 'f': 'Float32', + 'h': 'Int16', + 'H': 'UInt16', + 'i': 'Int32', 'l': 'Int32', 'q': 'Int32', + 'I': 'UInt32', 'L': 'UInt32', 'Q': 'UInt32', + # DAP2 does not support signed bytes. + # Its Byte type is unsigned and thus corresponds + # to numpy's 'B'. + # The consequence is that there is no natural way + # in DAP2 to represent numpy's 'b' type. + # Ideally, DAP2 would have a signed Byte type + # and an unsigned UByte type and we would have the + # following mapping: {'b': 'Byte', 'B': 'UByte'} + # but this not how the protocol has been defined. + # This means that numpy's 'b' must be mapped to Int16 + # and data must be upconverted in the DODS response. + 'b': 'Int16', + 'B': 'Byte', + # There are no boolean types in DAP2. Upconvert to + # Byte: + '?': 'Byte', + 'S': 'String', + # Map numpy's 'U' to String b/c + # DAP2 does not explicitly support unicode. + 'U': 'String' +} + +# DAP2 demands big-endian 32 bytes signed integers +# www.opendap.org/pdf/dap_2_data_model.pdf +# Before pydap 3.2.2, length was +# big-endian 32 bytes UNSIGNED integers: +# DAP2_ARRAY_LENGTH_NUMPY_TYPE = '>I' +# Since pydap 3.2.2, the length type is accurate: +DAP2_ARRAY_LENGTH_NUMPY_TYPE = '>i' + +DAP2_TO_NUMPY_RESPONSE_TYPEMAP = { + 'Float64': '>d', + 'Float32': '>f', + # This is a weird aspect of the DAP2 specification. + # For backward-compatibility, Int16 and UInt16 are + # encoded as 32 bits integers in the response, + # respectively: + 'Int16': '>i', + 'UInt16': '>I', + 'Int32': '>i', + 'UInt32': '>I', + # DAP2 does not support signed bytes. + # It's Byte type is unsigned and thus corresponds + # to numpy 'B'. + # The consequence is that there is no natural way + # in DAP2 to represent numpy's 'b' type. + # Ideally, DAP2 would have a signed Byte type + # and a usigned UByte type and we would have the + # following mapping: {'Byte': 'b', 'UByte': 'B'} + # but this not how the protocol has been defined. + # This means that DAP2 Byte is unsigned and must be + # mapped to numpy's 'B' type, usigned byte. + 'Byte': 'B', + # Map String to numpy's string type 'S' b/c + # DAP2 does not explicitly support unicode. + 'String': 'S', + 'URL': 'S', + # + # These two types are not DAP2 but it is useful + # to include them for compatiblity with other + # data sources: + 'Int': '>i', + 'UInt': '>I', +} + +# Typemap from lower case DAP2 types to +# numpy dtype string with specified endiannes. +# Here, the endianness is very important: +LOWER_DAP2_TO_NUMPY_PARSER_TYPEMAP = { + 'float64': '>d', + 'float32': '>f', + 'int16': '>h', + 'uint16': '>H', + 'int32': '>i', + 'uint32': '>I', + 'byte': 'B', + 'string': STRING, + 'url': STRING, + 'int': '>i', + 'uint': '>I', +} + def quote(name): """Return quoted name according to the DAP specification. diff --git a/src/pydap/parsers/das.py b/src/pydap/parsers/das.py index ff3910d..1618e89 100644 --- a/src/pydap/parsers/das.py +++ b/src/pydap/parsers/das.py @@ -16,10 +16,6 @@ from . import SimpleParser from ..lib import walk -atomic = ('byte', 'int', 'uint', 'int16', 'uint16', 'int32', 'uint32', - 'float32', 'float64', 'string', 'url') - - class DASParser(SimpleParser): """A parser for the Dataset Attribute Structure response.""" diff --git a/src/pydap/parsers/dds.py b/src/pydap/parsers/dds.py index 981cb7f..b0cb56a 100644 --- a/src/pydap/parsers/dds.py +++ b/src/pydap/parsers/dds.py @@ -8,25 +8,22 @@ from . import SimpleParser from ..model import (DatasetType, BaseType, SequenceType, StructureType, GridType) -from ..lib import quote, STRING - -typemap = { - 'byte': np.dtype("B"), - 'int': np.dtype(">i4"), - 'uint': np.dtype(">u4"), - 'int16': np.dtype(">i4"), - 'uint16': np.dtype(">u4"), - 'int32': np.dtype(">i4"), - 'uint32': np.dtype(">u4"), - 'float32': np.dtype(">f4"), - 'float64': np.dtype(">f8"), - 'string': np.dtype(STRING), # default is "|S128" - 'url': np.dtype(STRING), - } +from ..lib import (quote, LOWER_DAP2_TO_NUMPY_PARSER_TYPEMAP) + constructors = ('grid', 'sequence', 'structure') name_regexp = r'[\w%!~"\'\*-]+' +def DAP2_parser_typemap(type_string): + """ + This function takes a numpy dtype object + and returns a dtype object that is compatible with + the DAP2 specification. + """ + dtype_str = LOWER_DAP2_TO_NUMPY_PARSER_TYPEMAP[type_string.lower()] + return np.dtype(dtype_str) + + class DDSParser(SimpleParser): """A parser for the DDS.""" @@ -72,14 +69,15 @@ class DDSParser(SimpleParser): def base(self): """Parse a base variable, returning a ``BaseType``.""" - type = self.consume(r'\w+') + data_type_string = self.consume('\w+') + + parser_dtype = DAP2_parser_typemap(data_type_string) + name = quote(self.consume('[^;\[]+')) - dtype = typemap[type.lower()] - name = quote(self.consume(r'[^;\[]+')) shape, dimensions = self.dimensions() self.consume(';') - data = DummyData(dtype, shape) + data = DummyData(parser_dtype, shape) var = BaseType(name, data, dimensions=dimensions) return var diff --git a/src/pydap/responses/das.py b/src/pydap/responses/das.py index 5364734..1b18516 100644 --- a/src/pydap/responses/das.py +++ b/src/pydap/responses/das.py @@ -19,9 +19,8 @@ from six.moves import map from ..model import (DatasetType, BaseType, StructureType, SequenceType, GridType) -from ..lib import encode, quote, __version__ +from ..lib import encode, quote, __version__, NUMPY_TO_DAP2_TYPEMAP from .lib import BaseResponse -from .dds import typemap INDENT = ' ' * 4 @@ -130,13 +129,13 @@ def get_type(values): """ if hasattr(values, 'dtype'): - return typemap[values.dtype.char] + return NUMPY_TO_DAP2_TYPEMAP[values.dtype.char] elif isinstance(values, string_types) or not isinstance(values, Iterable): return type_convert(values) else: # if there are several values, they may have different types, so we # need to convert all of them and use a precedence table - types = list(map(type_convert, values)) + types = [type_convert(val) for val in values] precedence = ['String', 'Float64', 'Int32'] types.sort(key=precedence.index) return types[0] diff --git a/src/pydap/responses/dds.py b/src/pydap/responses/dds.py index aa38c02..44f9bf8 100644 --- a/src/pydap/responses/dds.py +++ b/src/pydap/responses/dds.py @@ -19,24 +19,11 @@ from ..model import (DatasetType, BaseType, SequenceType, StructureType, GridType) from .lib import BaseResponse -from ..lib import __version__ +from ..lib import __version__, NUMPY_TO_DAP2_TYPEMAP INDENT = ' ' * 4 -typemap = { - 'd': 'Float64', - 'f': 'Float32', - 'h': 'Int16', - 'i': 'Int32', 'l': 'Int32', 'q': 'Int32', - 'b': 'Byte', - 'H': 'UInt16', - 'I': 'UInt32', 'L': 'UInt32', 'Q': 'UInt32', - 'B': 'Byte', - 'S': 'String', - 'U': 'String', -} - class DDSResponse(BaseResponse): @@ -119,6 +106,6 @@ def _basetype(var, level=0, sequence=0): yield '{indent}{type} {name}{shape};\n'.format( indent=level*INDENT, - type=typemap[var.dtype.char], + type=NUMPY_TO_DAP2_TYPEMAP[var.dtype.char], name=var.name, shape=shape) diff --git a/src/pydap/responses/dods.py b/src/pydap/responses/dods.py index a9d10ab..16cd795 100644 --- a/src/pydap/responses/dods.py +++ b/src/pydap/responses/dods.py @@ -16,7 +16,10 @@ from six import string_types from ..model import (BaseType, SequenceType, StructureType) -from ..lib import walk, START_OF_SEQUENCE, END_OF_SEQUENCE, __version__ +from ..lib import (walk, START_OF_SEQUENCE, END_OF_SEQUENCE, __version__, + NUMPY_TO_DAP2_TYPEMAP, + DAP2_TO_NUMPY_RESPONSE_TYPEMAP, + DAP2_ARRAY_LENGTH_NUMPY_TYPE) from .lib import BaseResponse from .dds import dds @@ -25,16 +28,24 @@ try: except ImportError: from singledispatch import singledispatch -typemap = { - 'd': '>d', - 'f': '>f', - 'i': '>i', 'l': '>i', 'q': '>i', 'h': '>i', - 'b': 'B', - 'I': '>I', 'L': '>I', 'Q': '>I', 'H': '>I', - 'B': 'B', - 'U': 'S' # Map unicode to string type b/c - # DAP doesn't explicitly support it -} + +def DAP2_response_dtypemap(dtype): + """ + This function takes a numpy dtype object + and returns a dtype object that is compatible with + the DAP2 specification. + """ + dtype_str = DAP2_TO_NUMPY_RESPONSE_TYPEMAP[ + NUMPY_TO_DAP2_TYPEMAP[ + dtype.char]] + return np.dtype(dtype_str) + + +def tostring_with_byteorder(x, dtype): + return (x + .astype(dtype.str) + .newbyteorder(dtype.byteorder) + .tostring()) class DODSResponse(BaseResponse): @@ -79,16 +90,19 @@ def _structuretype(var): def _sequencetype(var): # a flat array can be processed one record (or more?) at a time if all(isinstance(child, BaseType) for child in var.children()): - types = [] + DAP2_types = [] position = 0 for child in var.children(): - if child.dtype.char in 'SU': - types.append('>I') # string length as int - types.append('|S{%s}' % position) # string padded to 4n + if DAP2_response_dtypemap(child.dtype).char == 'S': + (DAP2_types + .append(DAP2_ARRAY_LENGTH_NUMPY_TYPE)) # string length + DAP2_types.append('|S{%s}' % position) # string padded to 4n position += 1 else: - types.append(typemap[child.dtype.char]) - dtype = ','.join(types) + # Convert any numpy dtypes to numpy dtypes compatible + # with the DAP2 standard: + DAP2_types.append(DAP2_response_dtypemap(child.dtype).str) + DAP2_dtype_str = ','.join(DAP2_types) strings = position > 0 # array initializations is costy, so we keep a cache here; this will @@ -108,12 +122,21 @@ def _sequencetype(var): padded.append(length + (-length % 4)) out.append(value) record = out - dtype = ','.join(types).format(*padded) - - if dtype not in cache: - cache[dtype] = np.zeros((1,), dtype=dtype) - cache[dtype][:] = tuple(record) - yield cache[dtype].tostring() + DAP2_dtype_str = ','.join(DAP2_types).format(*padded) + + if DAP2_dtype_str not in cache: + # Remember that DAP2_dtype is a (possibly composite) + # numpy dtype that is compatible with the DAP2 + # data model. This means that all dtypes in + # DAP2_dtype are representable in DAP2 -- AND -- + # the data in var can all be upconverted + # in a lossless manner to the dtypes in DAP2_dtype. + cache[DAP2_dtype_str] = np.zeros((1,), dtype=DAP2_dtype_str) + # By assigning record to ``cache`` the upconversion + # occurs naturally: + cache[DAP2_dtype_str][:] = tuple(record) + # byteorder was taken care of during the upconversion: + yield cache[DAP2_dtype_str].tostring() yield END_OF_SEQUENCE @@ -139,35 +162,52 @@ def _basetype(var): if not hasattr(data, "shape"): data = np.asarray(data) + # Convert any numpy dtypes to numpy dtypes compatible + # with the DAP2 standard: + DAP2_dtype = DAP2_response_dtypemap(data.dtype) + if data.shape: # pack length for arrays - length = np.prod(data.shape).astype('I') - if data.dtype.char in 'SU': - yield length.newbyteorder('>').tostring() - else: - yield length.newbyteorder('>').tostring() * 2 - - # bytes are padded up to 4n - if data.dtype == np.byte: - length = np.prod(data.shape) + length = np.prod(data.shape).astype(np.int) + + # send length twice at the begining of an array... + factor = 2 + if DAP2_dtype.char == 'S': + # ... expcept for strings: + factor = 1 + yield tostring_with_byteorder( + length, + np.dtype(DAP2_ARRAY_LENGTH_NUMPY_TYPE)) * factor + + # make data iterable; 1D arrays must be converted to 2D, since + # iteration over 1D yields scalars which are not properly cast to big + # endian + # This line was removed because endianness is now treated explicitly + # in tostring_with_byteorder() + # if len(data.shape) < 2: + # data = data.reshape(1, -1) + # Only ensure that 0d arrays are iterable: + if len(data.shape) == 0: + data = data[np.newaxis] + + # unsigned bytes are padded up to 4n + if DAP2_dtype == np.ubyte: + length = np.prod(data.shape).astype(np.int) for block in data: - yield block.tostring() + yield tostring_with_byteorder(block, DAP2_dtype) yield (-length % 4) * b'\0' # regular data else: - # make data iterable; 1D arrays must be converted to 2D, since - # iteration over 1D yields scalars which are not properly cast to big - # endian - if len(data.shape) < 2: - data = data.reshape(1, -1) - # strings are also zero padded and preceeded by their length - if data.dtype.char in 'SU': + if DAP2_dtype.char == 'S': for block in data: for word in block.flat: length = len(word) - yield np.array(length).astype('>I').tostring() + yield tostring_with_byteorder( + np.array(length), + np.dtype(DAP2_ARRAY_LENGTH_NUMPY_TYPE)) + # byteorder is not important for strings: if hasattr(word, 'encode'): yield word.encode('ascii') elif hasattr(word, 'tostring'): @@ -178,7 +218,13 @@ def _basetype(var): yield (-length % 4) * b'\0' else: for block in data: - yield block.astype(typemap[data.dtype.char]).tostring() + # Remember that DAP2_dtype is a + # numpy dtype that is compatible with the DAP2 + # data model. This means that the dtype in + # DAP2_dtype is representable in DAP2 -- AND -- + # the data in var can all be upconverted + # in a lossless manner to the dtype in DAP2_dtype. + yield tostring_with_byteorder(block, DAP2_dtype) def calculate_size(dataset): @@ -191,22 +237,26 @@ def calculate_size(dataset): # individually, so it's not possible to get their size unless we read # everything. if (isinstance(var, SequenceType) or - (isinstance(var, BaseType) and var.dtype.char in 'SU')): + (isinstance(var, BaseType) and + DAP2_response_dtypemap(var.dtype).char == 'S')): return None elif isinstance(var, BaseType): if var.shape: length += 8 # account for array size marker size = int(np.prod(var.shape)) - if var.data.dtype == np.byte: + + # Convert any numpy dtype to numpy dtype compatible + # with the DAP2 standard: + DAP2_dtype = DAP2_response_dtypemap(var.data.dtype) + if DAP2_dtype == np.ubyte: length += size + (-size % 4) - elif var.data.dtype == np.short: - length += size * 4 else: - opendap_size = np.dtype(typemap[var.data.dtype.char]).itemsize - length += size * opendap_size + # Remember that numpy dtypes are upconverted to + # DAP2_dtype when sent in the response. + # Their length must thus be modified accordingly: + length += size * DAP2_dtype.itemsize # account for DDS length += len(''.join(dds(dataset))) + len(b'Data:\n') - return length
Check byte use I noticed in some places of the code byte is signed, while in others it's unsigned. I should verify how the DAP spec defines it (unsigned, I think) and ensure the proper type in the code.
pydap/pydap
diff --git a/src/pydap/tests/datasets.py b/src/pydap/tests/datasets.py index 9c52498..4e9be1e 100644 --- a/src/pydap/tests/datasets.py +++ b/src/pydap/tests/datasets.py @@ -15,6 +15,7 @@ from pydap.client import open_file from collections import OrderedDict +# Note that DAP2 does not support signed bytes (signed 8bits integers). # A very simple sequence: flat and with no strings. This sequence can be mapped # directly to a Numpy structured array, and can be easily encoded and decoded @@ -33,7 +34,7 @@ VerySimpleSequence["sequence"].data = np.array([ (5, 6, 60.), (6, 7, 70.), (7, 8, 80.), - ], dtype=[('byte', 'b'), ('int', 'i4'), ('float', 'f4')]) + ], dtype=[('byte', np.ubyte), ('int', 'i4'), ('float', 'f4')]) # A nested sequence. @@ -57,7 +58,7 @@ NestedSequence["location"].data = IterData([ # A simple array with bytes, strings and shorts. These types require special # encoding for the DODS response. SimpleArray = DatasetType("SimpleArray") -SimpleArray["byte"] = BaseType("byte", np.arange(5, dtype="b")) +SimpleArray["byte"] = BaseType("byte", np.arange(5, dtype=np.ubyte)) SimpleArray["string"] = BaseType("string", np.array(["one", "two"])) SimpleArray["short"] = BaseType("short", np.array(1, dtype="h")) @@ -95,16 +96,19 @@ SimpleStructure['types'] = StructureType( ("array", np.array(1)), ("float", 1000.0), ])) -SimpleStructure['types']['b'] = BaseType('b', np.array(0, np.byte)) -SimpleStructure['types']['i32'] = BaseType('i32', np.array(1, np.int32)) -SimpleStructure['types']['ui32'] = BaseType('ui32', np.array(0, np.uint32)) -SimpleStructure['types']['i16'] = BaseType('i16', np.array(0, np.int16)) -SimpleStructure['types']['ui16'] = BaseType('ui16', np.array(0, np.uint16)) -SimpleStructure['types']['f32'] = BaseType('f32', np.array(0.0, np.float32)) +SimpleStructure['types']['b'] = BaseType('b', np.array(-10, np.byte)) +SimpleStructure['types']['ub'] = BaseType('ub', np.array(10, np.ubyte)) +SimpleStructure['types']['i32'] = BaseType('i32', np.array(-10, np.int32)) +SimpleStructure['types']['ui32'] = BaseType('ui32', np.array(10, np.uint32)) +SimpleStructure['types']['i16'] = BaseType('i16', np.array(-10, np.int16)) +SimpleStructure['types']['ui16'] = BaseType('ui16', np.array(10, np.uint16)) +SimpleStructure['types']['f32'] = BaseType('f32', np.array(100.0, np.float32)) SimpleStructure['types']['f64'] = BaseType('f64', np.array(1000., np.float64)) SimpleStructure['types']['s'] = BaseType( 's', np.array("This is a data test string (pass 0).")) SimpleStructure['types']['u'] = BaseType('u', np.array("http://www.dods.org")) +SimpleStructure['types']['U'] = BaseType('U', np.array(u"test unicode", + np.unicode)) # test grid diff --git a/src/pydap/tests/test_client.py b/src/pydap/tests/test_client.py index 1f03425..3fa6f68 100644 --- a/src/pydap/tests/test_client.py +++ b/src/pydap/tests/test_client.py @@ -189,7 +189,6 @@ class TestFunctions(unittest.TestCase): np.array(1.0)) [email protected]("Unsure about this behavior") class Test16Bits(unittest.TestCase): """Test that 16-bit values are represented correctly. @@ -204,11 +203,11 @@ class Test16Bits(unittest.TestCase): self.app = BaseHandler(SimpleStructure) def test_int16(self): - """Load an int16.""" + """Load an int16 -> should yield '>i2' type.""" dataset = open_url("http://localhost:8001/", self.app) self.assertEqual(dataset.types.i16.dtype, np.dtype(">i2")) def test_uint16(self): - """Load an uint16.""" + """Load an uint16 -> should yield '>u2' type.""" dataset = open_url("http://localhost:8001/", self.app) self.assertEqual(dataset.types.ui16.dtype, np.dtype(">u2")) diff --git a/src/pydap/tests/test_handlers_dap.py b/src/pydap/tests/test_handlers_dap.py index 5c563ec..6f77f08 100644 --- a/src/pydap/tests/test_handlers_dap.py +++ b/src/pydap/tests/test_handlers_dap.py @@ -215,7 +215,7 @@ class TestBaseProxy(unittest.TestCase): self.data = BaseProxy( "http://localhost:8001/", "byte", - np.dtype("b"), (5,), + np.dtype("B"), (5,), application=self.app) def test_repr(self): @@ -223,7 +223,7 @@ class TestBaseProxy(unittest.TestCase): self.assertEqual( repr(self.data), "BaseProxy('http://localhost:8001/', 'byte', " - "dtype('int8'), (5,), " + "dtype('uint8'), (5,), " "(slice(None, None, None),))") def test_getitem(self): @@ -270,12 +270,13 @@ class TestBaseProxyShort(unittest.TestCase): self.data = BaseProxy( "http://localhost:8001/", "short", - np.dtype(">i"), (), + np.dtype(">h"), (), application=self.app) def test_getitem(self): """Test the ``__getitem__`` method.""" np.testing.assert_array_equal(self.data[:], np.array(1)) + assert self.data[:].dtype.char == 'h' class TestBaseProxyString(unittest.TestCase): diff --git a/src/pydap/tests/test_parsers_dds.py b/src/pydap/tests/test_parsers_dds.py index 9726f44..0e707e5 100644 --- a/src/pydap/tests/test_parsers_dds.py +++ b/src/pydap/tests/test_parsers_dds.py @@ -70,13 +70,13 @@ class TestBuildDataset(unittest.TestCase): def test_integer_16(self): """Test integer 16 parsing.""" self.assertIsInstance(self.dataset.structure.i16, BaseType) - self.assertEqual(self.dataset.structure.i16.dtype, np.dtype(">i")) + self.assertEqual(self.dataset.structure.i16.dtype, np.dtype(">h")) self.assertEqual(self.dataset.structure.i16.shape, ()) def test_unsigned_integer_16(self): """Test unsigned integer 16 parsing.""" self.assertIsInstance(self.dataset.structure.ui16, BaseType) - self.assertEqual(self.dataset.structure.ui16.dtype, np.dtype(">I")) + self.assertEqual(self.dataset.structure.ui16.dtype, np.dtype(">H")) self.assertEqual(self.dataset.structure.ui16.shape, ()) def test_integer_32(self): diff --git a/src/pydap/tests/test_responses_das.py b/src/pydap/tests/test_responses_das.py index c7935e9..95440fc 100644 --- a/src/pydap/tests/test_responses_das.py +++ b/src/pydap/tests/test_responses_das.py @@ -126,6 +126,8 @@ class TestDASResponseStructure(unittest.TestCase): } b { } + ub { + } i32 { } ui32 { @@ -142,6 +144,8 @@ class TestDASResponseStructure(unittest.TestCase): } u { } + U { + } } } """) diff --git a/src/pydap/tests/test_responses_dds.py b/src/pydap/tests/test_responses_dds.py index 0073b00..2d4d341 100644 --- a/src/pydap/tests/test_responses_dds.py +++ b/src/pydap/tests/test_responses_dds.py @@ -96,7 +96,8 @@ class TestDDSResponseStructure(unittest.TestCase): res = app.get('/.dds') self.assertEqual(res.text, """Dataset { Structure { - Byte b; + Int16 b; + Byte ub; Int32 i32; UInt32 ui32; Int16 i16; @@ -105,6 +106,7 @@ class TestDDSResponseStructure(unittest.TestCase): Float64 f64; String s; String u; + String U; } types; } SimpleStructure; """) diff --git a/src/pydap/tests/test_responses_dods.py b/src/pydap/tests/test_responses_dods.py index 595ccd0..fdfd4ef 100644 --- a/src/pydap/tests/test_responses_dods.py +++ b/src/pydap/tests/test_responses_dods.py @@ -5,12 +5,13 @@ import copy import numpy as np from webtest import TestApp as App from webob.headers import ResponseHeaders +from collections import OrderedDict from pydap.lib import START_OF_SEQUENCE, END_OF_SEQUENCE, __version__ from pydap.handlers.lib import BaseHandler from pydap.tests.datasets import ( VerySimpleSequence, SimpleSequence, SimpleGrid, - SimpleArray, NestedSequence) + SimpleArray, NestedSequence, SimpleStructure) from pydap.responses.dods import dods, DODSResponse import unittest @@ -147,6 +148,72 @@ class TestDODSResponseGrid(unittest.TestCase): b"\x00\x00\x00\x01") +class TestDODSResponseStructure(unittest.TestCase): + + """Test the DODS response with a sequence that has a string.""" + + def setUp(self): + """Create a simple WSGI app.""" + app = App(BaseHandler(SimpleStructure)) + self.res = app.get('/.dods') + + def test_body(self): + """Test response body.""" + dds, xdrdata = self.res.body.split(b'\nData:\n', 1) + dds = dds.decode('ascii') + self.assertEqual(dds, """Dataset { + Structure { + Int16 b; + Byte ub; + Int32 i32; + UInt32 ui32; + Int16 i16; + UInt16 ui16; + Float32 f32; + Float64 f64; + String s; + String u; + String U; + } types; +} SimpleStructure;""") + + expected = OrderedDict([ + # -10 signed byte upconv. to Int32 for transfer + ('b', (np.array(-10, dtype=np.byte) + .astype('>i') + .tostring())), + # 10 usigned byte padded to multiple of 4 bytes for transfer + ('ub', (np.array(10, dtype=np.ubyte) + .tostring()) + b'\x00\x00\x00'), + ('i32', (np.array(-10, dtype=np.int32) + .astype('>i').tostring())), + ('ui32', (np.array(10, dtype=np.uint32) + .astype('>I').tostring())), + # -10 int16 upconv. to int32 for transfer + ('i16', (np.array(-10, dtype=np.int16) + .astype('>i') + .newbyteorder('>').tostring())), + # 10 uint16 upconv. to uint32 for transfer + ('ui16', (np.array(10, dtype=np.uint16) + .astype('>I') + .tostring())), + ('f32', (np.array(100, dtype=np.float32) + .astype('>f') + .tostring())), + ('f64', (np.array(1000, dtype=np.float64) + .astype('>d') + .tostring())), + ('s', b'\x00\x00\x00$This is a data test string (pass 0).\x00'), + ('u', b'\x00\x00\x13http://www.dods.org\x00'), + ('U', b'\x00\x00\x00\x0ctest unicode')]) + + for key in expected: + string = expected[key] + assert xdrdata.startswith(string) + xdrdata = xdrdata[len(string):] + assert xdrdata == b'' + + class TestDODSResponseSequence(unittest.TestCase): """Test the DODS response with a sequence that has a string."""
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 7 }
3.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[testing,functions,server,tests]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov", "pytest-attrib", "mock", "requests-mock", "requests" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work beautifulsoup4==4.12.3 certifi==2021.5.30 charset-normalizer==2.0.12 coards==1.0.5 coverage==6.2 docopt==0.6.2 flake8==5.0.4 gsw==3.0.6 gunicorn==21.2.0 idna==3.10 importlib-metadata==4.2.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work Jinja2==3.0.3 lxml==5.3.1 MarkupSafe==2.0.1 mccabe==0.7.0 MechanicalSoup==1.3.0 mock==5.2.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work numpy==1.19.5 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.9.1 -e git+https://github.com/pydap/pydap.git@caf29ed33a4d96b0fc0f166863e1eea425b200eb#egg=Pydap pyflakes==2.5.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-attrib==0.1.3 pytest-cov==4.0.0 requests==2.27.1 requests-mock==1.12.1 six==1.17.0 soupsieve==2.3.2.post1 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 waitress==2.0.0 WebOb==1.8.9 WebTest==3.0.0 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: pydap channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - beautifulsoup4==4.12.3 - charset-normalizer==2.0.12 - coards==1.0.5 - coverage==6.2 - docopt==0.6.2 - flake8==5.0.4 - gsw==3.0.6 - gunicorn==21.2.0 - idna==3.10 - importlib-metadata==4.2.0 - jinja2==3.0.3 - lxml==5.3.1 - markupsafe==2.0.1 - mccabe==0.7.0 - mechanicalsoup==1.3.0 - mock==5.2.0 - numpy==1.19.5 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pytest-attrib==0.1.3 - pytest-cov==4.0.0 - requests==2.27.1 - requests-mock==1.12.1 - six==1.17.0 - soupsieve==2.3.2.post1 - tomli==1.2.3 - urllib3==1.26.20 - waitress==2.0.0 - webob==1.8.9 - webtest==3.0.0 prefix: /opt/conda/envs/pydap
[ "src/pydap/tests/test_client.py::Test16Bits::test_int16", "src/pydap/tests/test_client.py::Test16Bits::test_uint16", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_inexact_division", "src/pydap/tests/test_handlers_dap.py::TestBaseProxyShort::test_getitem", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_integer_16", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_unsigned_integer_16", "src/pydap/tests/test_responses_dds.py::TestDDSResponseStructure::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponseStructure::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponseArray::test_body" ]
[]
[ "src/pydap/tests/test_client.py::TestOpenUrl::test_open_url", "src/pydap/tests/test_client.py::TestOpenFile::test_open_dods", "src/pydap/tests/test_client.py::TestOpenFile::test_open_dods_das", "src/pydap/tests/test_client.py::TestOpenDods::test_open_dods", "src/pydap/tests/test_client.py::TestOpenDods::test_open_dods_with_attributes", "src/pydap/tests/test_client.py::TestFunctions::test_axis_mean", "src/pydap/tests/test_client.py::TestFunctions::test_first_axis", "src/pydap/tests/test_client.py::TestFunctions::test_lazy_evaluation_getattr", "src/pydap/tests/test_client.py::TestFunctions::test_lazy_evaluation_getitem", "src/pydap/tests/test_client.py::TestFunctions::test_nested_call", "src/pydap/tests/test_client.py::TestFunctions::test_original", "src/pydap/tests/test_client.py::TestFunctions::test_second_axis", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_base_type_with_projection", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid_array_with_projection", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid_erddap", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid_erddap_output_grid_false", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid_map_with_projection", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid_output_grid_false", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_grid_with_projection", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_sequence", "src/pydap/tests/test_handlers_dap.py::TestDapHandler::test_sequence_with_projection", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_comparisons", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_getitem", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_getitem_out_of_bound", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_iteration", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_len", "src/pydap/tests/test_handlers_dap.py::TestBaseProxy::test_repr", "src/pydap/tests/test_handlers_dap.py::TestBaseProxyString::test_getitem", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_attributes", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_comparisons", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_getitem", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_iter", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_iter_child", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_iter_find_pattern", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_repr", "src/pydap/tests/test_handlers_dap.py::TestSequenceProxy::test_url", "src/pydap/tests/test_handlers_dap.py::TestSequenceWithString::test_filtering", "src/pydap/tests/test_handlers_dap.py::TestSequenceWithString::test_iter", "src/pydap/tests/test_handlers_dap.py::TestSequenceWithString::test_iter_child", "src/pydap/tests/test_handlers_dap.py::TestSequenceWithString::test_projection", "src/pydap/tests/test_handlers_dap.py::TestStringBaseType::test_getitem", "src/pydap/tests/test_handlers_dap.py::TestArrayStringBaseType::test_getitem", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_byte", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_float_32", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_float_64", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_integer", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_integer_32", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_string", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_structure", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_unsigned_integer", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_unsigned_integer_32", "src/pydap/tests/test_parsers_dds.py::TestBuildDataset::test_url", "src/pydap/tests/test_responses_das.py::TestDASResponseSequence::test_body", "src/pydap/tests/test_responses_das.py::TestDASResponseSequence::test_charset", "src/pydap/tests/test_responses_das.py::TestDASResponseSequence::test_content_type", "src/pydap/tests/test_responses_das.py::TestDASResponseSequence::test_dispatcher", "src/pydap/tests/test_responses_das.py::TestDASResponseSequence::test_headers", "src/pydap/tests/test_responses_das.py::TestDASResponseSequence::test_status", "src/pydap/tests/test_responses_das.py::TestDASResponseGrid::test_body", "src/pydap/tests/test_responses_das.py::TestDASResponseStructure::test_body", "src/pydap/tests/test_responses_dds.py::TestDDSResponseSequence::test_body", "src/pydap/tests/test_responses_dds.py::TestDDSResponseSequence::test_charset", "src/pydap/tests/test_responses_dds.py::TestDDSResponseSequence::test_content_type", "src/pydap/tests/test_responses_dds.py::TestDDSResponseSequence::test_dispatcher", "src/pydap/tests/test_responses_dds.py::TestDDSResponseSequence::test_headers", "src/pydap/tests/test_responses_dds.py::TestDDSResponseSequence::test_status", "src/pydap/tests/test_responses_dds.py::TestDDSResponseGrid::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponse::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponse::test_charset", "src/pydap/tests/test_responses_dods.py::TestDODSResponse::test_content_type", "src/pydap/tests/test_responses_dods.py::TestDODSResponse::test_dispatcher", "src/pydap/tests/test_responses_dods.py::TestDODSResponse::test_headers", "src/pydap/tests/test_responses_dods.py::TestDODSResponse::test_status", "src/pydap/tests/test_responses_dods.py::TestDODSResponseGrid::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponseSequence::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponseArray::test_calculate_size_short", "src/pydap/tests/test_responses_dods.py::TestDODSResponseArrayterator::test_grid", "src/pydap/tests/test_responses_dods.py::TestDODSResponseNestedSequence::test_body", "src/pydap/tests/test_responses_dods.py::TestDODSResponseNestedSequence::test_iteration" ]
[]
MIT License
1,184
[ "src/pydap/lib.py", "src/pydap/parsers/das.py", "src/pydap/parsers/dds.py", "src/pydap/responses/dds.py", "src/pydap/responses/dods.py", "src/pydap/handlers/dap.py", "src/pydap/responses/das.py" ]
[ "src/pydap/lib.py", "src/pydap/parsers/das.py", "src/pydap/parsers/dds.py", "src/pydap/responses/dds.py", "src/pydap/responses/dods.py", "src/pydap/handlers/dap.py", "src/pydap/responses/das.py" ]
watson-developer-cloud__python-sdk-193
f6d0528f9369a1042372f92d37a67e3acce124eb
2017-04-13 22:29:59
f6d0528f9369a1042372f92d37a67e3acce124eb
diff --git a/examples/conversation_v1.py b/examples/conversation_v1.py index 235f80de..1efb9ce3 100644 --- a/examples/conversation_v1.py +++ b/examples/conversation_v1.py @@ -1,6 +1,10 @@ import json from watson_developer_cloud import ConversationV1 +######################### +# message +######################### + conversation = ConversationV1( username='YOUR SERVICE USERNAME', password='YOUR SERVICE PASSWORD', @@ -19,3 +23,117 @@ print(json.dumps(response, indent=2)) # 'text': 'turn the wipers on'}, # context=response['context']) # print(json.dumps(response, indent=2)) + +######################### +# workspaces +######################### + +response = conversation.create_workspace(name='test_workspace', + description='Test workspace.', + language='en', + metadata={}) +print(json.dumps(response, indent=2)) + +workspace_id = response['workspace_id'] + +response = conversation.get_workspace(workspace_id=workspace_id, export=True) +print(json.dumps(response, indent=2)) + +response = conversation.list_workspaces() +print(json.dumps(response, indent=2)) + +response = conversation.update_workspace(workspace_id=workspace_id, + description='Updated test workspace.') +print(json.dumps(response, indent=2)) + +# see cleanup section below for delete_workspace example + +######################### +# intents +######################### + +response = conversation.create_intent(workspace_id=workspace_id, + intent='test_intent', + description='Test intent.') +print(json.dumps(response, indent=2)) + +response = conversation.get_intent(workspace_id=workspace_id, + intent='test_intent', + export=True) +print(json.dumps(response, indent=2)) + +response = conversation.list_intents(workspace_id=workspace_id, + export=True) +print(json.dumps(response, indent=2)) + +response = conversation.update_intent(workspace_id=workspace_id, + intent='test_intent', + new_intent='updated_test_intent', + new_description='Updated test intent.') +print(json.dumps(response, indent=2)) + +# see cleanup section below for delete_intent example + +######################### +# examples +######################### + +response = conversation.create_example(workspace_id=workspace_id, + intent='updated_test_intent', + text='Gimme a pizza with pepperoni') +print(json.dumps(response, indent=2)) + +response = conversation.get_example(workspace_id=workspace_id, + intent='updated_test_intent', + text='Gimme a pizza with pepperoni') +print(json.dumps(response, indent=2)) + +response = conversation.list_examples(workspace_id=workspace_id, + intent='updated_test_intent') +print(json.dumps(response, indent=2)) + +response = conversation.update_example(workspace_id=workspace_id, + intent='updated_test_intent', + text='Gimme a pizza with pepperoni', + new_text='Gimme a pizza with pepperoni') +print(json.dumps(response, indent=2)) + +response = conversation.delete_example(workspace_id=workspace_id, + intent='updated_test_intent', + text='Gimme a pizza with pepperoni') +print(json.dumps(response, indent=2)) + +######################### +# counterexamples +######################### + +response = conversation.create_counterexample(workspace_id=workspace_id, + text='I want financial advice today.') +print(json.dumps(response, indent=2)) + +response = conversation.get_counterexample(workspace_id=workspace_id, + text='I want financial advice today.') +print(json.dumps(response, indent=2)) + +response = conversation.list_counterexamples(workspace_id=workspace_id) +print(json.dumps(response, indent=2)) + +response = conversation.update_counterexample(workspace_id=workspace_id, + text='I want financial advice today.', + new_text='I want financial advice today.') +print(json.dumps(response, indent=2)) + +response = conversation.delete_counterexample(workspace_id=workspace_id, + text='I want financial advice today.') +print(json.dumps(response, indent=2)) + +######################### +# clean-up +######################### + +response = conversation.delete_intent(workspace_id=workspace_id, + intent='updated_test_intent') +print(json.dumps(response, indent=2)) + +response = conversation.delete_workspace(workspace_id=workspace_id) +print(json.dumps(response, indent=2)) diff --git a/examples/notebooks/conversation_v1.ipynb b/examples/notebooks/conversation_v1.ipynb index 73515bc7..053631b9 100644 --- a/examples/notebooks/conversation_v1.ipynb +++ b/examples/notebooks/conversation_v1.ipynb @@ -1,13 +1,16 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Conversation Service" + ] + }, { "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 1, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -19,11 +22,9 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 2, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -33,12 +34,8 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 3, + "metadata": {}, "outputs": [], "source": [ "conversation = watson_developer_cloud.ConversationV1(username=USERNAME,\n", @@ -46,222 +43,321 @@ " version='2016-09-20')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pizza Chatbot" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's create and chat with a simple pizza bot. We'll start by defining the bot's workspace, then add intents and examples to recognize pizza orders. Once the chatbot is configured, we'll send a message to converse with our pizza bot." + ] + }, { "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 4, + "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "{'pagination': {'refresh_url': '/v1/workspaces?version=2016-09-20'},\n", - " 'workspaces': [{'created': '2017-02-09T19:46:26.792Z',\n", - " 'description': 'yo dawg',\n", - " 'language': 'en',\n", - " 'metadata': None,\n", - " 'name': 'development',\n", - " 'updated': '2017-02-09T20:00:38.558Z',\n", - " 'workspace_id': '8c8ee3b3-6149-4bc0-ba66-6517fd6c976a'}]}" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"name\": \"example_workspace\",\n", + " \"created\": \"2017-04-17T18:55:39.740Z\",\n", + " \"updated\": \"2017-04-17T18:55:39.740Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": null,\n", + " \"description\": \"An example workspace.\",\n", + " \"workspace_id\": \"0247c2f5-4155-4be5-bd51-167de32f2f39\"\n", + "}\n" + ] } ], "source": [ - "conversation.list_workspaces()" + "# define the dialog for our example workspace\n", + "dialog_nodes = [{'conditions': '#order_pizza',\n", + " 'context': None,\n", + " 'description': None,\n", + " 'dialog_node': 'YesYouCan',\n", + " 'go_to': None,\n", + " 'metadata': None,\n", + " 'output': {'text': {'selection_policy': 'random',\n", + " 'values': ['Yes You can!', 'Of course!']}},\n", + " 'parent': None,\n", + " 'previous_sibling': None,}]\n", + "\n", + "# create an example workspace\n", + "workspace = conversation.create_workspace(name='example_workspace',\n", + " description='An example workspace.',\n", + " language='en',\n", + " dialog_nodes=dialog_nodes)\n", + "\n", + "# print response and save workspace_id\n", + "print(json.dumps(workspace, indent=2))\n", + "workspace_id=workspace['workspace_id']" ] }, { "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 5, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'name': 'my experimental workspace', 'created': '2017-02-09T21:48:35.245Z', 'updated': '2017-02-09T21:48:35.245Z', 'language': 'en', 'metadata': None, 'description': 'an experimental workspace', 'workspace_id': 'dbd1211f-3abb-4165-8a67-8bfa95410aa9'}\n" + "{\n", + " \"intent\": \"order_pizza\",\n", + " \"created\": \"2017-04-17T18:55:40.899Z\",\n", + " \"updated\": \"2017-04-17T18:55:40.899Z\",\n", + " \"description\": \"A pizza order.\"\n", + "}\n" ] } ], "source": [ - "new_workspace = conversation.create_workspace(name='my experimental workspace',\n", - " description='an experimental workspace',\n", - " language='en',\n", - " intents=[{\n", - " \"intent\": \"orderpizza\",\n", - " \"examples\": [\n", - " {\n", - " \"text\": \"can I order a pizza?\"\n", - " },\n", - " {\n", - " \"text\": \"I want to order a pizza\"\n", - " },\n", - " {\n", - " \"text\": \"pizza order\"\n", - " },\n", - " {\n", - " \"text\": \"pizza to go\"\n", - " }\n", - " ],\n", - " \"description\": \"pizza intents\"\n", - " }\n", - " ],\n", - " dialog_nodes=[{'conditions': '#orderpizza',\n", - " 'context': None,\n", - " 'description': None,\n", - " 'dialog_node': 'YesYouCan',\n", - " 'go_to': None,\n", - " 'metadata': None,\n", - " 'output': {'text': {'selection_policy': 'random',\n", - " 'values': \n", - " ['Yes You can!', 'Of course!']}},\n", - " 'parent': None,\n", - " 'previous_sibling': None,}])\n", - "print(new_workspace)" + "# add an intent to the workspace\n", + "intent = conversation.create_intent(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " description='A pizza order.')\n", + "print(json.dumps(intent, indent=2))" ] }, { "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 6, + "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "{'created': '2017-02-09T21:48:35.245Z',\n", - " 'description': 'an experimental workspace',\n", - " 'language': 'en',\n", - " 'metadata': None,\n", - " 'name': 'my experimental workspace',\n", - " 'status': 'Training',\n", - " 'updated': '2017-02-09T21:48:35.245Z',\n", - " 'workspace_id': 'dbd1211f-3abb-4165-8a67-8bfa95410aa9'}" - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"Can I order a pizza?\",\n", + " \"created\": \"2017-04-17T18:55:41.755Z\",\n", + " \"updated\": \"2017-04-17T18:55:41.755Z\"\n", + "}\n", + "{\n", + " \"text\": \"I want to order a pizza.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.172Z\"\n", + "}\n", + "{\n", + " \"text\": \"pizza order\",\n", + " \"created\": \"2017-04-17T18:55:42.606Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.606Z\"\n", + "}\n", + "{\n", + " \"text\": \"pizza to go\",\n", + " \"created\": \"2017-04-17T18:55:43.018Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\"\n", + "}\n" + ] } ], "source": [ - "conversation.get_workspace(workspace_id=new_workspace['workspace_id'])" + "# add examples to the intent\n", + "example1 = conversation.create_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='Can I order a pizza?')\n", + "example2 = conversation.create_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='I want to order a pizza.')\n", + "example3 = conversation.create_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='pizza order')\n", + "example4 = conversation.create_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='pizza to go')\n", + "\n", + "print(json.dumps(example1, indent=2))\n", + "print(json.dumps(example2, indent=2))\n", + "print(json.dumps(example3, indent=2))\n", + "print(json.dumps(example4, indent=2))" ] }, { "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 9, + "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "{'created': '2017-02-09T21:39:30.390Z',\n", - " 'description': 'an experimental workspace',\n", - " 'language': 'en',\n", - " 'metadata': None,\n", - " 'name': 'changed name',\n", - " 'updated': '2017-02-09T21:39:59.124Z',\n", - " 'workspace_id': '66e78807-13fa-47ae-9251-dd8c89c8fd19'}" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "The workspace status is: Available\n", + "Ready to chat!\n" + ] } ], "source": [ - "new_workspace['name'] = 'changed name'\n", - "conversation.update_workspace(new_workspace['workspace_id'], name=new_workspace['name'])" + "# check workspace status (wait for training to complete)\n", + "workspace = conversation.get_workspace(workspace_id=workspace_id)\n", + "print('The workspace status is: {0}'.format(workspace['status']))\n", + "if workspace['status'] == 'Available':\n", + " print('Ready to chat!')\n", + "else:\n", + " print('The workspace should be available shortly. Please try again in 30s.')\n", + " print('(You can send messages, but not all functionality will be supported yet.)')" ] }, { "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 10, + "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "{'counterexamples': [],\n", - " 'created': '2017-02-09T21:48:35.245Z',\n", - " 'description': 'an experimental workspace',\n", - " 'dialog_nodes': [{'conditions': '#orderpizza',\n", - " 'context': None,\n", - " 'created': '2017-02-09T21:48:35.245Z',\n", - " 'description': None,\n", - " 'dialog_node': 'YesYouCan',\n", - " 'go_to': None,\n", - " 'metadata': None,\n", - " 'output': {'text': {'selection_policy': 'random',\n", - " 'values': ['Yes You can!', 'Of course!']}},\n", - " 'parent': None,\n", - " 'previous_sibling': None,\n", - " 'updated': '2017-02-09T21:48:35.245Z'}],\n", - " 'entities': [],\n", - " 'intents': [{'created': '2017-02-09T21:48:35.245Z',\n", - " 'description': 'pizza intents',\n", - " 'examples': [{'created': '2017-02-09T21:48:35.245Z',\n", - " 'text': 'can I order a pizza?',\n", - " 'updated': '2017-02-09T21:48:35.245Z'},\n", - " {'created': '2017-02-09T21:48:35.245Z',\n", - " 'text': 'I want to order a pizza',\n", - " 'updated': '2017-02-09T21:48:35.245Z'},\n", - " {'created': '2017-02-09T21:48:35.245Z',\n", - " 'text': 'pizza order',\n", - " 'updated': '2017-02-09T21:48:35.245Z'},\n", - " {'created': '2017-02-09T21:48:35.245Z',\n", - " 'text': 'pizza to go',\n", - " 'updated': '2017-02-09T21:48:35.245Z'}],\n", - " 'intent': 'orderpizza',\n", - " 'updated': '2017-02-09T21:48:35.245Z'}],\n", - " 'language': 'en',\n", - " 'metadata': None,\n", - " 'name': 'my experimental workspace',\n", - " 'status': 'Available',\n", - " 'updated': '2017-02-09T21:48:35.245Z',\n", - " 'workspace_id': 'dbd1211f-3abb-4165-8a67-8bfa95410aa9'}" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intents\": [\n", + " {\n", + " \"intent\": \"order_pizza\",\n", + " \"confidence\": 1\n", + " }\n", + " ],\n", + " \"entities\": [],\n", + " \"input\": {\n", + " \"text\": \"Can I order a pizza?\"\n", + " },\n", + " \"output\": {\n", + " \"log_messages\": [],\n", + " \"text\": [\n", + " \"Yes You can!\"\n", + " ],\n", + " \"nodes_visited\": [\n", + " \"YesYouCan\"\n", + " ]\n", + " },\n", + " \"context\": {\n", + " \"conversation_id\": \"a84cbf65-d41d-4092-8450-e03c986a3340\",\n", + " \"system\": {\n", + " \"dialog_stack\": [\n", + " {\n", + " \"dialog_node\": \"root\"\n", + " }\n", + " ],\n", + " \"dialog_turn_counter\": 1,\n", + " \"dialog_request_counter\": 1,\n", + " \"_node_output_map\": {\n", + " \"YesYouCan\": [\n", + " 0,\n", + " 0,\n", + " 1\n", + " ]\n", + " },\n", + " \"branch_exited\": true,\n", + " \"branch_exited_reason\": \"completed\"\n", + " }\n", + " }\n", + "}\n" + ] } ], "source": [ - "conversation.get_workspace(new_workspace['workspace_id'], export=True)" + "# start a chat with the pizza bot\n", + "message_input = {'text': 'Can I order a pizza?'}\n", + "response = conversation.message(workspace_id=workspace_id,\n", + " message_input=message_input)\n", + "print(json.dumps(response, indent=2))" ] }, { "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intents\": [\n", + " {\n", + " \"intent\": \"order_pizza\",\n", + " \"confidence\": 1\n", + " }\n", + " ],\n", + " \"entities\": [],\n", + " \"input\": {\n", + " \"text\": \"medium\"\n", + " },\n", + " \"output\": {\n", + " \"log_messages\": [],\n", + " \"text\": [\n", + " \"Of course!\"\n", + " ],\n", + " \"nodes_visited\": [\n", + " \"YesYouCan\"\n", + " ]\n", + " },\n", + " \"context\": {\n", + " \"conversation_id\": \"a84cbf65-d41d-4092-8450-e03c986a3340\",\n", + " \"system\": {\n", + " \"dialog_stack\": [\n", + " {\n", + " \"dialog_node\": \"root\"\n", + " }\n", + " ],\n", + " \"dialog_turn_counter\": 2,\n", + " \"dialog_request_counter\": 2,\n", + " \"_node_output_map\": {\n", + " \"YesYouCan\": [\n", + " 1,\n", + " 0,\n", + " 1\n", + " ]\n", + " },\n", + " \"branch_exited\": true,\n", + " \"branch_exited_reason\": \"completed\"\n", + " }\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "# continue a chat with the pizza bot\n", + "# (when you send multiple requests for the same conversation,\n", + "# then include the context object from the previous response)\n", + "message_input = {'text': 'medium'}\n", + "response = conversation.message(workspace_id=workspace_id,\n", + " message_input=message_input,\n", + " context=response['context'])\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Operation Examples" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The following examples demonstrate each operation of the Conversation service. They use the pizza chatbot workspace configured above." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Message" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -270,13 +366,13 @@ "{\n", " \"intents\": [\n", " {\n", - " \"intent\": \"orderpizza\",\n", + " \"intent\": \"order_pizza\",\n", " \"confidence\": 1\n", " }\n", " ],\n", " \"entities\": [],\n", " \"input\": {\n", - " \"text\": \"can I order a pizza?\"\n", + " \"text\": \"Can I order a pizza?\"\n", " },\n", " \"output\": {\n", " \"log_messages\": [],\n", @@ -288,7 +384,7 @@ " ]\n", " },\n", " \"context\": {\n", - " \"conversation_id\": \"972f212d-be0f-47fd-a82d-a6f917e16cfd\",\n", + " \"conversation_id\": \"bceff6eb-f89b-48d3-9190-99e9cca6a3e7\",\n", " \"system\": {\n", " \"dialog_stack\": [\n", " {\n", @@ -303,28 +399,724 @@ " 1,\n", " 0\n", " ]\n", - " }\n", + " },\n", + " \"branch_exited\": true,\n", + " \"branch_exited_reason\": \"completed\"\n", " }\n", - " },\n", - " \"alternate_intents\": false\n", + " }\n", "}\n" ] } ], "source": [ - "response = conversation.message(workspace_id=new_workspace['workspace_id'],\n", - " message_input={'text': 'can I order a pizza?'})\n", + "message_input = {'text': 'Can I order a pizza?'}\n", + "response = conversation.message(workspace_id=workspace_id,\n", + " message_input=message_input)\n", "print(json.dumps(response, indent=2))" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Workspaces" + ] + }, { "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"name\": \"test_workspace\",\n", + " \"created\": \"2017-04-17T18:57:41.168Z\",\n", + " \"updated\": \"2017-04-17T18:57:41.168Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": {},\n", + " \"description\": \"Test workspace.\",\n", + " \"workspace_id\": \"d8cc32e4-5fb4-47ec-944c-0d7fcd59651c\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.create_workspace(name='test_workspace',\n", + " description='Test workspace.',\n", + " language='en',\n", + " metadata={})\n", + "print(json.dumps(response, indent=2))\n", + "test_workspace_id = response['workspace_id']" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\n" + ] + } + ], + "source": [ + "response = conversation.delete_workspace(workspace_id=test_workspace_id)\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"name\": \"example_workspace\",\n", + " \"created\": \"2017-04-17T18:55:39.740Z\",\n", + " \"intents\": [\n", + " {\n", + " \"intent\": \"order_pizza\",\n", + " \"created\": \"2017-04-17T18:55:40.899Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\",\n", + " \"examples\": [\n", + " {\n", + " \"text\": \"Can I order a pizza?\",\n", + " \"created\": \"2017-04-17T18:55:41.755Z\",\n", + " \"updated\": \"2017-04-17T18:55:41.755Z\"\n", + " },\n", + " {\n", + " \"text\": \"I want to order a pizza.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.172Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza order\",\n", + " \"created\": \"2017-04-17T18:55:42.606Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.606Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza to go\",\n", + " \"created\": \"2017-04-17T18:55:43.018Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\"\n", + " }\n", + " ],\n", + " \"description\": \"A pizza order.\"\n", + " }\n", + " ],\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\",\n", + " \"entities\": [],\n", + " \"language\": \"en\",\n", + " \"metadata\": null,\n", + " \"description\": \"An example workspace.\",\n", + " \"dialog_nodes\": [\n", + " {\n", + " \"go_to\": null,\n", + " \"output\": {\n", + " \"text\": {\n", + " \"values\": [\n", + " \"Yes You can!\",\n", + " \"Of course!\"\n", + " ],\n", + " \"selection_policy\": \"random\"\n", + " }\n", + " },\n", + " \"parent\": null,\n", + " \"context\": null,\n", + " \"created\": \"2017-04-17T18:55:39.740Z\",\n", + " \"updated\": \"2017-04-17T18:55:39.740Z\",\n", + " \"metadata\": null,\n", + " \"conditions\": \"#order_pizza\",\n", + " \"description\": null,\n", + " \"dialog_node\": \"YesYouCan\",\n", + " \"previous_sibling\": null\n", + " }\n", + " ],\n", + " \"workspace_id\": \"0247c2f5-4155-4be5-bd51-167de32f2f39\",\n", + " \"counterexamples\": [],\n", + " \"status\": \"Available\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.get_workspace(workspace_id=workspace_id, export=True)\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"workspaces\": [\n", + " {\n", + " \"name\": \"Car_Dashboard\",\n", + " \"created\": \"2016-07-19T16:31:17.236Z\",\n", + " \"updated\": \"2017-04-11T02:29:46.290Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": {\n", + " \"runtime_version\": \"2016-09-20\"\n", + " },\n", + " \"description\": \"Cognitive Car workspace which allows multi-turn conversations to perform tasks in the car.\",\n", + " \"workspace_id\": \"8d869397-411b-4f0a-864d-a2ba419bb249\"\n", + " },\n", + " {\n", + " \"name\": \"example_workspace\",\n", + " \"created\": \"2017-04-17T18:07:47.842Z\",\n", + " \"updated\": \"2017-04-17T18:07:47.842Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": null,\n", + " \"description\": \"An example workspace.\",\n", + " \"workspace_id\": \"a7196fc9-c458-4b75-963c-dc4a3dc32ef7\"\n", + " },\n", + " {\n", + " \"name\": \"example_workspace\",\n", + " \"created\": \"2017-04-17T18:42:40.986Z\",\n", + " \"updated\": \"2017-04-17T18:54:21.407Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": null,\n", + " \"description\": \"An example workspace for ordering pizza.\",\n", + " \"workspace_id\": \"88a4327b-421c-436f-b54a-5e00df6b8e8b\"\n", + " },\n", + " {\n", + " \"name\": \"example_workspace\",\n", + " \"created\": \"2017-04-17T18:55:39.740Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": null,\n", + " \"description\": \"An example workspace.\",\n", + " \"workspace_id\": \"0247c2f5-4155-4be5-bd51-167de32f2f39\"\n", + " },\n", + " {\n", + " \"name\": \"LaForge POC\",\n", + " \"created\": \"2016-09-07T19:01:46.271Z\",\n", + " \"updated\": \"2016-11-29T21:46:38.969Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": {\n", + " \"runtime_version\": \"2016-09-20\"\n", + " },\n", + " \"description\": null,\n", + " \"workspace_id\": \"4f4046a6-50c5-4a52-9247-b2538f0fe7ac\"\n", + " }\n", + " ],\n", + " \"pagination\": {\n", + " \"refresh_url\": \"/v1/workspaces?version=2016-09-20\"\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.list_workspaces()\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"name\": \"example_workspace\",\n", + " \"created\": \"2017-04-17T18:55:39.740Z\",\n", + " \"updated\": \"2017-04-17T18:57:45.626Z\",\n", + " \"language\": \"en\",\n", + " \"metadata\": null,\n", + " \"description\": \"An example workspace for ordering pizza.\",\n", + " \"workspace_id\": \"0247c2f5-4155-4be5-bd51-167de32f2f39\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.update_workspace(workspace_id=workspace_id,\n", + " description='An example workspace for ordering pizza.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Intents" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intent\": \"test_intent\",\n", + " \"created\": \"2017-04-17T18:57:47.513Z\",\n", + " \"updated\": \"2017-04-17T18:57:47.513Z\",\n", + " \"description\": \"Test intent.\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.create_intent(workspace_id=workspace_id,\n", + " intent='test_intent',\n", + " description='Test intent.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\n" + ] + } + ], + "source": [ + "response = conversation.delete_intent(workspace_id=workspace_id,\n", + " intent='test_intent')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intent\": \"order_pizza\",\n", + " \"created\": \"2017-04-17T18:55:40.899Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\",\n", + " \"examples\": [\n", + " {\n", + " \"text\": \"Can I order a pizza?\",\n", + " \"created\": \"2017-04-17T18:55:41.755Z\",\n", + " \"updated\": \"2017-04-17T18:55:41.755Z\"\n", + " },\n", + " {\n", + " \"text\": \"I want to order a pizza.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.172Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza order\",\n", + " \"created\": \"2017-04-17T18:55:42.606Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.606Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza to go\",\n", + " \"created\": \"2017-04-17T18:55:43.018Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\"\n", + " }\n", + " ],\n", + " \"description\": \"A pizza order.\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.get_intent(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " export=True)\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intents\": [\n", + " {\n", + " \"intent\": \"order_pizza\",\n", + " \"created\": \"2017-04-17T18:55:40.899Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\",\n", + " \"examples\": [\n", + " {\n", + " \"text\": \"Can I order a pizza?\",\n", + " \"created\": \"2017-04-17T18:55:41.755Z\",\n", + " \"updated\": \"2017-04-17T18:55:41.755Z\"\n", + " },\n", + " {\n", + " \"text\": \"I want to order a pizza.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.172Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza order\",\n", + " \"created\": \"2017-04-17T18:55:42.606Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.606Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza to go\",\n", + " \"created\": \"2017-04-17T18:55:43.018Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\"\n", + " }\n", + " ],\n", + " \"description\": \"A pizza order.\"\n", + " }\n", + " ],\n", + " \"pagination\": {\n", + " \"refresh_url\": \"/v1/workspaces/0247c2f5-4155-4be5-bd51-167de32f2f39/intents?version=2016-09-20&export=true\"\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.list_intents(workspace_id=workspace_id,\n", + " export=True)\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"intent\": \"order_pizza\",\n", + " \"created\": \"2017-04-17T18:55:40.899Z\",\n", + " \"updated\": \"2017-04-17T18:57:52.129Z\",\n", + " \"description\": \"Order a pizza.\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.update_intent(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " new_intent='order_pizza',\n", + " new_description='Order a pizza.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Examples" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"Gimme a pizza with pepperoni\",\n", + " \"created\": \"2017-04-17T18:57:54.817Z\",\n", + " \"updated\": \"2017-04-17T18:57:54.817Z\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.create_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='Gimme a pizza with pepperoni')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\n" + ] + } + ], + "source": [ + "response = conversation.delete_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='Gimme a pizza with pepperoni')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"I want to order a pizza.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.172Z\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.get_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='I want to order a pizza.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"examples\": [\n", + " {\n", + " \"text\": \"Can I order a pizza?\",\n", + " \"created\": \"2017-04-17T18:55:41.755Z\",\n", + " \"updated\": \"2017-04-17T18:55:41.755Z\"\n", + " },\n", + " {\n", + " \"text\": \"I want to order a pizza.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.172Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza order\",\n", + " \"created\": \"2017-04-17T18:55:42.606Z\",\n", + " \"updated\": \"2017-04-17T18:55:42.606Z\"\n", + " },\n", + " {\n", + " \"text\": \"pizza to go\",\n", + " \"created\": \"2017-04-17T18:55:43.018Z\",\n", + " \"updated\": \"2017-04-17T18:55:43.018Z\"\n", + " }\n", + " ],\n", + " \"pagination\": {\n", + " \"refresh_url\": \"/v1/workspaces/0247c2f5-4155-4be5-bd51-167de32f2f39/intents/order_pizza/examples?version=2016-09-20\"\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.list_examples(workspace_id=workspace_id,\n", + " intent='order_pizza')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"I want to order a pizza with pepperoni.\",\n", + " \"created\": \"2017-04-17T18:55:42.172Z\",\n", + " \"updated\": \"2017-04-17T18:58:00.647Z\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.update_example(workspace_id=workspace_id,\n", + " intent='order_pizza',\n", + " text='I want to order a pizza.',\n", + " new_text='I want to order a pizza with pepperoni.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Counterexamples" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"I want financial advice today.\",\n", + " \"created\": \"2017-04-17T18:58:03.340Z\",\n", + " \"updated\": \"2017-04-17T18:58:03.340Z\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.create_counterexample(workspace_id=workspace_id,\n", + " text='I want financial advice today.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"I want financial advice today.\",\n", + " \"created\": \"2017-04-17T18:58:03.340Z\",\n", + " \"updated\": \"2017-04-17T18:58:03.340Z\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.get_counterexample(workspace_id=workspace_id,\n", + " text='I want financial advice today.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"counterexamples\": [\n", + " {\n", + " \"text\": \"I want financial advice today.\",\n", + " \"created\": \"2017-04-17T18:58:03.340Z\",\n", + " \"updated\": \"2017-04-17T18:58:03.340Z\"\n", + " }\n", + " ],\n", + " \"pagination\": {\n", + " \"refresh_url\": \"/v1/workspaces/0247c2f5-4155-4be5-bd51-167de32f2f39/counterexamples?version=2016-09-20\"\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.list_counterexamples(workspace_id=workspace_id)\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"text\": \"I want financial advice for tomorrow.\",\n", + " \"created\": \"2017-04-17T18:58:03.340Z\",\n", + " \"updated\": \"2017-04-17T18:58:09.403Z\"\n", + "}\n" + ] + } + ], + "source": [ + "response = conversation.update_counterexample(workspace_id=workspace_id,\n", + " text='I want financial advice today.',\n", + " new_text='I want financial advice for tomorrow.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\n" + ] + } + ], + "source": [ + "response = conversation.delete_counterexample(workspace_id=workspace_id,\n", + " text='I want financial advice for tomorrow.')\n", + "print(json.dumps(response, indent=2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cleanup (Delete Pizza Chatbot)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's cleanup by deleting the pizza chatbot, since it is no longer needed." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, "outputs": [ { "data": { @@ -332,13 +1124,14 @@ "{}" ] }, - "execution_count": 35, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "conversation.delete_workspace(new_workspace['workspace_id'])" + "# clean-up by deleting the workspace\n", + "conversation.delete_workspace(workspace_id=workspace_id)" ] } ], @@ -358,7 +1151,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.0" + "version": "3.6.1" } }, "nbformat": 4, diff --git a/watson_developer_cloud/conversation_v1.py b/watson_developer_cloud/conversation_v1.py index 408c225b..f44a6423 100644 --- a/watson_developer_cloud/conversation_v1.py +++ b/watson_developer_cloud/conversation_v1.py @@ -1,4 +1,4 @@ -# Copyright 2016 IBM All Rights Reserved. +# Copyright 2017 IBM All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,171 +11,536 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + """ -The Conversation v1 service -(https://www.ibm.com/watson/developercloud/conversation.html) +The IBM Watson Conversation service combines machine learning, natural +language understanding, and integrated dialog tools to create conversation +flows between your apps and your users. """ from .watson_developer_cloud_service import WatsonDeveloperCloudService - class ConversationV1(WatsonDeveloperCloudService): - """Client for the Conversation service""" + """Client for the Conversation service.""" default_url = 'https://gateway.watsonplatform.net/conversation/api' - latest_version = '2016-09-20' + latest_version = '2017-02-03' def __init__(self, version, url=default_url, **kwargs): WatsonDeveloperCloudService.__init__(self, 'conversation', url, **kwargs) self.version = version - def list_workspaces(self): + ######################### + # counterexamples + ######################### + + def create_counterexample(self, workspace_id, text): """ - List workspaces available. - This includes pagination info. + Create counterexample. + :param workspace_id: The workspace ID. + :param text: The text of a user input example. """ params = {'version': self.version} - return self.request(method='GET', - url='/v1/workspaces', - params=params, - accept_json=True) + data = {} + data['text'] = text + return self.request( + method='POST', + url='/v1/workspaces/{0}/counterexamples'.format(workspace_id), + params=params, + json=data, + accept_json=True) - def get_workspace(self, workspace_id, export=False): + def delete_counterexample(self, workspace_id, text): """ - Get a specific workspace - :param: workspace_id the guid of the workspace - :param: export (optional) return all workspace data + Delete counterexample. + :param workspace_id: The workspace ID. + :param text: The text of a user input counterexample (for example, + `What are you wearing?`). """ params = {'version': self.version} - if export: - params['export'] = True + return self.request( + method='DELETE', + url='/v1/workspaces/{0}/counterexamples/{1}'.format( + workspace_id, text), + params=params, + accept_json=True) - return self.request(method='GET', - url='/v1/workspaces/{0}'.format(workspace_id), - params=params, - accept_json=True) + def get_counterexample(self, workspace_id, text): + """ + Get counterexample. + :param workspace_id: The workspace ID. + :param text: The text of a user input counterexample (for example, + `What are you wearing?`). + """ + params = {'version': self.version} + return self.request( + method='GET', + url='/v1/workspaces/{0}/counterexamples/{1}'.format( + workspace_id, text), + params=params, + accept_json=True) - def delete_workspace(self, workspace_id): + def list_counterexamples(self, + workspace_id, + page_limit=None, + include_count=None, + sort=None, + cursor=None): """ - Deletes a given workspace. - :param: workspace_id the guid of the workspace_id + List counterexamples. + :param workspace_id: The workspace ID. + :param page_limit: The number of records to return in each page of + results. The default page limit is 100. + :param include_count: Whether to include information about the number + of records returned. + :param sort: The sort order that determines the behavior of the + pagination cursor. + :param cursor: A token identifying the last value from the previous + page of results. """ params = {'version': self.version} - return self.request(method='DELETE', - url='/v1/workspaces/{0}'.format(workspace_id), - params=params, - accept_json=True) + params['page_limit'] = page_limit + params['include_count'] = include_count + params['sort'] = sort + params['cursor'] = cursor + return self.request( + method='GET', + url='/v1/workspaces/{0}/counterexamples'.format(workspace_id), + params=params, + accept_json=True) - def create_workspace(self, name, description, language, - intents=None, - entities=None, - dialog_nodes=None, - counterexamples=None, - metadata=None): + def update_counterexample(self, workspace_id, text, new_text=None): + """ + Update counterexample. + :param workspace_id: The workspace ID. + :param text: The text of a user input counterexample (for example, + `What are you wearing?`). + :param new_text: The new text of a user input counterexample. + """ + params = {'version': self.version} + data = {} + data['text'] = new_text + return self.request( + method='POST', + url='/v1/workspaces/{0}/counterexamples/{1}'.format( + workspace_id, text), + params=params, + json=data, + accept_json=True) + + ######################### + # examples + ######################### + + def create_example(self, workspace_id, intent, text): + """ + Create user input example. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param text: The text of a user input example. + """ + params = {'version': self.version} + data = {} + data['text'] = text + return self.request( + method='POST', + url='/v1/workspaces/{0}/intents/{1}/examples'.format( + workspace_id, intent), + params=params, + json=data, + accept_json=True) + + def delete_example(self, workspace_id, intent, text): + """ + Delete user input example. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param text: The text of the user input example. + """ + params = {'version': self.version} + return self.request( + method='DELETE', + url='/v1/workspaces/{0}/intents/{1}/examples/{2}'.format( + workspace_id, intent, text), + params=params, + accept_json=True) + + def get_example(self, workspace_id, intent, text): + """ + Get user input example. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param text: The text of the user input example. + """ + params = {'version': self.version} + return self.request( + method='GET', + url='/v1/workspaces/{0}/intents/{1}/examples/{2}'.format( + workspace_id, intent, text), + params=params, + accept_json=True) + + def list_examples(self, + workspace_id, + intent, + page_limit=None, + include_count=None, + sort=None, + cursor=None): + """ + List user input examples. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param page_limit: The number of records to return in each page of + results. The default page limit is 100. + :param include_count: Whether to include information about the number + of records returned. + :param sort: The sort order that determines the behavior of the + pagination cursor. + :param cursor: A token identifying the last value from the previous + page of results. + """ + params = {'version': self.version} + params['page_limit'] = page_limit + params['include_count'] = include_count + params['sort'] = sort + params['cursor'] = cursor + return self.request( + method='GET', + url='/v1/workspaces/{0}/intents/{1}/examples'.format( + workspace_id, intent), + params=params, + accept_json=True) + + def update_example(self, workspace_id, intent, text, new_text=None): + """ + Update user input example. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param text: The text of the user input example. + :param new_text: The new text of the user input example. + """ + params = {'version': self.version} + data = {} + data['text'] = new_text + return self.request( + method='POST', + url='/v1/workspaces/{0}/intents/{1}/examples/{2}'.format( + workspace_id, intent, text), + params=params, + json=data, + accept_json=True) + + ######################### + # intents + ######################### + + def create_intent(self, + workspace_id, + intent, + description=None, + examples=None): + """ + Create intent. + :param workspace_id: The workspace ID. + :param intent: The name of the intent. + :param description: The description of the intent. + :param examples: An array of user input examples. + """ + params = {'version': self.version} + data = {} + data['intent'] = intent + data['description'] = description + data['examples'] = examples + return self.request( + method='POST', + url='/v1/workspaces/{0}/intents'.format(workspace_id), + params=params, + json=data, + accept_json=True) + + def delete_intent(self, workspace_id, intent): """ - Create a new workspace - :param name: Name of the workspace - :param description: description of the worksspace - :param language: language code - :param entities: an array of entities (optional) - :param dialog_nodes: an array of dialog notes (optional) - :param counterexamples: an array of counterexamples (optional) - :param metadata: metadata dictionary (optional) + Delete intent. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). """ - payload = {'name': name, - 'description': description, - 'language': language} - if intents is not None: - payload['intents'] = intents + params = {'version': self.version} + return self.request( + method='DELETE', + url='/v1/workspaces/{0}/intents/{1}'.format(workspace_id, intent), + params=params, + accept_json=True) - if entities is not None: - payload['entities'] = entities + def get_intent(self, workspace_id, intent, export=None): + """ + Get intent. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param export: Whether to include all element content in the + returned data. If export=`false`, the returned data includes + only information about the element itself. If export=`true`, + all content, including subelements, is included. The default + value is `false`. + """ + params = {'version': self.version} + params['export'] = export + return self.request( + method='GET', + url='/v1/workspaces/{0}/intents/{1}'.format(workspace_id, intent), + params=params, + accept_json=True) - if dialog_nodes is not None: - payload['dialog_nodes'] = dialog_nodes + def list_intents(self, + workspace_id, + export=None, + page_limit=None, + include_count=None, + sort=None, + cursor=None): + """ + List intents. + :param workspace_id: The workspace ID. + :param export: Whether to include all element content in the + returned data. If export=`false`, the returned data includes + only information about the element itself. If export=`true`, + all content, including subelements, is included. The default + value is `false`. + :param page_limit: The number of records to return in each page of + results. The default page limit is 100. + :param include_count: Whether to include information about the + number of records returned. + :param sort: The sort order that determines the behavior of the + pagination cursor. + :param cursor: A token identifying the last value from the previous + page of results. + """ + params = {'version': self.version} + params['export'] = export + params['page_limit'] = page_limit + params['include_count'] = include_count + params['sort'] = sort + params['cursor'] = cursor + return self.request( + method='GET', + url='/v1/workspaces/{0}/intents'.format(workspace_id), + params=params, + accept_json=True) - if counterexamples is not None: - payload['counterexamples'] = counterexamples + def update_intent(self, + workspace_id, + intent, + new_intent=None, + new_description=None, + new_examples=None): + """ + Update intent. + :param workspace_id: The workspace ID. + :param intent: The intent name (for example, `pizza_order`). + :param new_intent: The new intent name. + :param new_description: The new description of the intent. + :param new_examples: An array of new user input examples. + """ + params = {'version': self.version} + data = {} + data['intent'] = new_intent + data['description'] = new_description + data['examples'] = new_examples + return self.request( + method='POST', + url='/v1/workspaces/{0}/intents/{1}'.format(workspace_id, intent), + params=params, + json=data, + accept_json=True) - if metadata is not None: - payload['metadata'] = metadata + ######################### + # message + ######################### + def message(self, + workspace_id, + message_input, + alternate_intents=None, + context=None, + entities=None, + intents=None, + output=None): + """ + Get a response to a user's input. + :param workspace_id: Unique identifier of the workspace. + :param message_input: An input object that includes the input text. + :param alternate_intents: Whether to return more than one intent. + Set to `true` to return all matching intents. + :param context: State information for the conversation. Include the + context object from the previous response when you send multiple + requests for the same conversation. + :param entities: Include the entities from the previous response when + they do not need to change and to prevent Watson from trying to + identify them. + :param intents: An array of name-confidence pairs for the user input. + Include the intents from the previous response when they do not + need to change and to prevent Watson from trying to identify them. + :param output: System output. Include the output from the request + when you have several requests within the same Dialog turn to + pass back in the intermediate information. + """ params = {'version': self.version} - return self.request(method='POST', - url='/v1/workspaces', - json=payload, - params=params, - accept_json=True) + data = {} + data['input'] = message_input + data['alternate_intents'] = alternate_intents + data['context'] = context + data['entities'] = entities + data['intents'] = intents + data['output'] = output + return self.request( + method='POST', + url='/v1/workspaces/{0}/message'.format(workspace_id), + params=params, + json=data, + accept_json=True) + + ######################### + # workspaces + ######################### - def update_workspace(self, workspace_id, + def create_workspace(self, name=None, description=None, language=None, + metadata=None, intents=None, entities=None, dialog_nodes=None, - counterexamples=None, - metadata=None): - """ - Update an existing workspace - :param workspace_id: the guid of the workspace to update - :param name: Name of the workspace - :param description: description of the worksspace - :param language: language code - :param entities: an array of entities (optional) - :param dialog_nodes: an array of dialog notes (optional) - :param counterexamples: an array of counterexamples (optional) - :param metadata: metadata dictionary (optional) - """ - params = {'version': self.version} - payload = {'name': name, - 'description': description, - 'language': language} - if intents is not None: - payload['intents'] = intents - - if entities is not None: - payload['entities'] = entities - - if dialog_nodes is not None: - payload['dialog_nodes'] = dialog_nodes - - if counterexamples is not None: - payload['counterexamples'] = counterexamples - - if metadata is not None: - payload['metadata'] = metadata - - params = {'version': self.version} - return self.request(method='POST', - url='/v1/workspaces/{0}'.format(workspace_id), - json=payload, - params=params, - accept_json=True) - - def message(self, workspace_id, message_input=None, context=None, - entities=None, intents=None, output=None, - alternate_intents=False): - """ - Retrieves information about a specific classifier. - :param workspace_id: The workspace to use - :param message_input: The input, usually containing a text field - :param context: The optional context object - :param entities: The optional entities - :param intents: The optional intents - :param alternate_intents: Whether to return more than one intent. - :param output: The optional output object + counterexamples=None): + """ + Create workspace. + :param name: The name of the workspace. + :param description: The description of the workspace. + :param language: The language of the workspace. + :param metadata: Any metadata that is required by the workspace. + :param intents: An array of CreateIntent objects defining the + intents for the workspace. + :param entities: An array of CreateEntity objects defining the + entities for the workspace. + :param dialog_nodes: An array of CreateDialogNode objects defining + the nodes in the workspace dialog. + :param counterexamples: An array of CreateExample objects defining + input examples that have been marked as irrelevant input. """ + params = {'version': self.version} + data = {} + data['name'] = name + data['description'] = description + data['language'] = language + data['metadata'] = metadata + data['intents'] = intents + data['entities'] = entities + data['dialog_nodes'] = dialog_nodes + data['counterexamples'] = counterexamples + return self.request( + method='POST', + url='/v1/workspaces', + params=params, + json=data, + accept_json=True) + def delete_workspace(self, workspace_id): + """ + Delete workspace. + :param workspace_id: The workspace ID. + """ + params = {'version': self.version} + return self.request( + method='DELETE', + url='/v1/workspaces/{0}'.format(workspace_id), + params=params, + accept_json=True) + + def get_workspace(self, workspace_id, export=None): + """ + Get information about a workspace. + :param workspace_id: The workspace ID. + :param export: Whether to include all element content in the + returned data. If export=`false`, the returned data includes + only information about the element itself. If export=`true`, + all content, including subelements, is included. The default + value is `false`. + """ + params = {'version': self.version} + params['export'] = export + return self.request( + method='GET', + url='/v1/workspaces/{0}'.format(workspace_id), + params=params, + accept_json=True) + + def list_workspaces(self, + page_limit=None, + include_count=None, + sort=None, + cursor=None): + """ + List workspaces. + :param page_limit: The number of records to return in each page of + results. The default page limit is 100. + :param include_count: Whether to include information about the number + of records returned. + :param sort: The sort order that determines the behavior of the + pagination cursor. + :param cursor: A token identifying the last value from the previous + page of results. + """ + params = {'version': self.version} + params['page_limit'] = page_limit + params['include_count'] = include_count + params['sort'] = sort + params['cursor'] = cursor + return self.request( + method='GET', + url='/v1/workspaces', + params=params, + accept_json=True) + + def update_workspace(self, + workspace_id, + name=None, + description=None, + language=None, + metadata=None, + intents=None, + entities=None, + dialog_nodes=None, + counterexamples=None): + """ + Update workspace. + :param workspace_id: The workspace ID. + :param name: The name of the workspace. + :param description: The description of the workspace. + :param language: The language of the workspace. + :param metadata: Any metadata that is required by the workspace. + :param intents: An array of CreateIntent objects defining the + intents for the workspace. + :param entities: An array of CreateEntity objects defining the + entities for the workspace. + :param dialog_nodes: An array of CreateDialogNode objects defining + the nodes in the workspace dialog. + :param counterexamples: An array of CreateExample objects defining + input examples that have been marked as irrelevant input. + """ params = {'version': self.version} - data = {'input': message_input, - 'context': context, - 'entities': entities, - 'intents': intents, - 'alternate_intents': alternate_intents, - 'output': output} - return self.request(method='POST', - url='/v1/workspaces/{0}/message'.format( - workspace_id), params=params, - json=data, accept_json=True) + data = {} + data['name'] = name + data['description'] = description + data['language'] = language + data['metadata'] = metadata + data['intents'] = intents + data['entities'] = entities + data['dialog_nodes'] = dialog_nodes + data['counterexamples'] = counterexamples + return self.request( + method='POST', + url='/v1/workspaces/{0}'.format(workspace_id), + params=params, + json=data, + accept_json=True)
Add Intents, Examples and Counterexamples to Conversation SDK The API has been updated early February and not all features are supported by the Python SDK. https://www.ibm.com/watson/developercloud/conversation/api/v1/#versioning
watson-developer-cloud/python-sdk
diff --git a/test/test_conversation_v1.py b/test/test_conversation_v1.py index fb8d494a..361fe4e0 100644 --- a/test/test_conversation_v1.py +++ b/test/test_conversation_v1.py @@ -1,235 +1,666 @@ +# Copyright 2017 IBM All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import json import responses import watson_developer_cloud -platform_url = "https://gateway.watsonplatform.net" -conversation_path = "/conversation/api/v1" -base_url = "{0}{1}".format(platform_url, conversation_path) +platform_url = 'https://gateway.watsonplatform.net' +service_path = '/conversation/api' +base_url = '{0}{1}'.format(platform_url, service_path) + +######################### +# counterexamples +######################### @responses.activate -def test_list_worksapces(): - workspace_url = "{0}{1}".format(base_url, "/workspaces") - message_response = {"workspaces": [], - "pagination": { - "refresh_url": - "/v1/workspaces?version=2016-09-20"}} - responses.add(responses.GET, workspace_url, - body=json.dumps(message_response), status=200, - content_type='application/json') - conversation = watson_developer_cloud.ConversationV1(username="username", - password="password", - version='2016-09-20') - workspaces = conversation.list_workspaces() - assert 'workspaces' in workspaces - assert len(workspaces['workspaces']) == 0 +def test_create_counterexample(): + endpoint = '/v1/workspaces/{0}/counterexamples'.format('boguswid') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "text": "I want financial advice today.", + "created": "2016-07-11T16:39:01.774Z", + "updated": "2015-12-07T18:53:59.153Z" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=201, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + counterexample = service.create_counterexample( + workspace_id='boguswid', text='I want financial advice today.') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert counterexample == response @responses.activate -def test_get_workspace(): - workspace_url = "{0}{1}/boguswid".format(base_url, "/workspaces") - message_response = { - "name": "development", - "created": "2017-02-09T18:41:19.890Z", - "updated": "2017-02-09T18:41:19.890Z", - "language": "en", - "metadata": None, - "description": "this is a workspace", - "workspace_id": "boguswid", - "status": 'Training', - } - responses.add(responses.GET, workspace_url, - body=json.dumps(message_response), status=200, - content_type='application/json') - conversation = watson_developer_cloud.ConversationV1(username="username", - password="password", - version='2016-09-20') - workspace = conversation.get_workspace(workspace_id='boguswid') - assert workspace['name'] == 'development' - assert workspace['workspace_id'] == 'boguswid' - assert workspace['status'] == 'Training' - - workspace = conversation.get_workspace(workspace_id='boguswid', - export=True) - assert workspace['status'] == 'Training' +def test_delete_counterexample(): + endpoint = '/v1/workspaces/{0}/counterexamples/{1}'.format( + 'boguswid', 'I%20want%20financial%20advice%20today') + url = '{0}{1}'.format(base_url, endpoint) + response = {} + responses.add( + responses.DELETE, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + counterexample = service.delete_counterexample( + workspace_id='boguswid', text='I want financial advice today') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert counterexample == response @responses.activate -def test_delete_workspace(): - workspace_url = "{0}{1}/boguswid".format(base_url, "/workspaces") - message_response = {} - responses.add(responses.DELETE, workspace_url, - body=json.dumps(message_response), status=200, - content_type='application/json') - conversation = watson_developer_cloud.ConversationV1(username="username", - password="password", - version='2016-09-20') - workspace = conversation.delete_workspace(workspace_id='boguswid') +def test_get_counterexample(): + endpoint = '/v1/workspaces/{0}/counterexamples/{1}'.format( + 'boguswid', 'What%20are%20you%20wearing%3F') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "text": "What are you wearing?", + "created": "2016-07-11T23:53:59.153Z", + "updated": "2016-12-07T18:53:59.153Z" + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + counterexample = service.get_counterexample( + workspace_id='boguswid', text='What are you wearing%3F') assert len(responses.calls) == 1 - assert workspace == {} + assert responses.calls[0].request.url.startswith(url) + assert counterexample == response @responses.activate -def test_create_workspace(): - workspace_data = { - "name": "development", - "intents": [ - { - "intent": "orderpizza", - "examples": [ - { - "text": "can I order a pizza?" - }, { - "text": "want order a pizza" - }, { - "text": "pizza order" - }, { - "text": "pizza to go" - }], - "description": None - }], - "entities": [{'entity': 'just for testing'}], - "language": "en", - "metadata": {'thing': 'something'}, - "description": "this is a development workspace", - "dialog_nodes": [{'conditions': '#orderpizza', - 'context': None, - 'description': None, - 'dialog_node': 'YesYouCan', - 'go_to': None, - 'metadata': None, - 'output': {'text': {'selection_policy': 'random', - 'values': ['Yes You can!', 'Of course!']}}, - 'parent': None, - 'previous_sibling': None}], - "counterexamples": [{'counter': 'counterexamples for test'}] - } - - workspace_url = "{0}{1}".format(base_url, "/workspaces") - message_response = workspace_data - message_response["workspace_id"] = 'bogusid' - responses.add(responses.POST, workspace_url, - body=json.dumps(message_response), status=200, - content_type='application/json') - conversation = watson_developer_cloud.ConversationV1(username="username", - password="password", - version='2016-09-20') - workspace = conversation.create_workspace(name=workspace_data['name'], - description=workspace_data['description'], - language=workspace_data['language'], - intents=workspace_data['intents'], - metadata=workspace_data['metadata'], - counterexamples=workspace_data['counterexamples'], - dialog_nodes=workspace_data['dialog_nodes'], - entities=workspace_data['entities']) - assert workspace == message_response +def test_list_counterexamples(): + endpoint = '/v1/workspaces/{0}/counterexamples'.format('boguswid') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "counterexamples": [{ + "text": "I want financial advice today.", + "created": "2016-07-11T16:39:01.774Z", + "updated": "2015-12-07T18:53:59.153Z" + }, { + "text": "What are you wearing today", + "created": "2016-07-11T16:39:01.774Z", + "updated": "2015-12-07T18:53:59.153Z" + }], + "pagination": { + "refresh_url": + "/v1/workspaces/pizza_app-e0f3/counterexamples?version=2017-12-18&page_limit=2", + "next_url": + "/v1/workspaces/pizza_app-e0f3/counterexamples?cursor=base64=&version=2017-12-18&page_limit=2" + } + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + counterexamples = service.list_counterexamples(workspace_id='boguswid') assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert counterexamples == response @responses.activate -def test_update_workspace(): - workspace_data = { - "name": "development", - "intents": [ - { - "intent": "orderpizza", - "examples": [ - { - "text": "can I order a pizza?" - }, { - "text": "want order a pizza" - }, { - "text": "pizza order" - }, { - "text": "pizza to go" - }], - "description": None - }], - "entities": [], - "language": "en", - "metadata": {}, - "description": "this is a development workspace", - "dialog_nodes": [], - "counterexamples": [], - "workspace_id": 'boguswid' - } - - workspace_url = "{0}{1}".format(base_url, "/workspaces/boguswid") - message_response = workspace_data - responses.add(responses.POST, workspace_url, - body=json.dumps(message_response), status=200, - content_type='application/json') - conversation = watson_developer_cloud.ConversationV1(username="username", - password="password", - version='2016-09-20') - workspace = conversation.update_workspace('boguswid', - name=workspace_data['name'], - description=workspace_data['description'], - language=workspace_data['language'], - intents=workspace_data['intents'], - metadata=workspace_data['metadata'], - counterexamples=workspace_data['counterexamples'], - dialog_nodes=workspace_data['dialog_nodes'], - entities=workspace_data['entities']) - assert len(responses.calls) == 1 - assert workspace == message_response +def test_update_counterexample(): + endpoint = '/v1/workspaces/{0}/counterexamples/{1}'.format( + 'boguswid', 'What%20are%20you%20wearing%3F') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "text": "What are you wearing?", + "created": "2016-07-11T23:53:59.153Z", + "updated": "2015-12-07T18:53:59.153Z" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + counterexample = service.update_counterexample( + workspace_id='boguswid', + text='What are you wearing%3F', + new_text='What are you wearing%3F') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert counterexample == response + + +######################### +# examples +######################### + + [email protected] +def test_create_example(): + endpoint = '/v1/workspaces/{0}/intents/{1}/examples'.format( + 'boguswid', 'pizza_order') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "text": "Gimme a pizza with pepperoni", + "created": "2016-07-11T16:39:01.774Z", + "updated": "2015-12-07T18:53:59.153Z" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=201, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + example = service.create_example( + workspace_id='boguswid', + intent='pizza_order', + text='Gimme a pizza with pepperoni') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert example == response + + [email protected] +def test_delete_example(): + endpoint = '/v1/workspaces/{0}/intents/{1}/examples/{2}'.format( + 'boguswid', 'pizza_order', 'Gimme%20a%20pizza%20with%20pepperoni') + url = '{0}{1}'.format(base_url, endpoint) + response = {} + responses.add( + responses.DELETE, + url, + body=json.dumps(response), + status=200, + content_type='') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + example = service.delete_example( + workspace_id='boguswid', + intent='pizza_order', + text='Gimme a pizza with pepperoni') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert example == response + + [email protected] +def test_get_example(): + endpoint = '/v1/workspaces/{0}/intents/{1}/examples/{2}'.format( + 'boguswid', 'pizza_order', 'Gimme%20a%20pizza%20with%20pepperoni') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "text": "Gimme a pizza with pepperoni", + "created": "2016-07-11T23:53:59.153Z", + "updated": "2016-12-07T18:53:59.153Z" + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + example = service.get_example( + workspace_id='boguswid', + intent='pizza_order', + text='Gimme a pizza with pepperoni') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert example == response + + [email protected] +def test_list_examples(): + endpoint = '/v1/workspaces/{0}/intents/{1}/examples'.format( + 'boguswid', 'pizza_order') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "examples": [{ + "text": "Can I order a pizza?", + "created": "2016-07-11T16:39:01.774Z", + "updated": "2015-12-07T18:53:59.153Z" + }, { + "text": "Gimme a pizza with pepperoni", + "created": "2016-07-11T16:39:01.774Z", + "updated": "2015-12-07T18:53:59.153Z" + }], + "pagination": { + "refresh_url": + "/v1/workspaces/pizza_app-e0f3/intents/order/examples?version=2017-12-18&page_limit=2", + "next_url": + "/v1/workspaces/pizza_app-e0f3/intents/order/examples?cursor=base64=&version=2017-12-18&page_limit=2" + } + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + examples = service.list_examples( + workspace_id='boguswid', intent='pizza_order') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert examples == response + + [email protected] +def test_update_example(): + endpoint = '/v1/workspaces/{0}/intents/{1}/examples/{2}'.format( + 'boguswid', 'pizza_order', 'Gimme%20a%20pizza%20with%20pepperoni') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "text": "Gimme a pizza with pepperoni", + "created": "2016-07-11T23:53:59.153Z", + "updated": "2015-12-07T18:53:59.153Z" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + example = service.update_example( + workspace_id='boguswid', + intent='pizza_order', + text='Gimme a pizza with pepperoni', + new_text='Gimme a pizza with pepperoni') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert example == response + + +######################### +# intents +######################### + + [email protected] +def test_create_intent(): + endpoint = '/v1/workspaces/{0}/intents'.format('boguswid') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "intent": "pizza_order", + "created": "2015-12-06T23:53:59.153Z", + "updated": "2015-12-07T18:53:59.153Z", + "description": "User wants to start a new pizza order" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=201, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + intent = service.create_intent( + workspace_id='boguswid', + intent='pizza_order', + description='User wants to start a new pizza order') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert intent == response + + [email protected] +def test_delete_intent(): + endpoint = '/v1/workspaces/{0}/intents/{1}'.format('boguswid', + 'pizza_order') + url = '{0}{1}'.format(base_url, endpoint) + response = {} + responses.add( + responses.DELETE, + url, + body=json.dumps(response), + status=200, + content_type='') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + intent = service.delete_intent( + workspace_id='boguswid', intent='pizza_order') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert intent == response + + [email protected] +def test_get_intent(): + endpoint = '/v1/workspaces/{0}/intents/{1}'.format('boguswid', + 'pizza_order') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "intent": "pizza_order", + "created": "2015-12-06T23:53:59.153Z", + "updated": "2015-12-07T18:53:59.153Z", + "description": "User wants to start a new pizza order" + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + intent = service.get_intent( + workspace_id='boguswid', intent='pizza_order', export=False) + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert intent == response + + [email protected] +def test_list_intents(): + endpoint = '/v1/workspaces/{0}/intents'.format('boguswid') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "intents": [{ + "intent": "pizza_order", + "created": "2015-12-06T23:53:59.153Z", + "updated": "2015-12-07T18:53:59.153Z", + "description": "User wants to start a new pizza order" + }], + "pagination": { + "refresh_url": + "/v1/workspaces/pizza_app-e0f3/intents?version=2017-12-18&page_limit=1", + "next_url": + "/v1/workspaces/pizza_app-e0f3/intents?cursor=base64=&version=2017-12-18&page_limit=1" + } + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + intents = service.list_intents(workspace_id='boguswid', export=False) + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert intents == response + + [email protected] +def test_update_intent(): + endpoint = '/v1/workspaces/{0}/intents/{1}'.format('boguswid', + 'pizza_order') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "intent": "pizza_order", + "created": "2015-12-06T23:53:59.153Z", + "updated": "2015-12-07T18:53:59.153Z", + "description": "User wants to start a new pizza order" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + intent = service.update_intent( + workspace_id='boguswid', + intent='pizza_order', + new_intent='pizza_order', + new_description='User wants to start a new pizza order') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert intent == response + + +######################### +# message +######################### @responses.activate def test_message(): - conversation = watson_developer_cloud.ConversationV1(username="username", - password="password", - version='2016-09-20') + conversation = watson_developer_cloud.ConversationV1( + username="username", password="password", version='2016-09-20') workspace_id = 'f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec' - message_url = '%s/workspaces/%s/message' % (base_url, workspace_id) - url1_str = '%s/workspaces/%s/message?version=2016-09-20' + message_url = '%s/v1/workspaces/%s/message' % (base_url, workspace_id) + url1_str = '%s/v1/workspaces/%s/message?version=2016-09-20' message_url1 = url1_str % (base_url, workspace_id) - message_response = {"context": { - "conversation_id": - "1b7b67c0-90ed-45dc-8508-9488bc483d5b", - "system": {"dialog_stack": - ["root"], - "dialog_turn_counter": 1, - "dialog_request_counter": 1}}, - "intents": [], - "entities": [], - "input": {}} - - responses.add(responses.POST, message_url, - body=json.dumps(message_response), - status=200, - content_type='application/json') - - message = conversation.message(workspace_id=workspace_id, - message_input={'text': - 'Turn on the lights'}, - context=None) + message_response = { + "context": { + "conversation_id": "1b7b67c0-90ed-45dc-8508-9488bc483d5b", + "system": { + "dialog_stack": ["root"], + "dialog_turn_counter": 1, + "dialog_request_counter": 1 + } + }, + "intents": [], + "entities": [], + "input": {} + } + + responses.add( + responses.POST, + message_url, + body=json.dumps(message_response), + status=200, + content_type='application/json') + + message = conversation.message( + workspace_id=workspace_id, + message_input={'text': 'Turn on the lights'}, + context=None) assert message is not None assert responses.calls[0].request.url == message_url1 assert responses.calls[0].response.text == json.dumps(message_response) + # test context + responses.add( + responses.POST, + message_url, + body=message_response, + status=200, + content_type='application/json') -# test context - responses.add(responses.POST, message_url, - body=message_response, status=200, - content_type='application/json') - - message_ctx = {'context': - {'conversation_id': '1b7b67c0-90ed-45dc-8508-9488bc483d5b', - 'system': { - 'dialog_stack': ['root'], - 'dialog_turn_counter': 2, - 'dialog_request_counter': 1}}} - message = conversation.message(workspace_id=workspace_id, - message_input={'text': - 'Turn on the lights'}, - context=json.dumps(message_ctx)) + message_ctx = { + 'context': { + 'conversation_id': '1b7b67c0-90ed-45dc-8508-9488bc483d5b', + 'system': { + 'dialog_stack': ['root'], + 'dialog_turn_counter': 2, + 'dialog_request_counter': 1 + } + } + } + message = conversation.message( + workspace_id=workspace_id, + message_input={'text': 'Turn on the lights'}, + context=json.dumps(message_ctx)) assert message is not None assert responses.calls[1].request.url == message_url1 assert responses.calls[1].response.text == json.dumps(message_response) assert len(responses.calls) == 2 + + +######################### +# workspaces +######################### + + [email protected] +def test_create_workspace(): + endpoint = '/v1/workspaces' + url = '{0}{1}'.format(base_url, endpoint) + response = { + "name": "Pizza app", + "created": "2015-12-06T23:53:59.153Z", + "language": "en", + "metadata": {}, + "updated": "2015-12-06T23:53:59.153Z", + "description": "Pizza app", + "workspace_id": "pizza_app-e0f3" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=201, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + workspace = service.create_workspace( + name='Pizza app', description='Pizza app', language='en', metadata={}) + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert workspace == response + + [email protected] +def test_delete_workspace(): + endpoint = '/v1/workspaces/{0}'.format('boguswid') + url = '{0}{1}'.format(base_url, endpoint) + response = {} + responses.add( + responses.DELETE, + url, + body=json.dumps(response), + status=200, + content_type='') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + workspace = service.delete_workspace(workspace_id='boguswid') + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert workspace == response + + [email protected] +def test_get_workspace(): + endpoint = '/v1/workspaces/{0}'.format('boguswid') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "name": "Pizza app", + "created": "2015-12-06T23:53:59.153Z", + "language": "en", + "metadata": {}, + "updated": "2015-12-06T23:53:59.153Z", + "description": "Pizza app", + "status": "Available", + "workspace_id": "pizza_app-e0f3" + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + workspace = service.get_workspace(workspace_id='boguswid', export=False) + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert workspace == response + + [email protected] +def test_list_workspaces(): + endpoint = '/v1/workspaces' + url = '{0}{1}'.format(base_url, endpoint) + response = { + "workspaces": [{ + "name": "Pizza app", + "created": "2015-12-06T23:53:59.153Z", + "language": "en", + "metadata": {}, + "updated": "2015-12-06T23:53:59.153Z", + "description": "Pizza app", + "workspace_id": "pizza_app-e0f3" + }], + "pagination": { + "refresh_url": + "/v1/workspaces?version=2016-01-24&page_limit=1", + "next_url": + "/v1/workspaces?cursor=base64=&version=2016-01-24&page_limit=1" + } + } + responses.add( + responses.GET, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + workspaces = service.list_workspaces() + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert workspaces == response + + [email protected] +def test_update_workspace(): + endpoint = '/v1/workspaces/{0}'.format('pizza_app-e0f3') + url = '{0}{1}'.format(base_url, endpoint) + response = { + "name": "Pizza app", + "created": "2015-12-06T23:53:59.153Z", + "language": "en", + "metadata": {}, + "updated": "2015-12-06T23:53:59.153Z", + "description": "Pizza app", + "workspace_id": "pizza_app-e0f3" + } + responses.add( + responses.POST, + url, + body=json.dumps(response), + status=200, + content_type='application/json') + service = watson_developer_cloud.ConversationV1( + username='username', password='password', version='2017-02-03') + workspace = service.update_workspace( + workspace_id='pizza_app-e0f3', + name='Pizza app', + description='Pizza app', + language='en', + metadata={}) + assert len(responses.calls) == 1 + assert responses.calls[0].request.url.startswith(url) + assert workspace == response
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 3 }
0.25
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest>=2.8.2", "responses>=0.4.0", "python_dotenv>=0.1.5", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 cryptography==40.0.2 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycparser==2.21 pyOpenSSL==23.2.0 pyparsing==3.1.4 pysolr==3.10.0 pytest==7.0.1 python-dotenv==0.20.0 requests==2.27.1 responses==0.17.0 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 -e git+https://github.com/watson-developer-cloud/python-sdk.git@f6d0528f9369a1042372f92d37a67e3acce124eb#egg=watson_developer_cloud zipp==3.6.0
name: python-sdk channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - argparse==1.4.0 - attrs==22.2.0 - cffi==1.15.1 - charset-normalizer==2.0.12 - cryptography==40.0.2 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycparser==2.21 - pyopenssl==23.2.0 - pyparsing==3.1.4 - pysolr==3.10.0 - pytest==7.0.1 - python-dotenv==0.20.0 - requests==2.27.1 - responses==0.17.0 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/python-sdk
[ "test/test_conversation_v1.py::test_create_counterexample", "test/test_conversation_v1.py::test_delete_counterexample", "test/test_conversation_v1.py::test_get_counterexample", "test/test_conversation_v1.py::test_list_counterexamples", "test/test_conversation_v1.py::test_update_counterexample", "test/test_conversation_v1.py::test_create_example", "test/test_conversation_v1.py::test_delete_example", "test/test_conversation_v1.py::test_get_example", "test/test_conversation_v1.py::test_list_examples", "test/test_conversation_v1.py::test_update_example", "test/test_conversation_v1.py::test_create_intent", "test/test_conversation_v1.py::test_delete_intent", "test/test_conversation_v1.py::test_get_intent", "test/test_conversation_v1.py::test_list_intents", "test/test_conversation_v1.py::test_update_intent" ]
[ "test/test_conversation_v1.py::test_message" ]
[ "test/test_conversation_v1.py::test_create_workspace", "test/test_conversation_v1.py::test_delete_workspace", "test/test_conversation_v1.py::test_get_workspace", "test/test_conversation_v1.py::test_list_workspaces", "test/test_conversation_v1.py::test_update_workspace" ]
[]
Apache License 2.0
1,185
[ "watson_developer_cloud/conversation_v1.py", "examples/conversation_v1.py", "examples/notebooks/conversation_v1.ipynb" ]
[ "watson_developer_cloud/conversation_v1.py", "examples/conversation_v1.py", "examples/notebooks/conversation_v1.ipynb" ]
swistakm__graceful-53
d7679ac81be5e8c16f17467fe27efbaabc3ac4c8
2017-04-14 10:45:04
d7679ac81be5e8c16f17467fe27efbaabc3ac4c8
diff --git a/docs/guide/serializers.rst b/docs/guide/serializers.rst index 722da38..bb9f64b 100644 --- a/docs/guide/serializers.rst +++ b/docs/guide/serializers.rst @@ -117,9 +117,14 @@ All field classes accept this set of arguments: * **validators** *(list, optional):* list of validator callables. -* **many** *(bool, optional)* set to True if field is in fact a list +* **many** *(bool, optional):* set to True if field is in fact a list of given type objects +* **read_only** *(bool):* True if field is read-only and cannot be set/modified + via POST, PUT, or PATCH requests. + +* **write_only** *(bool):* True if field is write-only and cannot be retrieved + via GET requests. .. note:: diff --git a/src/graceful/fields.py b/src/graceful/fields.py index b306aa2..d7fbf89 100644 --- a/src/graceful/fields.py +++ b/src/graceful/fields.py @@ -35,10 +35,15 @@ class BaseField: validators (list): list of validator callables. many (bool): set to True if field is in fact a list of given type - objects + objects. - read_only (bool): True if field is read only and cannot be set/modified - by POST and PUT requests + read_only (bool): True if field is read-only and cannot be set/modified + via POST, PUT, or PATCH requests. + + write_only (bool): True if field is write-only and cannot be retrieved + via GET requests. + + .. versionadded:: 0.5.0 Example: @@ -77,6 +82,7 @@ class BaseField: validators=None, many=False, read_only=False, + write_only=False, ): """Initialize field definition.""" self.label = label @@ -85,6 +91,12 @@ class BaseField: self.validators = validators or [] self.many = many self.read_only = read_only + self.write_only = write_only + + if self.write_only and self.read_only: + raise ValueError( + "Field cannot be read-only and write-only at the same time." + ) def from_representation(self, data): """Convert representation value to internal value. @@ -142,6 +154,7 @@ class BaseField: 'type': "list of {}".format(self.type) if self.many else self.type, 'spec': self.spec, 'read_only': self.read_only, + 'write_only': self.write_only, } description.update(kwargs) return description diff --git a/src/graceful/serializers.py b/src/graceful/serializers.py index e83a76a..6a914d0 100644 --- a/src/graceful/serializers.py +++ b/src/graceful/serializers.py @@ -118,6 +118,9 @@ class BaseSerializer(metaclass=MetaSerializer): representation = {} for name, field in self.fields.items(): + if field.write_only: + continue + # note fields do not know their names in source representation # but may know what attribute they target from source object attribute = self.get_attribute(obj, field.source or name)
Add "write_only" fields
swistakm/graceful
diff --git a/tests/test_fields.py b/tests/test_fields.py index 888fb87..4d30e78 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -21,6 +21,15 @@ def test_base_field_implementation_hooks(): field.from_representation(None) +def test_base_field_write_or_read_only_not_both(): + + assert BaseField("Read only", read_only=True).write_only is False + assert BaseField("Write only", write_only=True).read_only is False + + with pytest.raises(ValueError): + BaseField("Both", read_only=True, write_only=True) + + def test_base_field_describe(): class SomeField(BaseField): type = "anything" @@ -33,7 +42,8 @@ def test_base_field_describe(): 'details': "bar", 'type': "anything", 'spec': None, - 'read_only': False + 'read_only': False, + 'write_only': False } # test extending descriptions by call with kwargs diff --git a/tests/test_serializers.py b/tests/test_serializers.py index 5e7b353..0a10553 100644 --- a/tests/test_serializers.py +++ b/tests/test_serializers.py @@ -5,6 +5,8 @@ we test how whole framework for defining new serializers works. """ import pytest +import graceful +from graceful.errors import DeserializationError from graceful.fields import BaseField, StringField from graceful.serializers import BaseSerializer @@ -197,6 +199,56 @@ def test_serializer_get_attribute(): assert serializer.get_attribute(instance, 'nonexistens') is None +def test_serializer_read_only_write_only_serialization(): + class ExampleSerializer(BaseSerializer): + readonly = ExampleField('A read-only field', read_only=True) + writeonly = ExampleField('A write-only field', write_only=True) + + serializer = ExampleSerializer() + + assert serializer.to_representation( + {"writeonly": "foo", 'readonly': 'bar'} + ) == {"readonly": "bar"} + + [email protected]( + # note: this is forward compatibility test that will ensure the behaviour + # will change in future major release. + graceful.VERSION[0] < 1, + reason="graceful<1.0.0 does not enforce validation on deserialization", + strict=True, +) +def test_serializer_read_only_write_only_deserialization(): + class ExampleSerializer(BaseSerializer): + readonly = ExampleField('A read-only field', read_only=True) + writeonly = ExampleField('A write-only field', write_only=True) + + serializer = ExampleSerializer() + + serializer.from_representation({"writeonly": "x"}) == {"writeonly": "x"} + + with pytest.raises(DeserializationError): + serializer.from_representation({"writeonly": "x", 'readonly': 'x'}) + + with pytest.raises(DeserializationError): + serializer.from_representation({'readonly': 'x'}) + + +def test_serializer_read_only_write_only_validation(): + class ExampleSerializer(BaseSerializer): + readonly = ExampleField('A read-only field', read_only=True) + writeonly = ExampleField('A write-only field', write_only=True) + + serializer = ExampleSerializer() + serializer.validate({"writeonly": "x"}) + + with pytest.raises(DeserializationError): + serializer.validate({"writeonly": "x", 'readonly': 'x'}) + + with pytest.raises(DeserializationError): + serializer.validate({'readonly': 'x'}) + + def test_serializer_source_wildcard(): """ Test that '*' wildcard causes whole instance is returned on get attribute
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 3 }
0.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 falcon==3.1.3 -e git+https://github.com/swistakm/graceful.git@d7679ac81be5e8c16f17467fe27efbaabc3ac4c8#egg=graceful importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 singledispatch==3.7.0 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: graceful channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - falcon==3.1.3 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - singledispatch==3.7.0 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/graceful
[ "tests/test_fields.py::test_base_field_write_or_read_only_not_both", "tests/test_fields.py::test_base_field_describe", "tests/test_serializers.py::test_serializer_read_only_write_only_serialization", "tests/test_serializers.py::test_serializer_read_only_write_only_validation" ]
[]
[ "tests/test_fields.py::test_base_field_implementation_hooks", "tests/test_fields.py::test_base_field_validate", "tests/test_fields.py::test_raw_field[int]", "tests/test_fields.py::test_raw_field[float]", "tests/test_fields.py::test_raw_field[str]", "tests/test_fields.py::test_raw_field[dict]", "tests/test_fields.py::test_raw_field[tuple]", "tests/test_fields.py::test_raw_field[set]", "tests/test_fields.py::test_string_field", "tests/test_fields.py::test_int_field", "tests/test_fields.py::test_bool_field", "tests/test_fields.py::test_bool_field_custom_representations", "tests/test_fields.py::test_float_field", "tests/test_serializers.py::test_simple_serializer_definition", "tests/test_serializers.py::test_empty_serializer_definition", "tests/test_serializers.py::test_serializer_inheritance", "tests/test_serializers.py::test_serializer_field_overriding", "tests/test_serializers.py::test_serialiser_simple_representation", "tests/test_serializers.py::test_serialiser_sources_representation", "tests/test_serializers.py::test_serializer_set_attribute", "tests/test_serializers.py::test_serializer_get_attribute", "tests/test_serializers.py::test_serializer_source_wildcard", "tests/test_serializers.py::test_serializer_source_field_with_wildcard", "tests/test_serializers.py::test_serializer_describe", "tests/test_serializers.py::test_serialiser_with_field_many", "tests/test_serializers.py::test_serializer_many_validation" ]
[]
BSD 3-Clause "New" or "Revised" License
1,186
[ "docs/guide/serializers.rst", "src/graceful/fields.py", "src/graceful/serializers.py" ]
[ "docs/guide/serializers.rst", "src/graceful/fields.py", "src/graceful/serializers.py" ]
polygraph-python__polygraph-7
b41d8ea4b5cb8fc90eae48a8398674fc4a4963a8
2017-04-14 12:09:09
b41d8ea4b5cb8fc90eae48a8398674fc4a4963a8
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py index 6c6d393..8c5f336 100644 --- a/polygraph/types/basic_type.py +++ b/polygraph/types/basic_type.py @@ -1,6 +1,6 @@ import types -from polygraph.exceptions import PolygraphValueError +from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError from polygraph.utils.trim_docstring import trim_docstring @@ -10,6 +10,7 @@ class PolygraphTypeMeta(type): meta = namespace.pop("Type", types.SimpleNamespace()) meta.description = getattr(meta, "description", default_description) meta.name = getattr(meta, "name", name) or name + meta.possible_types = getattr(meta, "possible_types", None) namespace["_type"] = meta @@ -18,6 +19,9 @@ class PolygraphTypeMeta(type): def __str__(self): return str(self._type.name) + def __or__(self, other): + return Union(self, other) + class PolygraphType(metaclass=PolygraphTypeMeta): pass @@ -61,6 +65,34 @@ class Union(PolygraphOutputType, PolygraphType): GraphQL Object types, but provides for no guaranteed fields between those types. """ + def __new__(cls, *types): + types = set(types) + assert len(types) >= 2, "Unions must consist of more than 1 type" + bad_types = [t for t in types if not issubclass(t, PolygraphType)] + if bad_types: + message = "All types must be subclasses of PolygraphType. Invalid values: "\ + "{}".format(", ".join(bad_types)) + raise PolygraphSchemaError(message) + type_names = [t._type.name for t in types] + + class Unionable(PolygraphType): + def __new__(cls, value): + if type(value) not in cls._type.possible_types: + valid_types = ", ".join(str(t) for t in cls._type.possible_types) + message = "{} is an invalid value type. "\ + "Valid types: {}".format(type(value), valid_types) + raise PolygraphValueError(message) + return value + + class Type: + name = "|".join(type_names) + description = "One of {}".format(", ".join(type_names)) + possible_types = types + + name = "Union__" + "_".join(type_names) + bases = (Unionable, ) + attrs = {"Type": Type} + return type(name, bases, attrs) class Listable(PolygraphType, list):
Union type http://graphql.org/learn/schema/#union-types
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_union.py b/polygraph/types/tests/test_union.py new file mode 100644 index 0000000..0c60c7d --- /dev/null +++ b/polygraph/types/tests/test_union.py @@ -0,0 +1,48 @@ +from unittest import TestCase, skip + +from polygraph.exceptions import PolygraphValueError +from polygraph.types.basic_type import Union +from polygraph.types.scalar import Float, Int, String + + +@skip # FIXME +class UnionTypeTest(TestCase): + def test_commutativity(self): + self.assertEqual(Union(String, Int), Union(Int, String)) + + def test_associativity(self): + self.assertEqual( + Union(Union(String, Int), Float), + Union(String, Int, Float), + ) + + def test_pipe_operator(self): + self.assertEqual( + String | Int, + Union(String, Int), + ) + + def test_pipe_operator_with_more_than_two_types(self): + self.assertEqual( + String | Int | Float, + Union(String, Int, Float), + ) + + +class UnionValueTest(TestCase): + def test_valid_type(self): + union = String | Int + self.assertEqual(union(Int(32)), Int(32)) + self.assertEqual(union(String("Test")), String("Test")) + + def test_value_must_be_typed(self): + union = String | Int + with self.assertRaises(PolygraphValueError): + union(32) + with self.assertRaises(PolygraphValueError): + union("Test") + + def test_value_must_have_right_type(self): + union = String | Int + with self.assertRaises(PolygraphValueError): + union(Float(32))
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 decorator==5.1.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@b41d8ea4b5cb8fc90eae48a8398674fc4a4963a8#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - decorator==5.1.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_union.py::UnionValueTest::test_valid_type", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_be_typed", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_have_right_type" ]
[]
[]
[]
MIT License
1,187
[ "polygraph/types/basic_type.py" ]
[ "polygraph/types/basic_type.py" ]
craffel__mir_eval-249
6f8ee58f437dd9b8f54b3c9700e7b4dc3879853f
2017-04-14 19:32:43
0d17e0d6d3a773d2f2d5d76f3ea0a010cc2f929e
bmcfee: Note: coverage percentage decrease here is because the rewrite of `interpolate_intervals` is shorter than the previous implementation. bmcfee: > Nice, elegant solution. Can you add a test which checks that it has the expected behavior with non-contiguous intervals? Done.
diff --git a/mir_eval/util.py b/mir_eval/util.py index 1df1142..0ce9130 100644 --- a/mir_eval/util.py +++ b/mir_eval/util.py @@ -129,11 +129,11 @@ def intervals_to_samples(intervals, labels, offset=0, sample_size=0.1, def interpolate_intervals(intervals, labels, time_points, fill_value=None): """Assign labels to a set of points in time given a set of intervals. - Note: Times outside of the known boundaries are mapped to None by default. + Time points that do not lie within an interval are mapped to `fill_value`. Parameters ---------- - intervals : np.ndarray, shape=(n, d) + intervals : np.ndarray, shape=(n, 2) An array of time intervals, as returned by :func:`mir_eval.io.load_intervals()`. The ``i`` th interval spans time ``intervals[i, 0]`` to @@ -145,7 +145,8 @@ def interpolate_intervals(intervals, labels, time_points, fill_value=None): The annotation for each interval time_points : array_like, shape=(m,) - Points in time to assign labels. + Points in time to assign labels. These must be in + non-decreasing order. fill_value : type(labels[0]) Object to use for the label with out-of-range time points. @@ -156,22 +157,26 @@ def interpolate_intervals(intervals, labels, time_points, fill_value=None): aligned_labels : list Labels corresponding to the given time points. + Raises + ------ + ValueError + If `time_points` is not in non-decreasing order. """ - # Sort the intervals by start time - intervals, labels = sort_labeled_intervals(intervals, labels) + # Verify that time_points is sorted + time_points = np.asarray(time_points) + + if np.any(time_points[1:] < time_points[:-1]): + raise ValueError('time_points must be in non-decreasing order') + + aligned_labels = [fill_value] * len(time_points) - start, end = intervals.min(), intervals.max() + starts = np.searchsorted(time_points, intervals[:, 0], side='left') + ends = np.searchsorted(time_points, intervals[:, 1], side='right') - aligned_labels = [] + for (start, end, lab) in zip(starts, ends, labels): + aligned_labels[start:end] = [lab] * (end - start) - for tpoint in time_points: - # This logic isn't correct if there's a gap in intervals - if start <= tpoint <= end: - index = np.argmax(intervals[:, 0] > tpoint) - 1 - aligned_labels.append(labels[index]) - else: - aligned_labels.append(fill_value) return aligned_labels
mir_eval.util.intervals_to_samples expected behavior What's the intended behavior for `mir_eval.util.intervals_to_samples`? In the following example: ```python import numpy as np import mir_eval intervals = np.array( [[0.2, 0.49], [0.8, 0.9]] ) labels = ['a', 'b'] sample_times, sample_labels = mir_eval.util.intervals_to_samples(intervals, labels, offset=0, sample_size=0.1, fill_value=None) ``` I expected something close to: ```python sample_times = np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) sample_labels = np.array([None, None, 'a', 'a', 'a', None, None, None, 'b']) ``` (i.e. time periods where there is no labeled interval get filled in with `None`) but instead get: ```python sample_times = np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) sample_labels = np.array([None, None, 'a', 'a', 'a', 'a', 'a', 'a', 'b']) ``` Am I missing something?
craffel/mir_eval
diff --git a/tests/test_util.py b/tests/test_util.py index b4103d8..913e529 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -21,6 +21,27 @@ def test_interpolate_intervals(): expected_ans) +def test_interpolate_intervals_gap(): + """Check that an interval set is interpolated properly, with gaps.""" + labels = list('abc') + intervals = np.array([[0.5, 1.0], [1.5, 2.0], [2.5, 3.0]]) + time_points = [0.0, 0.75, 1.25, 1.75, 2.25, 2.75, 3.5] + expected_ans = ['N', 'a', 'N', 'b', 'N', 'c', 'N'] + assert (util.interpolate_intervals(intervals, labels, time_points, 'N') == + expected_ans) + + [email protected](ValueError) +def test_interpolate_intervals_badtime(): + """Check that interpolate_intervals throws an exception if + input is unordered. + """ + labels = list('abc') + intervals = np.array([(n, n + 1.0) for n in range(len(labels))]) + time_points = [-1.0, 0.1, 0.9, 0.8, 2.3, 4.0] + mir_eval.util.interpolate_intervals(intervals, labels, time_points) + + def test_intervals_to_samples(): """Check that an interval set is sampled properly, with boundaries conditions and out-of-range values.
{ "commit_name": "merge_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 1 }
0.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[display,testing]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "nose-cov", "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
contourpy==1.3.0 cov-core==1.15.0 coverage==7.8.0 cycler==0.12.1 exceptiongroup==1.2.2 fonttools==4.56.0 future==1.0.0 importlib_resources==6.5.2 iniconfig==2.1.0 kiwisolver==1.4.7 matplotlib==3.9.4 -e git+https://github.com/craffel/mir_eval.git@6f8ee58f437dd9b8f54b3c9700e7b4dc3879853f#egg=mir_eval nose==1.3.7 nose-cov==1.6 numpy==2.0.2 packaging==24.2 pillow==11.1.0 pluggy==1.5.0 pyparsing==3.2.3 pytest==8.3.5 python-dateutil==2.9.0.post0 scipy==1.13.1 six==1.17.0 tomli==2.2.1 zipp==3.21.0
name: mir_eval channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - contourpy==1.3.0 - cov-core==1.15.0 - coverage==7.8.0 - cycler==0.12.1 - exceptiongroup==1.2.2 - fonttools==4.56.0 - future==1.0.0 - importlib-resources==6.5.2 - iniconfig==2.1.0 - kiwisolver==1.4.7 - matplotlib==3.9.4 - nose==1.3.7 - nose-cov==1.6 - numpy==2.0.2 - packaging==24.2 - pillow==11.1.0 - pluggy==1.5.0 - pyparsing==3.2.3 - pytest==8.3.5 - python-dateutil==2.9.0.post0 - scipy==1.13.1 - six==1.17.0 - tomli==2.2.1 - zipp==3.21.0 prefix: /opt/conda/envs/mir_eval
[ "tests/test_util.py::test_interpolate_intervals_gap", "tests/test_util.py::test_interpolate_intervals_badtime" ]
[]
[ "tests/test_util.py::test_interpolate_intervals", "tests/test_util.py::test_intervals_to_samples", "tests/test_util.py::test_intersect_files", "tests/test_util.py::test_merge_labeled_intervals", "tests/test_util.py::test_boundaries_to_intervals", "tests/test_util.py::test_adjust_events", "tests/test_util.py::test_bipartite_match", "tests/test_util.py::test_outer_distance_mod_n", "tests/test_util.py::test_outer_distance", "tests/test_util.py::test_match_events", "tests/test_util.py::test_validate_intervals", "tests/test_util.py::test_validate_events", "tests/test_util.py::test_validate_frequencies" ]
[]
MIT License
1,188
[ "mir_eval/util.py" ]
[ "mir_eval/util.py" ]
tornadoweb__tornado-2011
ecd8968c5135b810cd607b5902dda2cd32122b39
2017-04-15 16:56:05
ecd8968c5135b810cd607b5902dda2cd32122b39
diff --git a/tornado/web.py b/tornado/web.py index 8ff52e9c..d79889fa 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -993,6 +993,9 @@ class RequestHandler(object): self._log() self._finished = True self.on_finish() + self._break_cycles() + + def _break_cycles(self): # Break up a reference cycle between this handler and the # _ui_module closures to allow for faster GC on CPython. self.ui = None diff --git a/tornado/websocket.py b/tornado/websocket.py index ce13d262..69437ee4 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -434,6 +434,16 @@ class WebSocketHandler(tornado.web.RequestHandler): if not self._on_close_called: self._on_close_called = True self.on_close() + self._break_cycles() + + def _break_cycles(self): + # WebSocketHandlers call finish() early, but we don't want to + # break up reference cycles (which makes it impossible to call + # self.render_string) until after we've really closed the + # connection (if it was established in the first place, + # indicated by status code 101). + if self.get_status() != 101 or self._on_close_called: + super(WebSocketHandler, self)._break_cycles() def send_error(self, *args, **kwargs): if self.stream is None:
websocket demo exception tornado/demos/websocket/chatdemo.py ```python chat["html"] = tornado.escape.to_basestring( self.render_string("message.html", message=chat)) ``` ``` [E 170412 12:04:47 websocket:487] Uncaught exception in /chatsocket Traceback (most recent call last): File "/Users/crane/Projects/tornado/tornado/websocket.py", line 484, in _run_callback result = callback(*args, **kwargs) File "/Users/crane/Projects/tornado/demos/websocket/chatdemo.py", line 92, in on_message self.render_string("message.html", message=chat)) File "/Users/crane/Projects/tornado/tornado/web.py", line 863, in render_string namespace = self.get_template_namespace() File "/Users/crane/Projects/tornado/tornado/web.py", line 887, in get_template_namespace namespace.update(self.ui) TypeError: 'NoneType' object is not iterable ```
tornadoweb/tornado
diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py index 7bdca877..d47a74e6 100644 --- a/tornado/test/websocket_test.py +++ b/tornado/test/websocket_test.py @@ -8,6 +8,7 @@ from tornado.concurrent import Future from tornado import gen from tornado.httpclient import HTTPError, HTTPRequest from tornado.log import gen_log, app_log +from tornado.template import DictLoader from tornado.testing import AsyncHTTPTestCase, gen_test, bind_unused_port, ExpectLog from tornado.test.util import unittest, skipBefore35, exec_test from tornado.web import Application, RequestHandler @@ -130,6 +131,11 @@ class CoroutineOnMessageHandler(TestWebSocketHandler): self.write_message(message) +class RenderMessageHandler(TestWebSocketHandler): + def on_message(self, message): + self.write_message(self.render_string('message.html', message=message)) + + class WebSocketBaseTestCase(AsyncHTTPTestCase): @gen.coroutine def ws_connect(self, path, **kwargs): @@ -168,7 +174,15 @@ class WebSocketTest(WebSocketBaseTestCase): dict(close_future=self.close_future)), ('/coroutine', CoroutineOnMessageHandler, dict(close_future=self.close_future)), - ]) + ('/render', RenderMessageHandler, + dict(close_future=self.close_future)), + ], template_loader=DictLoader({ + 'message.html': '<b>{{ message }}</b>', + })) + + def tearDown(self): + super(WebSocketTest, self).tearDown() + RequestHandler._template_loaders.clear() def test_http_request(self): # WS server, HTTP client. @@ -219,6 +233,14 @@ class WebSocketTest(WebSocketBaseTestCase): self.assertEqual(response, u'hello \u00e9') yield self.close(ws) + @gen_test + def test_render_message(self): + ws = yield self.ws_connect('/render') + ws.write_message('hello') + response = yield ws.read_message() + self.assertEqual(response, '<b>hello</b>') + yield self.close(ws) + @gen_test def test_error_in_on_message(self): ws = yield self.ws_connect('/error_in_on_message')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 2 }
4.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "sphinx", "sphinx_rtd_theme", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work Jinja2==3.0.3 MarkupSafe==2.0.1 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytz==2025.2 requests==2.27.1 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml @ file:///tmp/build/80754af9/toml_1616166611790/work -e git+https://github.com/tornadoweb/tornado.git@ecd8968c5135b810cd607b5902dda2cd32122b39#egg=tornado typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: tornado channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - babel==2.11.0 - charset-normalizer==2.0.12 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - jinja2==3.0.3 - markupsafe==2.0.1 - pygments==2.14.0 - pytz==2025.2 - requests==2.27.1 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - urllib3==1.26.20 prefix: /opt/conda/envs/tornado
[ "tornado/test/websocket_test.py::WebSocketTest::test_render_message" ]
[]
[ "tornado/test/websocket_test.py::WebSocketTest::test_async_prepare", "tornado/test/websocket_test.py::WebSocketTest::test_bad_websocket_version", "tornado/test/websocket_test.py::WebSocketTest::test_binary_message", "tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid", "tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid_partial_url", "tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid_subdomains", "tornado/test/websocket_test.py::WebSocketTest::test_check_origin_valid_no_path", "tornado/test/websocket_test.py::WebSocketTest::test_check_origin_valid_with_path", "tornado/test/websocket_test.py::WebSocketTest::test_client_close_reason", "tornado/test/websocket_test.py::WebSocketTest::test_coroutine", "tornado/test/websocket_test.py::WebSocketTest::test_error_in_on_message", "tornado/test/websocket_test.py::WebSocketTest::test_http_request", "tornado/test/websocket_test.py::WebSocketTest::test_path_args", "tornado/test/websocket_test.py::WebSocketTest::test_server_close_reason", "tornado/test/websocket_test.py::WebSocketTest::test_unicode_message", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_callbacks", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_close_buffered_data", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_gen", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_header_echo", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_headers", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_http_fail", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_http_success", "tornado/test/websocket_test.py::WebSocketTest::test_websocket_network_fail", "tornado/test/websocket_test.py::WebSocketNativeCoroutineTest::test_native_coroutine", "tornado/test/websocket_test.py::NoCompressionTest::test_message_sizes", "tornado/test/websocket_test.py::ServerOnlyCompressionTest::test_message_sizes", "tornado/test/websocket_test.py::ClientOnlyCompressionTest::test_message_sizes", "tornado/test/websocket_test.py::DefaultCompressionTest::test_message_sizes", "tornado/test/websocket_test.py::PythonMaskFunctionTest::test_mask", "tornado/test/websocket_test.py::CythonMaskFunctionTest::test_mask", "tornado/test/websocket_test.py::ServerPeriodicPingTest::test_server_ping", "tornado/test/websocket_test.py::ClientPeriodicPingTest::test_client_ping", "tornado/test/websocket_test.py::MaxMessageSizeTest::test_large_message" ]
[]
Apache License 2.0
1,189
[ "tornado/web.py", "tornado/websocket.py" ]
[ "tornado/web.py", "tornado/websocket.py" ]
polygraph-python__polygraph-17
a32d1a2545e146c26396ed6d8c2199deca50ca51
2017-04-16 12:39:42
a32d1a2545e146c26396ed6d8c2199deca50ca51
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py index 900110a..3498d26 100644 --- a/polygraph/types/basic_type.py +++ b/polygraph/types/basic_type.py @@ -3,6 +3,10 @@ from polygraph.types.definitions import TypeDefinition, TypeKind from polygraph.utils.trim_docstring import trim_docstring +def typedef(type_): + return type_.__type + + class PolygraphTypeMeta(type): def __new__(cls, name, bases, namespace): default_description = trim_docstring(namespace.get("__doc__", "")) @@ -17,7 +21,7 @@ class PolygraphTypeMeta(type): meta = None if meta: - namespace["_type"] = TypeDefinition( + namespace["__type"] = TypeDefinition( kind=getattr(meta, "kind"), name=getattr(meta, "name", name) or name, description=getattr(meta, "description", default_description), @@ -32,7 +36,7 @@ class PolygraphTypeMeta(type): return super(PolygraphTypeMeta, cls).__new__(cls, name, bases, namespace) def __str__(self): - return str(self._type.name) + return str(typedef(self).name) def __or__(self, other): """ @@ -99,7 +103,7 @@ class Union(PolygraphOutputType, PolygraphType): message = "All types must be subclasses of PolygraphType. Invalid values: "\ "{}".format(", ".join(bad_types)) raise PolygraphSchemaError(message) - type_names = [t._type.name for t in types] + type_names = [typedef(t).name for t in types] def __new_from_value__(cls, value): if not any(isinstance(value, t) for t in types): @@ -132,7 +136,7 @@ class List(PolygraphType): """ def __new__(cls, type_): - type_name = type_._type.name + type_name = typedef(type_).name def __new_from_value__(cls, value): if value is None: @@ -157,7 +161,7 @@ class NonNull(PolygraphType): Represents a type for which null is not a valid result. """ def __new__(cls, type_): - type_name = type_._type.name + type_name = typedef(type_).name if issubclass(type, NonNull): raise TypeError("NonNull cannot modify NonNull types")
PolygraphType: Rename `_type` to `__type`
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_scalars.py b/polygraph/types/tests/test_scalars.py index 79ccae2..8eecd6a 100644 --- a/polygraph/types/tests/test_scalars.py +++ b/polygraph/types/tests/test_scalars.py @@ -1,5 +1,6 @@ from unittest import TestCase +from polygraph.types.basic_type import typedef from polygraph.types.scalar import ID, Boolean, Float, Int, String @@ -43,7 +44,7 @@ class BooleanTest(TestCase): def test_class_types(self): self.assertTrue(Boolean(True)) self.assertFalse(Boolean(False)) - self.assertEqual(Boolean._type.name, "Boolean") + self.assertEqual(typedef(Boolean).name, "Boolean") def test_none(self): self.assertIsNone(Boolean(None)) diff --git a/polygraph/types/tests/test_types.py b/polygraph/types/tests/test_types.py index 6dc1e57..aa4bd3a 100644 --- a/polygraph/types/tests/test_types.py +++ b/polygraph/types/tests/test_types.py @@ -1,19 +1,19 @@ from unittest import TestCase, skip from polygraph.exceptions import PolygraphValueError -from polygraph.types.basic_type import List, NonNull +from polygraph.types.basic_type import List, NonNull, typedef from polygraph.types.scalar import Boolean, Int, String from polygraph.utils.trim_docstring import trim_docstring class TypeMetaTest(TestCase): def test_scalar_meta(self): - self.assertEqual(Int._type.name, "Int") - self.assertEqual(Int._type.description, trim_docstring(Int.__doc__)) - self.assertEqual(String._type.name, "String") - self.assertEqual(String._type.description, trim_docstring(String.__doc__)) - self.assertEqual(Boolean._type.name, "Boolean") - self.assertEqual(Boolean._type.description, trim_docstring(Boolean.__doc__)) + self.assertEqual(typedef(Int).name, "Int") + self.assertEqual(typedef(Int).description, trim_docstring(Int.__doc__)) + self.assertEqual(typedef(String).name, "String") + self.assertEqual(typedef(String).description, trim_docstring(String.__doc__)) + self.assertEqual(typedef(Boolean).name, "Boolean") + self.assertEqual(typedef(Boolean).description, trim_docstring(Boolean.__doc__)) def test_type_string(self): self.assertEqual(str(Int), "Int") @@ -26,8 +26,8 @@ class TypeMetaTest(TestCase): """Not the description""" pass - self.assertEqual(FancyString._type.name, "String") - self.assertNotEqual(FancyString._type.description, "Not the description") + self.assertEqual(FancyString.__type.name, "String") + self.assertNotEqual(FancyString.__type.description, "Not the description") class NonNullTest(TestCase):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 decorator==5.1.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@a32d1a2545e146c26396ed6d8c2199deca50ca51#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 urwid==2.1.2 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - decorator==5.1.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - urwid==2.1.2 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_scalars.py::IntTest::test_class_types", "polygraph/types/tests/test_scalars.py::IntTest::test_none", "polygraph/types/tests/test_scalars.py::StringTest::test_class_types", "polygraph/types/tests/test_scalars.py::StringTest::test_none", "polygraph/types/tests/test_scalars.py::FloatTest::test_class_types", "polygraph/types/tests/test_scalars.py::BooleanTest::test_class_types", "polygraph/types/tests/test_scalars.py::BooleanTest::test_none", "polygraph/types/tests/test_scalars.py::IDTest::test_id_int", "polygraph/types/tests/test_scalars.py::IDTest::test_id_string", "polygraph/types/tests/test_types.py::TypeMetaTest::test_scalar_meta", "polygraph/types/tests/test_types.py::TypeMetaTest::test_type_string", "polygraph/types/tests/test_types.py::NonNullTest::test_cannot_have_nonnull_of_nonnull", "polygraph/types/tests/test_types.py::NonNullTest::test_nonnull_accepts_values", "polygraph/types/tests/test_types.py::NonNullTest::test_nonnull_doesnt_accept_none", "polygraph/types/tests/test_types.py::NonNullTest::test_string", "polygraph/types/tests/test_types.py::ListTest::test_list_of_nonnulls", "polygraph/types/tests/test_types.py::ListTest::test_scalar_list" ]
[]
[]
[]
MIT License
1,190
[ "polygraph/types/basic_type.py" ]
[ "polygraph/types/basic_type.py" ]
polygraph-python__polygraph-19
15e259607a85cddd45f2b0a44115b7d430970a25
2017-04-16 13:19:00
15e259607a85cddd45f2b0a44115b7d430970a25
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py index 3498d26..26e54b8 100644 --- a/polygraph/types/basic_type.py +++ b/polygraph/types/basic_type.py @@ -1,3 +1,5 @@ +from functools import wraps + from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError from polygraph.types.definitions import TypeDefinition, TypeKind from polygraph.utils.trim_docstring import trim_docstring @@ -7,6 +9,22 @@ def typedef(type_): return type_.__type +type_builder_registry = {} + + +def type_builder_cache(method): + @wraps(method) + def wrapper(cls, *args): + unique_args = frozenset(args) + if (cls, unique_args) in type_builder_registry: + return type_builder_registry[(cls, unique_args)] + else: + return_val = method(cls, *args) + type_builder_registry[(cls, unique_args)] = return_val + return return_val + return wrapper + + class PolygraphTypeMeta(type): def __new__(cls, name, bases, namespace): default_description = trim_docstring(namespace.get("__doc__", "")) @@ -95,6 +113,7 @@ class Union(PolygraphOutputType, PolygraphType): GraphQL Object types, but provides for no guaranteed fields between those types. """ + @type_builder_cache def __new__(cls, *types): types = set(types) assert len(types) >= 2, "Unions must consist of more than 1 type" @@ -135,6 +154,7 @@ class List(PolygraphType): each item in the list is serialized as per the item type. """ + @type_builder_cache def __new__(cls, type_): type_name = typedef(type_).name @@ -160,6 +180,7 @@ class NonNull(PolygraphType): """ Represents a type for which null is not a valid result. """ + @type_builder_cache def __new__(cls, type_): type_name = typedef(type_).name
Implement GraphQL type cache for GraphQL meta-types
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_union.py b/polygraph/types/tests/test_union.py index 0c60c7d..07abe3d 100644 --- a/polygraph/types/tests/test_union.py +++ b/polygraph/types/tests/test_union.py @@ -5,11 +5,13 @@ from polygraph.types.basic_type import Union from polygraph.types.scalar import Float, Int, String -@skip # FIXME +# @skip # FIXME class UnionTypeTest(TestCase): def test_commutativity(self): self.assertEqual(Union(String, Int), Union(Int, String)) + self.assertEqual(Union(String, Int, Float), Union(Float, String, Int, String)) + @skip def test_associativity(self): self.assertEqual( Union(Union(String, Int), Float), @@ -22,6 +24,7 @@ class UnionTypeTest(TestCase): Union(String, Int), ) + @skip def test_pipe_operator_with_more_than_two_types(self): self.assertEqual( String | Int | Float,
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 decorator==5.1.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@15e259607a85cddd45f2b0a44115b7d430970a25#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 urwid==2.1.2 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - decorator==5.1.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - urwid==2.1.2 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_union.py::UnionTypeTest::test_commutativity", "polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator" ]
[]
[ "polygraph/types/tests/test_union.py::UnionTypeTest::test_associativity", "polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator_with_more_than_two_types", "polygraph/types/tests/test_union.py::UnionValueTest::test_valid_type", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_be_typed", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_have_right_type" ]
[]
MIT License
1,191
[ "polygraph/types/basic_type.py" ]
[ "polygraph/types/basic_type.py" ]
polygraph-python__polygraph-24
67ecab9c9c8f6f0ade8e4a55ed5b2c2e66bc9eae
2017-04-17 21:15:38
67ecab9c9c8f6f0ade8e4a55ed5b2c2e66bc9eae
diff --git a/polygraph/types/api.py b/polygraph/types/api.py new file mode 100644 index 0000000..8ffc397 --- /dev/null +++ b/polygraph/types/api.py @@ -0,0 +1,2 @@ +def typedef(type_): + return type_.__type diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py index 26e54b8..6cbce15 100644 --- a/polygraph/types/basic_type.py +++ b/polygraph/types/basic_type.py @@ -1,30 +1,9 @@ -from functools import wraps - -from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError +from polygraph.exceptions import PolygraphValueError +from polygraph.types.api import typedef from polygraph.types.definitions import TypeDefinition, TypeKind from polygraph.utils.trim_docstring import trim_docstring -def typedef(type_): - return type_.__type - - -type_builder_registry = {} - - -def type_builder_cache(method): - @wraps(method) - def wrapper(cls, *args): - unique_args = frozenset(args) - if (cls, unique_args) in type_builder_registry: - return type_builder_registry[(cls, unique_args)] - else: - return_val = method(cls, *args) - type_builder_registry[(cls, unique_args)] = return_val - return return_val - return wrapper - - class PolygraphTypeMeta(type): def __new__(cls, name, bases, namespace): default_description = trim_docstring(namespace.get("__doc__", "")) @@ -62,6 +41,7 @@ class PolygraphTypeMeta(type): > x = String | Int """ + from polygraph.types.type_builder import Union return Union(self, other) @@ -107,103 +87,6 @@ class Interface(PolygraphOutputType, PolygraphType): kind = TypeKind.INTERFACE -class Union(PolygraphOutputType, PolygraphType): - """ - GraphQL Unions represent an object that could be one of a list of - GraphQL Object types, but provides for no guaranteed fields between - those types. - """ - @type_builder_cache - def __new__(cls, *types): - types = set(types) - assert len(types) >= 2, "Unions must consist of more than 1 type" - bad_types = [t for t in types if not issubclass(t, PolygraphType)] - if bad_types: - message = "All types must be subclasses of PolygraphType. Invalid values: "\ - "{}".format(", ".join(bad_types)) - raise PolygraphSchemaError(message) - type_names = [typedef(t).name for t in types] - - def __new_from_value__(cls, value): - if not any(isinstance(value, t) for t in types): - valid_types = ", ".join(type_names) - message = "{} is an invalid value type. "\ - "Valid types: {}".format(type(value), valid_types) - raise PolygraphValueError(message) - return value - - class Type: - name = "|".join(type_names) - description = "One of {}".format(", ".join(type_names)) - possible_types = types - kind = TypeKind.UNION - - name = "Union__" + "_".join(type_names) - bases = (Union, ) - attrs = {"__new__": __new_from_value__} - return type(name, bases, attrs) - - -class List(PolygraphType): - """ - A GraphQL list is a special collection type which declares the - type of each item in the List (referred to as the item type of - the list). - - List values are serialized as ordered lists, where - each item in the list is serialized as per the item type. - """ - - @type_builder_cache - def __new__(cls, type_): - type_name = typedef(type_).name - - def __new_from_value__(cls, value): - if value is None: - return None - ret_val = [type_(v) for v in value] - return list.__new__(cls, ret_val) - - class Type: - name = "[{}]".format(type_name) - description = "A list of {}".format(type_name) - kind = TypeKind.LIST - of_type = type_ - - name = "List__" + type_name - bases = (List, list) - attrs = {"__new__": __new_from_value__, "Type": Type} - return type(name, bases, attrs) - - -class NonNull(PolygraphType): - """ - Represents a type for which null is not a valid result. - """ - @type_builder_cache - def __new__(cls, type_): - type_name = typedef(type_).name - - if issubclass(type, NonNull): - raise TypeError("NonNull cannot modify NonNull types") - - class Type: - name = type_name + "!" - description = "A non-nullable version of {}".format(type_name) - kind = TypeKind.NON_NULL - of_type = type_ - - def __new_from_value__(cls, value): - if value is None: - raise PolygraphValueError("Non-nullable value cannot be None") - return type_.__new__(cls, value) - - name = "NonNull__" + type_name - bases = (NonNull, type_, ) - attrs = {"__new__": __new_from_value__, "Type": Type} - return type(name, bases, attrs) - - class InputObject(PolygraphInputType, PolygraphType): """ An Input Object defines a set of input fields; the input fields diff --git a/polygraph/types/type_builder.py b/polygraph/types/type_builder.py new file mode 100644 index 0000000..943b40d --- /dev/null +++ b/polygraph/types/type_builder.py @@ -0,0 +1,137 @@ +from functools import wraps + +from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError +from polygraph.types.api import typedef +from polygraph.types.basic_type import PolygraphOutputType, PolygraphType +from polygraph.types.definitions import TypeKind +from polygraph.utils.deduplicate import deduplicate + + +type_builder_registry = {} + + +def flatten(iterable): + for arg in iterable: + if issubclass(arg, Union): + yield from flatten(arg.__type.possible_types) + else: + yield arg + + +def deduplicate_union_args(method): + @wraps(method) + def wrapper(cls, *types): + types = list(deduplicate(flatten(types))) + return method(cls, *types) + return wrapper + + +def type_builder_cache(method): + @wraps(method) + def wrapper(cls, *args): + unique_args = frozenset(args) + if (cls, unique_args) in type_builder_registry: + return type_builder_registry[(cls, unique_args)] + else: + return_val = method(cls, *args) + type_builder_registry[(cls, unique_args)] = return_val + return return_val + return wrapper + + +class Union(PolygraphOutputType, PolygraphType): + """ + GraphQL Unions represent an object that could be one of a list of + GraphQL Object types, but provides for no guaranteed fields between + those types. + """ + + @deduplicate_union_args + @type_builder_cache + def __new__(cls, *types): + assert len(types) >= 2, "Unions must consist of more than 1 type" + bad_types = [t for t in types if not issubclass(t, PolygraphType)] + if bad_types: + message = "All types must be subclasses of PolygraphType. Invalid values: "\ + "{}".format(", ".join(bad_types)) + raise PolygraphSchemaError(message) + type_names = [typedef(t).name for t in types] + + def __new_from_value__(cls, value): + if not any(isinstance(value, t) for t in types): + valid_types = ", ".join(type_names) + message = "{} is an invalid value type. "\ + "Valid types: {}".format(type(value), valid_types) + raise PolygraphValueError(message) + return value + + class Type: + name = "|".join(type_names) + description = "One of {}".format(", ".join(type_names)) + possible_types = types + kind = TypeKind.UNION + + name = "Union__" + "_".join(type_names) + bases = (Union, ) + attrs = {"__new__": __new_from_value__, "Type": Type} + return type(name, bases, attrs) + + +class List(PolygraphType): + """ + A GraphQL list is a special collection type which declares the + type of each item in the List (referred to as the item type of + the list). + + List values are serialized as ordered lists, where + each item in the list is serialized as per the item type. + """ + + @type_builder_cache + def __new__(cls, type_): + type_name = typedef(type_).name + + def __new_from_value__(cls, value): + if value is None: + return None + ret_val = [type_(v) for v in value] + return list.__new__(cls, ret_val) + + class Type: + name = "[{}]".format(type_name) + description = "A list of {}".format(type_name) + kind = TypeKind.LIST + of_type = type_ + + name = "List__" + type_name + bases = (List, list) + attrs = {"__new__": __new_from_value__, "Type": Type} + return type(name, bases, attrs) + + +class NonNull(PolygraphType): + """ + Represents a type for which null is not a valid result. + """ + @type_builder_cache + def __new__(cls, type_): + type_name = typedef(type_).name + + if issubclass(type, NonNull): + raise TypeError("NonNull cannot modify NonNull types") + + class Type: + name = type_name + "!" + description = "A non-nullable version of {}".format(type_name) + kind = TypeKind.NON_NULL + of_type = type_ + + def __new_from_value__(cls, value): + if value is None: + raise PolygraphValueError("Non-nullable value cannot be None") + return type_.__new__(cls, value) + + name = "NonNull__" + type_name + bases = (NonNull, type_, ) + attrs = {"__new__": __new_from_value__, "Type": Type} + return type(name, bases, attrs) diff --git a/polygraph/utils/deduplicate.py b/polygraph/utils/deduplicate.py new file mode 100644 index 0000000..1554394 --- /dev/null +++ b/polygraph/utils/deduplicate.py @@ -0,0 +1,11 @@ +def deduplicate(iterable): + """ + Yields deduplicated values, in original order. + + The values of iterable must be hashable + """ + seen = set() + for val in iterable: + if val not in seen: + seen.add(val) + yield val
`Union(Union(String, Int), Float)` should be the same as `Union(String, Int, Float)`
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_object_type.py b/polygraph/types/tests/test_object_type.py index e328e6f..9ffd4d4 100644 --- a/polygraph/types/tests/test_object_type.py +++ b/polygraph/types/tests/test_object_type.py @@ -1,10 +1,10 @@ from unittest import TestCase from polygraph.exceptions import PolygraphValueError -from polygraph.types.basic_type import NonNull from polygraph.types.decorators import field from polygraph.types.object_type import ObjectType from polygraph.types.scalar import Int, String +from polygraph.types.type_builder import NonNull class HelloWorldObject(ObjectType): diff --git a/polygraph/types/tests/test_scalars.py b/polygraph/types/tests/test_scalars.py index 8eecd6a..1097619 100644 --- a/polygraph/types/tests/test_scalars.py +++ b/polygraph/types/tests/test_scalars.py @@ -1,6 +1,6 @@ from unittest import TestCase -from polygraph.types.basic_type import typedef +from polygraph.types.api import typedef from polygraph.types.scalar import ID, Boolean, Float, Int, String diff --git a/polygraph/types/tests/test_type_definitions.py b/polygraph/types/tests/test_type_definitions.py new file mode 100644 index 0000000..6e67345 --- /dev/null +++ b/polygraph/types/tests/test_type_definitions.py @@ -0,0 +1,27 @@ +from unittest import TestCase + +from polygraph.types.api import typedef +from polygraph.types.scalar import Float, Int, String +from polygraph.types.type_builder import List, NonNull, Union + + +class TestTypeDefinition(TestCase): + + def test_names_of_scalars(self): + type_names = [ + (String, "String"), + (Int, "Int"), + (Float, "Float"), + ] + for type_, name in type_names: + self.assertEqual(typedef(type_).name, name) + + def test_names_of_built_types(self): + type_names = [ + (List(String), "[String]"), + (Union(Int, String, List(String)), "Int|String|[String]"), + (NonNull(Int), "Int!"), + (NonNull(List(String)), "[String]!") + ] + for type_, name in type_names: + self.assertEqual(typedef(type_).name, name) diff --git a/polygraph/types/tests/test_types.py b/polygraph/types/tests/test_types.py index aa4bd3a..d08d30f 100644 --- a/polygraph/types/tests/test_types.py +++ b/polygraph/types/tests/test_types.py @@ -1,8 +1,9 @@ from unittest import TestCase, skip from polygraph.exceptions import PolygraphValueError -from polygraph.types.basic_type import List, NonNull, typedef +from polygraph.types.api import typedef from polygraph.types.scalar import Boolean, Int, String +from polygraph.types.type_builder import List, NonNull from polygraph.utils.trim_docstring import trim_docstring diff --git a/polygraph/types/tests/test_union.py b/polygraph/types/tests/test_union.py index 07abe3d..b04ac5e 100644 --- a/polygraph/types/tests/test_union.py +++ b/polygraph/types/tests/test_union.py @@ -1,15 +1,15 @@ from unittest import TestCase, skip from polygraph.exceptions import PolygraphValueError -from polygraph.types.basic_type import Union +from polygraph.types.type_builder import Union from polygraph.types.scalar import Float, Int, String -# @skip # FIXME class UnionTypeTest(TestCase): + def test_commutativity(self): self.assertEqual(Union(String, Int), Union(Int, String)) - self.assertEqual(Union(String, Int, Float), Union(Float, String, Int, String)) + self.assertEqual(Union(String, Int, Float), Union(Float, String, Int)) @skip def test_associativity(self): @@ -24,7 +24,6 @@ class UnionTypeTest(TestCase): Union(String, Int), ) - @skip def test_pipe_operator_with_more_than_two_types(self): self.assertEqual( String | Int | Float, diff --git a/polygraph/utils/tests/test_deduplicate.py b/polygraph/utils/tests/test_deduplicate.py new file mode 100644 index 0000000..5d0761b --- /dev/null +++ b/polygraph/utils/tests/test_deduplicate.py @@ -0,0 +1,11 @@ +from polygraph.utils.deduplicate import deduplicate +from unittest import TestCase + + +class DeduplicateTest(TestCase): + def test_deduplicate(self): + args = ['d', 'e', 'd', 'u', 'p', 'l', 'i', 'c', 'a', 't', 'e'] + self.assertEqual( + list(deduplicate(args)), + ['d', 'e', 'u', 'p', 'l', 'i', 'c', 'a', 't'], + )
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs==22.2.0 autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 coverage==6.2 decorator==5.1.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 packaging==21.3 parso==0.7.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 pluggy==1.0.0 -e git+https://github.com/polygraph-python/polygraph.git@67ecab9c9c8f6f0ade8e4a55ed5b2c2e66bc9eae#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py==1.11.0 pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions==4.1.1 urllib3==1.26.20 urwid==2.1.2 wcwidth==0.2.13 zipp==3.6.0
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - attrs==22.2.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - coverage==6.2 - decorator==5.1.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - packaging==21.3 - parso==0.7.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - py==1.11.0 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - urwid==2.1.2 - wcwidth==0.2.13 - zipp==3.6.0 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_bad_resolver", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_bare_resolver", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_resolver_argument", "polygraph/types/tests/test_scalars.py::IntTest::test_class_types", "polygraph/types/tests/test_scalars.py::IntTest::test_none", "polygraph/types/tests/test_scalars.py::StringTest::test_class_types", "polygraph/types/tests/test_scalars.py::StringTest::test_none", "polygraph/types/tests/test_scalars.py::FloatTest::test_class_types", "polygraph/types/tests/test_scalars.py::BooleanTest::test_class_types", "polygraph/types/tests/test_scalars.py::BooleanTest::test_none", "polygraph/types/tests/test_scalars.py::IDTest::test_id_int", "polygraph/types/tests/test_scalars.py::IDTest::test_id_string", "polygraph/types/tests/test_type_definitions.py::TestTypeDefinition::test_names_of_built_types", "polygraph/types/tests/test_type_definitions.py::TestTypeDefinition::test_names_of_scalars", "polygraph/types/tests/test_types.py::TypeMetaTest::test_scalar_meta", "polygraph/types/tests/test_types.py::TypeMetaTest::test_type_string", "polygraph/types/tests/test_types.py::NonNullTest::test_cannot_have_nonnull_of_nonnull", "polygraph/types/tests/test_types.py::NonNullTest::test_nonnull_accepts_values", "polygraph/types/tests/test_types.py::NonNullTest::test_nonnull_doesnt_accept_none", "polygraph/types/tests/test_types.py::NonNullTest::test_string", "polygraph/types/tests/test_types.py::ListTest::test_list_of_nonnulls", "polygraph/types/tests/test_types.py::ListTest::test_scalar_list", "polygraph/types/tests/test_union.py::UnionTypeTest::test_associativity", "polygraph/types/tests/test_union.py::UnionTypeTest::test_commutativity", "polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator", "polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator_with_more_than_two_types", "polygraph/types/tests/test_union.py::UnionValueTest::test_valid_type", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_be_typed", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_have_right_type", "polygraph/utils/tests/test_deduplicate.py::DeduplicateTest::test_deduplicate" ]
[]
[]
[]
MIT License
1,193
[ "polygraph/types/api.py", "polygraph/utils/deduplicate.py", "polygraph/types/type_builder.py", "polygraph/types/basic_type.py" ]
[ "polygraph/types/api.py", "polygraph/utils/deduplicate.py", "polygraph/types/type_builder.py", "polygraph/types/basic_type.py" ]
polygraph-python__polygraph-29
14fcd132bb737f5bb0159b818f935c0e27131a13
2017-04-17 21:55:03
14fcd132bb737f5bb0159b818f935c0e27131a13
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py index 6cbce15..7e889d1 100644 --- a/polygraph/types/basic_type.py +++ b/polygraph/types/basic_type.py @@ -4,6 +4,14 @@ from polygraph.types.definitions import TypeDefinition, TypeKind from polygraph.utils.trim_docstring import trim_docstring +def get_field_list(namespace): + return [ + value.__field__ + for value in namespace.values() + if hasattr(value, "__field__") + ] + + class PolygraphTypeMeta(type): def __new__(cls, name, bases, namespace): default_description = trim_docstring(namespace.get("__doc__", "")) @@ -22,7 +30,7 @@ class PolygraphTypeMeta(type): kind=getattr(meta, "kind"), name=getattr(meta, "name", name) or name, description=getattr(meta, "description", default_description), - fields=None, # FIXME + fields=get_field_list(namespace), possible_types=getattr(meta, "possible_types", None), interfaces=None, # FIXME enum_values=None, # FIXME diff --git a/polygraph/types/object_type.py b/polygraph/types/object_type.py index 7c6a0f8..9567e1b 100644 --- a/polygraph/types/object_type.py +++ b/polygraph/types/object_type.py @@ -1,7 +1,5 @@ -import inspect -from collections import OrderedDict - from polygraph.types.basic_type import PolygraphOutputType, PolygraphType +from polygraph.types.definitions import TypeKind class ObjectType(PolygraphOutputType, PolygraphType, dict): @@ -10,12 +8,5 @@ class ObjectType(PolygraphOutputType, PolygraphType, dict): a value of a specific type. """ - @classmethod - def get_field_map(cls): - field_map = OrderedDict() - for _, method in inspect.getmembers(cls, predicate=inspect.ismethod): - if hasattr(method, '__fieldname__') and hasattr(method, '__field__'): - fieldname = method.__fieldname__ - field = method.__field__ - field_map[fieldname] = field - return field_map + class Type: + kind = TypeKind.OBJECT
ObjectType type definition
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_object_type.py b/polygraph/types/tests/test_object_type.py index 9ffd4d4..5e380b3 100644 --- a/polygraph/types/tests/test_object_type.py +++ b/polygraph/types/tests/test_object_type.py @@ -1,6 +1,7 @@ from unittest import TestCase from polygraph.exceptions import PolygraphValueError +from polygraph.types.api import typedef from polygraph.types.decorators import field from polygraph.types.object_type import ObjectType from polygraph.types.scalar import Int, String @@ -27,6 +28,15 @@ class HelloWorldObject(ObjectType): class SimpleObjectTypeTest(TestCase): + def test_object_type_definition(self): + type_info = typedef(HelloWorldObject) + self.assertEqual(type_info.name, "HelloWorldObject") + self.assertEqual(type_info.description, "This is a test object") + self.assertEqual( + set([f.name for f in type_info.fields]), + set(["greet_world", "greet_you", "bad_resolver"]), + ) + def test_bare_resolver(self): hello_world = HelloWorldObject() self.assertEqual(hello_world.greet_world(), String("Hello world!"))
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 3, "test_score": 1 }, "num_modified_files": 2 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 coverage==6.2 decorator==5.1.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@14fcd132bb737f5bb0159b818f935c0e27131a13#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 urwid==2.1.2 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - coverage==6.2 - decorator==5.1.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - urwid==2.1.2 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_object_type_definition" ]
[]
[ "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_bad_resolver", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_bare_resolver", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_resolver_argument" ]
[]
MIT License
1,194
[ "polygraph/types/object_type.py", "polygraph/types/basic_type.py" ]
[ "polygraph/types/object_type.py", "polygraph/types/basic_type.py" ]
polygraph-python__polygraph-31
b95e00dbc6ba9738fcebf97e9a0bdab04fcd5fbd
2017-04-17 22:32:07
b95e00dbc6ba9738fcebf97e9a0bdab04fcd5fbd
diff --git a/polygraph/types/object_type.py b/polygraph/types/object_type.py index 9567e1b..b8e0a82 100644 --- a/polygraph/types/object_type.py +++ b/polygraph/types/object_type.py @@ -8,5 +8,8 @@ class ObjectType(PolygraphOutputType, PolygraphType, dict): a value of a specific type. """ + def __init__(self, root=None): + self.root = root + class Type: kind = TypeKind.OBJECT
ObjectType: resolve from Python object or dict
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_object_type.py b/polygraph/types/tests/test_object_type.py index 5e380b3..6bb7747 100644 --- a/polygraph/types/tests/test_object_type.py +++ b/polygraph/types/tests/test_object_type.py @@ -1,3 +1,4 @@ +from types import SimpleNamespace from unittest import TestCase from polygraph.exceptions import PolygraphValueError @@ -51,3 +52,53 @@ class SimpleObjectTypeTest(TestCase): hello_world = HelloWorldObject() with self.assertRaises(PolygraphValueError): hello_world.bad_resolver() + + +class ObjectResolver(ObjectType): + @field() + def name(self) -> NonNull(String): + return self.full_name() + + @field() + def age_in_2017(self) -> NonNull(Int): + return 2017 - self.root.birthyear + + @field() + def always_none(self) -> String: + return self.root.address + + @field() + def greeting(self) -> HelloWorldObject: + return HelloWorldObject() + + def full_name(self): + return self.root.first_name + " " + self.root.last_name + + +class ObjectResolverTest(TestCase): + def setUp(self): + obj = SimpleNamespace( + first_name="John", + last_name="Smith", + birthyear=2000, + address=None, + ) + self.object_type = ObjectResolver(obj) + + def test_method_is_not_automatically_field(self): + type_info = typedef(self.object_type) + fields = set([f.name for f in type_info.fields]) + self.assertEqual( + fields, + set(["name", "age_in_2017", "always_none", "greeting"]), + ) + self.assertNotIn("full_name", fields) + + def test_simple_resolver(self): + self.assertEqual(self.object_type.name(), "John Smith") + self.assertEqual(self.object_type.age_in_2017(), 17) + self.assertEqual(self.object_type.always_none(), None) + + def test_resolve_to_object(self): + greeting = self.object_type.greeting() + self.assertEqual(greeting.greet_world(), "Hello world!")
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "coverage" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 coverage==6.2 decorator==5.1.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@b95e00dbc6ba9738fcebf97e9a0bdab04fcd5fbd#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 urwid==2.1.2 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - coverage==6.2 - decorator==5.1.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - urwid==2.1.2 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_object_type.py::ObjectResolverTest::test_method_is_not_automatically_field", "polygraph/types/tests/test_object_type.py::ObjectResolverTest::test_resolve_to_object", "polygraph/types/tests/test_object_type.py::ObjectResolverTest::test_simple_resolver" ]
[]
[ "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_bad_resolver", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_bare_resolver", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_object_type_definition", "polygraph/types/tests/test_object_type.py::SimpleObjectTypeTest::test_resolver_argument" ]
[]
MIT License
1,195
[ "polygraph/types/object_type.py" ]
[ "polygraph/types/object_type.py" ]
polygraph-python__polygraph-34
ad747c9e64f551b9a8b0392994675a4bb79de4a7
2017-04-18 12:15:56
ad747c9e64f551b9a8b0392994675a4bb79de4a7
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py index 7e889d1..20dc9b6 100644 --- a/polygraph/types/basic_type.py +++ b/polygraph/types/basic_type.py @@ -1,6 +1,6 @@ from polygraph.exceptions import PolygraphValueError from polygraph.types.api import typedef -from polygraph.types.definitions import TypeDefinition, TypeKind +from polygraph.types.definitions import EnumValue, TypeDefinition, TypeKind from polygraph.utils.trim_docstring import trim_docstring @@ -12,6 +12,12 @@ def get_field_list(namespace): ] +def get_enum_value_list(namespace): + return [ + value for value in namespace.values() if isinstance(value, EnumValue) + ] + + class PolygraphTypeMeta(type): def __new__(cls, name, bases, namespace): default_description = trim_docstring(namespace.get("__doc__", "")) @@ -33,7 +39,7 @@ class PolygraphTypeMeta(type): fields=get_field_list(namespace), possible_types=getattr(meta, "possible_types", None), interfaces=None, # FIXME - enum_values=None, # FIXME + enum_values=get_enum_value_list(namespace), input_fields=None, # FIXME of_type=getattr(meta, "of_type", None) ) diff --git a/polygraph/types/definitions.py b/polygraph/types/definitions.py index 1d0008a..5943fc1 100644 --- a/polygraph/types/definitions.py +++ b/polygraph/types/definitions.py @@ -29,6 +29,20 @@ Field = namedtuple( ) +class EnumValue: + __slots__ = ["name", "description", "is_deprecated", "deprecation_reason", "parent"] + + def __init__(self, name, parent, description=None, deprecation_reason=None): + self.name = name + self.description = description + self.is_deprecated = bool(deprecation_reason) + self.deprecation_reason = deprecation_reason + self.parent = parent + + def __repr__(self): + return "EnumValue('{}')".format(self.name) + + TypeDefinition = namedtuple( "TypeDefinition", [ diff --git a/polygraph/types/enum.py b/polygraph/types/enum.py index 42efa7f..110d0ff 100644 --- a/polygraph/types/enum.py +++ b/polygraph/types/enum.py @@ -4,21 +4,7 @@ from polygraph.types.basic_type import ( PolygraphOutputType, PolygraphTypeMeta, ) -from polygraph.types.definitions import TypeKind - - -class EnumValue: - __slots__ = ["name", "description", "is_deprecated", "deprecation_reason", "parent"] - - def __init__(self, name, parent, description=None, deprecation_reason=None): - self.name = name - self.description = description - self.is_deprecated = bool(deprecation_reason) - self.deprecation_reason = deprecation_reason - self.parent = parent - - def __repr__(self): - return "EnumValue('{}')".format(self.name) +from polygraph.types.definitions import EnumValue, TypeKind class EnumTypeMeta(PolygraphTypeMeta):
Populate EnumValue field for Enum type definiton
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_enum.py b/polygraph/types/tests/test_enum.py index c59940c..dabba73 100644 --- a/polygraph/types/tests/test_enum.py +++ b/polygraph/types/tests/test_enum.py @@ -1,6 +1,7 @@ from unittest import TestCase from polygraph.exceptions import PolygraphValueError +from polygraph.types.api import typedef from polygraph.types.enum import EnumType @@ -10,6 +11,12 @@ class Colours(EnumType): BLUE = "The colour of sloth" +class Shapes(EnumType): + RECTANGLE = "A quadrangle" + SQUARE = "Also a quadrangle" + RHOMBUS = "Yet another quadrangle" + + class EnumTest(TestCase): def test_simple_enum(self): @@ -29,3 +36,14 @@ class EnumTest(TestCase): self.assertEqual(Colours(Colours.RED), Colours.RED) with self.assertRaises(PolygraphValueError): Colours("RED") + + def test_enum_values_dont_mix(self): + with self.assertRaises(PolygraphValueError): + Colours(Shapes.RECTANGLE) + + with self.assertRaises(PolygraphValueError): + Shapes(Colours.BLUE) + + def test_enum_type(self): + colour_type = typedef(Colours) + self.assertEqual(len(colour_type.enum_values), 3)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 3 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 coverage==6.2 decorator==5.1.1 distlib==0.3.9 filelock==3.4.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pbr==6.1.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@ad747c9e64f551b9a8b0392994675a4bb79de4a7#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 stevedore==3.5.2 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 urwid==2.1.2 virtualenv==20.17.1 virtualenv-clone==0.5.7 virtualenvwrapper==4.8.4 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - coverage==6.2 - decorator==5.1.1 - distlib==0.3.9 - filelock==3.4.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pbr==6.1.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - platformdirs==2.4.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - stevedore==3.5.2 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - urwid==2.1.2 - virtualenv==20.17.1 - virtualenv-clone==0.5.7 - virtualenvwrapper==4.8.4 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_enum.py::EnumTest::test_enum_type" ]
[]
[ "polygraph/types/tests/test_enum.py::EnumTest::test_enum_value", "polygraph/types/tests/test_enum.py::EnumTest::test_enum_values_dont_mix", "polygraph/types/tests/test_enum.py::EnumTest::test_simple_enum" ]
[]
MIT License
1,196
[ "polygraph/types/enum.py", "polygraph/types/basic_type.py", "polygraph/types/definitions.py" ]
[ "polygraph/types/enum.py", "polygraph/types/basic_type.py", "polygraph/types/definitions.py" ]
jboss-dockerfiles__dogen-107
d4c4c877a818a3ce382b7a2b7ea2d765f3568f72
2017-04-18 13:57:15
bc9263c5b683fdf901ac1646286ee3908b85dcdc
diff --git a/dogen/generator.py b/dogen/generator.py index 6d0793b..98ec763 100644 --- a/dogen/generator.py +++ b/dogen/generator.py @@ -292,7 +292,8 @@ class Generator(object): passed = False try: if os.path.exists(filename): - self.check_sum(filename, source['md5sum']) + if source.get('md5sum'): + self.check_sum(filename, source['md5sum']) passed = True except Exception as e: self.log.warn(str(e)) @@ -307,9 +308,11 @@ class Generator(object): self._fetch_file(url, filename) - self.check_sum(filename, source['md5sum']) - - self.cfg['artifacts'][target] = "md5:%s" % source['md5sum'] + if source.get('md5sum'): + self.check_sum(filename, source['md5sum']) + self.cfg['artifacts'][target] = "md5:%s" % source['md5sum'] + else: + self.cfg['artifacts'][target] = None def check_sum(self, filename, checksum): self.log.info("Checking '%s' MD5 hash..." % os.path.basename(filename))
Do not require md5sum for artifacts The EnMasse community images need to be built using the 'latest' artifacts. To import these using sources, we need the latest md5sum. The md5sum might change after every build. Can we have an option to skip the md5sum, or have it pull & recalculate it?
jboss-dockerfiles/dogen
diff --git a/tests/test_package.py b/tests/test_package.py index b742e65..3b961bc 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -5,7 +5,6 @@ import tempfile import unittest import shutil import re -import sys from dogen.plugins.repo import Repo from dogen.generator import Generator @@ -45,6 +44,5 @@ class TestPackage(unittest.TestCase): dockerfile = open(os.path.join(self.target_dir, "Dockerfile")).read() - sys.stderr.write("\t\t\tDEBUGDEBUG\n{}\n".format(dockerfile)) self.assertTrue(re.match(r'.*yum install[^\n]+wget', dockerfile, re.DOTALL)) self.assertTrue(re.match(r'.*rpm -q +wget', dockerfile, re.DOTALL)) diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py index 9c01463..e439971 100644 --- a/tests/test_unit_generate_configuration.py +++ b/tests/test_unit_generate_configuration.py @@ -261,6 +261,17 @@ class TestConfig(unittest.TestCase): generator._handle_scripts() # success if no stack trace thrown + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_without_specified_md5sum(self, mock_fetch_file): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + @mock.patch('dogen.generator.Generator.check_sum') @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources(self, mock_fetch_file, mock_check_sum):
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 docopt==0.6.2 -e git+https://github.com/jboss-dockerfiles/dogen.git@d4c4c877a818a3ce382b7a2b7ea2d765f3568f72#egg=dogen idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pykwalify==1.8.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 python-dateutil==2.9.0.post0 PyYAML==6.0.1 requests==2.27.1 ruamel.yaml==0.18.3 ruamel.yaml.clib==0.2.8 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: dogen channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - coverage==6.2 - docopt==0.6.2 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pykwalify==1.8.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - python-dateutil==2.9.0.post0 - pyyaml==6.0.1 - requests==2.27.1 - ruamel-yaml==0.18.3 - ruamel-yaml-clib==0.2.8 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/dogen
[ "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_without_specified_md5sum" ]
[]
[ "tests/test_package.py::TestPackage::test_custom_repo_files_should_add_two", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec_not_env", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_default", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_env", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_default_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_default_script_user", "tests/test_unit_generate_configuration.py::TestConfig::test_default_values", "tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_cli_false_should_override_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_env_provided_script_user", "tests/test_unit_generate_configuration.py::TestConfig::test_env_supplied_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_fail_if_version_mismatch", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_broken", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_correct", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_and_target_filename", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_target_filename", "tests/test_unit_generate_configuration.py::TestConfig::test_no_scripts_defined", "tests/test_unit_generate_configuration.py::TestConfig::test_scripts_dir_found_by_convention", "tests/test_unit_generate_configuration.py::TestConfig::test_skip_ssl_verification_in_descriptor" ]
[]
MIT License
1,197
[ "dogen/generator.py" ]
[ "dogen/generator.py" ]
polygraph-python__polygraph-39
a3023ad2c3207477fc4a0798d2e17da42ee8e6d2
2017-04-18 14:13:24
a3023ad2c3207477fc4a0798d2e17da42ee8e6d2
diff --git a/polygraph/types/schema.py b/polygraph/types/schema.py new file mode 100644 index 0000000..6c98fed --- /dev/null +++ b/polygraph/types/schema.py @@ -0,0 +1,61 @@ +from polygraph.exceptions import PolygraphSchemaError +from polygraph.types.api import typedef +from polygraph.types.definitions import TypeKind +from polygraph.types.object_type import ObjectType +from polygraph.utils.strict_dict import StrictDict + + +def typename(type_): + return typedef(type_).name + + +def build_type_map(type_list): + type_map = StrictDict() + + for type_ in type_list: + typedef = type_.__type + kind = typedef.kind + type_map[typename(type_)] = type_ + if kind in (TypeKind.SCALAR, TypeKind.ENUM): + continue + elif kind in (TypeKind.LIST, TypeKind.NON_NULL): + of_type = typedef.of_type + subtype_map = build_type_map([of_type]) + type_map.update(subtype_map) + + elif kind == TypeKind.UNION: + possible_types = typedef.possible_types + subtype_map = build_type_map(possible_types) + type_map.update(subtype_map) + + elif kind == TypeKind.OBJECT: + field_types = [] + for field in typedef.fields: + field_types.append(field.return_type) + field_types.extend(field.arg_types.values() if field.arg_types else []) + subtype_map = build_type_map(field_types) + type_map.update(subtype_map) + + elif kind == TypeKind.INPUT_OBJECT: + # FIXME + pass + + elif kind == TypeKind.INTERFACE: + # FIXME + pass + + return type_map + + +class Schema: + def __init__(self, query: ObjectType, mutation=None, directives=None, additional_types=None): + if not issubclass(query, ObjectType): + raise PolygraphSchemaError("Query must be an ObjectType") + self.query = query + self.mutation = mutation + self.directives = directives + initial_types = additional_types or [] + initial_types.append(query) + if mutation: + initial_types.append(mutation) + self.type_map = build_type_map(initial_types) diff --git a/polygraph/types/type_builder.py b/polygraph/types/type_builder.py index 943b40d..2b20577 100644 --- a/polygraph/types/type_builder.py +++ b/polygraph/types/type_builder.py @@ -77,7 +77,7 @@ class Union(PolygraphOutputType, PolygraphType): return type(name, bases, attrs) -class List(PolygraphType): +class List(PolygraphOutputType, PolygraphType): """ A GraphQL list is a special collection type which declares the type of each item in the List (referred to as the item type of diff --git a/polygraph/utils/strict_dict.py b/polygraph/utils/strict_dict.py new file mode 100644 index 0000000..98f7dc7 --- /dev/null +++ b/polygraph/utils/strict_dict.py @@ -0,0 +1,11 @@ +class StrictDict(dict): + """ + A dictionary that raises an exception if attempting to associate a known + key with a different value + """ + def __setitem__(self, key, item): + if key in self and self[key] != item: + raise ValueError( + "Attempting to set {} to a different value {}".format(key, item) + ) + return super().__setitem__(key, item)
Typemap builder
polygraph-python/polygraph
diff --git a/polygraph/types/tests/test_type_map.py b/polygraph/types/tests/test_type_map.py new file mode 100644 index 0000000..78476f0 --- /dev/null +++ b/polygraph/types/tests/test_type_map.py @@ -0,0 +1,41 @@ +from unittest import TestCase + +from polygraph.types.decorators import field +from polygraph.types.object_type import ObjectType +from polygraph.types.scalar import ID, Boolean, Float, Int, String +from polygraph.types.schema import Schema +from polygraph.types.type_builder import List, NonNull, Union + + +class Person(ObjectType): + @field() + def name(self) -> NonNull(String): + pass + + @field() + def age(year: Int) -> String: + pass + + +class Animal(ObjectType): + @field() + def can_walk(self) -> Boolean: + pass + + +class Query(ObjectType): + @field() + def characters(self) -> List(Union(Animal, Person)): + pass + + +class TypeMapTest(TestCase): + def test_type_map_builder(self): + schema = Schema(query=Query, additional_types=[ID]) + type_map = schema.type_map + self.assertEqual(type_map["Animal"], Animal) + self.assertEqual(type_map["Person"], Person) + self.assertEqual(type_map["Animal|Person"], Union(Animal, Person)) + self.assertEqual(type_map["Boolean"], Boolean) + self.assertEqual(type_map["ID"], ID) + self.assertNotIn(Float, type_map.values()) # Float was not defined anywhere diff --git a/polygraph/utils/tests/test_strict_dict.py b/polygraph/utils/tests/test_strict_dict.py new file mode 100644 index 0000000..b000dab --- /dev/null +++ b/polygraph/utils/tests/test_strict_dict.py @@ -0,0 +1,20 @@ +from unittest import TestCase + +from polygraph.utils.strict_dict import StrictDict + + +class StrictDictTest(TestCase): + def test_cannot_update_same_key_with_different_value(self): + d = StrictDict() + d["George"] = "Washington" + d["John"] = "Adams" + with self.assertRaises(ValueError): + d["George"] = "Bush" + self.assertEqual(d["George"], "Washington") + + def test_can_update_same_key_with_same_value(self): + d = StrictDict() + d["George"] = "Bush" + d["Bill"] = "Clinton" + d["George"] = "Bush" + self.assertEqual(d["George"], "Bush")
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 asttokens==3.0.0 autopep8==2.3.2 certifi==2025.1.31 charset-normalizer==3.4.1 clint==0.5.1 coverage==7.8.0 decorator==5.2.1 distlib==0.3.9 exceptiongroup==1.2.2 executing==2.2.0 filelock==3.18.0 flake8==7.2.0 graphql-core==3.2.6 idna==3.10 iniconfig==2.1.0 ipython==8.18.1 isort==6.0.1 jedi==0.19.2 matplotlib-inline==0.1.7 mccabe==0.7.0 packaging==24.2 parso==0.8.4 pbr==6.1.1 pexpect==4.9.0 pkginfo==1.12.1.2 platformdirs==4.3.7 pluggy==1.5.0 -e git+https://github.com/polygraph-python/polygraph.git@a3023ad2c3207477fc4a0798d2e17da42ee8e6d2#egg=polygraph prompt_toolkit==3.0.50 ptyprocess==0.7.0 pudb==2017.1.2 pure_eval==0.2.3 pycodestyle==2.13.0 pyflakes==3.3.1 Pygments==2.19.1 pytest==8.3.5 requests==2.32.3 requests-toolbelt==1.0.0 stack-data==0.6.3 stevedore==5.4.1 tomli==2.2.1 traitlets==5.14.3 twine==1.8.1 typing_extensions==4.13.0 urllib3==2.3.0 urwid==2.6.16 virtualenv==20.29.3 virtualenv-clone==0.5.7 virtualenvwrapper==6.1.1 wcwidth==0.2.13
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - asttokens==3.0.0 - autopep8==2.3.2 - certifi==2025.1.31 - charset-normalizer==3.4.1 - clint==0.5.1 - coverage==7.8.0 - decorator==5.2.1 - distlib==0.3.9 - exceptiongroup==1.2.2 - executing==2.2.0 - filelock==3.18.0 - flake8==7.2.0 - graphql-core==3.2.6 - idna==3.10 - iniconfig==2.1.0 - ipython==8.18.1 - isort==6.0.1 - jedi==0.19.2 - matplotlib-inline==0.1.7 - mccabe==0.7.0 - packaging==24.2 - parso==0.8.4 - pbr==6.1.1 - pexpect==4.9.0 - pkginfo==1.12.1.2 - platformdirs==4.3.7 - pluggy==1.5.0 - prompt-toolkit==3.0.50 - ptyprocess==0.7.0 - pudb==2017.1.2 - pure-eval==0.2.3 - pycodestyle==2.13.0 - pyflakes==3.3.1 - pygments==2.19.1 - pytest==8.3.5 - requests==2.32.3 - requests-toolbelt==1.0.0 - stack-data==0.6.3 - stevedore==5.4.1 - tomli==2.2.1 - traitlets==5.14.3 - twine==1.8.1 - typing-extensions==4.13.0 - urllib3==2.3.0 - urwid==2.6.16 - virtualenv==20.29.3 - virtualenv-clone==0.5.7 - virtualenvwrapper==6.1.1 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_type_map.py::TypeMapTest::test_type_map_builder", "polygraph/utils/tests/test_strict_dict.py::StrictDictTest::test_can_update_same_key_with_same_value", "polygraph/utils/tests/test_strict_dict.py::StrictDictTest::test_cannot_update_same_key_with_different_value" ]
[]
[]
[]
MIT License
1,198
[ "polygraph/utils/strict_dict.py", "polygraph/types/type_builder.py", "polygraph/types/schema.py" ]
[ "polygraph/utils/strict_dict.py", "polygraph/types/type_builder.py", "polygraph/types/schema.py" ]
jboss-dockerfiles__dogen-110
bb52f327cd889a0af7b046762a3856a9e6aecca9
2017-04-18 14:53:35
bc9263c5b683fdf901ac1646286ee3908b85dcdc
diff --git a/docs/environment_variables.adoc b/docs/environment_variables.adoc deleted file mode 100644 index 6186d98..0000000 --- a/docs/environment_variables.adoc +++ /dev/null @@ -1,32 +0,0 @@ -# Environment variables - -In Dogen you can use a few environment variables that can infulence how Dogen behaves. - -## `DOGEN_SOURCES_CACHE` - -Default value: not set - -Specifies a different location that could be used to fetch artifacts. Usually this is a -URL to some cache service. You can use following substitutions: - -* `\#filename#` -- the file name from the `url` of the artifact -* `\#algorithm#` -- has algorithm specified for the selected artifact -* `\#hash#` -- value of the digest. - -### Example - -Consider this sources section: - -``` -sources: - - url: http://some.host.com/7.0.0/jboss-eap-7.0.0.zip - md5: cd02482daa0398bf5500e1628d28179a -``` - -When you set `DOGEN_SOURCES_CACHE` to `http://cache.host.com/fetch?\#algorithm#=\#hash#` then -the JBoss EAP artifact will be fetched from: `http://cache.host.com/fetch?md5=cd02482daa0398bf5500e1628d28179a`. - -If `DOGEN_SOURCES_CACHE` would be set to `http://cache.host.com/cache/\#filename#` then -the JBoss EAP artifact will be fetched from: `http://cache.host.com/cache/jboss-eap-7.0.0.zip`. - -In all cases digest will be computed from the downloaded file and compared with the expected value. diff --git a/docs/index.adoc b/docs/index.adoc index 6d9617d..70a0f13 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -6,6 +6,5 @@ This document covers usage instructions and examples. * link:descriptor.adoc[Descriptor file explained] * link:conventions.adoc[Conventions] -* link:environment_variables.adoc[Environment variables] diff --git a/dogen/generator.py b/dogen/generator.py index 98ec763..0b5d94a 100644 --- a/dogen/generator.py +++ b/dogen/generator.py @@ -16,6 +16,8 @@ from dogen.tools import Tools from dogen import version, DEFAULT_SCRIPT_EXEC, DEFAULT_SCRIPT_USER from dogen.errors import Error +SUPPORTED_HASH_ALGORITHMS = ['sha256', 'sha1', 'md5'] + class Generator(object): def __init__(self, log, args, plugins=[]): self.log = log @@ -289,11 +291,29 @@ class Generator(object): target = basename filename = ("%s/%s" % (self.output, target)) + passed = False + algorithms = [] + + md5sum = source.get('md5sum') + + if md5sum: + self.log.warn("The 'md5sum' key is deprecated, please use 'md5' for %s. Or better switch to sha256 or sha1." % url) + + # Backwards compatibility for md5sum + if not source.get('md5'): + source['md5'] = md5sum + + for supported_algorithm in SUPPORTED_HASH_ALGORITHMS: + if not source.get(supported_algorithm): + continue + + algorithms.append(supported_algorithm) + try: - if os.path.exists(filename): - if source.get('md5sum'): - self.check_sum(filename, source['md5sum']) + if os.path.exists(filename) and algorithms: + for algorithm in algorithms: + self.check_sum(filename, source[algorithm], algorithm) passed = True except Exception as e: self.log.warn(str(e)) @@ -303,20 +323,36 @@ class Generator(object): sources_cache = os.environ.get("DOGEN_SOURCES_CACHE") if sources_cache: - url = sources_cache.replace('#hash#', source['md5sum']).replace('#algorithm#', 'md5') + url = sources_cache.replace('#filename#', basename) + + if algorithms: + if len(algorithms) > 1: + self.log.warn("You specified multiple algorithms for '%s' url, but only '%s' will be used to fetch it from cache" % (url, algorithms[0])) + + url = url.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0]) + self.log.info("Using '%s' as cached location for artifact" % url) self._fetch_file(url, filename) - if source.get('md5sum'): - self.check_sum(filename, source['md5sum']) - self.cfg['artifacts'][target] = "md5:%s" % source['md5sum'] + if algorithms: + for algorithm in algorithms: + self.check_sum(filename, source[algorithm], algorithm) + self.cfg['artifacts'][target] = "%s:%s" % (algorithms[0], source[algorithms[0]]) else: self.cfg['artifacts'][target] = None - def check_sum(self, filename, checksum): - self.log.info("Checking '%s' MD5 hash..." % os.path.basename(filename)) - filesum = hashlib.md5(open(filename, 'rb').read()).hexdigest() + def check_sum(self, filename, checksum, algorithm): + self.log.info("Checking '%s' %s hash..." % (os.path.basename(filename), algorithm)) + + hash = getattr(hashlib, algorithm)() + + with open(filename, "rb") as f: + for chunk in iter(lambda: f.read(65536), b""): + hash.update(chunk) + filesum = hash.hexdigest() + if filesum.lower() != checksum.lower(): - raise Exception("The md5sum computed for the '%s' file ('%s') doesn't match the '%s' value" % (filename, filesum, checksum)) + raise Exception("The %s computed for the '%s' file ('%s') doesn't match the '%s' value" % (algorithm, filename, filesum, checksum)) + self.log.debug("MD5 hash is correct.") diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml index 040cd19..8f053f7 100644 --- a/dogen/schema/kwalify_schema.yaml +++ b/dogen/schema/kwalify_schema.yaml @@ -67,6 +67,9 @@ map: - map: url: {type: str} md5sum: {type: str} + md5: {type: str} + sha1: {type: str} + sha256: {type: str} target: {type: str} packages: seq:
Add support for multiple hash algorithms in artifacts Currently we support only md5, but we should also support sha1 and sha256.
jboss-dockerfiles/dogen
diff --git a/tests/schemas/good/openshift_amq_6.2_image.yaml b/tests/schemas/good/openshift_amq_6.2_image.yaml index b7aff9b..fa4f3cf 100644 --- a/tests/schemas/good/openshift_amq_6.2_image.yaml +++ b/tests/schemas/good/openshift_amq_6.2_image.yaml @@ -52,9 +52,9 @@ scripts: exec: install.sh sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/openshift-activemq-plugin-1.0.0.Final-redhat-1.jar - md5sum: 325fbbaff0f7dbea42203346d9c3bf98 + md5: 325fbbaff0f7dbea42203346d9c3bf98 - url: http://redacted/jboss-dmr-1.2.2.Final-redhat-1.jar - md5sum: 8df4cbf6f39c3bce21de16ad708084d5 + md5: 8df4cbf6f39c3bce21de16ad708084d5 diff --git a/tests/schemas/good/openshift_datagrid_6.5_image.yaml b/tests/schemas/good/openshift_datagrid_6.5_image.yaml index 22ce48a..b20b77e 100644 --- a/tests/schemas/good/openshift_datagrid_6.5_image.yaml +++ b/tests/schemas/good/openshift_datagrid_6.5_image.yaml @@ -151,16 +151,16 @@ scripts: user: 185 sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/javax.json-1.0.4.jar - md5sum: 569870f975deeeb6691fcb9bc02a9555 + md5: 569870f975deeeb6691fcb9bc02a9555 - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar - md5sum: 7c743e35463db5f55f415dd666d705c5 + md5: 7c743e35463db5f55f415dd666d705c5 - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar - md5sum: bafa4db7efe4082d76cde2fa9499bf84 + md5: bafa4db7efe4082d76cde2fa9499bf84 - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar - md5sum: 71bbfdf795a2c65e4473df242f765490 + md5: 71bbfdf795a2c65e4473df242f765490 - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar - md5sum: 145add030a89c3ed588dce27b0f24999 + md5: 145add030a89c3ed588dce27b0f24999 - url: http://redacted/oauth-20100527.jar - md5sum: 91c7c70579f95b7ddee95b2143a49b41 + md5: 91c7c70579f95b7ddee95b2143a49b41 diff --git a/tests/schemas/good/openshift_eap_6.4_image.yaml b/tests/schemas/good/openshift_eap_6.4_image.yaml index 083329d..2b24f39 100644 --- a/tests/schemas/good/openshift_eap_6.4_image.yaml +++ b/tests/schemas/good/openshift_eap_6.4_image.yaml @@ -98,22 +98,22 @@ scripts: user: 185 sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/javax.json-1.0.4.jar - md5sum: 569870f975deeeb6691fcb9bc02a9555 + md5: 569870f975deeeb6691fcb9bc02a9555 - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar - md5sum: 7c743e35463db5f55f415dd666d705c5 + md5: 7c743e35463db5f55f415dd666d705c5 - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar - md5sum: bafa4db7efe4082d76cde2fa9499bf84 + md5: bafa4db7efe4082d76cde2fa9499bf84 - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar - md5sum: 71bbfdf795a2c65e4473df242f765490 + md5: 71bbfdf795a2c65e4473df242f765490 - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar - md5sum: 145add030a89c3ed588dce27b0f24999 + md5: 145add030a89c3ed588dce27b0f24999 - url: http://redacted/oauth-20100527.jar - md5sum: 91c7c70579f95b7ddee95b2143a49b41 + md5: 91c7c70579f95b7ddee95b2143a49b41 - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar - md5sum: 207e17ac8102c93233fe2764d1fe8499 + md5: 207e17ac8102c93233fe2764d1fe8499 - url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip - md5sum: 6fd81306ea4297307dcc5f51712e5f95 + md5: 6fd81306ea4297307dcc5f51712e5f95 - url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip - md5sum: 3b953c114dd09f86e71e18cd57d8af56 + md5: 3b953c114dd09f86e71e18cd57d8af56 diff --git a/tests/schemas/good/openshift_eap_7.0_image.yaml b/tests/schemas/good/openshift_eap_7.0_image.yaml index 72df73d..08f5a5c 100644 --- a/tests/schemas/good/openshift_eap_7.0_image.yaml +++ b/tests/schemas/good/openshift_eap_7.0_image.yaml @@ -107,22 +107,22 @@ scripts: user: 185 sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/javax.json-1.0.4.jar - md5sum: 569870f975deeeb6691fcb9bc02a9555 + md5: 569870f975deeeb6691fcb9bc02a9555 - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar - md5sum: 7c743e35463db5f55f415dd666d705c5 + md5: 7c743e35463db5f55f415dd666d705c5 - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar - md5sum: bafa4db7efe4082d76cde2fa9499bf84 + md5: bafa4db7efe4082d76cde2fa9499bf84 - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar - md5sum: 71bbfdf795a2c65e4473df242f765490 + md5: 71bbfdf795a2c65e4473df242f765490 - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar - md5sum: 145add030a89c3ed588dce27b0f24999 + md5: 145add030a89c3ed588dce27b0f24999 - url: http://redacted/oauth-20100527.jar - md5sum: 91c7c70579f95b7ddee95b2143a49b41 + md5: 91c7c70579f95b7ddee95b2143a49b41 - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar - md5sum: 207e17ac8102c93233fe2764d1fe8499 + md5: 207e17ac8102c93233fe2764d1fe8499 - url: http://redacted/rh-sso-7.0.0-eap7-adapter.zip - md5sum: 1542c1014d9ebc24522839a5fa8bee4d + md5: 1542c1014d9ebc24522839a5fa8bee4d - url: http://redacted/rh-sso-7.0.0-saml-eap7-adapter.zip - md5sum: ce858a47c707b362a968ffd5c66768dd + md5: ce858a47c707b362a968ffd5c66768dd diff --git a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml index abc1746..953fa45 100644 --- a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml +++ b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml @@ -101,22 +101,22 @@ scripts: exec: configure.sh sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/javax.json-1.0.4.jar - md5sum: 569870f975deeeb6691fcb9bc02a9555 + md5: 569870f975deeeb6691fcb9bc02a9555 - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar - md5sum: 7c743e35463db5f55f415dd666d705c5 + md5: 7c743e35463db5f55f415dd666d705c5 - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar - md5sum: bafa4db7efe4082d76cde2fa9499bf84 + md5: bafa4db7efe4082d76cde2fa9499bf84 - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar - md5sum: 71bbfdf795a2c65e4473df242f765490 + md5: 71bbfdf795a2c65e4473df242f765490 - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar - md5sum: 145add030a89c3ed588dce27b0f24999 + md5: 145add030a89c3ed588dce27b0f24999 - url: http://redacted/oauth-20100527.jar - md5sum: 91c7c70579f95b7ddee95b2143a49b41 + md5: 91c7c70579f95b7ddee95b2143a49b41 - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar - md5sum: 207e17ac8102c93233fe2764d1fe8499 + md5: 207e17ac8102c93233fe2764d1fe8499 - url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip - md5sum: 6fd81306ea4297307dcc5f51712e5f95 + md5: 6fd81306ea4297307dcc5f51712e5f95 - url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip - md5sum: 3b953c114dd09f86e71e18cd57d8af56 + md5: 3b953c114dd09f86e71e18cd57d8af56 diff --git a/tests/schemas/good/openshift_kieserver_6.2_image.yaml b/tests/schemas/good/openshift_kieserver_6.2_image.yaml index 5611e2c..3a1bd93 100644 --- a/tests/schemas/good/openshift_kieserver_6.2_image.yaml +++ b/tests/schemas/good/openshift_kieserver_6.2_image.yaml @@ -130,11 +130,11 @@ scripts: exec: configure.sh sources: - url: http://redacted/jboss-bpmsuite-6.2.1.GA-redhat-2-deployable-eap6.x.zip - md5sum: b63c7dfe82a44a140cce3a824c8c2e90 + md5: b63c7dfe82a44a140cce3a824c8c2e90 - url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar - md5sum: 5858103206d0bcc4695aad38a7430c75 + md5: 5858103206d0bcc4695aad38a7430c75 - url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar - md5sum: 4a80b12399c49a1d274bbd1c62b49b65 + md5: 4a80b12399c49a1d274bbd1c62b49b65 - url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar - md5sum: adf602d027020b30cc5743d3d5d8e2f7 + md5: adf602d027020b30cc5743d3d5d8e2f7 diff --git a/tests/schemas/good/openshift_kieserver_6.3_image.yaml b/tests/schemas/good/openshift_kieserver_6.3_image.yaml index 607ad96..caf4912 100644 --- a/tests/schemas/good/openshift_kieserver_6.3_image.yaml +++ b/tests/schemas/good/openshift_kieserver_6.3_image.yaml @@ -131,12 +131,12 @@ scripts: exec: configure.sh sources: - url: http://redacted/jboss-bpmsuite-6.3.0.GA-deployable-eap6.x.zip - md5sum: 4e283717b0f295adf7025971065d6db8 + md5: 4e283717b0f295adf7025971065d6db8 - url: http://redacted/jboss-bpmsuite-6.3.0.GA-supplementary-tools.zip - md5sum: b3d135e2d297f1e89d9ff8357c1e9aac + md5: b3d135e2d297f1e89d9ff8357c1e9aac - url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar - md5sum: 5858103206d0bcc4695aad38a7430c75 + md5: 5858103206d0bcc4695aad38a7430c75 - url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar - md5sum: 4a80b12399c49a1d274bbd1c62b49b65 + md5: 4a80b12399c49a1d274bbd1c62b49b65 - url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar - md5sum: adf602d027020b30cc5743d3d5d8e2f7 + md5: adf602d027020b30cc5743d3d5d8e2f7 diff --git a/tests/schemas/good/openshift_sso_7.0_image.yaml b/tests/schemas/good/openshift_sso_7.0_image.yaml index 9487fa4..76cee4f 100644 --- a/tests/schemas/good/openshift_sso_7.0_image.yaml +++ b/tests/schemas/good/openshift_sso_7.0_image.yaml @@ -97,17 +97,17 @@ scripts: exec: configure.sh sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/javax.json-1.0.4.jar - md5sum: 569870f975deeeb6691fcb9bc02a9555 + md5: 569870f975deeeb6691fcb9bc02a9555 - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar - md5sum: 7c743e35463db5f55f415dd666d705c5 + md5: 7c743e35463db5f55f415dd666d705c5 - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar - md5sum: bafa4db7efe4082d76cde2fa9499bf84 + md5: bafa4db7efe4082d76cde2fa9499bf84 - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar - md5sum: 71bbfdf795a2c65e4473df242f765490 + md5: 71bbfdf795a2c65e4473df242f765490 - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar - md5sum: 145add030a89c3ed588dce27b0f24999 + md5: 145add030a89c3ed588dce27b0f24999 - url: http://redacted/oauth-20100527.jar - md5sum: 91c7c70579f95b7ddee95b2143a49b41 + md5: 91c7c70579f95b7ddee95b2143a49b41 diff --git a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml index bc8c921..4c4d54e 100644 --- a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml +++ b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml @@ -94,10 +94,10 @@ scripts: exec: configure.sh sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/json-smart-1.1.1.jar - md5sum: c382c9109020d001b96329c2057ba933 + md5: c382c9109020d001b96329c2057ba933 - url: http://redacted/commons-lang-2.6.0.redhat-4.jar - md5sum: 0da0fbfb0ff2160df3a4832d28003361 + md5: 0da0fbfb0ff2160df3a4832d28003361 - url: http://redacted/jsonevent-layout-1.7-redhat-1.jar - md5sum: 08f9aa037ac91c4aaa0d5dabf143a60e + md5: 08f9aa037ac91c4aaa0d5dabf143a60e diff --git a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml index 11afdfb..6a0b095 100644 --- a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml +++ b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml @@ -94,10 +94,10 @@ scripts: exec: configure.sh sources: - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar - md5sum: 1b996b9083f537917b307309b0e2f16d + md5: 1b996b9083f537917b307309b0e2f16d - url: http://redacted/json-smart-1.1.1.jar - md5sum: c382c9109020d001b96329c2057ba933 + md5: c382c9109020d001b96329c2057ba933 - url: http://redacted/commons-lang-2.6.0.redhat-4.jar - md5sum: 0da0fbfb0ff2160df3a4832d28003361 + md5: 0da0fbfb0ff2160df3a4832d28003361 - url: http://redacted/jsonevent-layout-1.7-redhat-1.jar - md5sum: 08f9aa037ac91c4aaa0d5dabf143a60e + md5: 08f9aa037ac91c4aaa0d5dabf143a60e diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py index e439971..4572a7d 100644 --- a/tests/test_unit_generate_configuration.py +++ b/tests/test_unit_generate_configuration.py @@ -275,6 +275,50 @@ class TestConfig(unittest.TestCase): @mock.patch('dogen.generator.Generator.check_sum') @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + mock_check_sum.assert_called_with('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5') + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_multiple_hashes(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + calls = [mock.call('target/file.zip', '105bfe02a86ba69be5506cd559a54c4b252fb132', 'sha1'), mock.call('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5')] + mock_check_sum.assert_has_calls(calls) + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_multiple_hashes_and_cache_url(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode()) + + k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'}) + k.start() + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + k.stop() + + mock_fetch_file.assert_called_with('http://cache/get?sha1=105bfe02a86ba69be5506cd559a54c4b252fb132', 'target/file.zip') + calls = [mock.call('target/file.zip', '105bfe02a86ba69be5506cd559a54c4b252fb132', 'sha1'), mock.call('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5')] + mock_check_sum.assert_has_calls(calls) + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_deprecated_md5sum(self, mock_fetch_file, mock_check_sum): with self.descriptor as f: f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) @@ -283,13 +327,40 @@ class TestConfig(unittest.TestCase): generator.handle_sources() mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + mock_check_sum.assert_called_with('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5') + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_sha1(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + mock_check_sum.assert_called_with('target/file.zip', '105bfe02a86ba69be5506cd559a54c4b252fb132', 'sha1') + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_sha256(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n sha256: 9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + + mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip') + mock_check_sum.assert_called_with('target/file.zip', '9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb', 'sha256') @mock.patch('dogen.generator.os.path.exists', return_value=True) @mock.patch('dogen.generator.Generator.check_sum') @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources_when_local_file_exists_and_is_correct(self, mock_fetch_file, mock_check_sum, mock_path): with self.descriptor as f: - f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode()) generator = Generator(self.log, self.args) generator.configure() @@ -302,7 +373,7 @@ class TestConfig(unittest.TestCase): @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources_when_local_file_exists_and_is_broken(self, mock_fetch_file, mock_check_sum, mock_path): with self.descriptor as f: - f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode()) generator = Generator(self.log, self.args) generator.configure() @@ -314,7 +385,7 @@ class TestConfig(unittest.TestCase): @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources_with_target_filename(self, mock_fetch_file, mock_check_sum): with self.descriptor as f: - f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode()) + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode()) generator = Generator(self.log, self.args) generator.configure() @@ -326,7 +397,7 @@ class TestConfig(unittest.TestCase): @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources_with_cache_url(self, mock_fetch_file, mock_check_sum): with self.descriptor as f: - f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode()) + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode()) k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'}) k.start() @@ -341,7 +412,7 @@ class TestConfig(unittest.TestCase): @mock.patch('dogen.generator.Generator._fetch_file') def test_handling_sources_with_cache_url_and_target_filename(self, mock_fetch_file, mock_check_sum): with self.descriptor as f: - f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode()) + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode()) k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'}) k.start() @@ -351,3 +422,18 @@ class TestConfig(unittest.TestCase): k.stop() mock_fetch_file.assert_called_with('http://cache/get?md5=e9013fc202c87be48e3b302df10efc4b', 'target/target.zip') + + @mock.patch('dogen.generator.Generator.check_sum') + @mock.patch('dogen.generator.Generator._fetch_file') + def test_handling_sources_with_cache_url_with_filename_to_replace(self, mock_fetch_file, mock_check_sum): + with self.descriptor as f: + f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode()) + + k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/#filename#'}) + k.start() + generator = Generator(self.log, self.args) + generator.configure() + generator.handle_sources() + k.stop() + + mock_fetch_file.assert_called_with('http://cache/file.zip', 'target/target.zip')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_removed_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 3 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "mock", "pykwalify" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
certifi==2025.1.31 charset-normalizer==3.4.1 coverage==7.8.0 docopt==0.6.2 -e git+https://github.com/jboss-dockerfiles/dogen.git@bb52f327cd889a0af7b046762a3856a9e6aecca9#egg=dogen exceptiongroup==1.2.2 idna==3.10 iniconfig==2.1.0 Jinja2==3.1.6 MarkupSafe==3.0.2 mock==5.2.0 packaging==24.2 pluggy==1.5.0 pykwalify==1.8.0 pytest==8.3.5 pytest-cov==6.0.0 python-dateutil==2.9.0.post0 PyYAML==6.0.2 requests==2.32.3 ruamel.yaml==0.18.10 ruamel.yaml.clib==0.2.12 six==1.17.0 tomli==2.2.1 urllib3==2.3.0
name: dogen channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - certifi==2025.1.31 - charset-normalizer==3.4.1 - coverage==7.8.0 - docopt==0.6.2 - exceptiongroup==1.2.2 - idna==3.10 - iniconfig==2.1.0 - jinja2==3.1.6 - markupsafe==3.0.2 - mock==5.2.0 - packaging==24.2 - pluggy==1.5.0 - pykwalify==1.8.0 - pytest==8.3.5 - pytest-cov==6.0.0 - python-dateutil==2.9.0.post0 - pyyaml==6.0.2 - requests==2.32.3 - ruamel-yaml==0.18.10 - ruamel-yaml-clib==0.2.12 - six==1.17.0 - tomli==2.2.1 - urllib3==2.3.0 prefix: /opt/conda/envs/dogen
[ "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_broken", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_correct", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_and_target_filename", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_with_filename_to_replace", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_deprecated_md5sum", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_multiple_hashes", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_multiple_hashes_and_cache_url", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_sha1", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_sha256", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_target_filename", "tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_without_specified_md5sum" ]
[]
[ "tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec_not_env", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_default", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_env", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_cli_should_override_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_default_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_default_script_user", "tests/test_unit_generate_configuration.py::TestConfig::test_default_values", "tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_cli_false_should_override_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_descriptor", "tests/test_unit_generate_configuration.py::TestConfig::test_env_provided_script_user", "tests/test_unit_generate_configuration.py::TestConfig::test_env_supplied_script_exec", "tests/test_unit_generate_configuration.py::TestConfig::test_fail_if_version_mismatch", "tests/test_unit_generate_configuration.py::TestConfig::test_no_scripts_defined", "tests/test_unit_generate_configuration.py::TestConfig::test_scripts_dir_found_by_convention", "tests/test_unit_generate_configuration.py::TestConfig::test_skip_ssl_verification_in_descriptor" ]
[]
MIT License
1,199
[ "docs/index.adoc", "docs/environment_variables.adoc", "dogen/generator.py", "dogen/schema/kwalify_schema.yaml" ]
[ "docs/index.adoc", "docs/environment_variables.adoc", "dogen/generator.py", "dogen/schema/kwalify_schema.yaml" ]
polygraph-python__polygraph-43
f0897942b1fb6d6412a81852646eb94697d4632f
2017-04-18 14:53:53
f0897942b1fb6d6412a81852646eb94697d4632f
diff --git a/polygraph/types/type_builder.py b/polygraph/types/type_builder.py index 2b20577..fcce7f3 100644 --- a/polygraph/types/type_builder.py +++ b/polygraph/types/type_builder.py @@ -2,7 +2,11 @@ from functools import wraps from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError from polygraph.types.api import typedef -from polygraph.types.basic_type import PolygraphOutputType, PolygraphType +from polygraph.types.basic_type import ( + PolygraphOutputType, + PolygraphType, + PolygraphTypeMeta, +) from polygraph.types.definitions import TypeKind from polygraph.utils.deduplicate import deduplicate @@ -39,7 +43,15 @@ def type_builder_cache(method): return wrapper -class Union(PolygraphOutputType, PolygraphType): +class TypeBuilderMeta(PolygraphTypeMeta): + def __getitem__(self, value): + try: + return self.__new__(self, *value) + except TypeError: + return self.__new__(self, value) + + +class Union(PolygraphOutputType, PolygraphType, metaclass=TypeBuilderMeta): """ GraphQL Unions represent an object that could be one of a list of GraphQL Object types, but provides for no guaranteed fields between @@ -77,7 +89,7 @@ class Union(PolygraphOutputType, PolygraphType): return type(name, bases, attrs) -class List(PolygraphOutputType, PolygraphType): +class List(PolygraphOutputType, PolygraphType, metaclass=TypeBuilderMeta): """ A GraphQL list is a special collection type which declares the type of each item in the List (referred to as the item type of @@ -109,7 +121,7 @@ class List(PolygraphOutputType, PolygraphType): return type(name, bases, attrs) -class NonNull(PolygraphType): +class NonNull(PolygraphType, metaclass=TypeBuilderMeta): """ Represents a type for which null is not a valid result. """
Use square brackets for wrapping types, e.g. `Union[X, Y]`
polygraph-python/polygraph
diff --git a/polygraph/types/tests/helper.py b/polygraph/types/tests/helper.py new file mode 100644 index 0000000..59d17f2 --- /dev/null +++ b/polygraph/types/tests/helper.py @@ -0,0 +1,23 @@ +from polygraph.types.decorators import field +from polygraph.types.object_type import ObjectType +from polygraph.types.scalar import Int, String + + +class Person(ObjectType): + @field() + def name(self) -> String: + pass + + @field() + def age(self) -> Int: + pass + + +class Animal(ObjectType): + @field() + def name(self) -> String: + pass + + @field() + def sound(self) -> String: + pass diff --git a/polygraph/types/tests/test_types.py b/polygraph/types/tests/test_types.py index d08d30f..cb6bf0a 100644 --- a/polygraph/types/tests/test_types.py +++ b/polygraph/types/tests/test_types.py @@ -50,6 +50,9 @@ class NonNullTest(TestCase): with self.assertRaises(TypeError): NonNull(NonNullString) + def test_square_bracket_notation(self): + self.assertEqual(NonNull(String), NonNull[String]) + class ListTest(TestCase): @@ -67,3 +70,6 @@ class ListTest(TestCase): self.assertEqual(string_list(["a", "b", "c"]), ["a", "b", "c"]) with self.assertRaises(PolygraphValueError): string_list(["a", "b", "c", None]) + + def test_square_bracket_notation(self): + self.assertEqual(List(Int), List[Int]) diff --git a/polygraph/types/tests/test_union.py b/polygraph/types/tests/test_union.py index e98ba92..1150486 100644 --- a/polygraph/types/tests/test_union.py +++ b/polygraph/types/tests/test_union.py @@ -1,17 +1,23 @@ -from unittest import TestCase, skip +from unittest import TestCase from polygraph.exceptions import PolygraphValueError from polygraph.types.scalar import Float, Int, String +from polygraph.types.tests.helper import Animal, Person from polygraph.types.type_builder import Union class UnionTypeTest(TestCase): + def test_square_bracket_notation(self): + self.assertEqual( + Union(Person, Animal), + Union[Person, Animal], + ) + def test_commutativity(self): self.assertEqual(Union(String, Int), Union(Int, String)) self.assertEqual(Union(String, Int, Float), Union(Float, String, Int)) - @skip def test_associativity(self): self.assertEqual( Union(Union(String, Int), Float),
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autopep8==2.0.4 backcall==0.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 coverage==6.2 decorator==5.1.1 distlib==0.3.9 filelock==3.4.1 flake8==2.5.5 graphql-core==3.2.6 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work ipython==7.16.3 ipython-genutils==0.2.0 isort==5.10.1 jedi==0.17.2 mccabe==0.4.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work parso==0.7.1 pbr==6.1.1 pep8==1.7.1 pexpect==4.9.0 pickleshare==0.7.5 pkginfo==1.10.0 platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work -e git+https://github.com/polygraph-python/polygraph.git@f0897942b1fb6d6412a81852646eb94697d4632f#egg=polygraph prompt-toolkit==3.0.36 ptyprocess==0.7.0 pudb==2017.1.2 py @ file:///opt/conda/conda-bld/py_1644396412707/work pycodestyle==2.10.0 pyflakes==1.0.0 Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-cov==4.0.0 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 stevedore==3.5.2 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli==1.2.3 traitlets==4.3.3 twine==1.8.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 urwid==2.1.2 virtualenv==20.17.1 virtualenv-clone==0.5.7 virtualenvwrapper==4.8.4 wcwidth==0.2.13 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: polygraph channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - autopep8==2.0.4 - backcall==0.2.0 - charset-normalizer==2.0.12 - clint==0.5.1 - coverage==6.2 - decorator==5.1.1 - distlib==0.3.9 - filelock==3.4.1 - flake8==2.5.5 - graphql-core==3.2.6 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - ipython==7.16.3 - ipython-genutils==0.2.0 - isort==5.10.1 - jedi==0.17.2 - mccabe==0.4.0 - parso==0.7.1 - pbr==6.1.1 - pep8==1.7.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pkginfo==1.10.0 - platformdirs==2.4.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - pudb==2017.1.2 - pycodestyle==2.10.0 - pyflakes==1.0.0 - pygments==2.14.0 - pytest-cov==4.0.0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - stevedore==3.5.2 - tomli==1.2.3 - traitlets==4.3.3 - twine==1.8.1 - urllib3==1.26.20 - urwid==2.1.2 - virtualenv==20.17.1 - virtualenv-clone==0.5.7 - virtualenvwrapper==4.8.4 - wcwidth==0.2.13 prefix: /opt/conda/envs/polygraph
[ "polygraph/types/tests/test_types.py::NonNullTest::test_square_bracket_notation", "polygraph/types/tests/test_types.py::ListTest::test_square_bracket_notation", "polygraph/types/tests/test_union.py::UnionTypeTest::test_square_bracket_notation" ]
[]
[ "polygraph/types/tests/test_types.py::TypeMetaTest::test_scalar_meta", "polygraph/types/tests/test_types.py::TypeMetaTest::test_type_string", "polygraph/types/tests/test_types.py::NonNullTest::test_cannot_have_nonnull_of_nonnull", "polygraph/types/tests/test_types.py::NonNullTest::test_nonnull_accepts_values", "polygraph/types/tests/test_types.py::NonNullTest::test_nonnull_doesnt_accept_none", "polygraph/types/tests/test_types.py::NonNullTest::test_string", "polygraph/types/tests/test_types.py::ListTest::test_list_of_nonnulls", "polygraph/types/tests/test_types.py::ListTest::test_scalar_list", "polygraph/types/tests/test_union.py::UnionTypeTest::test_associativity", "polygraph/types/tests/test_union.py::UnionTypeTest::test_commutativity", "polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator", "polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator_with_more_than_two_types", "polygraph/types/tests/test_union.py::UnionValueTest::test_valid_type", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_be_typed", "polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_have_right_type" ]
[]
MIT License
1,200
[ "polygraph/types/type_builder.py" ]
[ "polygraph/types/type_builder.py" ]
Azure__azure-cli-2914
3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1
2017-04-19 03:29:49
eb12ac454cbe1ddb59c86cdf2045e1912660e750
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=h1) Report > Merging [#2914](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1?src=pr&el=desc) will **increase** coverage by `0.01%`. > The diff coverage is `87.5%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/2914/graphs/tree.svg?token=2pog0TKvF8&src=pr&width=650&height=150)](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2914 +/- ## ========================================== + Coverage 63.19% 63.21% +0.01% ========================================== Files 466 466 Lines 26168 26190 +22 Branches 4003 4003 ========================================== + Hits 16536 16555 +19 - Misses 8548 8551 +3 Partials 1084 1084 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...urce/azure/cli/command\_modules/resource/\_params.py](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9fcGFyYW1zLnB5) | `100% <100%> (ø)` | :arrow_up: | | [...re/cli/command\_modules/resource/\_client\_factory.py](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9fY2xpZW50X2ZhY3RvcnkucHk=) | `79.54% <100%> (+2.04%)` | :arrow_up: | | [...source/azure/cli/command\_modules/resource/\_help.py](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9faGVscC5weQ==) | `100% <100%> (ø)` | :arrow_up: | | [...rce/azure/cli/command\_modules/resource/commands.py](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9jb21tYW5kcy5weQ==) | `83.11% <100%> (+0.45%)` | :arrow_up: | | [...ource/azure/cli/command\_modules/resource/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9jdXN0b20ucHk=) | `52.71% <78.57%> (+0.53%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=footer). Last update [3699ef7...9cba2af](https://codecov.io/gh/Azure/azure-cli/pull/2914?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/azure-cli.pyproj b/azure-cli.pyproj index 39b535e11..cadb46c8f 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -43,7 +43,17 @@ <Compile Include="azure-cli-core\azure\cli\core\extensions\__init__.py" /> <Compile Include="azure-cli-core\azure\cli\core\help_files.py" /> <Compile Include="azure-cli-core\azure\cli\core\parser.py" /> + <Compile Include="azure-cli-core\azure\cli\core\profiles\_shared.py" /> + <Compile Include="azure-cli-core\azure\cli\core\profiles\_shared.py" /> + <Compile Include="azure-cli-core\azure\cli\core\profiles\__init__.py" /> + <Compile Include="azure-cli-core\azure\cli\core\profiles\__init__.py" /> <Compile Include="azure-cli-core\azure\cli\core\prompting.py" /> + <Compile Include="azure-cli-core\azure\cli\core\sdk\util.py" /> + <Compile Include="azure-cli-core\azure\cli\core\sdk\util.py" /> + <Compile Include="azure-cli-core\azure\cli\core\sdk\validators.py" /> + <Compile Include="azure-cli-core\azure\cli\core\sdk\validators.py" /> + <Compile Include="azure-cli-core\azure\cli\core\sdk\__init__.py" /> + <Compile Include="azure-cli-core\azure\cli\core\sdk\__init__.py" /> <Compile Include="azure-cli-core\azure\cli\core\telemetry_upload.py" /> <Compile Include="azure-cli-core\azure\cli\core\test_utils\vcr_test_base.py" /> <Compile Include="azure-cli-core\azure\cli\core\test_utils\__init__.py" /> @@ -583,6 +593,8 @@ <Folder Include="azure-cli-core\azure\cli\core\" /> <Folder Include="azure-cli-core\azure\cli\core\commands\" /> <Folder Include="azure-cli-core\azure\cli\core\extensions\" /> + <Folder Include="azure-cli-core\azure\cli\core\profiles\" /> + <Folder Include="azure-cli-core\azure\cli\core\sdk\" /> <Folder Include="azure-cli-core\azure\cli\core\test_utils\" /> <Folder Include="azure-cli-core\tests\" /> <Folder Include="azure-cli-core\tests\__pycache__\" /> diff --git a/doc/sphinx/azhelpgen/azhelpgen.py b/doc/sphinx/azhelpgen/azhelpgen.py index 0d98b5e04..969e84530 100644 --- a/doc/sphinx/azhelpgen/azhelpgen.py +++ b/doc/sphinx/azhelpgen/azhelpgen.py @@ -10,10 +10,10 @@ from docutils.statemachine import ViewList from sphinx.util.compat import Directive from sphinx.util.nodes import nested_parse_with_titles -from azure.cli.core.application import APPLICATION, Configuration +from azure.cli.core.application import Application, Configuration import azure.cli.core._help as _help -app = APPLICATION +app = Application(Configuration()) for cmd in app.configuration.get_command_table(): try: app.execute(cmd.split() + ['-h']) @@ -30,8 +30,11 @@ class AzHelpGenDirective(Directive): help_files = [] for cmd, parser in parser_dict.items(): - help_file = _help.GroupHelpFile(cmd, parser) if _is_group(parser) else _help.CommandHelpFile(cmd, parser) - help_file.load(parser) + help_file = _help.GroupHelpFile(cmd, parser) if _is_group(parser) else _help.CommandHelpFile(cmd, parser) + try: + help_file.load(parser) + catch Exception as ex: + print(ex) help_files.append(help_file) help_files = sorted(help_files, key=lambda x: x.command) diff --git a/src/azure-cli-core/azure/cli/core/commands/arm.py b/src/azure-cli-core/azure/cli/core/commands/arm.py index 958124117..5c90c8194 100644 --- a/src/azure-cli-core/azure/cli/core/commands/arm.py +++ b/src/azure-cli-core/azure/cli/core/commands/arm.py @@ -10,10 +10,13 @@ from six import string_types from azure.cli.core.commands import (CliCommand, get_op_handler, command_table as main_command_table, - command_module_map as main_command_module_map) + command_module_map as main_command_module_map, + CONFIRM_PARAM_NAME) from azure.cli.core.commands._introspection import extract_args_from_signature from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.application import APPLICATION, IterateValue +from azure.cli.core.prompting import prompt_y_n, NoTTYException +from azure.cli.core._config import az_config import azure.cli.core.azlogging as azlogging from azure.cli.core.util import CLIError, todict, shell_safe_json_parse from azure.cli.core.profiles import ResourceType @@ -207,12 +210,25 @@ def _get_child(parent, collection_name, item_name, collection_key): return result +def _user_confirmed(confirmation, command_args): + if callable(confirmation): + return confirmation(command_args) + try: + if isinstance(confirmation, string_types): + return prompt_y_n(confirmation) + return prompt_y_n('Are you sure you want to perform this operation?') + except NoTTYException: + logger.warning('Unable to prompt for confirmation as no tty available. Use --yes.') + return False + + # pylint: disable=too-many-arguments def cli_generic_update_command(module_name, name, getter_op, setter_op, factory=None, setter_arg_name='parameters', table_transformer=None, child_collection_prop_name=None, child_collection_key='name', child_arg_name='item_name', custom_function_op=None, - no_wait_param=None, transform=None): + no_wait_param=None, transform=None, confirmation=None, + exception_handler=None, formatter_class=None): if not isinstance(getter_op, string_types): raise ValueError("Getter operation must be a string. Got '{}'".format(getter_op)) if not isinstance(setter_op, string_types): @@ -246,6 +262,12 @@ def cli_generic_update_command(module_name, name, getter_op, setter_op, factory= def handler(args): # pylint: disable=too-many-branches,too-many-statements from msrestazure.azure_operation import AzureOperationPoller + if confirmation \ + and not args.items().get(CONFIRM_PARAM_NAME) \ + and not az_config.getboolean('core', 'disable_confirm_prompt', fallback=False) \ + and not _user_confirmed(confirmation, args.items()): + raise CLIError('Operation cancelled.') + ordered_arguments = args.pop('ordered_arguments', []) for item in ['properties_to_add', 'properties_to_set', 'properties_to_remove']: if args[item]: @@ -259,66 +281,73 @@ def cli_generic_update_command(module_name, name, getter_op, setter_op, factory= getterargs = {key: val for key, val in args.items() if key in get_arguments_loader()} getter = get_op_handler(getter_op) - if child_collection_prop_name: - parent = getter(client, **getterargs) if client else getter(**getterargs) - instance = _get_child( - parent, - child_collection_prop_name, - args.get(child_arg_name), - child_collection_key - ) - else: - parent = None - instance = getter(client, **getterargs) if client else getter(**getterargs) - - # pass instance to the custom_function, if provided - if custom_function_op: - custom_function = get_op_handler(custom_function_op) - custom_func_args = {k: v for k, v in args.items() if k in function_arguments_loader()} + try: if child_collection_prop_name: - parent = custom_function(instance, parent, **custom_func_args) + parent = getter(client, **getterargs) if client else getter(**getterargs) + instance = _get_child( + parent, + child_collection_prop_name, + args.get(child_arg_name), + child_collection_key + ) else: - instance = custom_function(instance, **custom_func_args) - - # apply generic updates after custom updates - setterargs = {key: val for key, val in args.items() if key in set_arguments_loader()} - - for arg in ordered_arguments: - arg_type, arg_values = arg - if arg_type == '--set': - try: - for expression in arg_values: - set_properties(instance, expression) - except ValueError: - raise CLIError('invalid syntax: {}'.format(set_usage)) - elif arg_type == '--add': - try: - add_properties(instance, arg_values) - except ValueError: - raise CLIError('invalid syntax: {}'.format(add_usage)) - elif arg_type == '--remove': - try: - remove_properties(instance, arg_values) - except ValueError: - raise CLIError('invalid syntax: {}'.format(remove_usage)) - - # Done... update the instance! - setterargs[setter_arg_name] = parent if child_collection_prop_name else instance - setter = get_op_handler(setter_op) - - opres = setter(client, **setterargs) if client else setter(**setterargs) - - if setterargs.get(no_wait_param, None): - return None + parent = None + instance = getter(client, **getterargs) if client else getter(**getterargs) - result = opres.result() if isinstance(opres, AzureOperationPoller) else opres - if child_collection_prop_name: - result = _get_child( - result, - child_collection_prop_name, - args.get(child_arg_name), - child_collection_key - ) + # pass instance to the custom_function, if provided + if custom_function_op: + custom_function = get_op_handler(custom_function_op) + custom_func_args = \ + {k: v for k, v in args.items() if k in function_arguments_loader()} + if child_collection_prop_name: + parent = custom_function(instance, parent, **custom_func_args) + else: + instance = custom_function(instance, **custom_func_args) + + # apply generic updates after custom updates + setterargs = {key: val for key, val in args.items() if key in set_arguments_loader()} + + for arg in ordered_arguments: + arg_type, arg_values = arg + if arg_type == '--set': + try: + for expression in arg_values: + set_properties(instance, expression) + except ValueError: + raise CLIError('invalid syntax: {}'.format(set_usage)) + elif arg_type == '--add': + try: + add_properties(instance, arg_values) + except ValueError: + raise CLIError('invalid syntax: {}'.format(add_usage)) + elif arg_type == '--remove': + try: + remove_properties(instance, arg_values) + except ValueError: + raise CLIError('invalid syntax: {}'.format(remove_usage)) + + # Done... update the instance! + setterargs[setter_arg_name] = parent if child_collection_prop_name else instance + setter = get_op_handler(setter_op) + + opres = setter(client, **setterargs) if client else setter(**setterargs) + + if setterargs.get(no_wait_param, None): + return None + + result = opres.result() if isinstance(opres, AzureOperationPoller) else opres + if child_collection_prop_name: + result = _get_child( + result, + child_collection_prop_name, + args.get(child_arg_name), + child_collection_key + ) + except Exception as ex: # pylint: disable=broad-except + if exception_handler: + result = exception_handler(ex) + else: + raise ex # apply results transform if specified if transform: @@ -334,7 +363,7 @@ def cli_generic_update_command(module_name, name, getter_op, setter_op, factory= namespace.ordered_arguments.append((option_string, values)) cmd = CliCommand(name, handler, table_transformer=table_transformer, - arguments_loader=arguments_loader) + arguments_loader=arguments_loader, formatter_class=formatter_class) group_name = 'Generic Update' cmd.add_argument('properties_to_set', '--set', nargs='+', action=OrderedArgsAction, default=[], help='Update an object by specifying a property path and value to set.' @@ -352,7 +381,7 @@ def cli_generic_update_command(module_name, name, getter_op, setter_op, factory= main_command_module_map[name] = module_name -def cli_generic_wait_command(module_name, name, getter_op, factory=None): +def cli_generic_wait_command(module_name, name, getter_op, factory=None, exception_handler=None): if not isinstance(getter_op, string_types): raise ValueError("Getter operation must be a string. Got '{}'".format(type(getter_op))) @@ -374,6 +403,12 @@ def cli_generic_wait_command(module_name, name, getter_op, factory=None): provisioning_state = getattr(properties, 'provisioning_state', None) return provisioning_state + def _handle_exception(ex): + if exception_handler: + return exception_handler(ex) + else: + raise ex + def handler(args): from msrest.exceptions import ClientException import time @@ -418,9 +453,11 @@ def cli_generic_wait_command(module_name, name, getter_op, factory=None): if wait_for_deleted: return if not any([wait_for_created, wait_for_exists, custom_condition]): - raise + _handle_exception(ex) else: - raise + _handle_exception(ex) + except Exception as ex: # pylint: disable=broad-except + _handle_exception(ex) time.sleep(interval) diff --git a/src/command_modules/azure-cli-redis/azure/cli/command_modules/redis/commands.py b/src/command_modules/azure-cli-redis/azure/cli/command_modules/redis/commands.py index 453f4d32c..ff1891f51 100644 --- a/src/command_modules/azure-cli-redis/azure/cli/command_modules/redis/commands.py +++ b/src/command_modules/azure-cli-redis/azure/cli/command_modules/redis/commands.py @@ -9,6 +9,8 @@ from azure.cli.core.commands import cli_command from azure.cli.core.commands.arm import cli_generic_update_command from azure.cli.command_modules.redis._client_factory import (cf_redis, cf_patch_schedules) +from azure.cli.command_modules.redis.custom import wrong_vmsize_argument_exception_handler + cli_command(__name__, 'redis create', 'azure.cli.command_modules.redis.custom#cli_redis_create', cf_redis) cli_command(__name__, 'redis delete', 'azure.mgmt.redis.operations.redis_operations#RedisOperations.delete', cf_redis) cli_command(__name__, 'redis export', 'azure.cli.command_modules.redis.custom#cli_redis_export', cf_redis) @@ -21,11 +23,12 @@ cli_command(__name__, 'redis regenerate-keys', 'azure.mgmt.redis.operations.redi cli_command(__name__, 'redis show', 'azure.mgmt.redis.operations.redis_operations#RedisOperations.get', cf_redis) cli_command(__name__, 'redis update-settings', 'azure.cli.command_modules.redis.custom#cli_redis_update_settings', cf_redis) -cli_generic_update_command(__name__, 'redis update', 'azure.mgmt.redis.operations.redis_operations#RedisOperations.get', - 'azure.mgmt.redis.operations.redis_operations#RedisOperations.create_or_update', - cf_redis, custom_function_op='azure.cli.command_modules.redis.custom#cli_redis_update') +cli_generic_update_command(__name__, 'redis update', + 'azure.mgmt.redis.operations.redis_operations#RedisOperations.get', + 'azure.mgmt.redis.operations.redis_operations#RedisOperations.create_or_update', cf_redis, + custom_function_op='azure.cli.command_modules.redis.custom#cli_redis_update', + exception_handler=wrong_vmsize_argument_exception_handler) cli_command(__name__, 'redis patch-schedule set', 'azure.mgmt.redis.operations.patch_schedules_operations#PatchSchedulesOperations.create_or_update', cf_patch_schedules) cli_command(__name__, 'redis patch-schedule delete', 'azure.mgmt.redis.operations.patch_schedules_operations#PatchSchedulesOperations.delete', cf_patch_schedules) cli_command(__name__, 'redis patch-schedule show', 'azure.mgmt.redis.operations.patch_schedules_operations#PatchSchedulesOperations.get', cf_patch_schedules) - diff --git a/src/command_modules/azure-cli-resource/HISTORY.rst b/src/command_modules/azure-cli-resource/HISTORY.rst index 4e6a4b0f5..1cb011440 100644 --- a/src/command_modules/azure-cli-resource/HISTORY.rst +++ b/src/command_modules/azure-cli-resource/HISTORY.rst @@ -2,8 +2,8 @@ Release History =============== -2.0.3 (unreleased) - +2.0.4 (unreleased) +* Support 'provider operation' commands (#2908) * Support generic resource create (#2606) 2.0.3 (2017-04-17) diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_client_factory.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_client_factory.py index 120dbaf54..9aa5c14ba 100644 --- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_client_factory.py +++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_client_factory.py @@ -28,6 +28,12 @@ def _resource_links_client_factory(**_): from azure.cli.core.profiles import ResourceType return get_mgmt_service_client(ResourceType.MGMT_RESOURCE_LINKS) +def _authorization_management_client(**_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azure.mgmt.authorization import AuthorizationManagementClient + return get_mgmt_service_client(AuthorizationManagementClient) + + def cf_resource_groups(_): return _resource_client_factory().resource_groups diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py index 02da799e6..728f0febe 100644 --- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py +++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py @@ -274,6 +274,18 @@ helps['provider unregister'] = """ type: command short-summary: Unregister a provider. """ +helps['provider operation'] = """ + type: group + short-summary: Get provider operations metadatas. +""" +helps['provider operation show'] = """ + type: command + short-summary: Get an individual provider's operations. +""" +helps['provider operation list'] = """ + type: command + short-summary: Get operations from all providers. +""" helps['tag'] = """ type: group short-summary: Manage resource tags. diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_params.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_params.py index f6c2b4aae..80c6063b0 100644 --- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_params.py +++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_params.py @@ -46,6 +46,8 @@ register_cli_argument('resource create', 'is_full_object', action='store_true', register_cli_argument('provider', 'top', ignore_type) register_cli_argument('provider', 'resource_provider_namespace', options_list=('--namespace', '-n'), completer=get_providers_completion_list, help=_PROVIDER_HELP_TEXT) +register_cli_argument('provider operation', 'api_version', help="The api version of the 'Microsoft.Authorization/providerOperations' resource (omit for latest)") + register_cli_argument('feature', 'resource_provider_namespace', options_list=('--namespace',), required=True, help=_PROVIDER_HELP_TEXT) register_cli_argument('feature list', 'resource_provider_namespace', options_list=('--namespace',), required=False, help=_PROVIDER_HELP_TEXT) diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/commands.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/commands.py index 2321dea4a..bb23b2197 100644 --- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/commands.py +++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/commands.py @@ -59,7 +59,8 @@ cli_command(__name__, 'provider list', 'azure.mgmt.resource.resources.operations cli_command(__name__, 'provider show', 'azure.mgmt.resource.resources.operations.providers_operations#ProvidersOperations.get', cf_providers, exception_handler=empty_on_404) cli_command(__name__, 'provider register', 'azure.cli.command_modules.resource.custom#register_provider') cli_command(__name__, 'provider unregister', 'azure.cli.command_modules.resource.custom#unregister_provider') - +cli_command(__name__, 'provider operation list', 'azure.cli.command_modules.resource.custom#list_provider_operations') +cli_command(__name__, 'provider operation show', 'azure.cli.command_modules.resource.custom#show_provider_operations') # Resource feature commands cli_command(__name__, 'feature list', 'azure.cli.command_modules.resource.custom#list_features', cf_features) cli_command(__name__, 'feature show', 'azure.mgmt.resource.features.operations.features_operations#FeaturesOperations.get', cf_features, exception_handler=empty_on_404) diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/custom.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/custom.py index 348c44447..38329f140 100644 --- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/custom.py +++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/custom.py @@ -27,7 +27,8 @@ from azure.cli.core.profiles import get_sdk, ResourceType from ._client_factory import (_resource_client_factory, _resource_policy_client_factory, _resource_lock_client_factory, - _resource_links_client_factory) + _resource_links_client_factory, + _authorization_management_client) logger = azlogging.get_az_logger(__name__) @@ -352,6 +353,26 @@ def _update_provider(namespace, registering): msg_template = '%s is still on-going. You can monitor using \'az provider show -n %s\'' logger.warning(msg_template, action, namespace) + +def list_provider_operations(api_version=None): + api_version = api_version or _get_auth_provider_latest_api_version() + auth_client = _authorization_management_client() + return auth_client.provider_operations_metadata.list(api_version) + + +def show_provider_operations(resource_provider_namespace, api_version=None): + api_version = api_version or _get_auth_provider_latest_api_version() + auth_client = _authorization_management_client() + return auth_client.provider_operations_metadata.get(resource_provider_namespace, api_version) + + +def _get_auth_provider_latest_api_version(): + rcf = _resource_client_factory() + api_version = _ResourceUtils.resolve_api_version(rcf, 'Microsoft.Authorization', + None, 'providerOperations') + return api_version + + def move_resource(ids, destination_group, destination_subscription_id=None): '''Moves resources from one resource group to another(can be under different subscription) @@ -536,6 +557,63 @@ def list_locks(resource_group_name=None, resource_provider_namespace=None, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=filter_string) +def _validate_lock_params_match_lock( + lock_client, name, resource_group_name, resource_provider_namespace, + parent_resource_path, resource_type, resource_name): + ''' + Locks are scoped to subscription, resource group or resource. + However, the az list command returns all locks for the current scopes + and all lower scopes (e.g. resource group level also includes resource locks). + This can lead to a confusing user experience where the user specifies a lock + name and assumes that it will work, even if they haven't given the right + scope. This function attempts to validate the parameters and help the + user find the right scope, by first finding the lock, and then infering + what it's parameters should be. + ''' + locks = lock_client.management_locks.list_at_subscription_level() + found_count = 0 # locks at different levels can have the same name + lock_resource_id = None + for lock in locks: + if lock.name == name: + found_count = found_count + 1 + lock_resource_id = lock.id + if found_count == 1: + # If we only found one lock, let's validate that the parameters are correct, + # if we found more than one, we'll assume the user knows what they're doing + # TODO: Add validation for that case too? + resource = parse_resource_id(lock_resource_id) + _resource_group = resource.get('resource_group', None) + _resource_namespace = resource.get('namespace', None) + if _resource_group is None: + return + if resource_group_name != _resource_group: + raise CLIError( + 'Unexpected --resource-group for lock {}, expected {}'.format( + name, _resource_group)) + if _resource_namespace is None: + return + if resource_provider_namespace != _resource_namespace: + raise CLIError( + 'Unexpected --namespace for lock {}, expected {}'.format(name, _resource_namespace)) + if resource.get('grandchild_type', None) is None: + _resource_type = resource.get('type', None) + _resource_name = resource.get('name', None) + else: + _resource_type = resource.get('child_type', None) + _resource_name = resource.get('child_name', None) + parent = (resource['type'] + '/' + resource['name']) + if parent != parent_resource_path: + raise CLIError( + 'Unexpected --parent for lock {}, expected {}'.format( + name, parent)) + if resource_type != _resource_type: + raise CLIError('Unexpected --resource-type for lock {}, expected {}'.format( + name, _resource_type)) + if resource_name != _resource_name: + raise CLIError('Unexpected --resource-name for lock {}, expected {}'.format( + name, _resource_name)) + + def get_lock(name, resource_group_name=None): ''' :param name: Name of the lock. @@ -563,11 +641,16 @@ def delete_lock(name, resource_group_name=None, resource_provider_namespace=None lock_client = _resource_lock_client_factory() lock_resource = _validate_lock_params(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name) + _validate_lock_params_match_lock(lock_client, name, resource_group_name, + resource_provider_namespace, parent_resource_path, + resource_type, resource_name) + resource_group_name = lock_resource[0] resource_name = lock_resource[1] resource_provider_namespace = lock_resource[2] resource_type = lock_resource[3] + if resource_group_name is None: return lock_client.management_locks.delete_at_subscription_level(name) if resource_name is None: @@ -632,7 +715,7 @@ def create_lock(name, resource_group_name=None, resource_provider_namespace=None :type notes: str ''' if level != 'ReadOnly' and level != 'CanNotDelete': - raise CLIError('--level must be one of "ReadOnly" or "CanNotDelete"') + raise CLIError('--lock-type must be one of "ReadOnly" or "CanNotDelete"') parameters = ManagementLockObject(level=level, notes=notes, name=name) lock_client = _resource_lock_client_factory() @@ -742,10 +825,10 @@ class _ResourceUtils(object): #pylint: disable=too-many-instance-attributes else: _validate_resource_inputs(resource_group_name, resource_provider_namespace, resource_type, resource_name) - api_version = _ResourceUtils._resolve_api_version(self.rcf, - resource_provider_namespace, - parent_resource_path, - resource_type) + api_version = _ResourceUtils.resolve_api_version(self.rcf, + resource_provider_namespace, + parent_resource_path, + resource_type) self.resource_group_name = resource_group_name self.resource_provider_namespace = resource_provider_namespace @@ -847,7 +930,7 @@ class _ResourceUtils(object): #pylint: disable=too-many-instance-attributes parameters) @staticmethod - def _resolve_api_version(rcf, resource_provider_namespace, parent_resource_path, resource_type): + def resolve_api_version(rcf, resource_provider_namespace, parent_resource_path, resource_type): provider = rcf.providers.get(resource_provider_namespace) #If available, we will use parent resource's api-version @@ -887,4 +970,4 @@ class _ResourceUtils(object): #pylint: disable=too-many-instance-attributes parent = None resource_type = parts['type'] - return _ResourceUtils._resolve_api_version(rcf, namespace, parent, resource_type) + return _ResourceUtils.resolve_api_version(rcf, namespace, parent, resource_type) diff --git a/src/command_modules/azure-cli-resource/setup.py b/src/command_modules/azure-cli-resource/setup.py index a9529b998..b87b9128a 100644 --- a/src/command_modules/azure-cli-resource/setup.py +++ b/src/command_modules/azure-cli-resource/setup.py @@ -27,6 +27,7 @@ CLASSIFIERS = [ DEPENDENCIES = [ 'azure-mgmt-resource==1.0.0rc1', 'azure-cli-core', + 'azure-mgmt-authorization==0.30.0rc6' ] with open('README.rst', 'r', encoding='utf-8') as f: diff --git a/src/command_modules/azure-cli-vm/HISTORY.rst b/src/command_modules/azure-cli-vm/HISTORY.rst index 4dbdb183b..62dac3bfd 100644 --- a/src/command_modules/azure-cli-vm/HISTORY.rst +++ b/src/command_modules/azure-cli-vm/HISTORY.rst @@ -2,6 +2,9 @@ Release History =============== +2.0.4 (unreleased) +++++++++++++++++++ +* vm/vmss: improve the warning text when generates ssh key pairs 2.0.3 (2017-04-17) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py index 747cef9db..f88ee11c8 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py @@ -665,7 +665,7 @@ def _validate_admin_password(password, os_type): def validate_ssh_key(namespace): string_or_file = (namespace.ssh_key_value or - os.path.join(os.path.expanduser('~'), '.ssh/id_rsa.pub')) + os.path.join(os.path.expanduser('~'), '.ssh', 'id_rsa.pub')) content = string_or_file if os.path.exists(string_or_file): logger.info('Use existing SSH public key file: %s', string_or_file) @@ -681,7 +681,10 @@ def validate_ssh_key(namespace): else: private_key_filepath = public_key_filepath + '.private' content = _generate_ssh_keys(private_key_filepath, public_key_filepath) - logger.warning('Created SSH key files: %s,%s', + logger.warning("SSH key files '%s' and '%s' have been generated under ~/.ssh to " + "allow SSH access to the VM. If using machines without " + "permanent storage like Azure Cloud Shell without an attached " + "file share, back up your keys to a safe location", private_key_filepath, public_key_filepath) else: raise CLIError('An RSA key file or key value must be supplied to SSH Key Value. '
Add support for querying ARM operations In the CLI 2.0 today, we don't have a way of showing operations, and (per the ARM team) "operations is critical for RBAC (creating custom roles etc) and auditing (this is what gets written into Event service entries)."
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-resource/tests/recordings/test_provider_operation.yaml b/src/command_modules/azure-cli-resource/tests/recordings/test_provider_operation.yaml new file mode 100644 index 000000000..300172ede --- /dev/null +++ b/src/command_modules/azure-cli-resource/tests/recordings/test_provider_operation.yaml @@ -0,0 +1,428 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [b0b09c36-24ae-11e7-b378-64510658e3b3] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization?api-version=2016-09-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization","namespace":"Microsoft.Authorization","resourceTypes":[{"resourceType":"roleAssignments","locations":[],"apiVersions":["2016-07-01","2015-07-01","2015-06-01","2015-05-01-preview","2014-10-01-preview","2014-07-01-preview","2014-04-01-preview"]},{"resourceType":"roleDefinitions","locations":[],"apiVersions":["2016-07-01","2015-07-01","2015-06-01","2015-05-01-preview","2014-10-01-preview","2014-07-01-preview","2014-04-01-preview"]},{"resourceType":"classicAdministrators","locations":[],"apiVersions":["2015-06-01","2015-05-01-preview","2014-10-01-preview","2014-07-01-preview","2014-04-01-preview"]},{"resourceType":"permissions","locations":[],"apiVersions":["2016-07-01","2015-07-01","2015-06-01","2015-05-01-preview","2014-10-01-preview","2014-07-01-preview","2014-04-01-preview"]},{"resourceType":"locks","locations":[],"apiVersions":["2017-04-01","2016-09-01","2015-06-01","2015-05-01-preview","2015-01-01"]},{"resourceType":"operations","locations":[],"apiVersions":["2016-07-01","2015-07-01","2015-01-01","2014-10-01-preview","2014-06-01"]},{"resourceType":"policyDefinitions","locations":[],"apiVersions":["2016-12-01","2016-04-01","2015-10-01-preview"]},{"resourceType":"policyAssignments","locations":[],"apiVersions":["2016-12-01","2016-04-01","2015-10-01-preview"]},{"resourceType":"providerOperations","locations":[],"apiVersions":["2016-07-01","2015-07-01-preview","2015-07-01"]},{"resourceType":"elevateAccess","locations":[],"apiVersions":["2016-07-01","2015-07-01","2015-06-01","2015-05-01-preview","2014-10-01-preview","2014-07-01-preview","2014-04-01-preview"]}],"registrationState":"Registered"}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 19 Apr 2017 03:17:16 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Vary: [Accept-Encoding] + content-length: ['1711'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 authorizationmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [b11a8248-24ae-11e7-a4df-64510658e3b3] + method: GET + uri: https://management.azure.com/providers/Microsoft.Authorization/providerOperations/microsoft.compute?api-version=2016-07-01&$expand=resourceTypes + response: + body: {string: '{"displayName":"Microsoft Compute","operations":[{"name":"Microsoft.Compute/register/action","displayName":"Register + Subscription for Compute","description":"Registers Subscription with Microsoft.Compute + resource provider","origin":"user,system","properties":null}],"resourceTypes":[{"name":"restorePointCollections","displayName":"Restore + Point Collections","operations":[{"name":"Microsoft.Compute/restorePointCollections/read","displayName":"Get + Restore Point Collection","description":"Get the properties of a restore point + collection","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/write","displayName":"Create + or Update Restore Point Collection","description":"Creates a new restore point + collection or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/delete","displayName":"Delete + Restore Point Collection","description":"Deletes the restore point collection + and contained restore points","origin":"user,system","properties":null}]},{"name":"restorePointCollections/restorePoints","displayName":"Restore + Points","operations":[{"name":"Microsoft.Compute/restorePointCollections/restorePoints/read","displayName":"Get + Restore Point","description":"Get the properties of a restore point","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/restorePoints/write","displayName":"Create + Restore Point","description":"Creates a new restore point","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/restorePoints/delete","displayName":"Delete + Restore Point","description":"Deletes the restore point","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/restorePoints/retrieveSasUris/action","displayName":"Get + Restore Point along with blob SAS URIs","description":"Get the properties + of a restore point along with blob SAS URIs","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets","displayName":"Virtual + Machine Scale Sets","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/read","displayName":"Get + Virtual Machine Scale Set","description":"Get the properties of a virtual + machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/write","displayName":"Create + or Update Virtual Machine Scale Set","description":"Creates a new virtual + machine scale set or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/delete","displayName":"Delete + Virtual Machine Scale Set","description":"Deletes the virtual machine scale + set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/start/action","displayName":"Start + Virtual Machine Scale Set","description":"Starts the instances of the virtual + machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/powerOff/action","displayName":"Power + Off Virtual Machine Scale Set","description":"Powers off the instances of + the virtual machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/restart/action","displayName":"Restart + Virtual Machine Scale Set","description":"Restarts the instances of the virtual + machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/deallocate/action","displayName":"Deallocate + Virtual Machine Scale Set","description":"Powers off and releases the compute + resources for the instances of the virtual machine scale set ","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/manualUpgrade/action","displayName":"Manual + Upgrade Virtual Machine Scale Set","description":"Manually updates instances + to latest model of the virtual machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/scale/action","displayName":"Scale + Virtual Machine Scale Set","description":"Scale In/Scale Out instance count + of an existing virtual machine scale set","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/providers/Microsoft.Insights/metricDefinitions","displayName":"Virtual + Machine Scalet Set Metric Definitions","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/providers/Microsoft.Insights/metricDefinitions/read","displayName":"Get + Virtual Machine Scalet Set Metric Definitions","description":"Reads Virtual + Machine Scalet Set Metric Definitions","origin":"system","properties":{"serviceSpecification":{"metricSpecifications":[{"name":"Percentage + CPU","displayName":"Percentage CPU","displayDescription":"The percentage of + allocated compute units that are currently in use by the Virtual Machine(s)","unit":"Percent","aggregationType":"Average"},{"name":"Network + In","displayName":"Network In","displayDescription":"The number of bytes received + on all network interfaces by the Virtual Machine(s) (Incoming Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Network + Out","displayName":"Network Out","displayDescription":"The number of bytes + out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Bytes","displayName":"Disk Read Bytes","displayDescription":"Total bytes + read from disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Write Bytes","displayName":"Disk Write Bytes","displayDescription":"Total + bytes written to disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Operations/Sec","displayName":"Disk Read Operations/Sec","displayDescription":"Disk + Read IOPS","unit":"CountPerSecond","aggregationType":"Average"},{"name":"Disk + Write Operations/Sec","displayName":"Disk Write Operations/Sec","displayDescription":"Disk + Write IOPS","unit":"CountPerSecond","aggregationType":"Average"}]}}}]},{"name":"virtualMachineScaleSets/instanceView","displayName":"Virtual + Machine Scale Set Instance View","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/instanceView/read","displayName":"Get + Virtual Machine Scale Set Instance View","description":"Gets the instance + view of the virtual machine scale set","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/skus","displayName":"Virtual + Machine Scale Set SKU","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/skus/read","displayName":"List + SKUs for Virtual Machine Scale Set","description":"Lists the valid SKUs for + an existing virtual machine scale set","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/virtualMachines","displayName":"Virtual + Machine in Scale Set","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read","displayName":"Gets + the properties of a Virtual Machine in a Virtual Machine Scale Set","description":"Retrieves + the properties of a Virtual Machine in a VM Scale Set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/delete","displayName":"Delete + Virtual Machine in a Virtual Machine Scale Set","description":"Delete a specific + Virtual Machine in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/start/action","displayName":"Start + Virtual Machine in a Virtual Machine Scale Set","description":"Starts a Virtual + Machine instance in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/powerOff/action","displayName":"Power + off Virtual Machine in a Virtual Machine Scale Set","description":"Powers + Off a Virtual Machine instance in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/restart/action","displayName":"Restart + Virtual Machine instance in a Virtual Machine Scale Set","description":"Restarts + a Virtual Machine instance in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/deallocate/action","displayName":"Deallocate + Virtual Machine in a Virtual Machine Scale Set","description":"Powers off + and releases the compute resources for a Virtual Machine in a VM Scale Set.","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/virtualMachines/providers/Microsoft.Insights/metricDefinitions","displayName":"Virtual + Machine in Scale Set Metric Definitions","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/providers/Microsoft.Insights/metricDefinitions/read","displayName":"Get + Virtual Machine in Scale Set Metric Definitions","description":"Reads Virtual + Machine in Scale Set Metric Definitions","origin":"system","properties":{"serviceSpecification":{"metricSpecifications":[{"name":"Percentage + CPU","displayName":"Percentage CPU","displayDescription":"The percentage of + allocated compute units that are currently in use by the Virtual Machine(s)","unit":"Percent","aggregationType":"Average"},{"name":"Network + In","displayName":"Network In","displayDescription":"The number of bytes received + on all network interfaces by the Virtual Machine(s) (Incoming Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Network + Out","displayName":"Network Out","displayDescription":"The number of bytes + out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Bytes","displayName":"Disk Read Bytes","displayDescription":"Total bytes + read from disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Write Bytes","displayName":"Disk Write Bytes","displayDescription":"Total + bytes written to disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Operations/Sec","displayName":"Disk Read Operations/Sec","displayDescription":"Disk + Read IOPS","unit":"CountPerSecond","aggregationType":"Average"},{"name":"Disk + Write Operations/Sec","displayName":"Disk Write Operations/Sec","displayDescription":"Disk + Write IOPS","unit":"CountPerSecond","aggregationType":"Average"}]}}}]},{"name":"virtualMachineScaleSets/virtualMachines/instanceView","displayName":"Instance + View of Virtual Machine in Scale Set","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/instanceView/read","displayName":"Gets + Instance View of a Virtual Machine in a Virtual Machine Scale Set","description":"Retrieves + the instance view of a Virtual Machine in a VM Scale Set.","origin":"user,system","properties":null}]},{"name":"images","displayName":"Images","operations":[{"name":"Microsoft.Compute/images/read","displayName":"Get + Image","description":"Get the properties of the Image","origin":"user,system","properties":null},{"name":"Microsoft.Compute/images/write","displayName":"Create + or Update Image","description":"Creates a new Image or updates an existing + one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/images/delete","displayName":"Delete + Image","description":"Deletes the image","origin":"user,system","properties":null}]},{"name":"operations","displayName":"Available + Compute Operations","operations":[{"name":"Microsoft.Compute/operations/read","displayName":"List + Available Compute Operations","description":"Lists operations available on + Microsoft.Compute resource provider","origin":"user,system","properties":null}]},{"name":"disks","displayName":"Disks","operations":[{"name":"Microsoft.Compute/disks/read","displayName":"Get + Disk","description":"Get the properties of a Disk","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/write","displayName":"Create + or Update Disk","description":"Creates a new Disk or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/delete","displayName":"Delete + Disk","description":"Deletes the Disk","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/beginGetAccess/action","displayName":"Get + Disk SAS URI","description":"Get the SAS URI of the Disk for blob access","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/endGetAccess/action","displayName":"Revoke + Disk SAS URI","description":"Revoke the SAS URI of the Disk","origin":"user,system","properties":null}]},{"name":"snapshots","displayName":"Snapshots","operations":[{"name":"Microsoft.Compute/snapshots/read","displayName":"Get + Snapshot","description":"Get the properties of a Snapshot","origin":"user,system","properties":null},{"name":"Microsoft.Compute/snapshots/write","displayName":"Create + or Update Snapshot","description":"Create a new Snapshot or update an existing + one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/snapshots/delete","displayName":"Delete + Snapshot","description":"Delete a Snapshot","origin":"user,system","properties":null}]},{"name":"availabilitySets","displayName":"Availability + Sets","operations":[{"name":"Microsoft.Compute/availabilitySets/read","displayName":"Get + Availablity Set","description":"Get the properties of an availability set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/availabilitySets/write","displayName":"Create + or Update Availability Set","description":"Creates a new availability set + or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/availabilitySets/delete","displayName":"Delete + Availability Set","description":"Deletes the availability set","origin":"user,system","properties":null}]},{"name":"availabilitySets/vmSizes","displayName":"Virtual + Machine Size for Availability set","operations":[{"name":"Microsoft.Compute/availabilitySets/vmSizes/read","displayName":"List + Virtual Machine Sizes for Availability Set","description":"List available + sizes for creating or updating a virtual machine in the availability set","origin":"user,system","properties":null}]},{"name":"virtualMachines","displayName":"Virtual + Machines","operations":[{"name":"Microsoft.Compute/virtualMachines/read","displayName":"Get + Virtual Machine","description":"Get the properties of a virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/write","displayName":"Create + or Update Virtual Machine","description":"Creates a new virtual machine or + updates an existing virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/delete","displayName":"Delete + Virtual Machine","description":"Deletes the virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/start/action","displayName":"Start + Virtual Machine","description":"Starts the virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/powerOff/action","displayName":"Power + Off Virtual Machine","description":"Powers off the virtual machine. Note that + the virtual machine will continue to be billed.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/redeploy/action","displayName":"Redeploy + Virtual Machine","description":"Redeploys virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/restart/action","displayName":"Restart + Virtual Machine","description":"Restarts the virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/deallocate/action","displayName":"Deallocate + Virtual Machine","description":"Powers off the virtual machine and releases + the compute resources","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/generalize/action","displayName":"Generalize + Virtual Machine","description":"Sets the virtual machine state to Generalized + and prepares the virtual machine for capture","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/capture/action","displayName":"Capture + Virtual Machine","description":"Captures the virtual machine by copying virtual + hard disks and generates a template that can be used to create similar virtual + machines","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/convertToManagedDisks/action","displayName":"Convert + Virtual Machine disks to Managed Disks","description":"Converts the blob based + disks of the virtual machine to managed disks","origin":"user,system","properties":null}]},{"name":"virtualMachines/providers/Microsoft.Insights/metricDefinitions","displayName":"Virtual + Machine Metric Definitions","operations":[{"name":"Microsoft.Compute/virtualMachines/providers/Microsoft.Insights/metricDefinitions/read","displayName":"Get + Virtual Machine Metric Definitions","description":"Reads Virtual Machine Metric + Definitions","origin":"system","properties":{"serviceSpecification":{"metricSpecifications":[{"name":"Percentage + CPU","displayName":"Percentage CPU","displayDescription":"The percentage of + allocated compute units that are currently in use by the Virtual Machine(s)","unit":"Percent","aggregationType":"Average"},{"name":"Network + In","displayName":"Network In","displayDescription":"The number of bytes received + on all network interfaces by the Virtual Machine(s) (Incoming Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Network + Out","displayName":"Network Out","displayDescription":"The number of bytes + out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Bytes","displayName":"Disk Read Bytes","displayDescription":"Total bytes + read from disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Write Bytes","displayName":"Disk Write Bytes","displayDescription":"Total + bytes written to disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Operations/Sec","displayName":"Disk Read Operations/Sec","displayDescription":"Disk + Read IOPS","unit":"CountPerSecond","aggregationType":"Average"},{"name":"Disk + Write Operations/Sec","displayName":"Disk Write Operations/Sec","displayDescription":"Disk + Write IOPS","unit":"CountPerSecond","aggregationType":"Average"}]}}}]},{"name":"virtualMachines/vmSizes","displayName":"Virtual + Machine Size","operations":[{"name":"Microsoft.Compute/virtualMachines/vmSizes/read","displayName":"Lists + Available Virtual Machine Sizes","description":"Lists available sizes the + virtual machine can be updated to","origin":"user,system","properties":null}]},{"name":"virtualMachines/instanceView","displayName":"Virtual + Machine Instance View","operations":[{"name":"Microsoft.Compute/virtualMachines/instanceView/read","displayName":"Get + Virtual Machine Instance View","description":"Gets the detailed runtime status + of the virtual machine and its resources","origin":"user,system","properties":null}]},{"name":"virtualMachines/extensions","displayName":"Virtual + Machine Extensions","operations":[{"name":"Microsoft.Compute/virtualMachines/extensions/read","displayName":"Get + Virtual Machine Extension","description":"Get the properties of a virtual + machine extension","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/extensions/write","displayName":"Create + or Update Virtual Machine Extension","description":"Creates a new virtual + machine extension or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/extensions/delete","displayName":"Delete + Virtual Machine Extension","description":"Deletes the virtual machine extension","origin":"user,system","properties":null}]},{"name":"locations/vmSizes","displayName":"Virtual + Machine Sizes","operations":[{"name":"Microsoft.Compute/locations/vmSizes/read","displayName":"List + Available Virtual Machine Sizes in Location","description":"Lists available + virtual machine sizes in a location","origin":"user,system","properties":null}]},{"name":"locations/usages","displayName":"Usage + Metrics","operations":[{"name":"Microsoft.Compute/locations/usages/read","displayName":"Get + Usage Metrics","description":"Gets service limits and current usage quantities + for the subscription''s compute resources in a location","origin":"user,system","properties":null}]},{"name":"locations/operations","displayName":"Operation","operations":[{"name":"Microsoft.Compute/locations/operations/read","displayName":"Get + Operation","description":"Gets the status of an asynchronous operation","origin":"user,system","properties":null}]}],"id":"/providers/Microsoft.Authorization/providerOperations/Microsoft.Compute","type":"Microsoft.Authorization/providerOperations","name":"Microsoft.Compute"}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 19 Apr 2017 03:17:16 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Set-Cookie: [x-ms-gateway-slice=productionb; path=/; secure; HttpOnly] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['20896'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 authorizationmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/TEST/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [b1821cb8-24ae-11e7-a4ab-64510658e3b3] + method: GET + uri: https://management.azure.com/providers/Microsoft.Authorization/providerOperations/microsoft.compute?api-version=2015-07-01&$expand=resourceTypes + response: + body: {string: '{"displayName":"Microsoft Compute","operations":[{"name":"Microsoft.Compute/register/action","displayName":"Register + Subscription for Compute","description":"Registers Subscription with Microsoft.Compute + resource provider","origin":"user,system","properties":null}],"resourceTypes":[{"name":"restorePointCollections","displayName":"Restore + Point Collections","operations":[{"name":"Microsoft.Compute/restorePointCollections/read","displayName":"Get + Restore Point Collection","description":"Get the properties of a restore point + collection","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/write","displayName":"Create + or Update Restore Point Collection","description":"Creates a new restore point + collection or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/delete","displayName":"Delete + Restore Point Collection","description":"Deletes the restore point collection + and contained restore points","origin":"user,system","properties":null}]},{"name":"restorePointCollections/restorePoints","displayName":"Restore + Points","operations":[{"name":"Microsoft.Compute/restorePointCollections/restorePoints/read","displayName":"Get + Restore Point","description":"Get the properties of a restore point","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/restorePoints/write","displayName":"Create + Restore Point","description":"Creates a new restore point","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/restorePoints/delete","displayName":"Delete + Restore Point","description":"Deletes the restore point","origin":"user,system","properties":null},{"name":"Microsoft.Compute/restorePointCollections/restorePoints/retrieveSasUris/action","displayName":"Get + Restore Point along with blob SAS URIs","description":"Get the properties + of a restore point along with blob SAS URIs","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets","displayName":"Virtual + Machine Scale Sets","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/read","displayName":"Get + Virtual Machine Scale Set","description":"Get the properties of a virtual + machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/write","displayName":"Create + or Update Virtual Machine Scale Set","description":"Creates a new virtual + machine scale set or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/delete","displayName":"Delete + Virtual Machine Scale Set","description":"Deletes the virtual machine scale + set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/start/action","displayName":"Start + Virtual Machine Scale Set","description":"Starts the instances of the virtual + machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/powerOff/action","displayName":"Power + Off Virtual Machine Scale Set","description":"Powers off the instances of + the virtual machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/restart/action","displayName":"Restart + Virtual Machine Scale Set","description":"Restarts the instances of the virtual + machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/deallocate/action","displayName":"Deallocate + Virtual Machine Scale Set","description":"Powers off and releases the compute + resources for the instances of the virtual machine scale set ","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/manualUpgrade/action","displayName":"Manual + Upgrade Virtual Machine Scale Set","description":"Manually updates instances + to latest model of the virtual machine scale set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/scale/action","displayName":"Scale + Virtual Machine Scale Set","description":"Scale In/Scale Out instance count + of an existing virtual machine scale set","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/providers/Microsoft.Insights/metricDefinitions","displayName":"Virtual + Machine Scalet Set Metric Definitions","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/providers/Microsoft.Insights/metricDefinitions/read","displayName":"Get + Virtual Machine Scalet Set Metric Definitions","description":"Reads Virtual + Machine Scalet Set Metric Definitions","origin":"system","properties":{"serviceSpecification":{"metricSpecifications":[{"name":"Percentage + CPU","displayName":"Percentage CPU","displayDescription":"The percentage of + allocated compute units that are currently in use by the Virtual Machine(s)","unit":"Percent","aggregationType":"Average"},{"name":"Network + In","displayName":"Network In","displayDescription":"The number of bytes received + on all network interfaces by the Virtual Machine(s) (Incoming Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Network + Out","displayName":"Network Out","displayDescription":"The number of bytes + out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Bytes","displayName":"Disk Read Bytes","displayDescription":"Total bytes + read from disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Write Bytes","displayName":"Disk Write Bytes","displayDescription":"Total + bytes written to disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Operations/Sec","displayName":"Disk Read Operations/Sec","displayDescription":"Disk + Read IOPS","unit":"CountPerSecond","aggregationType":"Average"},{"name":"Disk + Write Operations/Sec","displayName":"Disk Write Operations/Sec","displayDescription":"Disk + Write IOPS","unit":"CountPerSecond","aggregationType":"Average"}]}}}]},{"name":"virtualMachineScaleSets/instanceView","displayName":"Virtual + Machine Scale Set Instance View","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/instanceView/read","displayName":"Get + Virtual Machine Scale Set Instance View","description":"Gets the instance + view of the virtual machine scale set","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/skus","displayName":"Virtual + Machine Scale Set SKU","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/skus/read","displayName":"List + SKUs for Virtual Machine Scale Set","description":"Lists the valid SKUs for + an existing virtual machine scale set","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/virtualMachines","displayName":"Virtual + Machine in Scale Set","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read","displayName":"Gets + the properties of a Virtual Machine in a Virtual Machine Scale Set","description":"Retrieves + the properties of a Virtual Machine in a VM Scale Set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/delete","displayName":"Delete + Virtual Machine in a Virtual Machine Scale Set","description":"Delete a specific + Virtual Machine in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/start/action","displayName":"Start + Virtual Machine in a Virtual Machine Scale Set","description":"Starts a Virtual + Machine instance in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/powerOff/action","displayName":"Power + off Virtual Machine in a Virtual Machine Scale Set","description":"Powers + Off a Virtual Machine instance in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/restart/action","displayName":"Restart + Virtual Machine instance in a Virtual Machine Scale Set","description":"Restarts + a Virtual Machine instance in a VM Scale Set.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/deallocate/action","displayName":"Deallocate + Virtual Machine in a Virtual Machine Scale Set","description":"Powers off + and releases the compute resources for a Virtual Machine in a VM Scale Set.","origin":"user,system","properties":null}]},{"name":"virtualMachineScaleSets/virtualMachines/providers/Microsoft.Insights/metricDefinitions","displayName":"Virtual + Machine in Scale Set Metric Definitions","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/providers/Microsoft.Insights/metricDefinitions/read","displayName":"Get + Virtual Machine in Scale Set Metric Definitions","description":"Reads Virtual + Machine in Scale Set Metric Definitions","origin":"system","properties":{"serviceSpecification":{"metricSpecifications":[{"name":"Percentage + CPU","displayName":"Percentage CPU","displayDescription":"The percentage of + allocated compute units that are currently in use by the Virtual Machine(s)","unit":"Percent","aggregationType":"Average"},{"name":"Network + In","displayName":"Network In","displayDescription":"The number of bytes received + on all network interfaces by the Virtual Machine(s) (Incoming Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Network + Out","displayName":"Network Out","displayDescription":"The number of bytes + out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Bytes","displayName":"Disk Read Bytes","displayDescription":"Total bytes + read from disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Write Bytes","displayName":"Disk Write Bytes","displayDescription":"Total + bytes written to disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Operations/Sec","displayName":"Disk Read Operations/Sec","displayDescription":"Disk + Read IOPS","unit":"CountPerSecond","aggregationType":"Average"},{"name":"Disk + Write Operations/Sec","displayName":"Disk Write Operations/Sec","displayDescription":"Disk + Write IOPS","unit":"CountPerSecond","aggregationType":"Average"}]}}}]},{"name":"virtualMachineScaleSets/virtualMachines/instanceView","displayName":"Instance + View of Virtual Machine in Scale Set","operations":[{"name":"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/instanceView/read","displayName":"Gets + Instance View of a Virtual Machine in a Virtual Machine Scale Set","description":"Retrieves + the instance view of a Virtual Machine in a VM Scale Set.","origin":"user,system","properties":null}]},{"name":"images","displayName":"Images","operations":[{"name":"Microsoft.Compute/images/read","displayName":"Get + Image","description":"Get the properties of the Image","origin":"user,system","properties":null},{"name":"Microsoft.Compute/images/write","displayName":"Create + or Update Image","description":"Creates a new Image or updates an existing + one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/images/delete","displayName":"Delete + Image","description":"Deletes the image","origin":"user,system","properties":null}]},{"name":"operations","displayName":"Available + Compute Operations","operations":[{"name":"Microsoft.Compute/operations/read","displayName":"List + Available Compute Operations","description":"Lists operations available on + Microsoft.Compute resource provider","origin":"user,system","properties":null}]},{"name":"disks","displayName":"Disks","operations":[{"name":"Microsoft.Compute/disks/read","displayName":"Get + Disk","description":"Get the properties of a Disk","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/write","displayName":"Create + or Update Disk","description":"Creates a new Disk or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/delete","displayName":"Delete + Disk","description":"Deletes the Disk","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/beginGetAccess/action","displayName":"Get + Disk SAS URI","description":"Get the SAS URI of the Disk for blob access","origin":"user,system","properties":null},{"name":"Microsoft.Compute/disks/endGetAccess/action","displayName":"Revoke + Disk SAS URI","description":"Revoke the SAS URI of the Disk","origin":"user,system","properties":null}]},{"name":"snapshots","displayName":"Snapshots","operations":[{"name":"Microsoft.Compute/snapshots/read","displayName":"Get + Snapshot","description":"Get the properties of a Snapshot","origin":"user,system","properties":null},{"name":"Microsoft.Compute/snapshots/write","displayName":"Create + or Update Snapshot","description":"Create a new Snapshot or update an existing + one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/snapshots/delete","displayName":"Delete + Snapshot","description":"Delete a Snapshot","origin":"user,system","properties":null}]},{"name":"availabilitySets","displayName":"Availability + Sets","operations":[{"name":"Microsoft.Compute/availabilitySets/read","displayName":"Get + Availablity Set","description":"Get the properties of an availability set","origin":"user,system","properties":null},{"name":"Microsoft.Compute/availabilitySets/write","displayName":"Create + or Update Availability Set","description":"Creates a new availability set + or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/availabilitySets/delete","displayName":"Delete + Availability Set","description":"Deletes the availability set","origin":"user,system","properties":null}]},{"name":"availabilitySets/vmSizes","displayName":"Virtual + Machine Size for Availability set","operations":[{"name":"Microsoft.Compute/availabilitySets/vmSizes/read","displayName":"List + Virtual Machine Sizes for Availability Set","description":"List available + sizes for creating or updating a virtual machine in the availability set","origin":"user,system","properties":null}]},{"name":"virtualMachines","displayName":"Virtual + Machines","operations":[{"name":"Microsoft.Compute/virtualMachines/read","displayName":"Get + Virtual Machine","description":"Get the properties of a virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/write","displayName":"Create + or Update Virtual Machine","description":"Creates a new virtual machine or + updates an existing virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/delete","displayName":"Delete + Virtual Machine","description":"Deletes the virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/start/action","displayName":"Start + Virtual Machine","description":"Starts the virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/powerOff/action","displayName":"Power + Off Virtual Machine","description":"Powers off the virtual machine. Note that + the virtual machine will continue to be billed.","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/redeploy/action","displayName":"Redeploy + Virtual Machine","description":"Redeploys virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/restart/action","displayName":"Restart + Virtual Machine","description":"Restarts the virtual machine","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/deallocate/action","displayName":"Deallocate + Virtual Machine","description":"Powers off the virtual machine and releases + the compute resources","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/generalize/action","displayName":"Generalize + Virtual Machine","description":"Sets the virtual machine state to Generalized + and prepares the virtual machine for capture","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/capture/action","displayName":"Capture + Virtual Machine","description":"Captures the virtual machine by copying virtual + hard disks and generates a template that can be used to create similar virtual + machines","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/convertToManagedDisks/action","displayName":"Convert + Virtual Machine disks to Managed Disks","description":"Converts the blob based + disks of the virtual machine to managed disks","origin":"user,system","properties":null}]},{"name":"virtualMachines/providers/Microsoft.Insights/metricDefinitions","displayName":"Virtual + Machine Metric Definitions","operations":[{"name":"Microsoft.Compute/virtualMachines/providers/Microsoft.Insights/metricDefinitions/read","displayName":"Get + Virtual Machine Metric Definitions","description":"Reads Virtual Machine Metric + Definitions","origin":"system","properties":{"serviceSpecification":{"metricSpecifications":[{"name":"Percentage + CPU","displayName":"Percentage CPU","displayDescription":"The percentage of + allocated compute units that are currently in use by the Virtual Machine(s)","unit":"Percent","aggregationType":"Average"},{"name":"Network + In","displayName":"Network In","displayDescription":"The number of bytes received + on all network interfaces by the Virtual Machine(s) (Incoming Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Network + Out","displayName":"Network Out","displayDescription":"The number of bytes + out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Bytes","displayName":"Disk Read Bytes","displayDescription":"Total bytes + read from disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Write Bytes","displayName":"Disk Write Bytes","displayDescription":"Total + bytes written to disk during monitoring period","unit":"Bytes","aggregationType":"Total"},{"name":"Disk + Read Operations/Sec","displayName":"Disk Read Operations/Sec","displayDescription":"Disk + Read IOPS","unit":"CountPerSecond","aggregationType":"Average"},{"name":"Disk + Write Operations/Sec","displayName":"Disk Write Operations/Sec","displayDescription":"Disk + Write IOPS","unit":"CountPerSecond","aggregationType":"Average"}]}}}]},{"name":"virtualMachines/vmSizes","displayName":"Virtual + Machine Size","operations":[{"name":"Microsoft.Compute/virtualMachines/vmSizes/read","displayName":"Lists + Available Virtual Machine Sizes","description":"Lists available sizes the + virtual machine can be updated to","origin":"user,system","properties":null}]},{"name":"virtualMachines/instanceView","displayName":"Virtual + Machine Instance View","operations":[{"name":"Microsoft.Compute/virtualMachines/instanceView/read","displayName":"Get + Virtual Machine Instance View","description":"Gets the detailed runtime status + of the virtual machine and its resources","origin":"user,system","properties":null}]},{"name":"virtualMachines/extensions","displayName":"Virtual + Machine Extensions","operations":[{"name":"Microsoft.Compute/virtualMachines/extensions/read","displayName":"Get + Virtual Machine Extension","description":"Get the properties of a virtual + machine extension","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/extensions/write","displayName":"Create + or Update Virtual Machine Extension","description":"Creates a new virtual + machine extension or updates an existing one","origin":"user,system","properties":null},{"name":"Microsoft.Compute/virtualMachines/extensions/delete","displayName":"Delete + Virtual Machine Extension","description":"Deletes the virtual machine extension","origin":"user,system","properties":null}]},{"name":"locations/vmSizes","displayName":"Virtual + Machine Sizes","operations":[{"name":"Microsoft.Compute/locations/vmSizes/read","displayName":"List + Available Virtual Machine Sizes in Location","description":"Lists available + virtual machine sizes in a location","origin":"user,system","properties":null}]},{"name":"locations/usages","displayName":"Usage + Metrics","operations":[{"name":"Microsoft.Compute/locations/usages/read","displayName":"Get + Usage Metrics","description":"Gets service limits and current usage quantities + for the subscription''s compute resources in a location","origin":"user,system","properties":null}]},{"name":"locations/operations","displayName":"Operation","operations":[{"name":"Microsoft.Compute/locations/operations/read","displayName":"Get + Operation","description":"Gets the status of an asynchronous operation","origin":"user,system","properties":null}]}],"id":"/providers/Microsoft.Authorization/providerOperations/Microsoft.Compute","type":"Microsoft.Authorization/providerOperations","name":"Microsoft.Compute"}'} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 19 Apr 2017 03:17:17 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Set-Cookie: [x-ms-gateway-slice=productionb; path=/] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET] + content-length: ['20896'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/command_modules/azure-cli-resource/tests/test_resource.py b/src/command_modules/azure-cli-resource/tests/test_resource.py index 0705f87e8..8a6f1e28f 100644 --- a/src/command_modules/azure-cli-resource/tests/test_resource.py +++ b/src/command_modules/azure-cli-resource/tests/test_resource.py @@ -262,6 +262,25 @@ class ProviderRegistrationTest(VCRTestBase): # Not RG test base because it opera result = self.cmd('provider show -n {}'.format(provider)) self.assertTrue(result['registrationState'] in ['Registering', 'Registered']) + +class ProviderOperationTest(VCRTestBase): # Not RG test base because it operates only on the subscription + def __init__(self, test_method): + super(ProviderOperationTest, self).__init__(__file__, test_method) + + def test_provider_operation(self): + self.execute() + + def body(self): + self.cmd('provider operation show --namespace microsoft.compute', checks=[ + JMESPathCheck('id', '/providers/Microsoft.Authorization/providerOperations/Microsoft.Compute'), + JMESPathCheck('type', 'Microsoft.Authorization/providerOperations') + ]) + self.cmd('provider operation show --namespace microsoft.compute --api-version 2015-07-01', checks=[ + JMESPathCheck('id', '/providers/Microsoft.Authorization/providerOperations/Microsoft.Compute'), + JMESPathCheck('type', 'Microsoft.Authorization/providerOperations') + ]) + + class DeploymentTest(ResourceGroupVCRTestBase): def __init__(self, test_method): super(DeploymentTest, self).__init__(__file__, test_method, resource_group='azure-cli-deployment-test')
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 13 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.0 -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@3699ef7fdefc8c40fa76ebd83976fc8d4a0b92d1#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.6 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-containerregistry==0.2.0 azure-mgmt-datalake-analytics==0.1.3 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.3 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.1 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-monitor==0.1.0 azure-mgmt-network==1.0.0rc1 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.0.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-monitor==0.2.0 azure-multiapi-storage==0.1.0 azure-nspkg==3.0.2 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.0 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.6 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-containerregistry==0.2.0 - azure-mgmt-datalake-analytics==0.1.3 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.3 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.1 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-monitor==0.1.0 - azure-mgmt-network==1.0.0rc1 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.0.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-monitor==0.2.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==3.0.2 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-resource/tests/test_resource.py::ProviderOperationTest::test_provider_operation" ]
[]
[ "src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceGroupScenarioTest::test_resource_group", "src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceGroupNoWaitScenarioTest::test_resource_group_no_wait", "src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceScenarioTest::test_resource_scenario", "src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceIDScenarioTest::test_resource_id_scenario", "src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceCreateScenarioTest::test_resource_create", "src/command_modules/azure-cli-resource/tests/test_resource.py::TagScenarioTest::test_tag_scenario", "src/command_modules/azure-cli-resource/tests/test_resource.py::ProviderRegistrationTest::test_provider_registration", "src/command_modules/azure-cli-resource/tests/test_resource.py::DeploymentTest::test_group_deployment", "src/command_modules/azure-cli-resource/tests/test_resource.py::DeploymentnoWaitTest::test_group_deployment_no_wait", "src/command_modules/azure-cli-resource/tests/test_resource.py::DeploymentThruUriTest::test_group_deployment_thru_uri", "src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceMoveScenarioTest::test_resource_move", "src/command_modules/azure-cli-resource/tests/test_resource.py::FeatureScenarioTest::test_feature_list", "src/command_modules/azure-cli-resource/tests/test_resource.py::PolicyScenarioTest::test_resource_policy" ]
[]
MIT License
1,201
[ "azure-cli.pyproj", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_params.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py", "src/command_modules/azure-cli-vm/HISTORY.rst", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_client_factory.py", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/custom.py", "src/command_modules/azure-cli-resource/HISTORY.rst", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/commands.py", "doc/sphinx/azhelpgen/azhelpgen.py", "src/command_modules/azure-cli-redis/azure/cli/command_modules/redis/commands.py", "src/command_modules/azure-cli-resource/setup.py", "src/azure-cli-core/azure/cli/core/commands/arm.py", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py" ]
[ "azure-cli.pyproj", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_params.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py", "src/command_modules/azure-cli-vm/HISTORY.rst", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_client_factory.py", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/custom.py", "src/command_modules/azure-cli-resource/HISTORY.rst", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/commands.py", "doc/sphinx/azhelpgen/azhelpgen.py", "src/command_modules/azure-cli-redis/azure/cli/command_modules/redis/commands.py", "src/command_modules/azure-cli-resource/setup.py", "src/azure-cli-core/azure/cli/core/commands/arm.py", "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py" ]
jboss-dockerfiles__dogen-113
bb52f327cd889a0af7b046762a3856a9e6aecca9
2017-04-19 11:55:30
bc9263c5b683fdf901ac1646286ee3908b85dcdc
diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml index 040cd19..58ea832 100644 --- a/dogen/schema/kwalify_schema.yaml +++ b/dogen/schema/kwalify_schema.yaml @@ -43,6 +43,9 @@ map: seq: - map: value: {type: int, required: True} + volumes: + seq: + - {type: str, required: True} debugport: {type: int} dogen: map: diff --git a/dogen/templates/template.jinja b/dogen/templates/template.jinja index 170fd59..0912004 100644 --- a/dogen/templates/template.jinja +++ b/dogen/templates/template.jinja @@ -121,6 +121,12 @@ USER root RUN rm -rf /tmp/artifacts {% endif %} +{%- if volumes %} +{% for volume in volumes %} +VOLUME ["{{ volume }}"] +{% endfor %} +{% endif %} + {%- if workdir %} # Specify the working directory WORKDIR {{ workdir }}
Add support for volumes The MaaS broker images needs a volume. Can support be added for this? https://docs.docker.com/engine/reference/builder/#volume
jboss-dockerfiles/dogen
diff --git a/tests/test_dockerfile.py b/tests/test_dockerfile.py index 119b6de..63033dc 100644 --- a/tests/test_dockerfile.py +++ b/tests/test_dockerfile.py @@ -110,3 +110,21 @@ class TestDockerfile(unittest.TestCase): dockerfile = f.read() regex = re.compile(r'.*ENTRYPOINT \["/usr/bin/time"\]', re.MULTILINE) self.assertRegexpMatches(dockerfile, regex) + + def test_volumes(self): + """ + Test that cmd: is mapped into a CMD instruction + """ + with open(self.yaml, 'ab') as f: + f.write("volumes:\n - '/var/lib'\n - '/usr/lib'".encode()) + + generator = Generator(self.log, self.args) + generator.configure() + generator.render_from_template() + + self.assertEqual(generator.cfg['volumes'], ['/var/lib', '/usr/lib']) + + with open(os.path.join(self.target, "Dockerfile"), "r") as f: + dockerfile = f.read() + regex = re.compile(r'.*VOLUME \["/var/lib"\]\nVOLUME \["/usr/lib"\]', re.MULTILINE) + self.assertRegexpMatches(dockerfile, regex)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 0 }, "num_modified_files": 2 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 docopt==0.6.2 -e git+https://github.com/jboss-dockerfiles/dogen.git@bb52f327cd889a0af7b046762a3856a9e6aecca9#egg=dogen idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pykwalify==1.8.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 python-dateutil==2.9.0.post0 PyYAML==6.0.1 requests==2.27.1 ruamel.yaml==0.18.3 ruamel.yaml.clib==0.2.8 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: dogen channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - coverage==6.2 - docopt==0.6.2 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pykwalify==1.8.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - python-dateutil==2.9.0.post0 - pyyaml==6.0.1 - requests==2.27.1 - ruamel-yaml==0.18.3 - ruamel-yaml-clib==0.2.8 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/dogen
[ "tests/test_dockerfile.py::TestDockerfile::test_volumes" ]
[]
[ "tests/test_dockerfile.py::TestDockerfile::test_default_cmd_user", "tests/test_dockerfile.py::TestDockerfile::test_set_cmd", "tests/test_dockerfile.py::TestDockerfile::test_set_cmd_user", "tests/test_dockerfile.py::TestDockerfile::test_set_entrypoint" ]
[]
MIT License
1,202
[ "dogen/schema/kwalify_schema.yaml", "dogen/templates/template.jinja" ]
[ "dogen/schema/kwalify_schema.yaml", "dogen/templates/template.jinja" ]
ESSS__conda-devenv-50
f58819151109dfc68edbbf4a58cd56853ff1c414
2017-04-20 16:39:39
7867067acadb89f7da61af330d85caa31b284dd8
diff --git a/HISTORY.rst b/HISTORY.rst index 796bf32..608aaa0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,14 @@ History ======= +0.9.4 (2017-04-20) +------------------ + +* Fixed major bug where activate/deactivate scripts were not being generated (`#49`_). + +.. _`#49`: https://github.com/ESSS/conda-devenv/issues/49 + + 0.9.3 (2017-04-10) ------------------ diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 66b6bf9..16d174c 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -269,7 +269,10 @@ def __call_conda_env_update(args, output_filename): try: del command[0] sys.argv = command - return _call_conda() + try: + return _call_conda() + except SystemExit as e: + return e.code finally: sys.argv = old_argv
0.9.3 broken: no longer generates activate/deactivate scripts #46 introduced a bug: `conda-devenv` now calls `conda_env.main` directly, which probably calls `sys.exit()`, which skips activate/deactivate scripts generation.
ESSS/conda-devenv
diff --git a/tests/test_main.py b/tests/test_main.py index 3fd56e2..4f0db10 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -17,19 +17,20 @@ def patch_conda_calls(mocker): mocker.patch.object(devenv, 'write_activate_deactivate_scripts', autospec=True) [email protected]('input_name, expected_output_name', [ - ('environment.devenv.yml', 'environment.yml'), - ('environment.yml', 'environment.yml'), [email protected]('input_name, write_scripts_call_count', [ + ('environment.devenv.yml', 1), + ('environment.yml', 0), ]) @pytest.mark.usefixtures('patch_conda_calls') -def test_handle_input_file(tmpdir, input_name, expected_output_name): +def test_handle_input_file(tmpdir, input_name, write_scripts_call_count): """ Test how conda-devenv handles input files: devenv.yml and pure .yml files. """ argv = [] def call_conda_mock(): argv[:] = sys.argv[:] - return 0 + # simulate that we actually called conda's main, which calls sys.exit() + sys.exit(0) devenv._call_conda.side_effect = call_conda_mock @@ -41,8 +42,9 @@ def test_handle_input_file(tmpdir, input_name, expected_output_name): ''')) assert devenv.main(['--file', str(filename), '--quiet']) == 0 assert devenv._call_conda.call_count == 1 - cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join(expected_output_name)) + cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join('environment.yml')) assert argv == cmdline.split() + assert devenv.write_activate_deactivate_scripts.call_count == write_scripts_call_count @pytest.mark.parametrize('input_name', ['environment.devenv.yml', 'environment.yml'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 0 }, "num_modified_files": 2 }
0.9
{ "env_vars": null, "env_yml_path": [], "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-datadir" ], "pre_install": [], "python": "3.6", "reqs_path": [ "requirements_dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 bump2version==1.0.1 bumpversion==0.6.0 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 -e git+https://github.com/ESSS/conda-devenv.git@f58819151109dfc68edbbf4a58cd56853ff1c414#egg=conda_devenv coverage==6.2 cryptography==40.0.2 distlib==0.3.9 docutils==0.17.1 filelock==3.4.1 flake8==5.0.4 idna==3.10 imagesize==1.4.1 importlib-metadata==4.2.0 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mccabe==0.7.0 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pycparser==2.21 pyflakes==2.5.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytest-datadir==1.4.1 pytest-mock==3.6.1 pytz==2025.2 PyYAML==6.0.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==4.3.2 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 virtualenv==20.16.2 watchdog==2.3.1 zipp==3.6.0
name: conda-devenv channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - bump2version==1.0.1 - bumpversion==0.6.0 - cffi==1.15.1 - charset-normalizer==2.0.12 - coverage==6.2 - cryptography==40.0.2 - distlib==0.3.9 - docutils==0.17.1 - filelock==3.4.1 - flake8==5.0.4 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.2.0 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mccabe==0.7.0 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pycparser==2.21 - pyflakes==2.5.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-datadir==1.4.1 - pytest-mock==3.6.1 - pytz==2025.2 - pyyaml==6.0.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==4.3.2 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - virtualenv==20.16.2 - watchdog==2.3.1 - zipp==3.6.0 prefix: /opt/conda/envs/conda-devenv
[ "tests/test_main.py::test_handle_input_file[environment.yml-0]" ]
[ "tests/test_main.py::test_handle_input_file[environment.devenv.yml-1]", "tests/test_main.py::test_print[environment.devenv.yml]", "tests/test_main.py::test_print_full" ]
[ "tests/test_main.py::test_print[environment.yml]" ]
[]
MIT License
1,203
[ "HISTORY.rst", "conda_devenv/devenv.py" ]
[ "HISTORY.rst", "conda_devenv/devenv.py" ]
Azure__azure-cli-2943
fe509f803d562c48b3c1d936f59d4b7b6f698136
2017-04-20 18:46:27
eb12ac454cbe1ddb59c86cdf2045e1912660e750
diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index e0d45196a..9788066e4 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -106,6 +106,7 @@ class Profile(object): password, is_service_principal, tenant, + allow_no_subscriptions=False, subscription_finder=None): from azure.cli.core._debug import allow_debug_adal_connection allow_debug_adal_connection() @@ -128,18 +129,26 @@ class Profile(object): subscriptions = subscription_finder.find_from_user_account( username, password, tenant, self._ad_resource_uri) - if not subscriptions: - raise CLIError('No subscriptions found for this account.') + if not allow_no_subscriptions and not subscriptions: + raise CLIError("No subscriptions were found for '{}'. If this is expected, use " + "'--allow-no-subscriptions' to have tenant level accesses".format( + username)) if is_service_principal: self._creds_cache.save_service_principal_cred(sp_auth.get_entry_to_persist(username, tenant)) - if self._creds_cache.adal_token_cache.has_state_changed: self._creds_cache.persist_cached_creds() + + if allow_no_subscriptions: + t_list = [s.tenant_id for s in subscriptions] + bare_tenants = [t for t in subscription_finder.tenants if t not in t_list] + subscriptions = Profile._build_tenant_level_accounts(bare_tenants) + consolidated = Profile._normalize_properties(subscription_finder.user_id, subscriptions, is_service_principal) + self._set_subscriptions(consolidated) # use deepcopy as we don't want to persist these changes to file. return deepcopy(consolidated) @@ -162,6 +171,24 @@ class Profile(object): }) return consolidated + @staticmethod + def _build_tenant_level_accounts(tenants): + from azure.cli.core.profiles import get_sdk, ResourceType + SubscriptionType = get_sdk(ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS, + 'Subscription', mod='models') + StateType = get_sdk(ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS, + 'SubscriptionState', mod='models') + result = [] + for t in tenants: + s = SubscriptionType() + s.id = '/subscriptions/' + t + s.subscription = t + s.tenant_id = t + s.display_name = 'N/A(tenant level account)' + s.state = StateType.enabled + result.append(s) + return result + def _set_subscriptions(self, new_subscriptions): existing_ones = self.load_cached_subscriptions(all_clouds=True) active_one = next((x for x in existing_ones if x.get(_IS_DEFAULT_SUBSCRIPTION)), None) @@ -345,6 +372,7 @@ class SubscriptionFinder(object): config, base_url=CLOUD.endpoints.resource_manager)) self._arm_client_factory = create_arm_client_factory + self.tenants = [] def find_from_user_account(self, username, password, tenant, resource): context = self._create_auth_context(tenant or _COMMON_TENANT) @@ -379,6 +407,7 @@ class SubscriptionFinder(object): token_entry = sp_auth.acquire_token(context, resource, client_id) self.user_id = client_id result = self._find_using_specific_tenant(tenant, token_entry[_ACCESS_TOKEN]) + self.tenants = [tenant] return result def _create_auth_context(self, tenant, use_token_cache=True): @@ -410,6 +439,7 @@ class SubscriptionFinder(object): temp_credentials[_ACCESS_TOKEN]) all_subscriptions.extend(subscriptions) + self.tenants = tenants return all_subscriptions def _find_using_specific_tenant(self, tenant, access_token): @@ -422,6 +452,7 @@ class SubscriptionFinder(object): for s in subscriptions: setattr(s, 'tenant_id', tenant) all_subscriptions.append(s) + self.tenants = [tenant] return all_subscriptions diff --git a/src/command_modules/azure-cli-profile/HISTORY.rst b/src/command_modules/azure-cli-profile/HISTORY.rst index 3392ef64a..5b8cee30e 100644 --- a/src/command_modules/azure-cli-profile/HISTORY.rst +++ b/src/command_modules/azure-cli-profile/HISTORY.rst @@ -2,6 +2,9 @@ Release History =============== +2.0.4 (unreleased) +++++++++++++++++++ +* Support login when there are no subscriptions found (#2560) 2.0.3 (2017-04-17) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py b/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py index 494a62dbb..2b552e0d6 100644 --- a/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py +++ b/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py @@ -21,6 +21,7 @@ register_cli_argument('login', 'password', options_list=('--password', '-p'), he register_cli_argument('login', 'service_principal', action='store_true', help='The credential representing a service principal.') register_cli_argument('login', 'username', options_list=('--username', '-u'), help='Organization id or service principal') register_cli_argument('login', 'tenant', options_list=('--tenant', '-t'), help='The AAD tenant, must provide when using service principals.') +register_cli_argument('login', 'allow_no_subscriptions', action='store_true', help="Support access tenants without subscriptions. It's uncommon but useful to run tenant level commands, such as 'az ad'") register_cli_argument('logout', 'username', help='account user, if missing, logout the current active account') diff --git a/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py b/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py index f163f8122..089fdc1fe 100644 --- a/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py +++ b/src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py @@ -54,7 +54,8 @@ def account_clear(): profile.logout_all() -def login(username=None, password=None, service_principal=None, tenant=None): +def login(username=None, password=None, service_principal=None, tenant=None, + allow_no_subscriptions=False): """Log in to access Azure subscriptions""" from adal.adal_error import AdalError import requests @@ -76,7 +77,8 @@ def login(username=None, password=None, service_principal=None, tenant=None): username, password, service_principal, - tenant) + tenant, + allow_no_subscriptions=allow_no_subscriptions) except AdalError as err: # try polish unfriendly server errors if username: diff --git a/src/command_modules/azure-cli-storage/HISTORY.rst b/src/command_modules/azure-cli-storage/HISTORY.rst index 0f6cf0717..f7d5140f8 100644 --- a/src/command_modules/azure-cli-storage/HISTORY.rst +++ b/src/command_modules/azure-cli-storage/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +unreleased +++++++++++++++++++ + +* Default location to resource group location for `storage account create`. + 2.0.3 (2017-04-17) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py index 242334575..ed58494ad 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py @@ -11,7 +11,8 @@ from six import u as unicode_string from azure.cli.core._config import az_config from azure.cli.core.commands.parameters import \ (ignore_type, tags_type, file_type, get_resource_name_completion_list, enum_choice_list, - model_choice_list, enum_default) + model_choice_list, enum_default, location_type) +from azure.cli.core.commands.validators import get_default_location_from_resource_group import azure.cli.core.commands.arm # pylint: disable=unused-import from azure.cli.core.commands import register_cli_argument, register_extra_cli_argument, CliArgumentType @@ -283,6 +284,7 @@ register_cli_argument('storage account show-connection-string', 'key_name', opti for item in ['blob', 'file', 'queue', 'table']: register_cli_argument('storage account show-connection-string', '{}_endpoint'.format(item), help='Custom endpoint for {}s.'.format(item)) +register_cli_argument('storage account create', 'location', location_type, validator=get_default_location_from_resource_group) register_cli_argument('storage account create', 'account_type', help='The storage account type', **model_choice_list(ResourceType.MGMT_STORAGE, 'AccountType')) register_cli_argument('storage account create', 'account_name', account_name_type, options_list=('--name', '-n'), completer=None) diff --git a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py index 8018c9b4e..266f15f07 100644 --- a/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py +++ b/src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py @@ -52,7 +52,7 @@ def _update_progress(current, total): # CUSTOM METHODS -def create_storage_account(resource_group_name, account_name, sku, location, +def create_storage_account(resource_group_name, account_name, sku, location=None, kind=None, tags=None, custom_domain=None, encryption=None, access_tier=None): StorageAccountCreateParameters, Kind, Sku, CustomDomain, AccessTier = get_sdk( @@ -75,7 +75,8 @@ def create_storage_account(resource_group_name, account_name, sku, location, return scf.storage_accounts.create(resource_group_name, account_name, params) -def create_storage_account_with_account_type(resource_group_name, account_name, location, account_type, tags=None): +def create_storage_account_with_account_type(resource_group_name, account_name, account_type, + location=None, tags=None): StorageAccountCreateParameters, AccountType = get_sdk( ResourceType.MGMT_STORAGE, 'StorageAccountCreateParameters',
Azure CLI Feature: Use default location and sku when specifying a resource group ### Environment summary **Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly) Answer here: pip **CLI Version:** What version of the CLI and modules are installed? (Use `az --version`) Answer here: azure-cli (2.0.3) **OS Version:** What OS and version are you using? Answer here: macOS 10.12.3 **Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows) Answer here: bash on macOS --- ### Description It would be great if when we create a storage account (or other resources) that if we specify a resource group, we can default to use its location. Otherwise we do this ... ``` az group create -n PapaResourceGroup -l eastus az storage account create -n papastorage -g PapaResourceGroup --sku Standard_LRS -l eastus ``` Notice we type the location twice. If I omit the location in the second command, it fails. We also should be able to default the sku. A quicker way would look like this ... ``` az group create -n PapaResourceGroup -l eastus az storage account create -n papastorage -g PapaResourceGroup ``` cc // @SyntaxC4
Azure/azure-cli
diff --git a/src/azure-cli-core/tests/test_profile.py b/src/azure-cli-core/tests/test_profile.py index e344826e2..7c092e55f 100644 --- a/src/azure-cli-core/tests/test_profile.py +++ b/src/azure-cli-core/tests/test_profile.py @@ -243,6 +243,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method 'my-secret', True, self.tenant_id, + False, finder) # action extended_info = profile.get_expanded_subscription_info() @@ -253,6 +254,35 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method self.assertEqual('https://login.microsoftonline.com', extended_info['endpoints'].active_directory) + @mock.patch('adal.AuthenticationContext', autospec=True) + def test_create_account_without_subscriptions(self, mock_auth_context): + mock_auth_context.acquire_token_with_client_credentials.return_value = self.token_entry1 + mock_arm_client = mock.MagicMock() + mock_arm_client.subscriptions.list.return_value = [] + finder = SubscriptionFinder(lambda _, _2: mock_auth_context, + None, + lambda _: mock_arm_client) + + storage_mock = {'subscriptions': []} + profile = Profile(storage_mock) + profile._management_resource_uri = 'https://management.core.windows.net/' + + # action + result = profile.find_subscriptions_on_login(False, + '1234', + 'my-secret', + True, + self.tenant_id, + allow_no_subscriptions=True, + subscription_finder=finder) + + # assert + self.assertTrue(1, len(result)) + self.assertEqual(result[0]['id'], self.tenant_id) + self.assertEqual(result[0]['state'], 'Enabled') + self.assertEqual(result[0]['tenantId'], self.tenant_id) + self.assertEqual(result[0]['name'], 'N/A(tenant level account)') + @mock.patch('azure.cli.core._profile._load_tokens_from_file', autospec=True) def test_get_current_account_user(self, mock_read_cred_file): # setup
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 7 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.0 -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@fe509f803d562c48b3c1d936f59d4b7b6f698136#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.6 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-containerregistry==0.2.0 azure-mgmt-datalake-analytics==0.1.3 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.3 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.1 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-monitor==0.2.0 azure-mgmt-network==1.0.0rc2 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.0.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-monitor==0.3.0 azure-multiapi-storage==0.1.0 azure-nspkg==3.0.2 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.0 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.6 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-containerregistry==0.2.0 - azure-mgmt-datalake-analytics==0.1.3 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.3 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.1 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-monitor==0.2.0 - azure-mgmt-network==1.0.0rc2 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.0.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-monitor==0.3.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==3.0.2 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_create_account_without_subscriptions", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info_for_logged_in_service_principal" ]
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_using_cert", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_service_principal_auth_client_cert" ]
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_create_token_cache", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_add_new_sp_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_add_preexisting_sp_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds_with_cert", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds_with_secret", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_new_token_added_by_adal", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_remove_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_default_active_subscription_to_non_disabled_one", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_particular_tenent", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_id", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_interactive_from_particular_tenent", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_through_interactive_flow", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password_with_account_disabled", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_current_account_user", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_login_credentials", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_login_credentials_for_graph_client", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_subscription", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_load_cached_tokens", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_logout", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_logout_all", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_normalize", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_service_principal_auth_client_secret", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_set_active_subscription", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_update_add_two_different_subscriptions", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_update_with_same_subscription_added_twice" ]
[]
MIT License
1,204
[ "src/azure-cli-core/azure/cli/core/_profile.py", "src/command_modules/azure-cli-storage/HISTORY.rst", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py", "src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py", "src/command_modules/azure-cli-profile/HISTORY.rst", "src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py" ]
[ "src/azure-cli-core/azure/cli/core/_profile.py", "src/command_modules/azure-cli-storage/HISTORY.rst", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/custom.py", "src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/custom.py", "src/command_modules/azure-cli-profile/HISTORY.rst", "src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py", "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_params.py" ]
Azure__azure-cli-2955
3079f47653297161fd877f994cfaa0bc202f039f
2017-04-21 17:50:06
eb12ac454cbe1ddb59c86cdf2045e1912660e750
yugangw-msft: ```bash (env) D:\sdk\azure-cli>az ad group -h Group az ad group: Manage Azure Active Directory groups. Subgroups: member : Manage Azure Active Directory group members. Commands: create : Create a group in the directory. delete : Delete a group in the directory. get-member-groups: Gets a collection that contains the Object IDs of the groups of which the group is a member. list : List groups in the directory. show : Gets group information from the directory. (env) D:\sdk\azure-cli>az ad group member -h Group az ad group member: Manage Azure Active Directory group members. Commands: add : Add a memeber to a group. check : Checks whether the specified user, group, contact, or service principal is a direct or a transitive member of the specified group. list : Gets the members of a group. remove: Remove a memeber from a group. ``` codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=h1) Report > Merging [#2955](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/86c54142d7084eff0e8f2f5c7ae48ecbd53dfc0c?src=pr&el=desc) will **increase** coverage by `0.07%`. > The diff coverage is `85.1%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/2955/graphs/tree.svg?height=150&width=650&token=2pog0TKvF8&src=pr)](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2955 +/- ## ========================================== + Coverage 63.33% 63.41% +0.07% ========================================== Files 466 467 +1 Lines 26539 26584 +45 Branches 4069 4073 +4 ========================================== + Hits 16809 16858 +49 + Misses 8617 8609 -8 - Partials 1113 1117 +4 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...-cli-role/azure/cli/command\_modules/role/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvY3VzdG9tLnB5) | `33.56% <ø> (+1.6%)` | :arrow_up: | | [...e-cli-role/azure/cli/command\_modules/role/\_help.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvX2hlbHAucHk=) | `100% <100%> (ø)` | :arrow_up: | | [...cli-role/azure/cli/command\_modules/role/\_params.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvX3BhcmFtcy5weQ==) | `100% <100%> (ø)` | :arrow_up: | | [...li-role/azure/cli/command\_modules/role/commands.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvY29tbWFuZHMucHk=) | `90.19% <100%> (+5.75%)` | :arrow_up: | | [...role/azure/cli/command\_modules/role/\_validators.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvX3ZhbGlkYXRvcnMucHk=) | `76.66% <76.66%> (ø)` | | | [...rofile/azure/cli/command\_modules/profile/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcHJvZmlsZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3Byb2ZpbGUvY3VzdG9tLnB5) | `35.21% <0%> (+2.81%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=footer). Last update [86c5414...85551c8](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/src/command_modules/azure-cli-role/HISTORY.rst b/src/command_modules/azure-cli-role/HISTORY.rst index b34ef4fe7..5b6240d98 100644 --- a/src/command_modules/azure-cli-role/HISTORY.rst +++ b/src/command_modules/azure-cli-role/HISTORY.rst @@ -5,6 +5,7 @@ Release History 2.0.3 (unreleased) ++++++++++++++++++ * create-for-rbac: ensure SP's end date will not exceed certificate's expiration date (#2989) +* RBAC: add full support for 'ad group' (#2016) 2.0.2 (2017-04-17) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py index 852adcc35..25814a12f 100644 --- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py +++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py @@ -140,6 +140,10 @@ helps['ad group'] = """ type: group short-summary: Manage Azure Active Directory groups. """ +helps['ad group member'] = """ + type: group + short-summary: Manage Azure Active Directory group members. +""" helps['ad sp'] = """ type: group short-summary: Manage Azure Active Directory service principals for automation authentication. diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py index 828f046fc..9c749fcde 100644 --- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py +++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py @@ -8,9 +8,10 @@ from azure.cli.core.commands import CliArgumentType from azure.cli.core.commands import register_cli_argument from azure.cli.core.commands.parameters import enum_choice_list from .custom import get_role_definition_name_completion_list +from ._validators import validate_group, validate_member_id, VARIANT_GROUP_ID_ARGS register_cli_argument('ad app', 'application_object_id', options_list=('--object-id',)) -register_cli_argument('ad app', 'display_name', help=' the display name of the application') +register_cli_argument('ad app', 'display_name', help='the display name of the application') register_cli_argument('ad app', 'homepage', help='the url where users can sign in and use your app.') register_cli_argument('ad app', 'identifier', options_list=('--id',), help='identifier uri, application id, or object id') register_cli_argument('ad app', 'identifier_uris', nargs='+', help='space separated unique URIs that Azure AD can use for this app.') @@ -47,6 +48,15 @@ register_cli_argument('ad', 'query_filter', options_list=('--filter',), help='OD register_cli_argument('ad user', 'mail_nickname', help='mail alias. Defaults to user principal name') register_cli_argument('ad user', 'force_change_password_next_login', action='store_true') +group_help_msg = "group's object id or display name(prefix also works if there is a unique match)" +for arg in VARIANT_GROUP_ID_ARGS: + register_cli_argument('ad group', arg, options_list=('--group', '-g'), validator=validate_group, help=group_help_msg) + +register_cli_argument('ad group get-member-groups', 'security_enabled_only', action='store_true', default=False, required=False) +member_id_help_msg = 'The object ID of the contact, group, user, or service principal' +register_cli_argument('ad group member add', 'url', options_list='--member-id', validator=validate_member_id, help=member_id_help_msg) +register_cli_argument('ad group member', 'member_object_id', options_list='--member-id', help=member_id_help_msg) + register_cli_argument('role', 'scope', help='scope at which the role assignment or definition applies to, e.g., /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333, /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM') register_cli_argument('role assignment', 'role_assignment_name', options_list=('--name', '-n')) register_cli_argument('role assignment', 'role', help='role name or id', completer=get_role_definition_name_completion_list) diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py new file mode 100644 index 000000000..e88fb273b --- /dev/null +++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import uuid +from azure.cli.core.util import CLIError +from ._client_factory import _graph_client_factory + +VARIANT_GROUP_ID_ARGS = ['object_id', 'group_id', 'group_object_id'] + + +def validate_group(namespace): + # For AD auto-commands, here we resolve logic names to object ids needed by SDK methods + attr, value = next(((x, getattr(namespace, x)) for x in VARIANT_GROUP_ID_ARGS + if hasattr(namespace, x))) + try: + uuid.UUID(value) + except ValueError: + client = _graph_client_factory() + sub_filters = [] + sub_filters.append("startswith(displayName,'{}')".format(value)) + sub_filters.append("displayName eq '{}'".format(value)) + result = list(client.groups.list(filter=' or '.join(sub_filters))) + count = len(result) + if count == 1: + setattr(namespace, attr, result[0].object_id) + elif count == 0: + raise CLIError("No group matches the name of '{}'".format(value)) + else: + raise CLIError("More than one groups match the name of '{}'".format(value)) + + +def validate_member_id(namespace): + from azure.cli.core._profile import Profile, CLOUD + try: + uuid.UUID(namespace.url) + profile = Profile() + _, _, tenant_id = profile.get_login_credentials() + graph_url = CLOUD.endpoints.active_directory_graph_resource_id + namespace.url = '{}{}/directoryObjects/{}'.format(graph_url, tenant_id, + namespace.url) + except ValueError: + pass # let it go, invalid values will be caught by server anyway diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py index 3a490dfef..86a2a689b 100644 --- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py +++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py @@ -105,12 +105,23 @@ cli_command(__name__, 'ad user list', 'azure.cli.command_modules.role.custom#lis cli_command(__name__, 'ad user create', 'azure.cli.command_modules.role.custom#create_user', get_graph_client_users) -cli_command(__name__, 'ad group delete', - 'azure.graphrbac.operations.groups_operations#GroupsOperations.delete', - get_graph_client_groups) -cli_command(__name__, 'ad group show', - 'azure.graphrbac.operations.groups_operations#GroupsOperations.get', - get_graph_client_groups, +group_path = 'azure.graphrbac.operations.groups_operations#GroupsOperations.{}' +cli_command(__name__, 'ad group create', group_path.format('create'), get_graph_client_groups) +cli_command(__name__, 'ad group delete', group_path.format('delete'), get_graph_client_groups) +cli_command(__name__, 'ad group show', group_path.format('get'), get_graph_client_groups, exception_handler=empty_on_404) -cli_command(__name__, 'ad group list', 'azure.cli.command_modules.role.custom#list_groups', +cli_command(__name__, 'ad group list', + 'azure.cli.command_modules.role.custom#list_groups', + get_graph_client_groups) + +cli_command(__name__, 'ad group get-member-groups', group_path.format('get_member_groups'), + get_graph_client_groups) + +cli_command(__name__, 'ad group member list', group_path.format('get_group_members'), + get_graph_client_groups) +cli_command(__name__, 'ad group member add', group_path.format('add_member'), + get_graph_client_groups) +cli_command(__name__, 'ad group member remove', group_path.format('remove_member'), + get_graph_client_groups) +cli_command(__name__, 'ad group member check', group_path.format('is_member_of'), get_graph_client_groups) diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py index 4ccf4d0c8..5d22e92e2 100644 --- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py +++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py @@ -357,12 +357,14 @@ create_user.__doc__ = UserCreateParameters.__doc__ def list_groups(client, display_name=None, query_filter=None): + ''' + list groups in the directory + ''' sub_filters = [] if query_filter: sub_filters.append(query_filter) if display_name: sub_filters.append("startswith(displayName,'{}')".format(display_name)) - return client.list(filter=(' and ').join(sub_filters))
RBAC: support AD group commands 1. Author commands under `az ad group`, to be in parity with xplat's 2. On `group list`, add `--display-name` filtering 3. support group name when resolve `--assignee' on role creation
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-role/tests/recordings/test_graph_group_scenario.yaml b/src/command_modules/azure-cli-role/tests/recordings/test_graph_group_scenario.yaml new file mode 100644 index 000000000..325267215 --- /dev/null +++ b/src/command_modules/azure-cli-role/tests/recordings/test_graph_group_scenario.yaml @@ -0,0 +1,1048 @@ +interactions: +- request: + body: '{"passwordProfile": {"forceChangePasswordNextLogin": false, "password": + "Test1234!!"}, "accountEnabled": true, "userPrincipalName": "[email protected]", + "mailNickname": "deleteme1", "displayName": "deleteme1"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad user create] + Connection: [keep-alive] + Content-Length: ['230'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.User/@Element","odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"41109d4c-94f8-4308-a702-0a6f541d16a4","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme1","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme1","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:51.7535386Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['1216'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:50 GMT'] + Duration: ['8671347'] + Expires: ['-1'] + Location: ['https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/41109d4c-94f8-4308-a702-0a6f541d16a4/Microsoft.DirectoryServices.User'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [WJ9iNj7ky7Q0raKkGm6593SGt4ZAaZkDQgVPLNeXP0c=] + ocp-aad-session-key: [jpR7XXuX_T1kxSIkqFOB52jihfMTnn9SH4VWMOFXyp0ZNiFqhwsUnGl9wn5W-i3hqVx0J62RXwirgueJgLB7qRY_ZrmB5UZud2phlU0NZcVvhFOgMjFVJThd1KC61mYY5N6N537jdMmLDDe2_RIDEKhMkPKPw-JnPn_nCbLSWnIG-vqlchEdaqCdFEvyQgkdP4yedcwRXuAbmqp4jujqfQ.M32PAKgiR6c_upGTEedeqJUTCKT98l29GfNeezk8wW4] + request-id: [42b9d2f6-90dc-456e-aff0-1711d90eeaed] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 201, message: Created} +- request: + body: '{"passwordProfile": {"forceChangePasswordNextLogin": false, "password": + "Test1234!!"}, "accountEnabled": true, "userPrincipalName": "[email protected]", + "mailNickname": "deleteme2", "displayName": "deleteme2"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad user create] + Connection: [keep-alive] + Content-Length: ['230'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.User/@Element","odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"649c0cdc-2f45-4f78-b1d9-f555756dedba","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme2","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme2","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:52.5000485Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['1216'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:53 GMT'] + Duration: ['8892284'] + Expires: ['-1'] + Location: ['https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/649c0cdc-2f45-4f78-b1d9-f555756dedba/Microsoft.DirectoryServices.User'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [u3zz2DALsiEmtzDI1/lFfQ0UcLsw4WkTvQJPQAl1nu0=] + ocp-aad-session-key: [f0dEeZJswiKEs92Lt9GL5-gLCN0jfABXm0H0UrGYDbLoIs1s9Unws4ropIkTTPi1k8dbWjdcn2f-K9WkvLjsuiFwqtDyqYVBbABZYoGcs0cQ7Xo2h-kCKGjn13kbIfLLbcMs_RfGHsGewZ2cVvBZ1KbjcBKlfr4nEbWcfcM27tL7-EIP1vD_02lCmR0TZzQbtp0VFMdz83xs741c15862w.60JMcr9O_9PccmmONTfbG1v4nt-abfjZE6V41dTdMHM] + request-id: [707086d5-fa4b-4c2a-bf73-e294b49af987] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 201, message: Created} +- request: + body: '{"securityEnabled": true, "mailEnabled": false, "mailNickname": "deleteme_g", + "displayName": "deleteme_g"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group create] + Connection: [keep-alive] + Content-Length: ['106'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['552'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:53 GMT'] + Duration: ['2380019'] + Expires: ['-1'] + Location: ['https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/b511b706-141f-48e5-a700-7015860dbb04/Microsoft.DirectoryServices.Group'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [NQzzohdyto5u0aXRdIyWmvWAgmuTAftnKRMh6cwShWo=] + ocp-aad-session-key: [GJRbngTR61d56iJMPzyG31LFKOekl2lCiAF_4guv3uTEJM0pTp1IYSXej2vgjzZSZr_wc_QSSG2GjGPcvHSz6PHgpFZmyQKBORagTwJf6Sgnb5Cjq1ARhihaDfMoLp2Nwp3UKTdz4UmNlo48Act_66uoyRctddJV4xDNfX-_ib-u3psokOIAHlwOJaPCtt1a9lQZz3vYDNalIBgj2PgYlA.oysqr2-y3Dlx0zLdT6uZXhz1yUSnwGH8jKUIgr_3Exg] + request-id: [d7b18b60-8e95-4124-a278-e11110db1fdb] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member add] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:53 GMT'] + Duration: ['613565'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [4GoW7S4gK6ZADtJZ7anfPxmmIML2y1bLgHB/c5EmhGY=] + ocp-aad-session-key: [lVsL2ZNIVd6_koFCuZYBVypsOnwVi5RhktUhdU4EOGiAAogYhHtSeHArVlX-7J8V10S0K9VoDpn6J5ea_hgJcPbIjRBnF4jV6D5ignl8wpDUtDNricnghCITwDfGvtKDnbVhp_QlOmzpYEmTp89GzRvC6Hbt3qTqOk8GCCLG8qLC7dQhBO3UhtB8muEE4Zmu1__yXL1MO2LmRryH1XCw8A.nhxhzPCkXl7HVSP-Pg4r1wzJz42LCmtEjBeRUPQMxkE] + request-id: [649d075d-95f3-45d8-a462-91d4057163ea] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: '{"url": "https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/41109d4c-94f8-4308-a702-0a6f541d16a4"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member add] + Connection: [keep-alive] + Content-Length: ['127'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/$links/members?api-version=1.6 + response: + body: {string: ''} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + DataServiceVersion: [1.0;] + Date: ['Fri, 21 Apr 2017 02:34:53 GMT'] + Duration: ['1463966'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [p2VNFLoaL7S6Sl7mYZqZdKbM00cEf5mOy6vYy8NtAMg=] + ocp-aad-session-key: [Mc2Rjck_-jBXj-Da58jstd6v38mDi8GHdb2HNhm0rmJVN4CnooTHUAOMHHzq-fnbQ6URRFeYUV7EUwhf4nkA4SiNG4SWiwU8APAhVn8jrJs_xUXrjvo1Z1gu3Xnv0YWX0rTpX3eeV4WhXYbJWg2cYChAzF3ebXuW8YbR5tNl59MAKKM9w5ROdxY7s9BTm4UdJOQ7aWIr3H007p_RZaly7Q.WeG2JMDgIMMM0KjLnGgvWRoJz3GGEcTU-iOiCtPgYcU] + request-id: [691a8ac3-715c-4eb1-9d64-993356b5ac53] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member add] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:51 GMT'] + Duration: ['633708'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [TJ/xKag4M2mTYYn3oFmzro7Z2/Yt3ZkfYZ6omhAf2Kg=] + ocp-aad-session-key: [tgzoU9JUnwbYTWQcIfGbFU9A5W7_pdTcN0MBB9GgzZuOJh7dQmg5gx7ACvLmuf5YX96wBimFsnGbYtimx3Ue8KEOK6sCqxOqjn_c2ftwkiNKYhY2sqkV17KEou3pL0GJtiIRJwIWjdBS65lflkOVW1C6eRFPm-8ga8R7ufl1zYkMCeTXhPesVuQwQ4Qrg08XJ3g6tmeN82T6hgg3tA7VFA.QOc5DkKbo5rfi87-6n1xJSgJ_TOkNRnKZXh3b2Vebsc] + request-id: [e7ce4ca2-f289-431d-9489-f972e8c2b93c] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: '{"url": "https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/649c0cdc-2f45-4f78-b1d9-f555756dedba"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member add] + Connection: [keep-alive] + Content-Length: ['127'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/$links/members?api-version=1.6 + response: + body: {string: ''} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + DataServiceVersion: [1.0;] + Date: ['Fri, 21 Apr 2017 02:34:55 GMT'] + Duration: ['2588595'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [O47BPeqbxW4dIh1dbaaiyT5Lss9ZWY0UVhN/+FnW4PY=] + ocp-aad-session-key: [KgIPVZbeF1-PL2sO3Kq1GECy_eOyO76-rtcBT5GQPHLLl7N1ZokI5rqNitIKraWaBreIZ3jXYLgzlHMUQNMtwzrndGu-_uhPi5S9ZfS4Fs8yv2OcXMz2j_pFKMbDtFI9E0vGk4Sr9yAbKBOJnTgGak-yRYYo8UFB7TId3itnKuZWXEyTJq4L6UciG-kb8eyP_u1enjZivXzDqcCVVGY8cg.r_TJVu8lMP-4xXIuuhve7oo8HbA-AHdX7kHcI6zklY4] + request-id: [f7c039e8-5f75-4478-8606-dc0997ef1780] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:52 GMT'] + Duration: ['967824'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [cze88VSQ6HNztT9BK1BBqepYViZ+GvMC7osQIs0Tj5w=] + ocp-aad-session-key: [-5j5Ahwc7IMTKpWeF-kh3_QD14JFDesEmh8WUaXsIe5DPRG0PLSt_hO9LNUVYwOruRczAEPAbYxyb6u1A660EkqUCguZnZ80Dr4BMjyCZX7W0I3oK9kg8X0_KQMBLo7fP0vOZfLt0Mb1WTU9nM4atfC0fpO0sDzZUiXssuMWO0RD0BOxK1gWtd_pszIHl9CRKaPqHVQ05EFKP62TVDXveg.iJ8127LwB9Up_Urrj0xvV-NV7k3u0wZDDSvuuRd36Rc] + request-id: [0afe37e2-23a2-426d-844b-3f514ecd2a71] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['552'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:53 GMT'] + Duration: ['532282'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [bKebP66qgjbXsGkb8RKjEOK0Di4Z+mUFNK2uc4Kp3R8=] + ocp-aad-session-key: [DKS6X08Gzb4T4ohSw7NjrENjB-mLnbMLkOko1uC7zV5c7m2iakb2NG-ShAfDb-E1Rr-DwCq2FxxbowwD6Wwdr_TpzYWtJgULrB_ubgyAYbVkczf3Ycia8L0WyxKMXjk1HH3MbXXgZguiRXa6xSeVZcKS5_3UQE45TmCtVtNp9UzxMGBndJqmoDLrD429ppoJhlfA6jDJ1ok_dvSLgrWtoQ.Igsp3oo_oqgVSiCn5TWYqSXIghR4S2l2ghfvtMiaKQM] + request-id: [ef46cf12-ae59-4187-8170-eca9b76a29d9] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['552'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:56 GMT'] + Duration: ['591932'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [GWBF+FqKrwi9lJ0Nz2UosGLK6d7IORKv9drCwOzHa0Q=] + ocp-aad-session-key: [YDIS_R4fAoyGIX0WhWxYFw1FDWyLY1HsyiMA3x6aTFyMyvnE637IV3Lz7H8clHb12vOw01PBH-sOscshSTjL11HPmJIDlwOcvBuRtOXvuZSWUyp4V8_jO4VdTIuK5zbjThFZS15oAV2ujYB_ND36x2GP4NkAmz6BeE8nVhwyPh15XqqbwVVgOjcKwRvcTV1QqkKezvHgqKy1DLkMbw2D_g.WHyFdJ3G1HsN6XQ9FsTfBpbcbd1q_QgBaLtqFYBIFug] + request-id: [0da9d692-6a81-469d-8202-ccb68bf23e9f] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:54 GMT'] + Duration: ['636208'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [nG3hKVoq5XXuUdcuvSQIIaqQRGfFv8ulezCBqMPQCRQ=] + ocp-aad-session-key: [_hasrBAPYrcMyTqk7-JKvJ4RF_E-Q_0dnzcSp-N7p0WApD5pO_i0HzI0DCGesNwEcHm4k6o5g6n6uKj8xSDMCk7FnzOfWFt5CJlkdWphgf_AD2STxTEuyHFoLw9RTjN_zmklZHDhiMKtRDl1eMKUzMHgGucn0yh5jV1qpoYA3qeSjWVkPcm2tinQG3OLMk5XXEugvwGrczZfee0XgUDvOQ.pCR1otnzCj8LPTz0-pOtvCKF9lU7DmNKmNUOjR_kUsk] + request-id: [fb2902c6-d7b6-43be-86e5-f5c308ed2a07] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group get-member-groups] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:55 GMT'] + Duration: ['602504'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [xU4JSRnBDDuUT0qZaU7x6kfvEIokIxo5omNgFl2G0G4=] + ocp-aad-session-key: [OTQMxLHuUsIgc3ZFQJfpfavOnhw_OX1uMKuj3-9lXQgemAd6Tl_qVYvMxqJd1eOK5BiMQqfpqktUM4hlumWo_1oEF1PiA_X0EGhEkiq1Wos7YLfDDtLhSGyJq8FtaltULVlTfSmnGD2Y56-KxCvrL5NenemOd5zCAJpt3QIWu4xJtUAcEXF3O4CkAGEXQNY6FqEIHnAAcY1LQgtp7YgAaA.Hk_VuLh7XR6rRAn66nmruKCFAtxoaCI04ld9oeZ1uzI] + request-id: [d6450c5b-c7ee-4a5a-96bb-5f2156e9ebfd] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: '{"securityEnabledOnly": false}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group get-member-groups] + Connection: [keep-alive] + Content-Length: ['30'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/getMemberGroups?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Collection(Edm.String)","value":[]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['127'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:57 GMT'] + Duration: ['860475'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [2mzsumD7v4laEobzcd1BLO71t/RyrMmpEcVHR0ySBgI=] + ocp-aad-session-key: [CSlAkP3jSRRDYfT6gT36QzmwtPMLYLL1LgowcGHVZ4RFpymPbEI9Qd2HGpjuLrTZ2HC0iHL4vF1nYL_5CX_4ucK_wR8wobcCom93gvO9vH_qbu46h7sUSJoqtyPc7l0prau_VRTMenswmCWPnwpmHfcxzLeE5MkRZAjwWFFT1wozXKZRe90LJgkpfhCdWvdf95CbQZyIlkVZsKHc7WKgpw.KohCAEDmIrkgl533DVtAMiM36kmniAQPMrN5_Q5eupg] + request-id: [59972335-0452-498f-aac4-1e884a21f767] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member check] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:55 GMT'] + Duration: ['669783'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [v4ImhedTSMLcBqRGrUg4p+YYyJPNNYsWlqCUOR8+Elg=] + ocp-aad-session-key: [fKytxFLzaKADa9Bj5TrZUEHhLwxnse5FP-NjTz6VUot1t9uEEqCAeNB5WzLnJGg9M8suutqxkx9Xdpd8BcZn0gTwo2W0Zv5NAdOdW-jWTYUuq6NShKhVkMocF4_ympjuMl91J8bwd71aVZcgy3bYlXOD-exyOqD0EgjiNr49dsBmsfcGXmfnDdtJP5Z3VSdkpt9EerqPWIGNoANAMk9q6A.CoXW9B-GDT0SMGocGBhmNouBV5eNzZYlIzuOz4N_jpg] + request-id: [209df732-f113-4a39-8949-953eefadd24e] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: '{"groupId": "b511b706-141f-48e5-a700-7015860dbb04", "memberId": "41109d4c-94f8-4308-a702-0a6f541d16a4"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member check] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/isMemberOf?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Edm.Boolean","value":true}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['118'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:54 GMT'] + Duration: ['810984'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [0lQ4vCmckKCyRLoL4AoEX4aKPw4qTo7BdYx2Pv/0osg=] + ocp-aad-session-key: [_JpCop26AtTqhzRT-f7kL870Cu-5buOlVaE8K2g8_Rd2jWW0iNt7stu5Iks2HBZngb442bG8iY0qXd-_L7GP-Uskag_kslAHZ9_AjfhxTZN7Sf3jECQVY0-ptyTGtzuH8Kwn8eSXNlXYujbMzaGY-SDGsKe6PAcvqdRCAvIMdPTY_JbiA8zMoLC8W38mru5qJZL3UZzx7KkMtA_v4GHAAg.dqfTW22-j6WG-x5hDsmTEDe4GivwGJnEQbTtwrRvWxA] + request-id: [2e0c0686-9861-4efd-b05a-117df3c4b83c] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member check] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:57 GMT'] + Duration: ['657067'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [pl1kFb+g22xnnvGQgyu9q8Kv53mcwJTK0gXSbnmQHzY=] + ocp-aad-session-key: [D_nZv7BCyyH6hlTvgKbDTE9IazhxY-nkG1TuujzN3aIMX7Bd3iDvXMexnWqfxoqTZ-L-B80C5RPPCzHumjjdt0Pfc_g_dqyS_w-i6-kou6l74Zcf8URH_MldqFcP5qbxAm4HqVfDQnCeGX69Fmu2y02B7X37AZX-d-xoPPriC-CRq_6Q_of5IXQ016ZxTN_WWJbjw60cVV-nSaT7kkExew.EwnlKxADC8uYpvoJLAyjx2X5ah-tUT3CvsXDLLb3urU] + request-id: [ad92ec24-7416-4f12-8ddb-904ba9b727c2] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: '{"groupId": "b511b706-141f-48e5-a700-7015860dbb04", "memberId": "649c0cdc-2f45-4f78-b1d9-f555756dedba"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member check] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/isMemberOf?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Edm.Boolean","value":true}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['118'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:58 GMT'] + Duration: ['1363446'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [zBnO1zgN2HN/dAMzOnN35k2SLefJt7CbCenk7Vv7NR0=] + ocp-aad-session-key: [-TiuX6eJNiZR5sLdWaZrYhs1vdOlVQPbB7WGntmO-Ih8Sy-tgqZ231YAiFWoQ2vCeYr1pq3B5UGCuGhedAGVmCQOQqBTBRwP2TQklHXsYpMykYL5MkRcOhAe_hoYiwaFbCUt-3nRBTIgPl2Kr_fPelty82eT09gMO62-wEWE6kGZRqTLH_pC0xkLsLX547Kz12pSvACjjpIeCwyntegALw.Jg6m9-Tptl_sHwTs-qSTZjYkowuz5wne44awV_BfMv8] + request-id: [b0e3ec2f-6e1d-4a01-94af-fc1f3631f9e1] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:56 GMT'] + Duration: ['503530'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [WJ9iNj7ky7Q0raKkGm6593SGt4ZAaZkDQgVPLNeXP0c=] + ocp-aad-session-key: [s4MzuxF7PdUctiURqSCyFM4YarHwm4Xu5NDwpXdGD5My5mOBj_10DJCTTiy9AoPB4yK-XLVblTzodQjoUCNqRrGmN7kWzDaBABnY07YXqM4yos8WfnagpjNKUOFwojko2DKzCRyozLN7zkI83OPUW0gpumTT756eA3CWeg9uzLPg1rDaDSEKfqWZQDZSnqHBpKTvuElFgi_zI9mZfjSqSQ.r6CVQarU5-XzxmQNj--scdG-3Js9D3MbCZE_kJmbriE] + request-id: [231fc766-9c95-4a42-a7af-5f3d513f9b4c] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/members?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects","value":[{"odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"41109d4c-94f8-4308-a702-0a6f541d16a4","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme1","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme1","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:51Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"},{"odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"649c0cdc-2f45-4f78-b1d9-f555756dedba","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme2","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme2","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:52Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['2236'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:58 GMT'] + Duration: ['830347'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [JI7Ca0Wtacsn3e2Y1FRjFO8qh6f3DNYttzXsIANsgIA=] + ocp-aad-session-key: [MyKWg_I_7XGy3aU0fv7IykF3JWU1LUc76ZrFlJDEvtngI9fjM9DxLbid04bmhYoZBAvaqjFJaKjxrlGFcS0NelPbaxVPvznRSXuK7NcWM-IkpLYC8luNgPfTljTa1pp5k5HiAqVf92DeIoUa_wymsCnUzIxUiKghvZEatWPw9MJBgHQ-lnZabqBHu1w0txkA3UJqmExlJDkBg0TQmZWS2Q.gpY5bTlXcwfHZilpCGbJQz-Ylxl0IhfTIxagx5dUeqg] + request-id: [f4acfc1e-6b2f-4a79-a502-03cd8f5801d2] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member remove] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:56 GMT'] + Duration: ['506900'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [O47BPeqbxW4dIh1dbaaiyT5Lss9ZWY0UVhN/+FnW4PY=] + ocp-aad-session-key: [z3lSHGlTSyWGBXraRiHc-kHSCzKy0CuH27o-v5Pwjd4NwNooZ8I_jmixBVTiX7R6x8sS0E9PL-ob1hIfN18dGzZestDbSPnaCmKn_4yjDCXWf_dh9_KfzB4OeIKyFiCwr5NcQU_FdngQuzO8rIgAaj5LK_KVRtwkeYMBlL-2EQxL1iDyGC7bF4t0rFxg-NVW_Y2i9mf-lPcJaLLprYsp1g.zOxy-ZzKq9pq0K03tQs5zxP8SKJy7WhxY8OkRrXu8bE] + request-id: [f1df41ee-cd2b-47c2-a7a4-26ab3d4ea6ce] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member remove] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: DELETE + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/$links/members/41109d4c-94f8-4308-a702-0a6f541d16a4?api-version=1.6 + response: + body: {string: ''} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + DataServiceVersion: [1.0;] + Date: ['Fri, 21 Apr 2017 02:34:56 GMT'] + Duration: ['2264001'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [Gn/SyFs1dI76n3DdqL7J62Lgmc/wMbIjPyRQ+vCls0k=] + ocp-aad-session-key: [isZqfNhyBGpSID-iupVpM_ceSzx5HasaP6wT7cUFjc3dCRd5lXE7q6NOyFu3X6TdoL46o3pCXbouBhVkFww7EuyeivddBZrlDoW8157LvM5fc3EgDsbWa1fJien5MrYKog38AmLG-vKsiBShDkYm7bY2wX1dM053D7EldRlq23ogZyWLuTufr1AwWqw6IwAfVHCTmSyYdiDqcM2EaHp7uA.MdO06y-NG9KQaVpO4ZZQx5UZErNAGqsaIheOrl2WkK8] + request-id: [c95e201a-2ef2-4d3e-8c4c-289d67778d25] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member check] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:56 GMT'] + Duration: ['902544'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [JI7Ca0Wtacsn3e2Y1FRjFO8qh6f3DNYttzXsIANsgIA=] + ocp-aad-session-key: [Ixi9Zw0nnJ_cLexDXVKMMyDHI12GEB7Bqe6jHvOJto-z3SrIRxrBmmL2C2e7Ei0JYvrKblOJQyxcEM10Ko6Tux1bJizCcnOgaGfbwoUArfpn4L5i5npLxYycpIvC9ccou4aZwEGBgTGrpU6ikpTtq7EHnwZuauUIhOWgw5YxKsoF8h_ALWrwV78X5jLy_XG_96DnNf_Tf2-YUm-TkXWXMw.ZWBUBsEQ0fvQGQLF_nUNzojvb7Ipzl_tmXCmDH0npWQ] + request-id: [23dc0b65-1128-421b-8e22-115ac2a482fd] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: '{"groupId": "b511b706-141f-48e5-a700-7015860dbb04", "memberId": "41109d4c-94f8-4308-a702-0a6f541d16a4"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group member check] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: POST + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/isMemberOf?api-version=1.6 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Edm.Boolean","value":false}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['119'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:58 GMT'] + Duration: ['930994'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [iyH1L5ZSeWH83EP1icIOAwr148oY/OGtb+Pw+quNhWk=] + ocp-aad-session-key: [saU0G3jLDN3q38j_e89BHbOJSXIG3CVkdt7Wzj52cGrFX_KKTJv3sCwz_bDEdZnCi76bYCIGqFaM6ruj-zlJSp67G3nr1qJ-4_vOdVvtj6Mz3rE9v5MF61aRVPLevQCXCER_cCG_-9geT4yiKlsZ0SzyEgwC3PnnTIm30HJHoNYXoqTTyVm2ak-m_JdxzufWwOvB37r7dSN5Eknri5Z9Jg.uOFMAEkCGQ8MG7fjBTzaDP_d32TUwjLPLSYErDY4x00] + request-id: [00e0dbe2-a8d1-46d0-b626-d3dfedcf2ec1] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27 + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['555'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:59 GMT'] + Duration: ['534658'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [JI7Ca0Wtacsn3e2Y1FRjFO8qh6f3DNYttzXsIANsgIA=] + ocp-aad-session-key: [LLv91GFqIBDylaY8nCzsIu6ncyPFpFrDgwSG5WbQ6uaZziEtmR7JQCx7IHENvL0dC2pinnGg_rj3OpLKlW0HwIFosf_3nAVT83SjKP6HVF84kO2ggLil7PUMAgOr6QhVLuWxxzuqzmT_IeHnROOHR4HvuF7sw4fGyktpP-pGW3SKpHzjRmHdX1ot2Lv9Y35VQ9hVAwYKMzVMr2msGZ2SFw.Wzrkhf5M2eSmF3zPf8n-dtwLe1x9hXpSmHJRqSJt4p4] + request-id: [1eb02221-6565-4bd8-9e69-8260b570f66f] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: DELETE + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04?api-version=1.6 + response: + body: {string: ''} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + DataServiceVersion: [1.0;] + Date: ['Fri, 21 Apr 2017 02:34:59 GMT'] + Duration: ['1432029'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [kuyxkXWpuMdFkyXupIcvORPNJ/cSc7C7Qv+yP0H/SL8=] + ocp-aad-session-key: [5r2cXJ4JlXL82zHO6N1eHSUTyf3gOowRwmmNcHP6io1291uQMjaFaSsBWVfvY04uFFhEqScMhiNyWuhF8DSty1LbfZulags2SjweEr93IPhdd2osXW5VF1gQEKruYOdwCLfyEI4RMk-CgkmgFAep4ED7FQI1CT-etHGenE2rawllPxncHXpunP3DvbMsSUys7dAyWaVFDChC9FfxQNzDew.c1-LftJXGu5ega3zTPx8GcZab8-viwiyOdm0nsBqKl0] + request-id: [a0a2c6e8-50d0-4950-b862-709348956edf] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad group list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: GET + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter= + response: + body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"d758a069-52cc-47f6-bc00-961cea17be39","deletionTimestamp":null,"description":"for + bug investigation and will delete ","dirSyncEnabled":null,"displayName":"yugangwTestGroup","lastDirSyncTime":null,"mail":null,"mailNickname":"fb7f38a2-3b88-49a7-b890-71105a0091b7","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + Content-Length: ['623'] + Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8] + DataServiceVersion: [3.0;] + Date: ['Fri, 21 Apr 2017 02:34:59 GMT'] + Duration: ['648611'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [u3zz2DALsiEmtzDI1/lFfQ0UcLsw4WkTvQJPQAl1nu0=] + ocp-aad-session-key: [gdefyo02rjZpQ4alGN3LlhbqHuofuYFfbrWf8_HmgDE1RAsyLPD9__rN2qS7S7pnyeDJpd34iBfACME1vnWmEs8V3I7vNh5CiQcoy6VOIKwWfXLy7uFM_3H_w8A6f3hxqbuymCeTN0-4vP9b1SizZTrj9u3qYyPvznP2mGgSCO98zHyQLWPUG0t9fhxJlWb8pUHB7b0fNXxwjHDAAFnNxw.I9mpazRb1lY7F7iXf1Dn36KhFfZm-SNSVZu2NrR_DU8] + request-id: [a38f7538-9554-4955-bfb7-be38e1fcc9e9] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad user delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: DELETE + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users/41109d4c-94f8-4308-a702-0a6f541d16a4?api-version=1.6 + response: + body: {string: ''} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + DataServiceVersion: [1.0;] + Date: ['Fri, 21 Apr 2017 02:35:01 GMT'] + Duration: ['11793485'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [1sP0P7WxKcBID6yc4fbz9MeUVowvkTIjVOQX5YMG/jY=] + ocp-aad-session-key: [JmkBUmhKvkEH-OeCNAXbnL4RSo-pgfrl4ubNDoMR7CaPOU_shaDJPHayz3PX_Gl3DSdPB_ingGSo2F7gb6CP87Il9yNmzvqM6ssWKm1RVSQU8ME4oYn-Qdhs7aXNRADVZVcefIgHUyDXRZDpZLp8YM6sauBkkyIfzcaum7CcjwGdeC6K04NUuwHA1n7HRx3ZKlbDGoDhAkUfRNsdM8_fjQ.mhlltQ0G6fsfwX-hzU4_V88B5c1IX8mwSx4QYhntv18] + request-id: [bd02d713-ee43-4416-b722-12e4385ace1e] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [ad user delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python + AZURECLI/2.0.3+dev] + accept-language: [en-US] + x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3] + method: DELETE + uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users/649c0cdc-2f45-4f78-b1d9-f555756dedba?api-version=1.6 + response: + body: {string: ''} + headers: + Access-Control-Allow-Origin: ['*'] + Cache-Control: [no-cache] + DataServiceVersion: [1.0;] + Date: ['Fri, 21 Apr 2017 02:35:02 GMT'] + Duration: ['12149129'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-IIS/8.5] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + X-AspNet-Version: [4.0.30319] + X-Content-Type-Options: [nosniff] + X-Powered-By: [ASP.NET, ASP.NET] + ocp-aad-diagnostics-server-name: [DJl/5bFSkj1cqgm9u7PtSoh9YAGkLAPecUruXCQn6TE=] + ocp-aad-session-key: [njJm2iHZLEr7FCWeEBDNfjLMWjYHetqMGYgkQtXxVNV1MQ8WvEv2k9pcmTeXTng_zRF32wu714hTx3tXrQu6VvrLiLVnD61UKLRgTgLDxB59lSVfw6TiXIDCK32RzuStmWhNz33YkvLtjikdMd7sb3_4WDKff2j_8UsbUvxrz2vsYKg1ldnwhf1JnFqm8RlX1FcSKD_uTIWnbP9k9fIpKg.7J0h-ySRCH2ygywgtd1ktEKsMc4J1dy1wk5adRmYi3I] + request-id: [0c718af5-bcc8-4339-81c2-95653fe7aa58] + x-ms-dirapi-data-contract-version: ['1.6'] + status: {code: 204, message: No Content} +version: 1 diff --git a/src/command_modules/azure-cli-role/tests/test_graph.py b/src/command_modules/azure-cli-role/tests/test_graph.py index ad32ff733..95f3b3655 100644 --- a/src/command_modules/azure-cli-role/tests/test_graph.py +++ b/src/command_modules/azure-cli-role/tests/test_graph.py @@ -2,8 +2,11 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - +import json from azure.cli.core.test_utils.vcr_test_base import VCRTestBase, JMESPathCheck, NoneCheck +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import JMESPathCheck as JMESPathCheck2 +from azure.cli.testsdk import NoneCheck as NoneCheck2 class ServicePrincipalExpressCreateScenarioTest(VCRTestBase): @@ -85,3 +88,71 @@ class ApplicationSetScenarioTest(VCRTestBase): # delete app self.cmd('ad app delete --id {}'.format(app_id_uri)) self.cmd('ad app list --identifier-uri {}'.format(app_id_uri), checks=NoneCheck()) + + +class GraphGroupScenarioTest(ScenarioTest): + + def test_graph_group_scenario(self): + self.user1 = 'deleteme1' + self.user1 = 'deleteme2' + upn = self.cmd('account show --query "user.name" -o tsv').output + _, domain = upn.split('@', 1) + user1 = 'deleteme1' + user2 = 'deleteme2' + group = 'deleteme_g' + password = 'Test1234!!' + try: + # create user1 + user1_result = json.loads(self.cmd('ad user create --display-name {0} --password {1} --user-principal-name {0}@{2}'.format(user1, password, domain)).output) + # create user2 + user2_result = json.loads(self.cmd('ad user create --display-name {0} --password {1} --user-principal-name {0}@{2}'.format(user2, password, domain)).output) + # create group + group_result = json.loads(self.cmd('ad group create --display-name {0} --mail-nickname {0}'.format(group)).output) + # add user1 into group + self.cmd('ad group member add -g {} --member-id {}'.format(group, user1_result['objectId']), checks=NoneCheck2()) + # add user2 into group + self.cmd('ad group member add -g {} --member-id {}'.format(group, user2_result['objectId']), checks=NoneCheck2()) + # show group + self.cmd('ad group show -g ' + group, checks=[ + JMESPathCheck2('objectId', group_result['objectId']), + JMESPathCheck2('displayName', group) + ]) + self.cmd('ad group show -g ' + group_result['objectId'], checks=[ + JMESPathCheck2('displayName', group) + ]) + # list group + self.cmd('ad group list --display-name ' + group, checks=[ + JMESPathCheck2('[0].displayName', group) + ]) + # show member groups + self.cmd('ad group get-member-groups -g ' + group, checks=[ + JMESPathCheck2('length([])', 0) + ]) + # check user1 memebership + self.cmd('ad group member check -g {} --member-id {}'.format(group, user1_result['objectId']), checks=[ + JMESPathCheck2('value', True) + ]) + # check user2 memebership + self.cmd('ad group member check -g {} --member-id {}'.format(group, user2_result['objectId']), checks=[ + JMESPathCheck2('value', True) + ]) + # list memebers + self.cmd('ad group member list -g ' + group, checks=[ + JMESPathCheck2("length([?displayName=='{}'])".format(user1), 1), + JMESPathCheck2("length([?displayName=='{}'])".format(user2), 1), + JMESPathCheck2("length([])", 2), + ]) + # remove user1 + self.cmd('ad group member remove -g {} --member-id {}'.format(group, user1_result['objectId'])) + # check user1 memebership + self.cmd('ad group member check -g {} --member-id {}'.format(group, user1_result['objectId']), checks=[ + JMESPathCheck2('value', False) + ]) + # delete the group + self.cmd('ad group delete -g ' + group) + self.cmd('ad group list', checks=[ + JMESPathCheck2("length([?displayName=='{}'])".format(group), 0) + ]) + finally: + self.cmd('ad user delete --upn-or-object-id ' + user1_result['objectId']) + self.cmd('ad user delete --upn-or-object-id ' + user2_result['objectId'])
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 5 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.0 -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.6 azure-graphrbac==0.30.0rc6 azure-keyvault==0.1.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-containerregistry==0.2.0 azure-mgmt-datalake-analytics==0.1.3 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.3 azure-mgmt-dns==1.0.0 azure-mgmt-documentdb==0.1.1 azure-mgmt-iothub==0.2.1 azure-mgmt-keyvault==0.30.0 azure-mgmt-monitor==0.2.0 azure-mgmt-network==1.0.0rc2 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.0.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0rc6 azure-mgmt-web==0.31.0 azure-monitor==0.3.0 azure-multiapi-storage==0.1.0 azure-nspkg==3.0.2 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.0 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.6 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.1.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-containerregistry==0.2.0 - azure-mgmt-datalake-analytics==0.1.3 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.3 - azure-mgmt-dns==1.0.0 - azure-mgmt-documentdb==0.1.1 - azure-mgmt-iothub==0.2.1 - azure-mgmt-keyvault==0.30.0 - azure-mgmt-monitor==0.2.0 - azure-mgmt-network==1.0.0rc2 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.0.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0rc6 - azure-mgmt-web==0.31.0 - azure-monitor==0.3.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==3.0.2 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-role/tests/test_graph.py::GraphGroupScenarioTest::test_graph_group_scenario" ]
[]
[ "src/command_modules/azure-cli-role/tests/test_graph.py::ServicePrincipalExpressCreateScenarioTest::test_sp_create_scenario", "src/command_modules/azure-cli-role/tests/test_graph.py::ApplicationSetScenarioTest::test_application_set_scenario" ]
[]
MIT License
1,205
[ "src/command_modules/azure-cli-role/HISTORY.rst", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py" ]
[ "src/command_modules/azure-cli-role/HISTORY.rst", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py", "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py" ]
ESSS__conda-devenv-51
320f7fdd672abf4122506850982a6b4095614e55
2017-04-24 13:37:58
7867067acadb89f7da61af330d85caa31b284dd8
diff --git a/HISTORY.rst b/HISTORY.rst index 608aaa0..f9fafd4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,12 @@ History ======= +0.9.5 (2017-04-24) +------------------ + +* Handle ``None`` correctly, which actually fixes (`#49`_). + + 0.9.4 (2017-04-20) ------------------ diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 16d174c..44df72e 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -373,7 +373,7 @@ def main(args=None): # Call conda-env update retcode = __call_conda_env_update(args, output_filename) - if retcode != 0: + if retcode: return retcode if is_devenv_input_file:
0.9.3 broken: no longer generates activate/deactivate scripts #46 introduced a bug: `conda-devenv` now calls `conda_env.main` directly, which probably calls `sys.exit()`, which skips activate/deactivate scripts generation.
ESSS/conda-devenv
diff --git a/tests/test_main.py b/tests/test_main.py index 4f0db10..feb2425 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -21,16 +21,20 @@ def patch_conda_calls(mocker): ('environment.devenv.yml', 1), ('environment.yml', 0), ]) [email protected]('return_none', [True, False]) @pytest.mark.usefixtures('patch_conda_calls') -def test_handle_input_file(tmpdir, input_name, write_scripts_call_count): +def test_handle_input_file(tmpdir, input_name, write_scripts_call_count, return_none): """ Test how conda-devenv handles input files: devenv.yml and pure .yml files. """ argv = [] def call_conda_mock(): argv[:] = sys.argv[:] - # simulate that we actually called conda's main, which calls sys.exit() - sys.exit(0) + # conda's env main() function sometimes returns None and other times raises SystemExit + if return_none: + return None + else: + sys.exit(0) devenv._call_conda.side_effect = call_conda_mock
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 2 }
0.9
{ "env_vars": null, "env_yml_path": [], "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-datadir" ], "pre_install": [], "python": "3.6", "reqs_path": [ "requirements_dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 bump2version==1.0.1 bumpversion==0.6.0 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 -e git+https://github.com/ESSS/conda-devenv.git@320f7fdd672abf4122506850982a6b4095614e55#egg=conda_devenv coverage==6.2 cryptography==40.0.2 distlib==0.3.9 docutils==0.17.1 filelock==3.4.1 flake8==5.0.4 idna==3.10 imagesize==1.4.1 importlib-metadata==4.2.0 importlib-resources==5.4.0 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 mccabe==0.7.0 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pycparser==2.21 pyflakes==2.5.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytest-datadir==1.4.1 pytest-mock==3.6.1 pytz==2025.2 PyYAML==6.0.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==4.3.2 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 virtualenv==20.16.2 watchdog==2.3.1 zipp==3.6.0
name: conda-devenv channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - bump2version==1.0.1 - bumpversion==0.6.0 - cffi==1.15.1 - charset-normalizer==2.0.12 - coverage==6.2 - cryptography==40.0.2 - distlib==0.3.9 - docutils==0.17.1 - filelock==3.4.1 - flake8==5.0.4 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.2.0 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - mccabe==0.7.0 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pycparser==2.21 - pyflakes==2.5.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-datadir==1.4.1 - pytest-mock==3.6.1 - pytz==2025.2 - pyyaml==6.0.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==4.3.2 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - virtualenv==20.16.2 - watchdog==2.3.1 - zipp==3.6.0 prefix: /opt/conda/envs/conda-devenv
[ "tests/test_main.py::test_handle_input_file[True-environment.yml-0]" ]
[ "tests/test_main.py::test_handle_input_file[True-environment.devenv.yml-1]", "tests/test_main.py::test_handle_input_file[False-environment.devenv.yml-1]", "tests/test_main.py::test_print[environment.devenv.yml]", "tests/test_main.py::test_print_full" ]
[ "tests/test_main.py::test_handle_input_file[False-environment.yml-0]", "tests/test_main.py::test_print[environment.yml]" ]
[]
MIT License
1,207
[ "HISTORY.rst", "conda_devenv/devenv.py" ]
[ "HISTORY.rst", "conda_devenv/devenv.py" ]
davebshow__goblin-54
cc152a9c8e5eca92715721ae26d0ec94703818a9
2017-04-24 15:08:54
cc152a9c8e5eca92715721ae26d0ec94703818a9
diff --git a/goblin/element.py b/goblin/element.py index a80d427..ff5e37b 100644 --- a/goblin/element.py +++ b/goblin/element.py @@ -178,6 +178,7 @@ class VertexProperty(Vertex, abc.BaseProperty): self._data_type = data_type self._default = default self._db_name = db_name + self._val = None if card is None: card = Cardinality.single self._cardinality = card
Issues with Sphinx: `VertexProperty` Missing Attribute Build failure in sphinx: ``` File "/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 862, in filter_members not keep, self.options) File "/lib/python3.5/site-packages/sphinx/application.py", line 593, in emit_firstresult for result in self.emit(event, *args): File "/lib/python3.5/site-packages/sphinx/application.py", line 589, in emit results.append(callback(self, *args)) File "/lib/python3.5/site-packages/sphinxcontrib/napoleon/__init__.py", line 428, in _skip_member qualname = getattr(obj, '__qualname__', '') File "/lib/python3.5/site-packages/goblin/element.py", line 211, in __repr__ self._data_type, self.value) File "/lib/python3.5/site-packages/goblin/element.py", line 194, in getvalue return self._val AttributeError: 'SubOption' object has no attribute '_val' ``` `SubOption` is a sub-class of `VertexProperty`: ```python class SubOption(goblin.VertexProperty): a = goblin.Property(goblin.Boolean, default=True) b = goblin.Property(goblin.Boolean, default=True) ``` I hacked `element.py` to get my build to pass by adding `self._val = None` to the class initializer for `VertexProperty` (https://github.com/davebshow/goblin/blob/master/goblin/element.py#L183).
davebshow/goblin
diff --git a/tests/test_properties.py b/tests/test_properties.py index cff8ded..10d546a 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -76,6 +76,12 @@ def test_set_change_vertex_property(person): person.birthplace = 'U of I Hospital' assert person.birthplace.value == 'U of I Hospital' +def test_vertex_property_default(): + """Makes sure that a brand new VertexProperty (i.e., with no value set) is + still representable. Addresses issue #52. + """ + vp = element.VertexProperty(int) + assert repr(vp) == "<VertexProperty(type=0, value=None)" def test_validate_vertex_prop(person): assert not person.birthplace
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-asyncio" ], "pre_install": null, "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiogremlin==3.2.4 aiohttp==1.3.3 async-timeout==4.0.2 attrs==22.2.0 certifi==2021.5.30 chardet==5.0.0 charset-normalizer==2.0.12 coverage==6.2 coveralls==1.1 docopt==0.6.2 -e git+https://github.com/davebshow/goblin.git@cc152a9c8e5eca92715721ae26d0ec94703818a9#egg=goblin idna==3.10 importlib-metadata==4.8.3 inflection==0.3.1 iniconfig==1.1.1 multidict==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-asyncio==0.16.0 PyYAML==3.12 requests==2.27.1 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 yarl==0.9.8 zipp==3.6.0
name: goblin channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiogremlin==3.2.4 - aiohttp==1.3.3 - async-timeout==4.0.2 - attrs==22.2.0 - chardet==5.0.0 - charset-normalizer==2.0.12 - coverage==6.2 - coveralls==1.1 - docopt==0.6.2 - idna==3.10 - importlib-metadata==4.8.3 - inflection==0.3.1 - iniconfig==1.1.1 - multidict==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-asyncio==0.16.0 - pyyaml==3.12 - requests==2.27.1 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - yarl==0.9.8 - zipp==3.6.0 prefix: /opt/conda/envs/goblin
[ "tests/test_properties.py::test_vertex_property_default" ]
[]
[ "tests/test_properties.py::test_set_change_property", "tests/test_properties.py::test_property_default", "tests/test_properties.py::test_validation", "tests/test_properties.py::test_setattr_validation", "tests/test_properties.py::test_set_id_long", "tests/test_properties.py::test_id_class_attr_throws", "tests/test_properties.py::test_set_change_vertex_property", "tests/test_properties.py::test_validate_vertex_prop", "tests/test_properties.py::test_set_change_list_card_vertex_property", "tests/test_properties.py::test_list_card_vertex_property_validation", "tests/test_properties.py::test_set_change_set_card_vertex_property", "tests/test_properties.py::test_set_card_validation_vertex_property", "tests/test_properties.py::test_cant_set_vertex_prop_on_edge", "tests/test_properties.py::test_meta_property_set_update", "tests/test_properties.py::test_meta_property_validation", "tests/test_properties.py::TestString::test_validation", "tests/test_properties.py::TestString::test_to_db", "tests/test_properties.py::TestString::test_to_ogm", "tests/test_properties.py::TestString::test_initval_to_db", "tests/test_properties.py::TestInteger::test_validation", "tests/test_properties.py::TestInteger::test_to_db", "tests/test_properties.py::TestInteger::test_to_ogm", "tests/test_properties.py::TestInteger::test_initval_to_db", "tests/test_properties.py::TestFloat::test_validation", "tests/test_properties.py::TestFloat::test_to_db", "tests/test_properties.py::TestFloat::test_to_ogm", "tests/test_properties.py::TestFloat::test_initval_to_db", "tests/test_properties.py::TestBoolean::test_validation_true", "tests/test_properties.py::TestBoolean::test_validation_false", "tests/test_properties.py::TestBoolean::test_to_db_true", "tests/test_properties.py::TestBoolean::test_to_db_false", "tests/test_properties.py::TestBoolean::test_to_ogm_true", "tests/test_properties.py::TestBoolean::test_to_ogm_false", "tests/test_properties.py::TestBoolean::test_initval_to_db_true" ]
[]
Apache License 2.0
1,208
[ "goblin/element.py" ]
[ "goblin/element.py" ]
naftulikay__mutagen-tools-23
84a04ac4a422feefdb4e9e4dba82fbb7586b1148
2017-04-25 04:00:50
84a04ac4a422feefdb4e9e4dba82fbb7586b1148
diff --git a/src/mutagentools/flac/convert.py b/src/mutagentools/flac/convert.py index 0ce867e..8b0438a 100644 --- a/src/mutagentools/flac/convert.py +++ b/src/mutagentools/flac/convert.py @@ -46,8 +46,8 @@ def convert_flac_to_id3(flac): result.append(convert_genre_to_tcon(tags.pop('genre'), tags.pop('style') if 'style' in tags.keys() else [])) if 'discnumber' in tags.keys(): - result.append(convert_disc_number_to_tpos(tags.pop('discnumber'), - tags.pop('totaldiscs') if 'totaldiscs' in tags.keys() else None)) + result.append(convert_disc_number_to_tpos(first_of_list(tags.pop('discnumber')), + first_of_list(first(pop_keys(tags, 'totaldiscs', 'disctotal'))))) if contains_any(tags.keys(), 'date', 'year'): result.append(convert_date_to_tdrc(first(pop_keys(tags, 'date', 'year')))) @@ -67,7 +67,7 @@ def convert_flac_to_id3(flac): if 'tracknumber' in tags.keys(): tracknumber = first_of_list(tags.pop('tracknumber')) - totaltracks = first_of_list(tags.pop('totaltracks')) if 'totaltracks' in tags.keys() else None + totaltracks = first_of_list(first(pop_keys(tags, 'totaltracks', 'tracktotal'))) if PART_OF_SET.match(tracknumber): # it's a complicated dude
Disc Count isn't Being Copied Properly from EasyTAG FLACs to MP3s **TL;DR** EasyTAG removes the `encoder` tag :unamused: and screws things up with the tags it uses. Three bugs have been identified in `flac2id3`. two of which are fixable in this project: - Prevent EasyTag from removing the `encoder` tag. - [ ] Correctly bring in `tracktotal` into `TRCK` conversions. - [ ] Correctly bring in `disctotal` into `TPOS` conversions.
naftulikay/mutagen-tools
diff --git a/src/mutagentools/flac/tests.py b/src/mutagentools/flac/tests.py index d57b6e9..7f42ec8 100644 --- a/src/mutagentools/flac/tests.py +++ b/src/mutagentools/flac/tests.py @@ -242,6 +242,62 @@ class FullConversionTestCase(unittest.TestCase): self.assertEqual(['Artist'], id3.get('TPE1')) self.assertEqual(2017, int(str(id3.get('TDRC').text[0]))) + def test_convert_tracktotal(self): + """Tests that converting a track number and total number of tracks is accomplished.""" + tags = { + 'tracknumber': '1', + 'totaltracks': '3', + 'tracktotal': '5', + } + + flac_mock = mock.MagicMock() + flac_mock.tags = tags + + id3 = ID3() + list(map(lambda t: id3.add(t), convert_flac_to_id3(flac_mock))) + # make sure that no TXXX tags are created + self.assertEqual(0, len(list( + filter(lambda f: f.FrameID == 'TXXX', id3.values() + )))) + + def test_convert_tracktotal_no_total(self): + """Tests that total track numbers are detected properly.""" + # test that the track got populated singularly + flac_mock = mock.MagicMock() + flac_mock.tags = { 'tracknumber': '1' } + + id3 = ID3() + list(map(lambda t: id3.add(t), convert_flac_to_id3(flac_mock))) + self.assertEqual('01', id3.get('TRCK')) + + def test_convert_disctotal_no_total(self): + """Tests that total disc numbers something something.""" + # test that the track got populated singularly + flac_mock = mock.MagicMock() + flac_mock.tags = { 'discnumber': '1' } + + id3 = ID3() + list(map(lambda t: id3.add(t), convert_flac_to_id3(flac_mock))) + self.assertEqual('1', id3.get('TPOS')) + + def test_convert_disctotal(self): + """Tests that total disc numbers something something.""" + # test that the track got populated singularly + flac_mock = mock.MagicMock() + flac_mock.tags = { + 'discnumber': '1', + 'totaldiscs': '3', + 'disctotal': '5', + } + + id3 = ID3() + list(map(lambda t: id3.add(t), convert_flac_to_id3(flac_mock))) + self.assertEqual('1/3', id3.get('TPOS')) + # make sure that no TXXX tags are created + self.assertEqual(0, len(list( + filter(lambda f: f.FrameID == 'TXXX', id3.values() + )))) + class IndividualConversionTestCase(unittest.TestCase):
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
1.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "ipython", "mock", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
asttokens==3.0.0 decorator==5.2.1 exceptiongroup==1.2.2 executing==2.2.0 iniconfig==2.1.0 ipython==8.18.1 jedi==0.19.2 matplotlib-inline==0.1.7 mock==5.2.0 mutagen==1.47.0 -e git+https://github.com/naftulikay/mutagen-tools.git@84a04ac4a422feefdb4e9e4dba82fbb7586b1148#egg=mutagentools packaging==24.2 parso==0.8.4 pexpect==4.9.0 pluggy==1.5.0 prompt_toolkit==3.0.50 ptyprocess==0.7.0 pure_eval==0.2.3 Pygments==2.19.1 pytest==8.3.5 six==1.17.0 stack-data==0.6.3 tomli==2.2.1 traitlets==5.14.3 typing_extensions==4.13.0 wcwidth==0.2.13 zc.buildout==4.1.4
name: mutagen-tools channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - asttokens==3.0.0 - decorator==5.2.1 - exceptiongroup==1.2.2 - executing==2.2.0 - iniconfig==2.1.0 - ipython==8.18.1 - jedi==0.19.2 - matplotlib-inline==0.1.7 - mock==5.2.0 - mutagen==1.47.0 - packaging==24.2 - parso==0.8.4 - pexpect==4.9.0 - pluggy==1.5.0 - prompt-toolkit==3.0.50 - ptyprocess==0.7.0 - pure-eval==0.2.3 - pygments==2.19.1 - pytest==8.3.5 - six==1.17.0 - stack-data==0.6.3 - tomli==2.2.1 - traitlets==5.14.3 - typing-extensions==4.13.0 - wcwidth==0.2.13 - zc-buildout==4.1.4 prefix: /opt/conda/envs/mutagen-tools
[ "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_disctotal", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_tracktotal" ]
[]
[ "src/mutagentools/flac/tests.py::MainTestCase::test_to_json_dict", "src/mutagentools/flac/tests.py::MainTestCase::test_to_json_dict_flatten", "src/mutagentools/flac/tests.py::MainTestCase::test_to_json_dict_pictures", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_disctotal_no_total", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_flac_to_id3", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_flac_to_id3_adds_tpos", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_flac_to_id3_duplicates", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_flac_to_id3_track", "src/mutagentools/flac/tests.py::FullConversionTestCase::test_convert_tracktotal_no_total", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_album_to_talb", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_albumartist_to_tpe2", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_artist_to_tpe1", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_composer_to_tcom", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_date_to_tdrc", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_disc_number_to_tpos", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_encoded_by_to_txxx", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_encoder_settings_to_txxx", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_encoder_to_txxx", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_generic_to_txxx", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_genre_to_tcon", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_length_to_tlen", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_mbid_to_ufid", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_organization_to_tpub", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_picture_to_apic", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_title_to_tit2", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_toc_to_mcdi_bytes", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_toc_to_mcdi_str", "src/mutagentools/flac/tests.py::IndividualConversionTestCase::test_convert_tracknumber_to_trck" ]
[]
MIT License
1,209
[ "src/mutagentools/flac/convert.py" ]
[ "src/mutagentools/flac/convert.py" ]
velp__nocexec-5
593494ad2e0735ad7b6bd03d726646a77ebd6e1c
2017-04-25 10:15:19
593494ad2e0735ad7b6bd03d726646a77ebd6e1c
diff --git a/README.md b/README.md index 53dccfd..af40ce1 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,10 @@ Supported protocols for connecting to devices: * Telnet * [NetConf](https://tools.ietf.org/html/rfc6241) -The following vendors of network equipment are supported (now in development, see the issues): - * Cisco (IOS) - * Juniper (JunOS) - * Extreme (XOS) +The following vendors of network equipment are supported: + * Cisco: IOS (SSH, Telnet) + * Juniper: JunOS (NetConf only) + * Extreme networks: ExtremeXOS (SSH, Telnet) ## Installation NOCExec can be installed from PyPi: @@ -21,7 +21,7 @@ NOCExec can be installed from PyPi: pip install nocexec ``` -## Usage +## Examples Using a basic SSH client ```python @@ -43,13 +43,59 @@ Using a basic NetConf client ... if cli.compare() is not None: ... cli.commit() ... - '<rpc-reply message-id="urn:uuid:a89b27fb-209c-4e61-9a38-993b51b54eae">\n - <system-uptime-information>\n - <current-time>\n + '<rpc-reply message-id="urn:uuid:a89b27fb-209c-4e61-9a38-993b51b54eae">\n<system-uptime-information>\n<current-time>\n ..... - </current-time>\n - </system-uptime-information>\n - </rpc-reply>\n' + </current-time>\n</system-uptime-information>\n</rpc-reply>\n' +``` + +Using driver for Juniper device with JunOS operating system: + +```python + >>> from nocexec.drivers.juniper import JunOS + >>> with JunOS("192.168.0.1", "user", "password") as cli: + ... cli.edit("set interfaces ae0.0 description Test") + ... cli.save() + ... + <ncclient.xml_.NCElement object at 0x7fd9581d6c90> + True + >>> with JunOS("192.168.0.1", "user", "password") as cli: + ... cli.view("show system uptime", tostring=True) + ... + '<rpc-reply message-id="urn:uuid:ea3192f8-3e94-4565-86ce-c81f07269845">\n <system-uptime-information>\n <current-time>\n <date-time seconds="1493113938">2017-04-25 12:52:18 MSK</date-time>\n </current-time>\n <system-booted-time>\n <date-time seconds="1490603699">2017-03-27 11:34:59 MSK</date-time>\n <time-length seconds="2510239">4w1d 01:17</time-length>\n </system-booted-time>\n <protocols-started-time>\n <date-time seconds="1490749306">2017-03-29 04:01:46 MSK</date-time>\n <time-length seconds="2364632">3w6d 08:50</time-length>\n </protocols-started-time>\n <last-configured-time>\n <date-time seconds="1493113807">2017-04-25 12:50:07 MSK</date-time>\n <time-length seconds="131">00:02:11</time-length>\n <user>vponomarev</user>\n </last-configured-time>\n <uptime-information>\n <date-time seconds="1493113938">\n12:52PM\n</date-time>\n <up-time seconds="2510269">\n29 days, 1:17\n</up-time>\n <active-user-count format="2 users">\n2\n</active-user-count>\n <load-average-1>\n0.02\n</load-average-1>\n <load-average-5>\n0.07\n</load-average-5>\n <load-average-15>\n0.07\n</load-average-15>\n </uptime-information>\n </system-uptime-information>\n</rpc-reply>\n' +``` + +Using driver for Cisco device with IOS operating system: + +```python + >>> from nocexec.drivers.cisco import IOS + >>> with IOS("192.168.0.1", "user", "password") as cli: + ... cli.edit("interface FastEthernet 0/31") + ... cli.edit("description Test") + ... cli.save() + ... + ['interface FastEthernet 0/31'] + ['description Test'] + True + >>> with IOS("192.168.0.1", "user", "password") as cli: + ... cli.view("sh run interface Fa0/31") + ... + ['sh run interface Fa0/31', 'Building configuration...', '', 'Current configuration : 126 bytes', '!', 'interface FastEthernet0/31', ' description Test', ' switchport access vlan 9', ' switchport mode access', ' spanning-tree portfast', 'end', ''] +``` + +Using driver for Extreme networks device with XOS operating system: + +```python + >>> from nocexec.drivers.extreme import XOS + >>> with XOS("192.168.0.1", "user", "password") as cli: + ... cli.edit("create vlan Test tag 1000") + ... cli.save() + ... + [' create vlan Test tag 1000', '', '* '] + True + >>> with XOS("192.168.0.1", "user", "password") as cli: + ... cli.view("show switch") + ... + [' show switch', '', '', 'SysName: swm', 'SysLocation: ', 'SysContact: ', 'System MAC: 00:04:96:52:D9:8D', 'System Type: X670-48x', '', 'SysHealth check: Enabled (Normal)', 'Recovery Mode: All', 'System Watchdog: Enabled', '', 'Current Time: Tue Apr 25 14:02:30 2017', 'Timezone: [Auto DST Disabled] GMT Offset: 240 minutes, name is not set.', 'Boot Time: Mon Mar 20 20:27:10 2017', 'Boot Count: 23', 'Next Reboot: None scheduled', 'System UpTime: 35 days 17 hours 35 minutes 20 seconds ', '', 'Current State: OPERATIONAL ', 'Image Selected: primary ', 'Image Booted: primary ', 'Primary ver: 15.3.2.11 ', 'Secondary ver: 12.6.2.10 ', '', 'Config Selected: primary.cfg ', 'Config Booted: primary.cfg ', '', 'primary.cfg Created by ExtremeXOS version 15.3.2.11', ' 254518 bytes saved on Tue Apr 25 14:01:57 2017'] ``` ## Tests diff --git a/nocexec/__init__.py b/nocexec/__init__.py index 02c0369..c360b5e 100644 --- a/nocexec/__init__.py +++ b/nocexec/__init__.py @@ -54,8 +54,21 @@ from nocexec.exception import SSHClientError, TelnetClientError, \ LOG = logging.getLogger('nocexec') +__all__ = ['TelnetClient', 'SSHClient', 'NetConfClient'] -class TelnetClient(object): # pylint: disable=too-few-public-methods + +class ContextClient(object): # pylint: disable=too-few-public-methods + """Context manager class for all clients and drivers""" + + def __enter__(self): + self.connect() # pylint: disable=no-member + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.disconnect() # pylint: disable=no-member + + +class TelnetClient(ContextClient): # pylint: disable=too-few-public-methods """ A client class for connecting to devices using the telnet protocol and executing commands. @@ -63,7 +76,7 @@ class TelnetClient(object): # pylint: disable=too-few-public-methods pass -class SSHClient(object): +class SSHClient(ContextClient): """ A client class for connecting to devices using the SSH protocol and executing commands. @@ -71,10 +84,12 @@ class SSHClient(object): :param device: domain or ip address of device (default: "") :param login: username for authorization on device (default: "") :param password: password for authorization on device (default: "") + :param port: SSH port for connection :param timeout: timeout waiting for connection (default: 5) :type device: string :type login: string :type password: string + :type port: int :type timeout: int :Example: @@ -91,22 +106,17 @@ class SSHClient(object): raises exceptions inherited from SSHClientError exception """ - def __init__(self, device="", login="", password="", timeout=5): + # pylint: disable=too-many-arguments + def __init__(self, device="", login="", password="", port=22, timeout=5): self.ssh_options = {"UserKnownHostsFile": "/dev/null", "StrictHostKeyChecking": "no", "PubkeyAuthentication": "no"} self.device = device + self.port = port self.login = login self.password = password self.timeout = timeout - self.cli = None - - def __enter__(self): - self.connect() - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.disconnect() + self.connection = None def disconnect(self): """ @@ -115,7 +125,7 @@ class SSHClient(object): .. note:: not raises exceptions. """ - self.cli.close() + self.connection.close() def connect(self): """ @@ -126,20 +136,21 @@ class SSHClient(object): """ opts = " ".join(["-o%s=%s" % (k, v) for k, v in self.ssh_options.items()]) - conn_cmd = 'ssh {0} {1}@{2}'.format(opts, self.login, self.device) - self.cli = pexpect.spawn(conn_cmd, timeout=self.timeout) + conn_cmd = 'ssh {0} -p {1} {2}@{3}'.format( + opts, self.port, self.login, self.device) + self.connection = pexpect.spawn(conn_cmd, timeout=self.timeout) LOG.debug("SSH client command: %s", conn_cmd) - if self.cli is None: + if self.connection is None: LOG.error("SSH spawn error to host %s", self.device) raise SSHClientError( "SSH spawn error to host {0}".format(self.device)) - answ = self.cli.expect(['.?assword.*:', - pexpect.EOF, pexpect.TIMEOUT]) + answ = self.connection.expect(['.?assword.*:', + pexpect.EOF, pexpect.TIMEOUT]) # Catch password request if answ == 0: - self.cli.sendline(self.password) - answ = self.cli.expect(['>', '#', 'Permission denied', - pexpect.EOF, pexpect.TIMEOUT]) + self.connection.sendline(self.password) + answ = self.connection.expect(['>', '#', 'Permission denied', + pexpect.EOF, pexpect.TIMEOUT]) # Check promt if not answ > 1: LOG.debug("Connect and login successful on %s", self.device) @@ -162,7 +173,7 @@ class SSHClient(object): def execute(self, command, wait=None, timeout=10): """ - Execute the command on the device with the expected result and error + Running a command on the device with the expected result and error handling. :param command: sent command @@ -183,8 +194,11 @@ class SSHClient(object): if isinstance(wait, list): ex = wait + ex LOG.debug("execute command '%s'", command) - self.cli.sendline(command) - answ = self.cli.expect(ex, timeout=timeout) + self.connection.sendline(command) + answ = self.connection.expect(ex, timeout=timeout) + LOG.debug("expect (regex): %s", ex) + before = self.connection.before.splitlines() + LOG.debug("lines before expect: %s", before) # Catch EOF if answ == len(ex) - 1: LOG.error("execute command '%s' EOF error", command) @@ -195,7 +209,7 @@ class SSHClient(object): LOG.error("execute command '%s' timeout", command) raise SSHClientExecuteCmdError( "Execute command '{0}' timeout".format(command)) - return self.cli.before.splitlines() + return before def send(self, command): """ @@ -209,10 +223,11 @@ class SSHClient(object): not raises exceptions. """ LOG.debug("send command '%s'", command) - self.cli.sendline(command) + self.connection.sendline(command) -class NetConfClient(object): # pylint: disable=too-many-instance-attributes +# pylint: disable=too-many-instance-attributes +class NetConfClient(ContextClient): """ A client class for connecting to devices using the NetConf protocol (RFC6241) and executing commands. @@ -259,14 +274,15 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-arguments def __init__(self, device="", login="", password="", timeout=5, - exclusive=True, ignore_rpc_errors=None): + device_params=None, exclusive=True, ignore_rpc_errors=None): self.device = device self.login = login self.password = password self.timeout = timeout - self.cli = None + self.connection = None self.exclusive = exclusive self._configuration_lock = False + self.device_params = device_params or {'name': 'junos'} if ignore_rpc_errors is None: self.ignore_rpc_errors = [ # delete not existing configuration @@ -274,13 +290,6 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes # clear not exist entry "no entry for"] - def __enter__(self): - self.connect() - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.disconnect() - def _ignored_rpc_error(self, error): """ Check error ignored or not. @@ -307,7 +316,7 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes """ if self.exclusive: self.unlock() - self.cli.close_session() + self.connection.close_session() def connect(self): """ @@ -318,13 +327,13 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes occurs. """ try: - self.cli = manager.connect(host=self.device, - port=22, - username=self.login, - password=self.password, - timeout=self.timeout, - device_params={'name': 'junos'}, - hostkey_verify=False) + self.connection = manager.connect(host=self.device, + port=22, + username=self.login, + password=self.password, + timeout=self.timeout, + device_params=self.device_params, + hostkey_verify=False) except AuthenticationError: LOG.error("authentication failed on '%s'", self.device) raise NetConfClientError( @@ -333,7 +342,7 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes LOG.error("connection to '%s' error: %s", self.device, err) raise NetConfClientError( "Connection to '{0}' error: {1}".format(self.device, err)) - if self.cli is None: + if self.connection is None: LOG.error("connection to '%s' error: manager return " "None object", self.device) raise NetConfClientError("Connection to '{0}' error: manager " @@ -357,9 +366,9 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes """ try: if action == "unlock": - lock_res = self.cli.unlock() + lock_res = self.connection.unlock() else: - lock_res = self.cli.lock() + lock_res = self.connection.lock() if lock_res.xpath('//ok'): self._configuration_lock = not self._configuration_lock LOG.debug("%s configuration on '%s'", action, self.device) @@ -424,7 +433,7 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes """ LOG.debug("execute edit command '%s'", command) try: - result = self.cli.load_configuration( + result = self.connection.load_configuration( action='set', config=[command]) if tostring: return result.tostring @@ -455,8 +464,8 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes LOG.debug("execute view command '%s'", command) try: if tostring: - return self.cli.command(command).tostring - return self.cli.command(command) + return self.connection.command(command).tostring + return self.connection.command(command) except RPCError as err: if self._ignored_rpc_error(err): LOG.info("catch skiped RCP error: %s", str(err)) @@ -474,7 +483,7 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes :returns: differences between versions in unix diff format :rtype: string or None (if no differences) """ - result = self.cli.compare_configuration(version).xpath( + result = self.connection.compare_configuration(version).xpath( '//configuration-information/configuration-output') if result[0].text and result[0].text.rstrip() != '': return result[0].text @@ -491,7 +500,7 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes False, if errors occur """ try: - commit_res = self.cli.commit() + commit_res = self.connection.commit() if commit_res.xpath('//ok'): return True except RPCError as err: @@ -509,9 +518,16 @@ class NetConfClient(object): # pylint: disable=too-many-instance-attributes False, if errors occur """ try: - self.cli.validate() + self.connection.validate() return True except RPCError as err: LOG.error("configuration check on '%s' error: %s", self.device, str(err)) return False + +# pylint: disable=invalid-name +protocols = { + "ssh": SSHClient, + "telnet": TelnetClient, + "netconf": NetConfClient +} diff --git a/nocexec/drivers/__init__.py b/nocexec/drivers/__init__.py new file mode 100644 index 0000000..de668f7 --- /dev/null +++ b/nocexec/drivers/__init__.py @@ -0,0 +1,19 @@ +""" +Module with drivers for connecting to devices from different manufacturers. + +Supported devices: + - Cisco devices with IOS devices + - Extreme netwroks devices with XOS operating system + - Juniper devices with JunOS operating system +""" + +from nocexec.drivers.juniper import JunOS +from nocexec.drivers.cisco import IOS +from nocexec.drivers.extreme import XOS + +# pylint: disable=invalid-name +drivers = { + "CiscoIOS": IOS, + "ExtremeXOS": XOS, + "JuniperJunOS": JunOS +} diff --git a/nocexec/drivers/base.py b/nocexec/drivers/base.py new file mode 100644 index 0000000..9f6ab85 --- /dev/null +++ b/nocexec/drivers/base.py @@ -0,0 +1,39 @@ +""" +Parent driver class from which other drivers are inherited +""" + +import nocexec + +__all__ = ['NOCExecDriver'] + + +# pylint: disable=too-many-instance-attributes +class NOCExecDriver(nocexec.ContextClient): + """ + Parent driver class from which other drivers are inherited + """ + + # pylint: disable=too-many-arguments + def __init__(self, device, login="", password="", port=22, timeout=5, + protocol="ssh"): + self._device = device + self._login = login + self._password = password + self._port = port + self._timeout = timeout + self._protocol = nocexec.protocols.get(protocol) + self._hostname = device + self.cli = None + + def init_client(self): + """Initialize client for protocol""" + self.cli = self._protocol(device=self._device, + login=self._login, + password=self._password, + port=self._port, + timeout=self._timeout) + + def disconnect(self): + """Close the connection if the client is initialized.""" + if self.cli is not None: + self.cli.disconnect() diff --git a/nocexec/drivers/cisco.py b/nocexec/drivers/cisco.py new file mode 100644 index 0000000..cfa79fa --- /dev/null +++ b/nocexec/drivers/cisco.py @@ -0,0 +1,216 @@ +""" +Driver classes for cisco devices. + + - IOS - driver for cisco IOS operating system +""" + +import logging +from nocexec.drivers.base import NOCExecDriver +from nocexec.exception import SSHClientError, TelnetClientError, \ + NOCExecError, SSHClientExecuteCmdError, TelnetClientExecuteCmdError + + +LOG = logging.getLogger('nocexec.drivers.cisco') + +__all__ = ['IOSError', 'IOSCommandError', 'IOS'] + + +class IOSError(NOCExecError): + """ + The base exception class for Cisco IOS driver + """ + pass + + +class IOSCommandError(IOSError): + """ + The exception class for command errors + """ + pass + + +class IOS(NOCExecDriver): # pylint: disable=too-many-instance-attributes + """ + A driver class for connecting to Cisco IOS devices using the SSH or Telnet + protocol and executing commands. + + :param device: domain or ip address of device (default: "") + :param login: username for authorization on device (default: "") + :param password: password for authorization on device (default: "") + :param port: port number for connection (default: 22) + :param timeout: timeout waiting for connection (default: 5) + :param protocol: use protocol ('ssh' or 'telnet') for + connection (default: "ssh") + :type device: string + :type login: string + :type password: string + :type port: int + :type timeout: int + :type protocol: string + + :Example: + + >>> from nocexec.drivers.cisco import IOS + >>> with IOS("192.168.0.1", "user", "password") as cli: + ... for l in cli.view("show system mtu"): + ... print(l) + ['', 'System MTU size is 1500 bytes', 'System Jumbo MTU size is 1500 + bytes', 'System Alternate MTU size is 1500 bytes', 'Routing MTU size is + 1500 bytes'] + + .. seealso:: :class:`nocexec.drivers.juniper.JunOS` and + :class:`nocexec.drivers.extreme.XOS` + .. note:: + raises exceptions inherited from IOSError exception + """ + + def __init__(self, *args, **kwargs): + super(IOS, self).__init__(*args, **kwargs) + self._shell_prompt = "#" + self._config_prompt = r"\(config.*?\)#" + self._priv_mode = False + self._config_mode = False + + def _prepare_shell(self): + # disable clipaging, check permission level nad fill hostname + shell_ends = ['>', '#'] + self.cli.connection.sendline("terminal length 0") + answ = self.cli.connection.expect(shell_ends) + self._hostname = self.cli.connection.before.splitlines()[-1] + self._shell_prompt = self._hostname + "#" + self._config_prompt = self._hostname + self._config_prompt + self._priv_mode = bool(answ) + + def _enable_privileged(self): + try: + self.cli.execute("enable", wait=[self._hostname + "#"]) + self._shell_prompt = self._hostname + "#" + self._priv_mode = True + return True + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError): + return False + + def _disable_privileged(self): + try: + self.cli.execute("disable", wait=[self._hostname + ">"]) + self._shell_prompt = self._hostname + ">" + self._priv_mode = False + return True + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError): + return False + + def _enter_config(self): + if not self._priv_mode and not self._enable_privileged(): + LOG.error("unregistered mode is used") + return False + if self._config_mode: + return True + try: + self.cli.execute("configure terminal", + wait=[self._config_prompt]) + self._config_mode = True + return True + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + LOG.error("enter config mode error: %s", str(err)) + return False + + def _exit_config(self): + if not self._config_mode: + return True + try: + self.cli.execute("end", wait=[self._shell_prompt]) + self._config_mode = False + return True + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + LOG.error("enter config mode error: %s", str(err)) + return False + + def connect(self): + """ + Connection to the device via the specified protocol. + + .. note:: + raises an exception IOSError if a connection error occurs. + """ + super(IOS, self).init_client() + try: + self.cli.connect() + except (SSHClientError, TelnetClientError) as err: + raise IOSError(err) + self._prepare_shell() + + def edit(self, command): + """ + Running a command on the Cisco IOS device in configuration mode with + the expected result and error handling. Before executing the command, + the access level is checked and the configuration mode is enabled. + + :param command: sent command + :type command: string + :returns: list of lines with the result of the command execution + :rtype: list of lines + + .. warning:: command is required argument + .. note:: + raises an exception IOSError if connection not established. + raises an exception IOSCommandError if an error occurs. + """ + if self.cli is None: + raise IOSError("no connection to the device") + if not self._enter_config(): + raise IOSCommandError("can not enter configuration mode") + try: + result = self.cli.execute( + command=command, wait=[self._config_prompt]) + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + raise IOSCommandError(err) + return result + + def view(self, command): + """ + Running a command on the Cisco IOS device in view mode with + the expected result and error handling. Before executing the command, + the configuration mode is disabled. + + :param command: sent command + :type command: string + :returns: list of lines with the result of the command execution + :rtype: list of lines + + .. warning:: command is required argument + .. note:: + raises an exception IOSError if connection not established. + raises an exception IOSCommandError if an error occurs. + """ + if self.cli is None: + raise IOSError("no connection to the device") + if not self._exit_config(): + raise IOSCommandError("can not exit the configuration mode") + try: + result = self.cli.execute( + command=command, wait=[self._shell_prompt]) + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + raise IOSCommandError(err) + return result + + def save(self): + """ + Saving the configuration on the device + + :returns: True if configuration saved, False if not + :rtype: bool + + .. note:: + not raises exceptions. + """ + if self.cli is None: + return False + if not self._exit_config(): + return False + try: + self.cli.execute(command="write memory", wait=[r"\[OK\]"]) + return True + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + LOG.error("CiscoIOS save configuration on device '%s' error: %s", + self._device, str(err)) + return False diff --git a/nocexec/drivers/extreme.py b/nocexec/drivers/extreme.py new file mode 100644 index 0000000..b0da521 --- /dev/null +++ b/nocexec/drivers/extreme.py @@ -0,0 +1,162 @@ +""" +Driver classes for Extreme networks devices. + + - XOS - driver for extreme XOS operating system +""" + + +import logging +import re +from nocexec.drivers.base import NOCExecDriver +from nocexec.exception import SSHClientError, TelnetClientError, \ + NOCExecError, SSHClientExecuteCmdError, TelnetClientExecuteCmdError + + +LOG = logging.getLogger('nocexec.drivers.extreme') + +__all__ = ['XOSError', 'XOSCommandError', 'XOS'] + + +class XOSError(NOCExecError): + """ + The base exception class for Extreme XOS driver + """ + pass + + +class XOSCommandError(XOSError): + """ + The exception class for command errors + """ + pass + + +class XOS(NOCExecDriver): # pylint: disable=too-many-instance-attributes + """ + A driver class for connecting to Cisco IOS devices using the SSH or Telnet + protocol and executing commands. + + :param device: domain or ip address of device (default: "") + :param login: username for authorization on device (default: "") + :param password: password for authorization on device (default: "") + :param port: port number for connection (default: 22) + :param timeout: timeout waiting for connection (default: 5) + :param protocol: use protocol ('ssh' or 'telnet') for + connection (default: "ssh") + :type device: string + :type login: string + :type password: string + :type port: int + :type timeout: int + :type protocol: string + + :Example: + + >>> from nocexec.drivers.extreme import XOS + >>> with XOS("192.168.0.1", "user", "password") as cli: + ... for l in cli.view("show system mtu"): + ... print(l) + ['', 'SysName: extreme-switch', ............ + + .. seealso:: :class:`nocexec.drivers.juniper.JunOS` and + :class:`nocexec.drivers.cisco.IOS` + .. note:: + raises exceptions inherited from XOSError exception + """ + + def __init__(self, *args, **kwargs): + super(XOS, self).__init__(*args, **kwargs) + self._cmd_num = 2 + self._last_cmd = "" + + def _prepare_shell(self): + # disable clipaging, check permission level nad fill hostname + self.cli.connection.sendline("disable clipaging") + self.cli.connection.expect('.{0} #'.format(self._cmd_num)) + self._hostname = self.cli.connection.before.splitlines()[-1] + + @staticmethod + def _is_error(cmd_result_lines): + text = '|'.join(cmd_result_lines) + errors = [r'Invalid .* detected.*[.]', + r'Error:.*[.]'] + for error in errors: + if re.findall(error, text): + return True + return False + + def connect(self): + """ + Connection to the device via the specified protocol. + + .. note:: + raises an exception XOSError if a connection error occurs. + """ + super(XOS, self).init_client() + try: + self.cli.connect() + except (SSHClientError, TelnetClientError) as err: + raise XOSError(err) + self._prepare_shell() + + def edit(self, command): + """ + Since there is no configuration mode in the Extreme networks devices, + this function is a wrapper over the view() function for driver + compatibility. + """ + return self.view(command) + + def view(self, command): + """ + Running a command on the extreme XOS device with the expected result + and error handling. + + :param command: sent command + :type command: string + :returns: list of lines with the result of the command execution + :rtype: list of lines + + .. warning:: command is required argument + .. note:: + raises an exception XOSError if connection not established. + raises an exception XOSCommandError if an error occurs. + """ + if self.cli is None: + raise XOSError("no connection to the device") + shell_prompt = self._hostname + ".{0} #" + if command != self._last_cmd: + self._cmd_num += 1 + self._last_cmd = command + try: + result = self.cli.execute( + command=command, wait=[shell_prompt.format(self._cmd_num)]) + if self._is_error(result): + raise XOSCommandError('\n'.join(result)) + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + raise XOSCommandError(err) + return result + + def save(self): + """ + Saving the primary configuration on the device + + :returns: True if configuration saved, False if not + :rtype: bool + + .. note:: + not raises exceptions. + """ + if self.cli is None: + return False + try: + self.cli.execute(command="save configuration primary", + wait=["Do you want to save configuration to " + "primary.cfg and overwrite it?"]) + self.cli.execute(command="Yes", wait=["Configuration saved to " + "primary.cfg successfully."]) + return True + except (SSHClientExecuteCmdError, TelnetClientExecuteCmdError) as err: + LOG.error("ExtremeXOS save configuration on device '%s' error: %s", + self._device, str(err)) + return False diff --git a/nocexec/drivers/juniper.py b/nocexec/drivers/juniper.py new file mode 100644 index 0000000..144063a --- /dev/null +++ b/nocexec/drivers/juniper.py @@ -0,0 +1,171 @@ +""" +Driver classes for Juniper devices. + + - JunOS - driver for Juniper JunOS operating system +""" +import logging +from nocexec.drivers.base import NOCExecDriver +from nocexec.exception import NOCExecError, NetConfClientError, \ + NetConfClientExecuteCmdError + + +LOG = logging.getLogger('nocexec.drivers.juniper') + +__all__ = ['JunOSError', 'JunOSCommandError', 'JunOS'] + + +class JunOSError(NOCExecError): + """ + The base exception class for Juniper JunOS driver + """ + pass + + +class JunOSCommandError(JunOSError): + """ + The exception class for command errors + """ + pass + + +class JunOS(NOCExecDriver): + """ + A driver class for connecting to Juniper JunOS devices using the NetConf + protocol and executing commands. + + :param device: domain or ip address of device (default: "") + :param login: username for authorization on device (default: "") + :param password: password for authorization on device (default: "") + :param port: port number for connection (default: 22) + :param timeout: timeout waiting for connection (default: 5) + :type device: string + :type login: string + :type password: string + :type port: int + :type timeout: int + + :Example: + + >>> from nocexec.drivers.juniper import JunOS + >>> with JunOS("192.168.0.1", "user", "password") as cli: + ... for l in cli.view("show system uptime", tostring=True): + ... print(l) + ['Current time: 2017-04-24 14:54:04 MSK', 'System booted: 2017-03-27 + 11:34:59 MSK (4w0d 03:19 ago)'............... + + .. seealso:: :class:`nocexec.drivers.juniper.JunOS` and + :class:`nocexec.drivers.extreme.XOS` + .. note:: + raises exceptions inherited from IOSError exception + """ + + def __init__(self, *args, **kwargs): # pylint: disable=too-many-arguments + super(JunOS, self).__init__(protocol="netconf", *args, **kwargs) + + def connect(self): + """ + Connection to the device via the specified protocol. + + .. note:: + raises an exception JunOSError if a connection error occurs. + """ + self.cli = self._protocol(device=self._device, + login=self._login, + password=self._password, + timeout=self._timeout, + exclusive=False, + device_params={'name': 'junos'}) + try: + self.cli.connect() + except NetConfClientError as err: + raise JunOSError(err) + # only exclusive mode + if not self.cli.lock(): + raise JunOSError("configuration lock error") + + def disconnect(self): + """ + Unlock configuration and close connection. + + .. note:: + not raises exceptions. + """ + if self.cli is not None: + self.cli.unlock() + self.cli.disconnect() + + def edit(self, command, tostring=False): + """ + Running a command on the Juniper JunOS device in configuration mode + with the expected result and error handling. + + :param command: sent command + :param tostring: enable or disable converting to + string (default: False) + :type command: string + :type tostring: bool + :returns: result of the command execution + :rtype: list of lines or etree Element (if tostring == False) + + .. warning:: command is required argument + .. note:: + raises an exception JunOSError if connection not established. + raises an exception JunOSCommandError if an error occurs. + """ + if self.cli is None: + raise JunOSError("no connection to the device") + try: + result = self.cli.edit(command=command, tostring=tostring) + except NetConfClientExecuteCmdError as err: + raise JunOSCommandError(err) + return result + + def view(self, command, tostring=False): + """ + Running a command on the Juniper JunOS device in view mode + with the expected result and error handling. + + :param command: sent command + :param tostring: enable or disable converting to + string (default: False) + :type command: string + :type tostring: bool + :returns: result of the command execution + :rtype: list of lines or etree Element (if tostring == False) + + .. warning:: command is required argument + .. note:: + raises an exception JunOSError if connection not established. + raises an exception JunOSCommandError if an error occurs. + """ + if self.cli is None: + raise JunOSError("no connection to the device") + try: + result = self.cli.view(command=command, tostring=tostring) + except NetConfClientExecuteCmdError as err: + raise JunOSCommandError(err) + return result + + def save(self): + """ + Saving the configuration on the device. Before saving, the + configuration is checked for errors, and if any changes were made. If + no changes were made, the save command is not called on the device, + but the function returns true. + + :returns: True if configuration saved, False if not + :rtype: bool + + .. note:: + not raises exceptions. + """ + if self.cli.validate(): + if self.cli.compare() is not None: + if not self.cli.commit(): + LOG.error("don't commit configuration on '%s'", + self._device) + return False + return True + else: + LOG.error("error in device configuration") + return False diff --git a/nocexec/exception.py b/nocexec/exception.py index 74499f2..8c84f23 100644 --- a/nocexec/exception.py +++ b/nocexec/exception.py @@ -40,6 +40,14 @@ class SSHClientExecuteCmdError(SSHClientError): pass +class TelnetClientExecuteCmdError(TelnetClientError): + """ + The exception class for errors that occurred during the execution of + commands + """ + pass + + class NetConfClientExecuteCmdError(SSHClientError): """ The exception class for errors that occurred during the execution of diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..224a779 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md \ No newline at end of file diff --git a/setup.py b/setup.py index 3270725..04a460b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ import sys import os from setuptools import setup -if sys.version_info < (2, 6): +if sys.version_info < (2, 7): raise Exception("NOCExec requires Python 2.7 or higher.") # Hard linking doesn't work inside VirtualBox shared folders. This means that @@ -23,7 +23,7 @@ if os.path.abspath(__file__).split(os.path.sep)[1] == 'vagrant': setup( name="NOCExec", - version="0.1a", + version="0.2a", packages=["nocexec"], author="Vadim Ponomarev", author_email="[email protected]", @@ -41,7 +41,7 @@ setup( 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: System :: Networking', - 'Topic :: System :: Systems Administratio', + 'Topic :: System :: Systems Administration', 'Topic :: Software Development :: Libraries :: Python Modules' ], install_requires=["pexpect", "ncclient>=0.5"], diff --git a/tox.ini b/tox.ini index 34f1ca7..d826b56 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py33, py34, py35 +envlist = py27, py33, py34, py35, lint skip_missing_interpreters = true [testenv] @@ -20,9 +20,10 @@ deps = py27: mock==1.0 [testenv:lint] +basepython = python3.5 commands = pep8 tests/ nocexec/ - pylint tests/ nocexec/ -r n + pylint --disable=duplicate-code tests/ nocexec/ -r n deps = pep8 pylint
Add base support for CIsco IOS
velp/nocexec
diff --git a/tests/test_nocexec_drivers_base.py b/tests/test_nocexec_drivers_base.py new file mode 100644 index 0000000..d6e8ad4 --- /dev/null +++ b/tests/test_nocexec_drivers_base.py @@ -0,0 +1,42 @@ +""" +Tests for module nocexec.drivers.base +""" + +import unittest +try: + from unittest import mock +except ImportError: # pragma: no cover + import mock +from nocexec import SSHClient +from nocexec.drivers.base import NOCExecDriver + +# pylint: disable=invalid-name,missing-docstring,protected-access + + +class TestNOCExecDriver(unittest.TestCase): + + def setUp(self): + self.c = NOCExecDriver(device="d") + + def test_init(self): + self.assertEqual(self.c._device, "d") + self.assertEqual(self.c._login, "") + self.assertEqual(self.c._password, "") + self.assertEqual(self.c._port, 22) + self.assertEqual(self.c._timeout, 5) + self.assertEqual(self.c._protocol, SSHClient) + self.assertEqual(self.c._hostname, "d") + self.assertEqual(self.c.cli, None) + + def test_init_client(self): + self.c._protocol = mock.Mock() + self.c.init_client() + self.c._protocol.assert_called_with(device='d', login='', password='', + port=22, timeout=5) + self.c.cli = self.c._protocol.return_value + + def test_disconnect(self): + self.c.disconnect() # cli now is None + self.c.cli = mock.Mock() + self.c.disconnect() + self.c.cli.disconnect.assert_called_with() diff --git a/tests/test_nocexec_drivers_cisco.py b/tests/test_nocexec_drivers_cisco.py new file mode 100644 index 0000000..776607e --- /dev/null +++ b/tests/test_nocexec_drivers_cisco.py @@ -0,0 +1,149 @@ +""" +Tests for module nocexec.drivers.cisco +""" + +import unittest +try: + from unittest import mock +except ImportError: # pragma: no cover + import mock +from nocexec.drivers.cisco import IOS, IOSError, IOSCommandError +from nocexec.exception import SSHClientError, SSHClientExecuteCmdError + +# pylint: disable=invalid-name,missing-docstring,protected-access + + +class TestIOS(unittest.TestCase): + + def setUp(self): + self.c = IOS(device="d") + self.c.cli = mock.MagicMock() + + @mock.patch('nocexec.drivers.base.NOCExecDriver.init_client') + def test_connect(self, mock_init_client): + mock_sendline = self.c.cli.connection.sendline + mock_expect = self.c.cli.connection.expect + self.c.cli.connection.before.splitlines.return_value = ["", "hostname"] + self.c.connect() + mock_init_client.assert_called_with() + self.c.cli.connect.assert_called_with() + mock_sendline.assert_called_with("terminal length 0") + mock_expect.assert_called_with(['>', '#']) + self.assertEqual(self.c._hostname, "hostname") + self.assertEqual(self.c._shell_prompt, "hostname#") + self.assertEqual(self.c._config_prompt, r"hostname\(config.*?\)#") + self.assertEqual(self.c._priv_mode, bool(mock_expect.return_value)) + + # Test connection error + @mock.patch('nocexec.drivers.base.NOCExecDriver.init_client') + def test_error_connect(self, mock_init_client): + self.c.cli.connect.side_effect = SSHClientError("error") + with self.assertRaises(IOSError): + self.c.connect() + mock_init_client.assert_called_with() + + def test_enable_privileged(self): + self.assertTrue(self.c._enable_privileged()) + self.c.cli.execute.assert_called_with("enable", wait=["d#"]) + self.assertEqual(self.c._shell_prompt, "d#") + self.assertEqual(self.c._priv_mode, True) + # error + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + self.assertFalse(self.c._enable_privileged()) + + def test_disable_privileged(self): + self.assertTrue(self.c._disable_privileged()) + self.c.cli.execute.assert_called_with("disable", wait=["d>"]) + self.assertEqual(self.c._shell_prompt, "d>") + self.assertEqual(self.c._priv_mode, False) + # error + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + self.assertFalse(self.c._disable_privileged()) + + @mock.patch('nocexec.drivers.cisco.IOS._enable_privileged') + def test_enter_config(self, mock_priv): + self.assertTrue(self.c._enter_config()) + self.c.cli.execute.assert_called_with( + 'configure terminal', wait=[r'\(config.*?\)#']) + # error execute + self.c._priv_mode = True + self.c._config_mode = False + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + self.assertFalse(self.c._enter_config()) + # already config mode + self.c.cli.reset_mock() + self.c._config_mode = True + self.assertTrue(self.c._enter_config()) + self.c.cli.execute.assert_not_called() + # not privilaged mode + self.c._priv_mode = False + mock_priv.return_value = False + self.assertFalse(self.c._enter_config()) + + def test_exit_config(self): + self.assertTrue(self.c._exit_config()) + # exit from config mode + self.c._config_mode = True + self.assertTrue(self.c._exit_config()) + self.c.cli.execute.assert_called_with("end", wait=["#"]) + self.assertFalse(self.c._config_mode) + # command error + self.c._config_mode = True + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + self.assertFalse(self.c._exit_config()) + + @mock.patch('nocexec.drivers.cisco.IOS._enter_config') + def test_edit(self, mock_config): + self.c.cli.execute.return_value = ["l1", "l2"] + self.assertEqual(self.c.edit("test"), ["l1", "l2"]) + self.c.cli.execute.assert_called_with( + command='test', wait=[r'\(config.*?\)#']) + # command error + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + with self.assertRaises(IOSCommandError): + self.assertFalse(self.c.edit("test")) + # not configuration mode + mock_config.return_value = False + with self.assertRaises(IOSCommandError) as err: + self.assertFalse(self.c.edit("test")) + self.assertEqual("can not enter configuration mode", + str(err.exception)) + # client not initilized + self.c.cli = None + with self.assertRaises(IOSError): + self.assertFalse(self.c.edit("test")) + + @mock.patch('nocexec.drivers.cisco.IOS._exit_config') + def test_view(self, mock_config): + self.c.cli.execute.return_value = ["l1", "l2"] + self.assertEqual(self.c.view("test"), ["l1", "l2"]) + self.c.cli.execute.assert_called_with(command='test', wait=['#']) + # command error + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + with self.assertRaises(IOSCommandError): + self.assertFalse(self.c.view("test")) + # not configuration mode + mock_config.return_value = False + with self.assertRaises(IOSCommandError) as err: + self.assertFalse(self.c.view("test")) + self.assertEqual("can not exit the configuration mode", + str(err.exception)) + # client not initilized + self.c.cli = None + with self.assertRaises(IOSError): + self.assertFalse(self.c.view("test")) + + @mock.patch('nocexec.drivers.cisco.IOS._exit_config') + def test_save(self, mock_exit): + self.assertTrue(self.c.save()) + self.c.cli.execute.assert_called_with(command="write memory", + wait=[r"\[OK\]"]) + # error command + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + self.assertFalse(self.c.save()) + # error exit config mode + mock_exit.return_value = False + self.assertFalse(self.c.save()) + # client is None + self.c.cli = None + self.assertFalse(self.c.save()) diff --git a/tests/test_nocexec_drivers_extreme.py b/tests/test_nocexec_drivers_extreme.py new file mode 100644 index 0000000..3c0d6d9 --- /dev/null +++ b/tests/test_nocexec_drivers_extreme.py @@ -0,0 +1,99 @@ +""" +Tests for module nocexec.drivers.extreme +""" + +import unittest +try: + from unittest import mock +except ImportError: # pragma: no cover + import mock +from nocexec.drivers.extreme import XOS, XOSError, XOSCommandError +from nocexec.exception import SSHClientError, SSHClientExecuteCmdError + +# pylint: disable=invalid-name,missing-docstring,protected-access +invalid_input = [' asdasdasd', '', '\x07 ^', + '', "%% Invalid input detected at '^' marker.", ''] +error_input = [' create vlan Test tag 11', '', + 'Error: 802.1Q Tag 11 is assigned to VLAN test.'] +normal = [' show vlan', '', 'test'] + + +class TestXOS(unittest.TestCase): + + def setUp(self): + self.c = XOS(device="d") + self.c.cli = mock.MagicMock() + + @mock.patch('nocexec.drivers.base.NOCExecDriver.init_client') + def test_connect(self, mock_init_client): + mock_sendline = self.c.cli.connection.sendline + mock_expect = self.c.cli.connection.expect + self.c.cli.connection.before.splitlines.return_value = ["", "hostname"] + self.c.connect() + mock_init_client.assert_called_with() + self.c.cli.connect.assert_called_with() + mock_sendline.assert_called_with("disable clipaging") + mock_expect.assert_called_with('.2 #') + self.assertEqual(self.c._hostname, "hostname") + + # Test connection error + @mock.patch('nocexec.drivers.base.NOCExecDriver.init_client') + def test_error_connect(self, mock_init_client): + self.c.cli.connect.side_effect = SSHClientError("error") + with self.assertRaises(XOSError): + self.c.connect() + mock_init_client.assert_called_with() + + def test_is_error(self): + self.assertTrue(self.c._is_error(invalid_input)) + self.assertTrue(self.c._is_error(error_input)) + self.assertFalse(self.c._is_error(normal)) + + def _command_function_test(self, funct): + self.c.cli.execute.return_value = ["l1", "l2"] + # If the command is repeated then the counter self._cmd_num does + # not increase + for _ in range(3): + self.assertEqual(funct("test"), ["l1", "l2"]) + self.c.cli.execute.assert_called_with( + command='test', wait=['d.3 #']) + # but if run new command, counter self._cmd_num does increase + self.assertEqual(funct("test2"), ["l1", "l2"]) + self.c.cli.execute.assert_called_with(command='test2', wait=['d.4 #']) + # check errors in result + for err in [invalid_input, error_input]: + self.c.cli.execute.return_value = err + with self.assertRaises(XOSCommandError): + funct("test2") + self.c.cli.execute.assert_called_with( + command='test2', wait=['d.4 #']) + # execute error + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + with self.assertRaises(XOSCommandError): + self.assertFalse(funct("test")) + # client not initilized + self.c.cli = None + with self.assertRaises(XOSError): + self.assertFalse(funct("test")) + + def test_view(self): + self._command_function_test(self.c.view) + + def test_edit(self): + self._command_function_test(self.c.edit) + + def test_save(self): + call1 = mock.call(command="save configuration primary", + wait=["Do you want to save configuration to primary." + "cfg and overwrite it?"]) + call2 = mock.call(command='Yes', + wait=["Configuration saved to primary.cfg " + "successfully."]) + self.assertTrue(self.c.save()) + self.assertEqual(self.c.cli.execute.mock_calls, [call1, call2]) + # error command + self.c.cli.execute.side_effect = SSHClientExecuteCmdError("error") + self.assertFalse(self.c.save()) + # client is None + self.c.cli = None + self.assertFalse(self.c.save()) diff --git a/tests/test_nocexec_drivers_juniper.py b/tests/test_nocexec_drivers_juniper.py new file mode 100644 index 0000000..6e4e945 --- /dev/null +++ b/tests/test_nocexec_drivers_juniper.py @@ -0,0 +1,87 @@ +""" +Tests for module nocexec.drivers.juniper +""" + +import unittest +try: + from unittest import mock +except ImportError: # pragma: no cover + import mock +from nocexec.drivers.juniper import JunOS, JunOSError, JunOSCommandError +from nocexec.exception import NetConfClientError, NetConfClientExecuteCmdError + +# pylint: disable=invalid-name,missing-docstring,protected-access + + +class TestJunOS(unittest.TestCase): + + def setUp(self): + self.c = JunOS(device="d") + self.c.cli = mock.MagicMock() + + @mock.patch('nocexec.NetConfClient.__init__', return_value=None) + @mock.patch('nocexec.NetConfClient.connect') + @mock.patch('nocexec.NetConfClient.lock') + def test_connect(self, mock_lock, mock_connect, mock_init): + self.c.connect() + mock_init.assert_called_with(device='d', + device_params={'name': 'junos'}, + exclusive=False, login='', + password='', timeout=5) + # not lock + mock_lock.return_value = False + with self.assertRaises(JunOSError): + self.c.connect() + # connect error + mock_connect.side_effect = NetConfClientError("error") + with self.assertRaises(JunOSError): + self.c.connect() + + def test_disconnect(self): + # client initilized + self.c.disconnect() + self.c.cli.unlock.assert_called_with() + self.c.cli.disconnect.assert_called_with() + + def _command_functions_test(self, funct_name): + # get ftesting functions + funct = getattr(self.c, funct_name) + cli_funct = getattr(self.c.cli, funct_name) + # mocking result from client + result = cli_funct.return_value = mock.Mock() + # test base call + self.assertEqual(funct("test"), result) + cli_funct.assert_called_with(command="test", tostring=False) + # test tostring + self.assertEqual(funct("test", True), result) + cli_funct.assert_called_with(command="test", tostring=True) + # test command error + cli_funct.side_effect = NetConfClientExecuteCmdError("error") + with self.assertRaises(JunOSCommandError): + funct("test") + # test client not initilized + self.c.cli = None + with self.assertRaises(JunOSError) as err: + funct("test") + self.assertEqual("no connection to the device", str(err.exception)) + + def test_edit(self): + self._command_functions_test("edit") + + def test_view(self): + self._command_functions_test("view") + + def test_save(self): + self.assertTrue(self.c.save()) + # not commit + self.c.cli.reset_mock() + self.c.cli.commit.return_value = False + self.assertFalse(self.c.save()) + # compare is None (not found changes) + self.c.cli.reset_mock() + self.c.cli.compare.return_value = None + self.assertTrue(self.c.save()) + # errors in config + self.c.cli.reset_mock() + self.c.cli.validate.return_value = False + self.assertFalse(self.c.save()) diff --git a/tests/test_nocexec_module.py b/tests/test_nocexec_module.py index c1416a1..0456a47 100644 --- a/tests/test_nocexec_module.py +++ b/tests/test_nocexec_module.py @@ -44,7 +44,7 @@ class TestSSHClient(unittest.TestCase): login="user", password="pass") # mocking pexpect - self.c.cli = mock.Mock() + self.c.connection = mock.Mock() @mock.patch('nocexec.SSHClient.connect') @mock.patch('nocexec.SSHClient.disconnect') @@ -56,13 +56,13 @@ class TestSSHClient(unittest.TestCase): def test_disconnect(self): self.c.disconnect() - self.c.cli.close.assert_called_with() + self.c.connection.close.assert_called_with() @mock.patch('pexpect.spawn') def test_connect(self, mock_spawn): opts = " ".join(["-o%s=%s" % (k, v) for k, v in self.c.ssh_options.items()]) - cmd = 'ssh {0} user@test'.format(opts) + cmd = 'ssh {0} -p 22 user@test'.format(opts) # Check normal connect mock_spawn.return_value.expect.return_value = 0 self.c.connect() @@ -71,7 +71,7 @@ class TestSSHClient(unittest.TestCase): # check enter password mock_spawn.return_value.sendline.assert_called_with("pass") # check result - self.assertEqual(self.c.cli, mock_spawn.return_value) + self.assertEqual(self.c.connection, mock_spawn.return_value) # Check welcome expect errors for code in [1, 2]: mock_spawn.return_value.expect.return_value = code @@ -86,32 +86,32 @@ class TestSSHClient(unittest.TestCase): mock_spawn.return_value = None with self.assertRaises(SSHClientError) as err: self.c.connect() - self.assertEqual(self.c.cli, None) + self.assertEqual(self.c.connection, None) self.assertIn("SSH spawn error to host test", str(err.exception)) def test_execute(self): - self.c.cli.before.splitlines.return_value = ["line0", "line1"] + self.c.connection.before.splitlines.return_value = ["line0", "line1"] res = self.c.execute(command="test", wait=["#"]) - self.c.cli.sendline.assert_called_with("test") - self.c.cli.expect.assert_called_with( + self.c.connection.sendline.assert_called_with("test") + self.c.connection.expect.assert_called_with( ["#", pexpect.TIMEOUT, pexpect.EOF], timeout=10) self.assertEqual(len(res), 2) for indx in [0, 1]: self.assertEqual(res[indx], "line%s" % indx) # check expect EOF - self.c.cli.expect.return_value = 1 + self.c.connection.expect.return_value = 1 with self.assertRaises(SSHClientExecuteCmdError) as err: self.c.execute(command="test") self.assertIn("Execute command 'test' EOF error", str(err.exception)) # check expect timeout - self.c.cli.expect.return_value = 0 + self.c.connection.expect.return_value = 0 with self.assertRaises(SSHClientExecuteCmdError) as err: self.c.execute(command="test") self.assertIn("Execute command 'test' timeout", str(err.exception)) def test_send(self): self.c.send("test") - self.c.cli.sendline.assert_called_with("test") + self.c.connection.sendline.assert_called_with("test") class TestNetConfClient(unittest.TestCase): @@ -121,7 +121,7 @@ class TestNetConfClient(unittest.TestCase): login="user", password="pass") # mocking pexpect - self.c.cli = mock.Mock() + self.c.connection = mock.Mock() # for xml device_handler = ncclient.manager.make_device_handler( {'name': 'junos'}) @@ -139,7 +139,7 @@ class TestNetConfClient(unittest.TestCase): def test_disconnect(self): self.c.disconnect() - self.c.cli.close_session.assert_called_with() + self.c.connection.close_session.assert_called_with() def test_ignored_rpc_error(self): self.assertTrue(self.c._ignored_rpc_error( @@ -172,12 +172,12 @@ class TestNetConfClient(unittest.TestCase): def test_locking(self): # check lock - self.c.cli.lock.return_value = NCElement( + self.c.connection.lock.return_value = NCElement( good_reply, self.tr) self.assertTrue(self.c._locking("lock")) self.assertTrue(self.c._configuration_lock) # check unlock - self.c.cli.unlock.return_value = NCElement( + self.c.connection.unlock.return_value = NCElement( good_reply, self.tr) self.assertTrue(self.c._locking("unlock")) self.assertFalse(self.c._configuration_lock) @@ -185,16 +185,16 @@ class TestNetConfClient(unittest.TestCase): self.assertTrue(self.c._locking("test")) self.assertTrue(self.c._configuration_lock) # bad RCP reply lock - self.c.cli.lock.return_value = NCElement(bad_reply, self.tr) + self.c.connection.lock.return_value = NCElement(bad_reply, self.tr) self.assertFalse(self.c._locking("lock")) # bad RCP reply unlock - self.c.cli.unlock.return_value = NCElement( + self.c.connection.unlock.return_value = NCElement( bad_reply, self.tr) self.assertFalse(self.c._locking("unlock")) # check RPCError - self.c.cli.lock.side_effect = RPCError(mock.MagicMock()) + self.c.connection.lock.side_effect = RPCError(mock.MagicMock()) self.assertFalse(self.c._locking("lock")) - self.c.cli.unlock.side_effect = RPCError(mock.MagicMock()) + self.c.connection.unlock.side_effect = RPCError(mock.MagicMock()) self.assertFalse(self.c._locking("unlock")) @mock.patch('nocexec.NetConfClient._locking') @@ -218,7 +218,7 @@ class TestNetConfClient(unittest.TestCase): mock_locking.assert_called_with(action="unlock") def test_edit(self): - mock_lc = self.c.cli.load_configuration + mock_lc = self.c.connection.load_configuration self.assertEqual(self.c.edit("test"), mock_lc.return_value) mock_lc.assert_called_with(action='set', config=["test"]) # check tostring @@ -238,7 +238,7 @@ class TestNetConfClient(unittest.TestCase): mock_ig.assert_called_with(mock_lc.side_effect) def test_view(self): - mock_cmd = self.c.cli.command + mock_cmd = self.c.connection.command self.assertEqual(self.c.view("test"), mock_cmd.return_value) # check tostring mock_cmd.return_value = mock.Mock() @@ -257,7 +257,7 @@ class TestNetConfClient(unittest.TestCase): mock_ig.assert_called_with(mock_cmd.side_effect) def test_compare(self): - mock_compare = self.c.cli.compare_configuration + mock_compare = self.c.connection.compare_configuration mock_compare.return_value = NCElement(comp_reply, self.tr) self.assertEqual(self.c.compare().replace(" ", ""), "\ntest\n") mock_compare.assert_called_with(0) @@ -270,7 +270,7 @@ class TestNetConfClient(unittest.TestCase): self.assertEqual(self.c.compare(), None) def test_commit(self): - mock_commit = self.c.cli.commit + mock_commit = self.c.connection.commit mock_commit.return_value = NCElement(good_reply, self.tr) self.assertTrue(self.c.commit()) # bad reply @@ -281,7 +281,7 @@ class TestNetConfClient(unittest.TestCase): self.assertFalse(self.c.commit()) def test_validate(self): - mock_validate = self.c.cli.validate + mock_validate = self.c.connection.validate self.assertTrue(self.c.validate()) mock_validate.assert_called_with() # RPC error
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 5 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "mock>=1.0", "pep8", "pylint", "coverage", "coveralls", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
astroid==3.3.9 bcrypt==4.3.0 certifi==2025.1.31 cffi==1.17.1 charset-normalizer==3.4.1 coverage==7.8.0 coveralls==4.0.1 cryptography==44.0.2 dill==0.3.9 docopt==0.6.2 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work idna==3.10 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work isort==6.0.1 lxml==5.3.1 mccabe==0.7.0 mock==5.2.0 ncclient==0.6.19 -e git+https://github.com/velp/nocexec.git@593494ad2e0735ad7b6bd03d726646a77ebd6e1c#egg=NOCExec packaging @ file:///croot/packaging_1734472117206/work paramiko==3.5.1 pep8==1.7.1 pexpect==4.9.0 platformdirs==4.3.7 pluggy @ file:///croot/pluggy_1733169602837/work ptyprocess==0.7.0 pycparser==2.22 pylint==3.3.6 PyNaCl==1.5.0 pytest @ file:///croot/pytest_1738938843180/work requests==2.32.3 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work tomlkit==0.13.2 typing_extensions==4.13.0 urllib3==2.3.0
name: nocexec channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - astroid==3.3.9 - bcrypt==4.3.0 - certifi==2025.1.31 - cffi==1.17.1 - charset-normalizer==3.4.1 - coverage==7.8.0 - coveralls==4.0.1 - cryptography==44.0.2 - dill==0.3.9 - docopt==0.6.2 - idna==3.10 - isort==6.0.1 - lxml==5.3.1 - mccabe==0.7.0 - mock==5.2.0 - ncclient==0.6.19 - paramiko==3.5.1 - pep8==1.7.1 - pexpect==4.9.0 - platformdirs==4.3.7 - ptyprocess==0.7.0 - pycparser==2.22 - pylint==3.3.6 - pynacl==1.5.0 - requests==2.32.3 - tomlkit==0.13.2 - typing-extensions==4.13.0 - urllib3==2.3.0 prefix: /opt/conda/envs/nocexec
[ "tests/test_nocexec_drivers_base.py::TestNOCExecDriver::test_disconnect", "tests/test_nocexec_drivers_base.py::TestNOCExecDriver::test_init", "tests/test_nocexec_drivers_base.py::TestNOCExecDriver::test_init_client", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_connect", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_disable_privileged", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_edit", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_enable_privileged", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_enter_config", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_error_connect", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_exit_config", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_save", "tests/test_nocexec_drivers_cisco.py::TestIOS::test_view", "tests/test_nocexec_drivers_extreme.py::TestXOS::test_connect", "tests/test_nocexec_drivers_extreme.py::TestXOS::test_edit", "tests/test_nocexec_drivers_extreme.py::TestXOS::test_error_connect", "tests/test_nocexec_drivers_extreme.py::TestXOS::test_is_error", "tests/test_nocexec_drivers_extreme.py::TestXOS::test_save", "tests/test_nocexec_drivers_extreme.py::TestXOS::test_view", "tests/test_nocexec_drivers_juniper.py::TestJunOS::test_connect", "tests/test_nocexec_drivers_juniper.py::TestJunOS::test_disconnect", "tests/test_nocexec_drivers_juniper.py::TestJunOS::test_edit", "tests/test_nocexec_drivers_juniper.py::TestJunOS::test_save", "tests/test_nocexec_drivers_juniper.py::TestJunOS::test_view", "tests/test_nocexec_module.py::TestSSHClient::test_connect", "tests/test_nocexec_module.py::TestSSHClient::test_context", "tests/test_nocexec_module.py::TestSSHClient::test_disconnect", "tests/test_nocexec_module.py::TestSSHClient::test_execute", "tests/test_nocexec_module.py::TestSSHClient::test_send", "tests/test_nocexec_module.py::TestNetConfClient::test_commit", "tests/test_nocexec_module.py::TestNetConfClient::test_compare", "tests/test_nocexec_module.py::TestNetConfClient::test_connect", "tests/test_nocexec_module.py::TestNetConfClient::test_context", "tests/test_nocexec_module.py::TestNetConfClient::test_disconnect", "tests/test_nocexec_module.py::TestNetConfClient::test_edit", "tests/test_nocexec_module.py::TestNetConfClient::test_ignored_rpc_error", "tests/test_nocexec_module.py::TestNetConfClient::test_lock", "tests/test_nocexec_module.py::TestNetConfClient::test_locking", "tests/test_nocexec_module.py::TestNetConfClient::test_unlock", "tests/test_nocexec_module.py::TestNetConfClient::test_validate", "tests/test_nocexec_module.py::TestNetConfClient::test_view" ]
[]
[]
[]
MIT License
1,210
[ "nocexec/drivers/__init__.py", "nocexec/drivers/cisco.py", "nocexec/drivers/extreme.py", "setup.py", "nocexec/drivers/base.py", "nocexec/__init__.py", "nocexec/exception.py", "README.md", "setup.cfg", "tox.ini", "nocexec/drivers/juniper.py" ]
[ "nocexec/drivers/__init__.py", "nocexec/drivers/cisco.py", "nocexec/drivers/extreme.py", "setup.py", "nocexec/drivers/base.py", "nocexec/__init__.py", "nocexec/exception.py", "README.md", "setup.cfg", "tox.ini", "nocexec/drivers/juniper.py" ]
Duke-GCB__DukeDSClient-131
e158990c3f68aef9ed4731aa446cea6d49be2950
2017-04-25 13:35:08
bffebebd86d09f5924461959401ef3698b4e47d5
diff --git a/ddsc/core/localstore.py b/ddsc/core/localstore.py index db0fa4b..9ced1a4 100644 --- a/ddsc/core/localstore.py +++ b/ddsc/core/localstore.py @@ -231,7 +231,14 @@ class LocalFile(object): self.remote_id = remote_id def count_chunks(self, bytes_per_chunk): - return math.ceil(float(self.size) / float(bytes_per_chunk)) + """ + Based on the size of the file determine how many chunks we will need to upload. + For empty files 1 chunk is returned (DukeDS requires an empty chunk for empty files). + :param bytes_per_chunk: int: how many bytes should chunks to spglit the file into + :return: int: number of chunks that will need to be sent + """ + chunks = math.ceil(float(self.size) / float(bytes_per_chunk)) + return max(chunks, 1) def __str__(self): return 'file:{}'.format(self.name)
File Synchronization issue between portal and ddsclient User feedback: > As you may be aware, if a project has been modified via the web-portal, ddsclient seems to get confused. For example, If a file from a project has been removed via the web-portal, the ddsclient will ignore an upload request that would re-instantiate that file; it will report "Uploading 0 projects, 0 folders, 1 file.", but no files will be uploaded and the nothing will happen.
Duke-GCB/DukeDSClient
diff --git a/ddsc/core/tests/test_localstore.py b/ddsc/core/tests/test_localstore.py index ff182bf..b4bb9da 100644 --- a/ddsc/core/tests/test_localstore.py +++ b/ddsc/core/tests/test_localstore.py @@ -1,9 +1,9 @@ import shutil import tarfile from unittest import TestCase - from ddsc.core.localstore import LocalFile, LocalFolder, LocalProject, FileFilter from ddsc.config import FILE_EXCLUDE_REGEX_DEFAULT +from mock import patch INCLUDE_ALL = '' @@ -159,3 +159,20 @@ class TestFileFilter(TestCase): # exclude bad filenames for bad_filename in bad_files: self.assertEqual(include_file(bad_filename), False) + + +class TestLocalFile(TestCase): + @patch('ddsc.core.localstore.os') + @patch('ddsc.core.localstore.PathData') + def test_count_chunks_values(self, mock_path_data, mock_os): + values = [ + # file_size, bytes_per_chunk, expected + (200, 10, 20), + (200, 150, 2), + (3, 150, 1), + (0, 10, 1), # Empty files must send 1 empty chunk to DukeDS + ] + f = LocalFile('fakefile.txt') + for file_size, bytes_per_chunk, expected in values: + f.size = file_size + self.assertEqual(expected, f.count_chunks(bytes_per_chunk)) diff --git a/ddsc/core/tests/test_upload.py b/ddsc/core/tests/test_upload.py index d3a4099..6fcbac1 100644 --- a/ddsc/core/tests/test_upload.py +++ b/ddsc/core/tests/test_upload.py @@ -1,6 +1,7 @@ from __future__ import absolute_import from unittest import TestCase -from ddsc.core.upload import ProjectUpload +from ddsc.core.upload import ProjectUpload, LocalOnlyCounter +from ddsc.core.localstore import LocalFile from mock import MagicMock, patch @@ -24,3 +25,19 @@ class TestUploadCommand(TestCase): self.assertIn("Files/Folders that need to be uploaded:", dry_run_report) self.assertIn("data.txt", dry_run_report) self.assertIn("data2.txt", dry_run_report) + + +class TestLocalOnlyCounter(TestCase): + @patch('ddsc.core.localstore.os') + @patch('ddsc.core.localstore.PathData') + def test_total_items(self, mock_path_data, mock_os): + counter = LocalOnlyCounter(bytes_per_chunk=100) + self.assertEqual(0, counter.total_items()) + f = LocalFile('fakefile.txt') + f.size = 0 + counter.visit_file(f, None) + self.assertEqual(1, counter.total_items()) + f = LocalFile('fakefile2.txt') + f.size = 200 + counter.visit_file(f, None) + self.assertEqual(3, counter.total_items())
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 1 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio", "pytest-bdd", "pytest-benchmark", "pytest-randomly", "responses", "mock", "hypothesis", "freezegun", "trustme", "requests-mock", "requests", "tomlkit" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==25.3.0 certifi==2025.1.31 cffi==1.17.1 charset-normalizer==3.4.1 coverage==7.8.0 cryptography==44.0.2 -e git+https://github.com/Duke-GCB/DukeDSClient.git@e158990c3f68aef9ed4731aa446cea6d49be2950#egg=DukeDSClient exceptiongroup==1.2.2 execnet==2.1.1 freezegun==1.5.1 future==0.16.0 gherkin-official==29.0.0 hypothesis==6.130.5 idna==3.10 importlib_metadata==8.6.1 iniconfig==2.1.0 Mako==1.3.9 MarkupSafe==3.0.2 mock==5.2.0 packaging==24.2 parse==1.20.2 parse_type==0.6.4 pluggy==1.5.0 py-cpuinfo==9.0.0 pycparser==2.22 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-bdd==8.1.0 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-randomly==3.16.0 pytest-xdist==3.6.1 python-dateutil==2.9.0.post0 PyYAML==3.12 requests==2.32.3 requests-mock==1.12.1 responses==0.25.7 six==1.17.0 sortedcontainers==2.4.0 tomli==2.2.1 tomlkit==0.13.2 trustme==1.2.1 typing_extensions==4.13.0 urllib3==2.3.0 zipp==3.21.0
name: DukeDSClient channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==25.3.0 - certifi==2025.1.31 - cffi==1.17.1 - charset-normalizer==3.4.1 - coverage==7.8.0 - cryptography==44.0.2 - exceptiongroup==1.2.2 - execnet==2.1.1 - freezegun==1.5.1 - future==0.16.0 - gherkin-official==29.0.0 - hypothesis==6.130.5 - idna==3.10 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - mako==1.3.9 - markupsafe==3.0.2 - mock==5.2.0 - packaging==24.2 - parse==1.20.2 - parse-type==0.6.4 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pycparser==2.22 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-bdd==8.1.0 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-randomly==3.16.0 - pytest-xdist==3.6.1 - python-dateutil==2.9.0.post0 - pyyaml==3.12 - requests==2.32.3 - requests-mock==1.12.1 - responses==0.25.7 - six==1.17.0 - sortedcontainers==2.4.0 - tomli==2.2.1 - tomlkit==0.13.2 - trustme==1.2.1 - typing-extensions==4.13.0 - urllib3==2.3.0 - zipp==3.21.0 prefix: /opt/conda/envs/DukeDSClient
[ "ddsc/core/tests/test_upload.py::TestLocalOnlyCounter::test_total_items", "ddsc/core/tests/test_localstore.py::TestLocalFile::test_count_chunks_values" ]
[ "ddsc/core/tests/test_localstore.py::TestProjectContent::test_nested_folder_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_big_folder_str" ]
[ "ddsc/core/tests/test_upload.py::TestUploadCommand::test_nothing_to_do", "ddsc/core/tests/test_upload.py::TestUploadCommand::test_two_files_to_upload", "ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_empty_folder_str", "ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_folder_one_child_str", "ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_folder_two_children_str", "ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_nested_folder_str", "ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_file_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_name_removes_slash", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_folder_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_up_and_back", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_dot_name", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_exclude_dot_files", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_top_level_file_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_one_folder_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_folder_and_file_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_str", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_name_no_slash", "ddsc/core/tests/test_localstore.py::TestProjectContent::test_include_dot_files", "ddsc/core/tests/test_localstore.py::TestFileFilter::test_default_file_exclude_regex" ]
[]
MIT License
1,211
[ "ddsc/core/localstore.py" ]
[ "ddsc/core/localstore.py" ]
zopefoundation__zope.configuration-18
6e09fee3a67116babff6d9b3182792499ec3fe83
2017-04-25 19:59:45
6e09fee3a67116babff6d9b3182792499ec3fe83
diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..af40312 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +source = src + +[report] +exclude_lines = + pragma: no cover diff --git a/.travis.yml b/.travis.yml index 4f6ff3e..ddcc8dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,27 @@ language: python sudo: false python: - - 2.7 - - 3.3 - - 3.4 - - 3.5 - - 3.6 - - pypy -install: - - pip install . + - 2.7 + - 3.3 + - 3.4 + - 3.5 + - 3.6 + - pypy-5.4.1 script: - - python setup.py -q test -q + - coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress + +after_success: + - coveralls notifications: - email: false + email: false + +install: + - pip install -U pip setuptools + - pip install -U coveralls coverage + - pip install -U -e ".[test]" + + +cache: pip + +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log diff --git a/CHANGES.rst b/CHANGES.rst index b21324c..34e40f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,11 @@ Changes - Add support for Python 3.5 and 3.6. +- Fix the ``domain`` of MessageID fields to be a native string. + Previously on Python 3 they were bytes, which meant that they + couldn't be used to find translation utilities registered by + zope.i18n. See `issue 17 <https://github.com/zopefoundation/zope.configuration/issues/17>`_. + 4.0.3 (2014-03-19) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in index 4bed54d..d93dadc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,7 @@ include *.txt include *.py include buildout.cfg include tox.ini +include .coveragerc recursive-include docs *.rst *.bat *.py Makefile recursive-include src *.zcml *.in diff --git a/setup.py b/setup.py index 3adb48b..103a1c4 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,8 @@ import os from setuptools import setup, find_packages def read(*rnames): - return open(os.path.join(os.path.dirname(__file__), *rnames)).read() + with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: + return f.read() def _modname(path, base, name=''): if path == base: @@ -36,7 +37,7 @@ def alltests(): class NullHandler(logging.Handler): level = 50 - + def emit(self, record): pass @@ -56,10 +57,12 @@ def alltests(): suite.addTest(mod.test_suite()) return suite -TESTS_REQUIRE = [] +TESTS_REQUIRE = [ + 'zope.testrunner', +] setup(name='zope.configuration', - version = '4.1.0.dev0', + version='4.1.0.dev0', author='Zope Foundation and Contributors', author_email='[email protected]', description='Zope Configuration Markup Language (ZCML)', @@ -68,8 +71,8 @@ setup(name='zope.configuration', + '\n\n' + read('CHANGES.rst') ), - keywords = "zope configuration zcml", - classifiers = [ + keywords="zope configuration zcml", + classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', @@ -95,16 +98,17 @@ setup(name='zope.configuration', namespace_packages=['zope'], extras_require={ 'docs': ['Sphinx', 'repoze.sphinx.autointerface'], - 'test': [], + 'test': TESTS_REQUIRE, 'testing': TESTS_REQUIRE + ['nose', 'coverage'], }, - install_requires=['zope.i18nmessageid', - 'zope.interface', - 'zope.schema', - 'setuptools', - ], + install_requires=[ + 'setuptools', + 'zope.i18nmessageid', + 'zope.interface', + 'zope.schema', + ], include_package_data=True, zip_safe=False, - tests_require = TESTS_REQUIRE, + tests_require=TESTS_REQUIRE, test_suite='__main__.alltests', - ) +) diff --git a/src/zope/configuration/fields.py b/src/zope/configuration/fields.py index c5d26eb..dd8405e 100644 --- a/src/zope/configuration/fields.py +++ b/src/zope/configuration/fields.py @@ -15,6 +15,7 @@ """ import os import re +import sys import warnings from zope.interface import implementer @@ -158,6 +159,14 @@ class MessageID(Text): "You did not specify an i18n translation domain for the "\ "'%s' field in %s" % (self.getName(), context.info.file ) ) + if not isinstance(domain, str): + # IZopeConfigure specifies i18n_domain as a BytesLine, but that's + # wrong on Python 3, where the filesystem uses str, and hence + # zope.i18n registers ITranslationDomain utilities with str names. + # If we keep bytes, we can't find those utilities. + enc = sys.getfilesystemencoding() or sys.getdefaultencoding() + domain = domain.decode(enc) + v = super(MessageID, self).fromUnicode(u) # Check whether there is an explicit message is specified diff --git a/tox.ini b/tox.ini index 190f97a..7ce21b5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,38 +1,31 @@ [tox] -envlist = +envlist = # Jython support pending 2.7 support, due 2012-07-15 or so. See: # http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html # py27,py33,py34,py35,jython,pypy,coverage,docs py27,py33,py34,py35,py36,pypy,coverage,docs [testenv] -# see https://github.com/zopefoundation/zope.configuration/issues/16 for -# the reason we set usedevelop here -usedevelop = true deps = - zope.event - zope.i18nmessageid - zope.interface - zope.schema -commands = - python setup.py -q test -q + .[test] +commands = + zope-testrunner --test-path=src --all [] [testenv:coverage] usedevelop = true basepython = python2.7 -commands = - nosetests --with-xunit --with-xcoverage +commands = + coverage run -m zope.testrunner --test-path=src --all + coverage report deps = {[testenv]deps} - nose coverage - nosexcover [testenv:docs] basepython = python2.7 -commands = +commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest deps =
MessageID broken for Python 3; produces byte domains which can't find utilities As discovered in [zope.app.form](https://github.com/zopefoundation/zope.app.form/pull/1/files#diff-cbfcb4b47015db9258707315ce537abaR66), when reading a MessageID field out of a ZCML file, the `domain` will be a `byte` string under Python 3 (e.g., `b'zope'`). But `zope.i18n` registers ITranslationDomain utilities with normal `str` names. Since no byte string can ever equal a `str` on Python 3, the utilities will never be found and translation will not happen. It seems to me that either MessageID should ensure that the domain is a `str` (decoding from...utf-8?) or the context itself could ensure that its `i18n_domain` is a `str`. I think I like the latter better.
zopefoundation/zope.configuration
diff --git a/src/zope/configuration/tests/test_fields.py b/src/zope/configuration/tests/test_fields.py index c135420..641e136 100644 --- a/src/zope/configuration/tests/test_fields.py +++ b/src/zope/configuration/tests/test_fields.py @@ -34,7 +34,7 @@ class PythonIdentifierTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import PythonIdentifier return PythonIdentifier - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -69,7 +69,7 @@ class GlobalObjectTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import GlobalObject return GlobalObject - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -143,7 +143,7 @@ class GlobalInterfaceTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import GlobalInterface return GlobalInterface - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -157,7 +157,7 @@ class TokensTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import Tokens return Tokens - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -188,7 +188,7 @@ class PathTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import Path return Path - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -214,7 +214,7 @@ class BoolTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import Bool return Bool - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -244,7 +244,7 @@ class MessageIDTests(unittest.TestCase, _ConformsToIFromUnicode): def _getTargetClass(self): from zope.configuration.fields import MessageID return MessageID - + def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) @@ -306,14 +306,13 @@ class MessageIDTests(unittest.TestCase, _ConformsToIFromUnicode): self.assertEqual(context.i18n_strings, {'testing_domain': {'testing': [('test_file', 42)]}}) + def test_domain_decodes_bytes(self): + mid = self._makeOne() + context = self._makeContext(domain=b'domain') + bound = mid.bind(context) + msgid = bound.fromUnicode(u'msgid') + self.assertIsInstance(msgid.domain, str) + self.assertEqual(msgid.domain, 'domain') def test_suite(): - return unittest.TestSuite(( - unittest.makeSuite(PythonIdentifierTests), - unittest.makeSuite(GlobalObjectTests), - unittest.makeSuite(GlobalInterfaceTests), - unittest.makeSuite(TokensTests), - unittest.makeSuite(PathTests), - unittest.makeSuite(BoolTests), - unittest.makeSuite(MessageIDTests), - )) + return unittest.defaultTestLoader.loadTestsFromName(__name__)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 1 }, "num_modified_files": 6 }
4.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose", "coverage", "Sphinx", "repoze.sphinx.autointerface", "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 nose==1.3.7 packaging==21.3 pluggy==1.0.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytz==2025.2 repoze.sphinx.autointerface==1.0.0 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0 -e git+https://github.com/zopefoundation/zope.configuration.git@6e09fee3a67116babff6d9b3182792499ec3fe83#egg=zope.configuration zope.event==4.6 zope.i18nmessageid==5.1.1 zope.interface==5.5.2 zope.schema==6.2.1
name: zope.configuration channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - coverage==6.2 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - nose==1.3.7 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytz==2025.2 - repoze-sphinx-autointerface==1.0.0 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 - zope-event==4.6 - zope-i18nmessageid==5.1.1 - zope-interface==5.5.2 - zope-schema==6.2.1 prefix: /opt/conda/envs/zope.configuration
[ "src/zope/configuration/tests/test_fields.py::MessageIDTests::test_domain_decodes_bytes" ]
[]
[ "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test__validate_hit", "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test__validate_miss", "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test_fromUnicode_empty", "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test_fromUnicode_normal", "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test_fromUnicode_strips_ws", "src/zope/configuration/tests/test_fields.py::PythonIdentifierTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test__validate_w_value_type", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test__validate_wo_value_type", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test_fromUnicode_w_resolve_but_validation_fails", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test_fromUnicode_w_resolve_fails", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test_fromUnicode_w_resolve_success", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test_fromUnicode_w_star_and_extra_ws", "src/zope/configuration/tests/test_fields.py::GlobalObjectTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::GlobalInterfaceTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::GlobalInterfaceTests::test_ctor", "src/zope/configuration/tests/test_fields.py::GlobalInterfaceTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::TokensTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::TokensTests::test_fromUnicode_empty", "src/zope/configuration/tests/test_fields.py::TokensTests::test_fromUnicode_invalid", "src/zope/configuration/tests/test_fields.py::TokensTests::test_fromUnicode_strips_ws", "src/zope/configuration/tests/test_fields.py::TokensTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::PathTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::PathTests::test_fromUnicode_absolute", "src/zope/configuration/tests/test_fields.py::PathTests::test_fromUnicode_relative", "src/zope/configuration/tests/test_fields.py::PathTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::BoolTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::BoolTests::test_fromUnicode_w_false_values", "src/zope/configuration/tests/test_fields.py::BoolTests::test_fromUnicode_w_invalid", "src/zope/configuration/tests/test_fields.py::BoolTests::test_fromUnicode_w_true_values", "src/zope/configuration/tests/test_fields.py::BoolTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::MessageIDTests::test_class_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::MessageIDTests::test_instance_conforms_to_IFromUnicode", "src/zope/configuration/tests/test_fields.py::MessageIDTests::test_w_empty_id", "src/zope/configuration/tests/test_fields.py::MessageIDTests::test_w_id_and_default", "src/zope/configuration/tests/test_fields.py::MessageIDTests::test_wo_domain", "src/zope/configuration/tests/test_fields.py::test_suite" ]
[]
Zope Public License 2.1
1,212
[ "MANIFEST.in", "setup.py", ".travis.yml", "tox.ini", ".coveragerc", "CHANGES.rst", "src/zope/configuration/fields.py" ]
[ "MANIFEST.in", "setup.py", ".travis.yml", "tox.ini", ".coveragerc", "CHANGES.rst", "src/zope/configuration/fields.py" ]
bmcfee__pumpp-65
797a732eb907bd816b75b10da4707517789e871d
2017-04-26 19:24:09
797a732eb907bd816b75b10da4707517789e871d
diff --git a/pumpp/core.py b/pumpp/core.py index ab389c4..014dbe8 100644 --- a/pumpp/core.py +++ b/pumpp/core.py @@ -19,49 +19,6 @@ from .feature import FeatureExtractor from .sampler import Sampler -def transform(audio_f, jam, *ops): - '''Apply a set of operations to a track - - Parameters - ---------- - audio_f : str - The path to the audio file - - jam : str, jams.JAMS, or file-like - A JAMS object, or path to a JAMS file. - - If not provided, an empty jams object will be created. - - ops : list of task.BaseTaskTransform or feature.FeatureExtractor - The operators to apply to the input data - - Returns - ------- - data : dict - Extracted features and annotation encodings - ''' - - # Load the audio - y, sr = librosa.load(audio_f, sr=None, mono=True) - - if jam is None: - jam = jams.JAMS() - jam.file_metadata.duration = librosa.get_duration(y=y, sr=sr) - - # Load the jams - if not isinstance(jam, jams.JAMS): - jam = jams.load(jam) - - data = dict() - - for op in ops: - if isinstance(op, BaseTaskTransformer): - data.update(op.transform(jam)) - elif isinstance(op, FeatureExtractor): - data.update(op.transform(y, sr)) - return data - - class Pump(object): '''Top-level pump object. @@ -79,7 +36,18 @@ class Pump(object): >>> p_cqt = pumpp.feature.CQT('cqt', sr=44100, hop_length=1024) >>> p_chord = pumpp.task.ChordTagTransformer(sr=44100, hop_length=1024) >>> pump = pumpp.Pump(p_cqt, p_chord) - >>> data = pump.transform('/my/audio/file.mp3', '/my/jams/annotation.jams') + >>> data = pump.transform(audio_f='/my/audio/file.mp3', + ... jam='/my/jams/annotation.jams') + + Or use the call interface: + + >>> data = pump(audio_f='/my/audio/file.mp3', + ... jam='/my/jams/annotation.jams') + + Or apply to audio in memory, and without existing annotations: + + >>> y, sr = librosa.load('/my/audio/file.mp3') + >>> data = pump(y=y, sr=sr) Access all the fields produced by this pump: @@ -92,10 +60,6 @@ class Pump(object): >>> pump['chord'].fields {'chord/chord': Tensor(shape=(None, 170), dtype=<class 'bool'>)} - - See Also - -------- - transform ''' def __init__(self, *ops): @@ -124,12 +88,13 @@ class Pump(object): .format(op)) if op.name in self.opmap: - raise ParameterError('Duplicate operator name detected: {}'.format(op)) + raise ParameterError('Duplicate operator name detected: ' + '{}'.format(op)) self.opmap[op.name] = op self.ops.append(op) - def transform(self, audio_f, jam=None): + def transform(self, audio_f=None, jam=None, y=None, sr=None): '''Apply the transformations to an audio file, and optionally JAMS object. Parameters @@ -142,13 +107,51 @@ class Pump(object): If provided, this will provide data for task transformers. + y : np.ndarray + sr : number > 0 + If provided, operate directly on an existing audio buffer `y` at + sampling rate `sr` rather than load from `audio_f`. + Returns ------- data : dict Data dictionary containing the transformed audio (and annotations) + + Raises + ------ + ParameterError + At least one of `audio_f` or `(y, sr)` must be provided. + ''' - return transform(audio_f, jam, *self.ops) + if y is None: + if audio_f is None: + raise ParameterError('At least one of `y` or `audio_f` ' + 'must be provided') + + # Load the audio + y, sr = librosa.load(audio_f, sr=sr, mono=True) + + if sr is None: + raise ParameterError('If audio is provided as `y`, you must ' + 'specify the sampling rate as sr=') + + if jam is None: + jam = jams.JAMS() + jam.file_metadata.duration = librosa.get_duration(y=y, sr=sr) + + # Load the jams + if not isinstance(jam, jams.JAMS): + jam = jams.load(jam) + + data = dict() + + for op in self.ops: + if isinstance(op, BaseTaskTransformer): + data.update(op.transform(jam)) + elif isinstance(op, FeatureExtractor): + data.update(op.transform(y, sr)) + return data def sampler(self, n_samples, duration, random_state=None): '''Construct a sampler object for this pump's operators. @@ -212,3 +215,6 @@ class Pump(object): def __getitem__(self, key): return self.opmap.get(key) + + def __call__(self, *args, **kwargs): + return self.transform(*args, **kwargs)
Deprecate transform function We may as well move entirely to the object API.
bmcfee/pumpp
diff --git a/tests/test_core.py b/tests/test_core.py index 4feb22f..dd45deb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5,9 +5,11 @@ import pytest import numpy as np -import pumpp +import librosa import jams +import pumpp + @pytest.fixture(params=[11025, 22050]) def sr(request): @@ -26,48 +28,10 @@ def jam(request): return request.param [email protected]('audio_f', ['tests/data/test.ogg']) -def test_transform(audio_f, jam, sr, hop_length): - - ops = [pumpp.feature.STFT(name='stft', sr=sr, - hop_length=hop_length, - n_fft=2*hop_length), - - pumpp.task.BeatTransformer(name='beat', sr=sr, - hop_length=hop_length), - - pumpp.task.ChordTransformer(name='chord', sr=sr, - hop_length=hop_length), - - pumpp.task.StaticLabelTransformer(name='tags', - namespace='tag_open', - labels=['rock', 'jazz'])] - - data = pumpp.transform(audio_f, jam, *ops) - - # Fields we should have: - assert set(data.keys()) == set(['stft/mag', 'stft/phase', - 'beat/beat', 'beat/downbeat', - 'beat/_valid', - 'beat/mask_downbeat', - 'chord/pitch', 'chord/root', 'chord/bass', - 'chord/_valid', - 'tags/tags', 'tags/_valid']) - - # time shapes should be the same for annotations - assert data['beat/beat'].shape[1] == data['beat/downbeat'].shape[1] - assert data['beat/beat'].shape[1] == data['chord/pitch'].shape[1] - assert data['beat/beat'].shape[1] == data['chord/root'].shape[1] - assert data['beat/beat'].shape[1] == data['chord/bass'].shape[1] - - # Audio features can be off by at most a frame - assert (np.abs(data['stft/mag'].shape[1] - data['beat/beat'].shape[1]) - * hop_length / float(sr)) <= 0.05 - pass - - [email protected]('audio_f', ['tests/data/test.ogg']) -def test_pump(audio_f, jam, sr, hop_length): [email protected]('audio_f', [None, 'tests/data/test.ogg']) [email protected]('y', [None, 'tests/data/test.ogg']) [email protected]('sr2', [None, 22050, 44100]) +def test_pump(audio_f, jam, y, sr, sr2, hop_length): ops = [pumpp.feature.STFT(name='stft', sr=sr, hop_length=hop_length, @@ -83,22 +47,46 @@ def test_pump(audio_f, jam, sr, hop_length): namespace='tag_open', labels=['rock', 'jazz'])] - data1 = pumpp.transform(audio_f, jam, *ops) - - pump = pumpp.Pump(*ops) - data2 = pump.transform(audio_f, jam) - - assert data1.keys() == data2.keys() - - for key in data1: - assert np.allclose(data1[key], data2[key]) - - fields = dict() - for op in ops: - fields.update(**op.fields) - assert pump[op.name] == op - - assert pump.fields == fields + P = pumpp.Pump(*ops) + if audio_f is None and y is None: + # no input + with pytest.raises(pumpp.ParameterError): + data = P.transform(audio_f=audio_f, jam=jam, y=y, sr=sr2) + elif y is not None and sr2 is None: + # input buffer, but no sampling rate + y = librosa.load(y, sr=sr2)[0] + with pytest.raises(pumpp.ParameterError): + data = P.transform(audio_f=audio_f, jam=jam, y=y, sr=sr2) + elif y is not None: + y = librosa.load(y, sr=sr2)[0] + data = P.transform(audio_f=audio_f, jam=jam, y=y, sr=sr2) + else: + data = P.transform(audio_f=audio_f, jam=jam, y=y, sr=sr2) + data2 = P(audio_f=audio_f, jam=jam, y=y, sr=sr2) + + # Fields we should have: + assert set(data.keys()) == set(['stft/mag', 'stft/phase', + 'beat/beat', 'beat/downbeat', + 'beat/_valid', + 'beat/mask_downbeat', + 'chord/pitch', 'chord/root', + 'chord/bass', + 'chord/_valid', + 'tags/tags', 'tags/_valid']) + + # time shapes should be the same for annotations + assert data['beat/beat'].shape[1] == data['beat/downbeat'].shape[1] + assert data['beat/beat'].shape[1] == data['chord/pitch'].shape[1] + assert data['beat/beat'].shape[1] == data['chord/root'].shape[1] + assert data['beat/beat'].shape[1] == data['chord/bass'].shape[1] + + # Audio features can be off by at most a frame + assert (np.abs(data['stft/mag'].shape[1] - data['beat/beat'].shape[1]) + * hop_length / float(sr)) <= 0.05 + + assert data.keys() == data2.keys() + for k in data: + assert np.allclose(data[k], data2[k]) @pytest.mark.parametrize('audio_f', ['tests/data/test.ogg']) diff --git a/tests/test_sampler.py b/tests/test_sampler.py index 6461345..50a03e4 100644 --- a/tests/test_sampler.py +++ b/tests/test_sampler.py @@ -52,7 +52,8 @@ def data(ops): audio_f = 'tests/data/test.ogg' jams_f = 'tests/data/test.jams' - return pumpp.transform(audio_f, jams_f, *ops) + P = pumpp.Pump(*ops) + return P.transform(audio_f=audio_f, jam=jams_f) @pytest.fixture(params=[4, 16, None], scope='module')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
0.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[docs,tests]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": [ "apt-get update", "apt-get install -y ffmpeg" ], "python": "3.5", "reqs_path": [ "docs/requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
absl-py==0.15.0 alabaster==0.7.13 appdirs==1.4.4 astunparse==1.6.3 attrs==22.2.0 audioread==3.0.1 Babel==2.11.0 cached-property==1.5.2 cachetools==4.2.4 certifi==2021.5.30 cffi==1.15.1 charset-normalizer==2.0.12 clang==5.0 coverage==6.2 dataclasses==0.8 decorator==5.1.1 docutils==0.18.1 flatbuffers==1.12 gast==0.4.0 google-auth==1.35.0 google-auth-oauthlib==0.4.6 google-pasta==0.2.0 grpcio==1.48.2 h5py==3.1.0 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 jams==0.3.4 Jinja2==3.0.3 joblib==1.1.1 jsonschema==3.2.0 keras==2.6.0 Keras-Preprocessing==1.1.2 librosa==0.9.2 llvmlite==0.36.0 Markdown==3.3.7 MarkupSafe==2.0.1 mir_eval==0.8.2 numba==0.53.1 numpy==1.19.5 numpydoc==1.1.0 oauthlib==3.2.2 opt-einsum==3.3.0 packaging==21.3 pandas==1.1.5 pluggy==1.0.0 pooch==1.6.0 protobuf==3.19.6 -e git+https://github.com/bmcfee/pumpp.git@797a732eb907bd816b75b10da4707517789e871d#egg=pumpp py==1.11.0 pyasn1==0.5.1 pyasn1-modules==0.3.0 pycparser==2.21 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 pytest-cov==4.0.0 python-dateutil==2.9.0.post0 pytz==2025.2 requests==2.27.1 requests-oauthlib==2.0.0 resampy==0.4.3 rsa==4.9 scikit-learn==0.24.2 scipy==1.5.4 six==1.15.0 snowballstemmer==2.2.0 sortedcontainers==2.4.0 soundfile==0.13.1 Sphinx==5.3.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tensorboard==2.6.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow==2.6.2 tensorflow-estimator==2.6.0 termcolor==1.1.0 threadpoolctl==3.1.0 tomli==1.2.3 typing-extensions==3.7.4.3 urllib3==1.26.20 Werkzeug==2.0.3 wrapt==1.12.1 zipp==3.6.0
name: pumpp channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - absl-py==0.15.0 - alabaster==0.7.13 - appdirs==1.4.4 - astunparse==1.6.3 - attrs==22.2.0 - audioread==3.0.1 - babel==2.11.0 - cached-property==1.5.2 - cachetools==4.2.4 - cffi==1.15.1 - charset-normalizer==2.0.12 - clang==5.0 - coverage==6.2 - dataclasses==0.8 - decorator==5.1.1 - docutils==0.18.1 - flatbuffers==1.12 - gast==0.4.0 - google-auth==1.35.0 - google-auth-oauthlib==0.4.6 - google-pasta==0.2.0 - grpcio==1.48.2 - h5py==3.1.0 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - jams==0.3.4 - jinja2==3.0.3 - joblib==1.1.1 - jsonschema==3.2.0 - keras==2.6.0 - keras-preprocessing==1.1.2 - librosa==0.9.2 - llvmlite==0.36.0 - markdown==3.3.7 - markupsafe==2.0.1 - mir-eval==0.8.2 - numba==0.53.1 - numpy==1.19.5 - numpydoc==1.1.0 - oauthlib==3.2.2 - opt-einsum==3.3.0 - packaging==21.3 - pandas==1.1.5 - pluggy==1.0.0 - pooch==1.6.0 - protobuf==3.19.6 - py==1.11.0 - pyasn1==0.5.1 - pyasn1-modules==0.3.0 - pycparser==2.21 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - pytest-cov==4.0.0 - python-dateutil==2.9.0.post0 - pytz==2025.2 - requests==2.27.1 - requests-oauthlib==2.0.0 - resampy==0.4.3 - rsa==4.9 - scikit-learn==0.24.2 - scipy==1.5.4 - six==1.15.0 - snowballstemmer==2.2.0 - sortedcontainers==2.4.0 - soundfile==0.13.1 - sphinx==5.3.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tensorboard==2.6.0 - tensorboard-data-server==0.6.1 - tensorboard-plugin-wit==1.8.1 - tensorflow==2.6.2 - tensorflow-estimator==2.6.0 - termcolor==1.1.0 - threadpoolctl==3.1.0 - tomli==1.2.3 - typing-extensions==3.7.4.3 - urllib3==1.26.20 - werkzeug==2.0.3 - wrapt==1.12.1 - zipp==3.6.0 prefix: /opt/conda/envs/pumpp
[ "tests/test_core.py::test_pump[None-11025-128-None-None-None]", "tests/test_core.py::test_pump[None-11025-128-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-11025-128-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-128-22050-None-None]", "tests/test_core.py::test_pump[None-11025-128-44100-None-None]", "tests/test_core.py::test_pump[None-11025-512-None-None-None]", "tests/test_core.py::test_pump[None-11025-512-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-11025-512-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-512-22050-None-None]", "tests/test_core.py::test_pump[None-11025-512-44100-None-None]", "tests/test_core.py::test_pump[None-22050-128-None-None-None]", "tests/test_core.py::test_pump[None-22050-128-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-22050-128-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-128-22050-None-None]", "tests/test_core.py::test_pump[None-22050-128-44100-None-None]", "tests/test_core.py::test_pump[None-22050-512-None-None-None]", "tests/test_core.py::test_pump[None-22050-512-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-22050-512-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-512-22050-None-None]", "tests/test_core.py::test_pump[None-22050-512-44100-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-None-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-22050-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-44100-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-None-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-22050-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-44100-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-None-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-22050-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-44100-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-None-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-22050-None-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-44100-None-None]", "tests/test_core.py::test_pump[jam2-11025-128-None-None-None]", "tests/test_core.py::test_pump[jam2-11025-128-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-11025-128-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-128-22050-None-None]", "tests/test_core.py::test_pump[jam2-11025-128-44100-None-None]", "tests/test_core.py::test_pump[jam2-11025-512-None-None-None]", "tests/test_core.py::test_pump[jam2-11025-512-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-11025-512-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-512-22050-None-None]", "tests/test_core.py::test_pump[jam2-11025-512-44100-None-None]", "tests/test_core.py::test_pump[jam2-22050-128-None-None-None]", "tests/test_core.py::test_pump[jam2-22050-128-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-22050-128-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-128-22050-None-None]", "tests/test_core.py::test_pump[jam2-22050-128-44100-None-None]", "tests/test_core.py::test_pump[jam2-22050-512-None-None-None]", "tests/test_core.py::test_pump[jam2-22050-512-None-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-22050-512-None-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-512-22050-None-None]", "tests/test_core.py::test_pump[jam2-22050-512-44100-None-None]" ]
[ "tests/test_core.py::test_pump[None-11025-128-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-128-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-128-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-11025-128-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-128-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-128-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-11025-128-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-512-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-512-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-512-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-11025-512-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-512-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-11025-512-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-11025-512-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-128-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-128-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-128-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-22050-128-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-128-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-128-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-22050-128-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-512-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-512-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-512-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-22050-512-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-512-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[None-22050-512-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[None-22050-512-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-128-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-11025-512-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-128-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[tests/data/test.jams-22050-512-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-128-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-128-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-128-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-11025-128-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-128-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-128-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-11025-128-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-512-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-512-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-512-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-11025-512-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-512-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-11025-512-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-11025-512-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-128-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-128-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-128-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-22050-128-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-128-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-128-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-22050-128-44100-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-512-None-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-512-22050-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-512-22050-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-22050-512-22050-tests/data/test.ogg-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-512-44100-None-tests/data/test.ogg]", "tests/test_core.py::test_pump[jam2-22050-512-44100-tests/data/test.ogg-None]", "tests/test_core.py::test_pump[jam2-22050-512-44100-tests/data/test.ogg-tests/data/test.ogg]" ]
[ "tests/test_core.py::test_pump_empty[None-11025-128-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[None-11025-512-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[None-22050-128-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[None-22050-512-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[tests/data/test.jams-11025-128-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[tests/data/test.jams-11025-512-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[tests/data/test.jams-22050-128-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[tests/data/test.jams-22050-512-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[jam2-11025-128-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[jam2-11025-512-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[jam2-22050-128-tests/data/test.ogg]", "tests/test_core.py::test_pump_empty[jam2-22050-512-tests/data/test.ogg]", "tests/test_core.py::test_pump_add[11025-128]", "tests/test_core.py::test_pump_add[11025-512]", "tests/test_core.py::test_pump_add[22050-128]", "tests/test_core.py::test_pump_add[22050-512]", "tests/test_core.py::test_pump_sampler[11025-128-None-1-None]", "tests/test_core.py::test_pump_sampler[11025-128-None-1-10]", "tests/test_core.py::test_pump_sampler[11025-128-None-5-None]", "tests/test_core.py::test_pump_sampler[11025-128-None-5-10]", "tests/test_core.py::test_pump_sampler[11025-128-1-1-None]", "tests/test_core.py::test_pump_sampler[11025-128-1-1-10]", "tests/test_core.py::test_pump_sampler[11025-128-1-5-None]", "tests/test_core.py::test_pump_sampler[11025-128-1-5-10]", "tests/test_core.py::test_pump_sampler[11025-512-None-1-None]", "tests/test_core.py::test_pump_sampler[11025-512-None-1-10]", "tests/test_core.py::test_pump_sampler[11025-512-None-5-None]", "tests/test_core.py::test_pump_sampler[11025-512-None-5-10]", "tests/test_core.py::test_pump_sampler[11025-512-1-1-None]", "tests/test_core.py::test_pump_sampler[11025-512-1-1-10]", "tests/test_core.py::test_pump_sampler[11025-512-1-5-None]", "tests/test_core.py::test_pump_sampler[11025-512-1-5-10]", "tests/test_core.py::test_pump_sampler[22050-128-None-1-None]", "tests/test_core.py::test_pump_sampler[22050-128-None-1-10]", "tests/test_core.py::test_pump_sampler[22050-128-None-5-None]", "tests/test_core.py::test_pump_sampler[22050-128-None-5-10]", "tests/test_core.py::test_pump_sampler[22050-128-1-1-None]", "tests/test_core.py::test_pump_sampler[22050-128-1-1-10]", "tests/test_core.py::test_pump_sampler[22050-128-1-5-None]", "tests/test_core.py::test_pump_sampler[22050-128-1-5-10]", "tests/test_core.py::test_pump_sampler[22050-512-None-1-None]", "tests/test_core.py::test_pump_sampler[22050-512-None-1-10]", "tests/test_core.py::test_pump_sampler[22050-512-None-5-None]", "tests/test_core.py::test_pump_sampler[22050-512-None-5-10]", "tests/test_core.py::test_pump_sampler[22050-512-1-1-None]", "tests/test_core.py::test_pump_sampler[22050-512-1-1-10]", "tests/test_core.py::test_pump_sampler[22050-512-1-5-None]", "tests/test_core.py::test_pump_sampler[22050-512-1-5-10]" ]
[]
ISC License
1,213
[ "pumpp/core.py" ]
[ "pumpp/core.py" ]
python-cmd2__cmd2-89
90330f29a7fd1ebf03ef2b639f8bc44caf5c379a
2017-04-26 19:54:18
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
diff --git a/cmd2.py b/cmd2.py index d14c36f8..e2201632 100755 --- a/cmd2.py +++ b/cmd2.py @@ -618,7 +618,7 @@ class Cmd(cmd.Cmd): for editor in ['vim', 'vi', 'emacs', 'nano', 'pico', 'gedit', 'kate', 'subl', 'geany', 'atom']: if _which(editor): break - feedback_to_output = False # Do include nonessentials in >, | output + feedback_to_output = True # Do include nonessentials in >, | output locals_in_py = True quiet = False # Do not suppress nonessential output timing = False # Prints elapsed time for each command @@ -1691,7 +1691,7 @@ Script should contain one command per line, just like command would be typed in :param callargs: List[str] - list of transcript test file names """ class TestMyAppCase(Cmd2TestCase): - CmdApp = self.__class__ + cmdapp = self self.__class__.testfiles = callargs sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() @@ -1731,12 +1731,12 @@ Script should contain one command per line, just like command would be typed in if callopts.test: self._transcript_files = callargs + # Always run the preloop first + self.preloop() + if self._transcript_files is not None: self.run_transcript_tests(self._transcript_files) else: - # Always run the preloop first - self.preloop() - # If an intro was supplied in the method call, allow it to override the default if intro is not None: self.intro = intro @@ -1754,8 +1754,8 @@ Script should contain one command per line, just like command would be typed in if not stop: self._cmdloop() - # Run the postloop() no matter what - self.postloop() + # Run the postloop() no matter what + self.postloop() class HistoryItem(str): @@ -1960,25 +1960,11 @@ class Statekeeper(object): setattr(self.obj, attrib, getattr(self, attrib)) -class Borg(object): - """All instances of any Borg subclass will share state. - from Python Cookbook, 2nd Ed., recipe 6.16""" - _shared_state = {} - - def __new__(cls, *a, **k): - obj = object.__new__(cls) - obj.__dict__ = cls._shared_state - return obj - - -class OutputTrap(Borg): - """Instantiate an OutputTrap to divert/capture ALL stdout output. For use in unit testing. - Call `tearDown()` to return to normal output.""" +class OutputTrap(object): + """Instantiate an OutputTrap to divert/capture ALL stdout output. For use in transcript testing.""" def __init__(self): self.contents = '' - self.old_stdout = sys.stdout - sys.stdout = self def write(self, txt): """Add text to the internal contents. @@ -1996,17 +1982,12 @@ class OutputTrap(Borg): self.contents = '' return result - def tear_down(self): - """Restores normal output.""" - sys.stdout = self.old_stdout - self.contents = '' - class Cmd2TestCase(unittest.TestCase): """Subclass this, setting CmdApp, to make a unittest.TestCase class that will execute the commands in a transcript file and expect the results shown. See example.py""" - CmdApp = None + cmdapp = None regexPattern = pyparsing.QuotedString(quoteChar=r'/', escChar='\\', multiline=True, unquoteResults=True) regexPattern.ignore(pyparsing.cStyleComment) notRegexPattern = pyparsing.Word(pyparsing.printables) @@ -2016,7 +1997,7 @@ class Cmd2TestCase(unittest.TestCase): def fetchTranscripts(self): self.transcripts = {} - for fileset in self.CmdApp.testfiles: + for fileset in self.cmdapp.testfiles: for fname in glob.glob(fileset): tfile = open(fname) self.transcripts[fname] = iter(tfile.readlines()) @@ -2025,17 +2006,15 @@ class Cmd2TestCase(unittest.TestCase): raise Exception("No test files found - nothing to test.") def setUp(self): - if self.CmdApp: - self.outputTrap = OutputTrap() - self.cmdapp = self.CmdApp() + if self.cmdapp: self.fetchTranscripts() - # Make sure any required initialization gets done and flush the output buffer - self.cmdapp.preloop() - self.outputTrap.read() + # Trap stdout + self._orig_stdout = self.cmdapp.stdout + self.cmdapp.stdout = OutputTrap() def runTest(self): # was testall - if self.CmdApp: + if self.cmdapp: its = sorted(self.transcripts.items()) for (fname, transcript) in its: self._test_transcript(fname, transcript) @@ -2071,7 +2050,7 @@ class Cmd2TestCase(unittest.TestCase): # Send the command into the application and capture the resulting output # TODO: Should we get the return value and act if stop == True? self.cmdapp.onecmd_plus_hooks(command) - result = self.outputTrap.read() + result = self.cmdapp.stdout.read() # Read the expected result from transcript if line.startswith(self.cmdapp.prompt): message = '\nFile %s, line %d\nCommand was:\n%r\nExpected: (nothing)\nGot:\n%r\n' % \ @@ -2098,11 +2077,9 @@ class Cmd2TestCase(unittest.TestCase): self.assertTrue(re.match(expected, result, re.MULTILINE | re.DOTALL), message) def tearDown(self): - if self.CmdApp: - # Make sure any required cleanup gets done - self.cmdapp.postloop() - - self.outputTrap.tear_down() + if self.cmdapp: + # Restore stdout + self.cmdapp.stdout = self._orig_stdout def namedtuple_with_two_defaults(typename, field_names, default_values=('', '')):
Transcript tests create apparently unnecessary 2nd instance of cmd2.Cmd class Transcript testing creates a 2nd instance of the class derived from cmd2.Cmd. This appears to be unecessary and done primarily for redirecting stdout. This should probably be handled in a better and more efficient way which doesn't require creating a second instance.
python-cmd2/cmd2
diff --git a/tests/conftest.py b/tests/conftest.py index 6f3131e7..b036943d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -55,7 +55,7 @@ debug: False default_file_name: command.txt echo: False editor: vim -feedback_to_output: False +feedback_to_output: True locals_in_py: True prompt: (Cmd) quiet: False @@ -75,7 +75,7 @@ debug: False # Show full error stack on error default_file_name: command.txt # for ``save``, ``load``, etc. echo: False # Echo command issued into output editor: vim # Program used by ``edit`` -feedback_to_output: False # include nonessentials in `|`, `>` results +feedback_to_output: True # include nonessentials in `|`, `>` results locals_in_py: True # Allow access to your application in py via self prompt: (Cmd) # The prompt issued to solicit input quiet: False # Don't print nonessential feedback diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 99409d46..10ae4329 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -266,16 +266,15 @@ _relative_load {} assert out == expected -def test_base_save(base_app, capsys): +def test_base_save(base_app): # TODO: Use a temporary directory for the file filename = 'deleteme.txt' run_cmd(base_app, 'help') run_cmd(base_app, 'help save') # Test the * form of save which saves all commands from history - run_cmd(base_app, 'save * {}'.format(filename)) - out, err = capsys.readouterr() - assert out == 'Saved to {}\n'.format(filename) + out = run_cmd(base_app, 'save * {}'.format(filename)) + assert out == normalize('Saved to {}\n'.format(filename)) expected = normalize(""" help @@ -288,18 +287,16 @@ save * deleteme.txt assert content == expected # Test the N form of save which saves a numbered command from history - run_cmd(base_app, 'save 1 {}'.format(filename)) - out, err = capsys.readouterr() - assert out == 'Saved to {}\n'.format(filename) + out = run_cmd(base_app, 'save 1 {}'.format(filename)) + assert out == normalize('Saved to {}\n'.format(filename)) expected = normalize('help') with open(filename) as f: content = normalize(f.read()) assert content == expected # Test the blank form of save which saves the most recent command from history - run_cmd(base_app, 'save {}'.format(filename)) - out, err = capsys.readouterr() - assert out == 'Saved to {}\n'.format(filename) + out = run_cmd(base_app, 'save {}'.format(filename)) + assert out == normalize('Saved to {}\n'.format(filename)) expected = normalize('save 1 {}'.format(filename)) with open(filename) as f: content = normalize(f.read()) @@ -397,6 +394,7 @@ def test_send_to_paste_buffer(base_app): def test_base_timing(base_app, capsys): + base_app.feedback_to_output = False out = run_cmd(base_app, 'set timing True') expected = normalize("""timing - was: False now: True diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 89f2ea7c..6049119f 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -149,6 +149,7 @@ set maxrepeats 5 -------------------------[6] say -ps --repeat=5 goodnight, Gracie (Cmd) run 4 +say -ps --repeat=5 goodnight, Gracie OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY diff --git a/tests/transcript_regex.txt b/tests/transcript_regex.txt index b8e0e654..a44870e9 100644 --- a/tests/transcript_regex.txt +++ b/tests/transcript_regex.txt @@ -10,7 +10,7 @@ debug: False default_file_name: command.txt echo: False editor: /([^\s]+)/ -feedback_to_output: False +feedback_to_output: True locals_in_py: True maxrepeats: 3 prompt: (Cmd)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 1 }
0.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "mock" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/python-cmd2/cmd2.git@90330f29a7fd1ebf03ef2b639f8bc44caf5c379a#egg=cmd2 exceptiongroup==1.2.2 iniconfig==2.1.0 mock==5.2.0 packaging==24.2 pluggy==1.5.0 pyparsing==3.2.3 pytest==8.3.5 six==1.17.0 tomli==2.2.1
name: cmd2 channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - mock==5.2.0 - packaging==24.2 - pluggy==1.5.0 - pyparsing==3.2.3 - pytest==8.3.5 - six==1.17.0 - tomli==2.2.1 prefix: /opt/conda/envs/cmd2
[ "tests/test_cmd2.py::test_base_show", "tests/test_cmd2.py::test_base_show_long", "tests/test_cmd2.py::test_base_save", "tests/test_transcript.py::test_base_with_transcript", "tests/test_transcript.py::test_regex_transcript" ]
[ "tests/test_cmd2.py::test_output_redirection" ]
[ "tests/test_cmd2.py::test_ver", "tests/test_cmd2.py::test_base_help", "tests/test_cmd2.py::test_base_help_history", "tests/test_cmd2.py::test_base_shortcuts", "tests/test_cmd2.py::test_base_set", "tests/test_cmd2.py::test_base_set_not_supported", "tests/test_cmd2.py::test_base_shell", "tests/test_cmd2.py::test_base_py", "tests/test_cmd2.py::test_base_run_python_script", "tests/test_cmd2.py::test_base_error", "tests/test_cmd2.py::test_base_history", "tests/test_cmd2.py::test_base_list", "tests/test_cmd2.py::test_list_with_string_argument", "tests/test_cmd2.py::test_list_with_integer_argument", "tests/test_cmd2.py::test_list_with_integer_span", "tests/test_cmd2.py::test_base_cmdenvironment", "tests/test_cmd2.py::test_base_load", "tests/test_cmd2.py::test_base_load_default_file", "tests/test_cmd2.py::test_base_relative_load", "tests/test_cmd2.py::test_allow_redirection", "tests/test_cmd2.py::test_input_redirection", "tests/test_cmd2.py::test_pipe_to_shell", "tests/test_cmd2.py::test_send_to_paste_buffer", "tests/test_cmd2.py::test_base_timing", "tests/test_cmd2.py::test_base_debug", "tests/test_cmd2.py::test_base_colorize", "tests/test_cmd2.py::test_edit_no_editor", "tests/test_cmd2.py::test_edit_file", "tests/test_cmd2.py::test_edit_number", "tests/test_cmd2.py::test_edit_blank", "tests/test_cmd2.py::test_base_py_interactive", "tests/test_cmd2.py::test_base_cmdloop_with_queue", "tests/test_cmd2.py::test_base_cmdloop_without_queue", "tests/test_cmd2.py::test_cmdloop_without_rawinput", "tests/test_transcript.py::Cmd2TestCase::runTest", "tests/test_transcript.py::TestMyAppCase::runTest", "tests/test_transcript.py::test_optparser", "tests/test_transcript.py::test_optparser_nosuchoption", "tests/test_transcript.py::test_comment_stripping", "tests/test_transcript.py::test_optarser_correct_args_with_quotes_and_midline_options", "tests/test_transcript.py::test_optarser_options_with_spaces_in_quotes", "tests/test_transcript.py::test_commands_at_invocation", "tests/test_transcript.py::test_select_options", "tests/test_transcript.py::test_transcript_from_cmdloop", "tests/test_transcript.py::test_multiline_command_transcript_with_comments_at_beginning", "tests/test_transcript.py::test_invalid_syntax" ]
[]
MIT License
1,214
[ "cmd2.py" ]
[ "cmd2.py" ]
agraubert__agutil-123
4ec472cc162415a809bf16ef69e045351b44c59e
2017-04-27 01:18:42
4ec472cc162415a809bf16ef69e045351b44c59e
diff --git a/README.md b/README.md index 38e01c1..4e79ffb 100644 --- a/README.md +++ b/README.md @@ -34,5 +34,29 @@ The __security__ package: ## Documentation: Detailed documentation of these packages can be found on the [agutil Github wiki page](https://github.com/agraubert/agutil/wiki) +## Features in development + +## agutil (main module) +The following change has been made to the `agutil` module: +* Added a `byteSize()` method to convert a number of bytes to a human-readable string + +##### API +* byteSize(n): + + Returns a string with _n_ converted to the highest unit of Bytes where _n_ would + be at least 1 (caps at ZiB), rounded to 1 decimal place. Examples: + + * byteSize(1) = `1B` + * byteSize(1023) = `1023B` + * byteSize(1024) = `1KiB` + * byteSize(856633344) = `816.9MiB` + * byteSize(12379856472314232739172) = `10.5ZiB` + +## agutil.security.SECURECONNECTION +The following change has been made to the `agutil.security.SecureConnection` class: +* `savefile()` timeout now applies to each chunk of the file. The operation will +block so long as the remote socket sends at least one chunk per timeout period. +(API unchanged) + ## Installation note: This package requires PyCrypto, which typically has issues compiling on windows. If you are on windows and `pip install agutil` fails during the installation of PyCrypto, then follow the instructions [here](https://github.com/sfbahr/PyCrypto-Wheels) for installing PyCrypto from a precompiled wheel, and then run `pip install agutil` again. diff --git a/agutil/__init__.py b/agutil/__init__.py index 56dbd0a..58d133f 100644 --- a/agutil/__init__.py +++ b/agutil/__init__.py @@ -1,4 +1,4 @@ from .src.search_range import search_range from .src.status_bar import status_bar from .src.logger import Logger, DummyLog -from .src.misc import split_iterable, byte_xor, intToBytes, bytesToInt +from .src.misc import split_iterable, byte_xor, intToBytes, bytesToInt, byteSize diff --git a/agutil/security/src/connection.py b/agutil/security/src/connection.py index ff825b9..2ecbd6e 100644 --- a/agutil/security/src/connection.py +++ b/agutil/security/src/connection.py @@ -1,5 +1,5 @@ from .securesocket import SecureSocket -from ... import io, Logger, DummyLog +from ... import io, Logger, DummyLog, byteSize from . import protocols from socket import timeout as socketTimeout import threading @@ -33,7 +33,7 @@ class SecureConnection: self.pending_tasks = threading.Event() self.intakeEvent = threading.Event() self.pendingRequest = threading.Event() - self.transferComplete = threading.Event() + self.transferTracking = {} self.killedtask = threading.Event() self.completed_transfers = set() self.queuedmessages = [] #Queue of decrypted received text messages @@ -167,9 +167,10 @@ class SecureConnection: if not result: raise socketTimeout("No file transfer requests recieved within the specified timeout") self.pendingRequest.clear() - (filename, auth) = self.authqueue.pop(0) + (filename, auth, size) = self.authqueue.pop(0) if not force: print("The remote socket is attempting to send the file '%s'"%filename) + print("Size:", byteSize(size)) accepted = False choice = "" while not accepted: @@ -189,19 +190,20 @@ class SecureConnection: self.pending_tasks.set() return self.log("Accepted transfer of file '%s'"%filename) + transferKey = '%s-%d'%(auth, hash(destination)) + self.transferTracking[transferKey] = threading.Event() self.schedulingqueue.append({ 'cmd': protocols.lookupcmd('fti'), 'auth': auth, - 'filepath': destination + 'filepath': destination, + 'key': transferKey, + 'timeout':timeout }) self.pending_tasks.set() self.log("Waiting for transfer to complete...", "INFO") - while destination not in self.completed_transfers: - result = self.transferComplete.wait(timeout) - if not result: - raise socketTimeout("File transfer did not complete in the specified timeout") - self.transferComplete.clear() - self.completed_transfers.remove(destination) + self.transferTracking[transferKey].wait() + if destination not in self.completed_transfers: + raise socketTimeout("File transfer did not complete in the specified timeout") self.log("File transfer complete", "INFO") return destination diff --git a/agutil/security/src/protocols.py b/agutil/security/src/protocols.py index 58a512f..da79f11 100644 --- a/agutil/security/src/protocols.py +++ b/agutil/security/src/protocols.py @@ -1,6 +1,7 @@ import rsa import os import random +from socket import timeout as socketTimeout _COMMANDS = ['kill', 'ti', 'to', 'fri', 'fro', 'fto', 'fti', '_NULL', 'dci',] _CMD_LOOKUP = {} @@ -150,7 +151,12 @@ def _file_request_out(sock,cmd,name): sock.filemap[auth_key] = cmd['filepath'] sock.sock.sendAES(packcmd( 'fri', - {'auth':auth_key, 'filename':os.path.basename(cmd['filepath']), 'name':name} + { + 'auth':auth_key, + 'filename':os.path.basename(cmd['filepath']), + 'name':name, + 'size': str(os.path.getsize(cmd['filepath'])) + } ), '__cmd__') tasklog("Sent file transfer request to remote socket", "DETAIL") sock.schedulingqueue.append({ @@ -162,7 +168,7 @@ def _file_request_out(sock,cmd,name): def _file_request_in(sock,cmd,name): tasklog = sock.log.bindToSender(sock.log.name+":"+name) tasklog("Received new file request. Queueing authorization", "DETAIL") - sock.authqueue.append((cmd['filename'], cmd['auth'])) + sock.authqueue.append((cmd['filename'], cmd['auth'], int(cmd['size']))) sock.pendingRequest.set() sock.schedulingqueue.append({ 'cmd': lookupcmd('kill'), @@ -196,12 +202,17 @@ def _file_transfer_in(sock,cmd,name): {'name':name, 'auth':cmd['auth'], 'reject':'reject' in cmd} ), '__cmd__') if 'reject' not in cmd: - sock.sock.recvRAW(name, timeout=None) - tasklog("File transfer initiated", "DEBUG") - sock.sock.recvAES(name, output_file=cmd['filepath']) - sock.completed_transfers.add(cmd['filepath']) - sock.transferComplete.set() - tasklog("Transfer complete", "DEBUG") + try: + sock.sock.recvRAW(name, timeout=cmd['timeout']) + tasklog("File transfer initiated", "DEBUG") + sock.sock.recvAES(name, output_file=cmd['filepath'], timeout=cmd['timeout']) + except socketTimeout: + tasklog("Transfer timed out", "ERROR") + else: + tasklog("Transfer complete", "DEBUG") + sock.completed_transfers.add(cmd['filepath']) + finally: + sock.transferTracking[cmd['key']].set() sock.schedulingqueue.append({ 'cmd': lookupcmd('kill'), 'name': name diff --git a/agutil/src/misc.py b/agutil/src/misc.py index 28fefc6..0605346 100644 --- a/agutil/src/misc.py +++ b/agutil/src/misc.py @@ -1,4 +1,5 @@ from itertools import chain, islice, zip_longest +from math import log def intToBytes(num, padding_length=0): s = format(num, 'x') @@ -28,3 +29,9 @@ def split_iterable(seq, length): def byte_xor(b1, b2): return intToBytes(bytesToInt(b1)^bytesToInt(b2), max(len(b1), len(b2))) + +def byteSize(n): + index = min(7, int(log(abs(n), 1024))) + suffix = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB'][index] + output = '%.1f'%(n / 1024**index) + return output.rstrip('.0')+suffix
SecureConnection.savefile() times out for large files Right now the _timeout_ argument for SecureConnection.savefile() applies to the operation as a whole. This is inconsequential for small files, but can timeout on larger files where the transfer may not complete in time even though the two sockets are still actively communicating. The _timeout_ parameter should apply to each chunk of the file, so the operation will continue as long as it receives at least one chunk per timeout interval.
agraubert/agutil
diff --git a/tests/test_misc_functions.py b/tests/test_misc_functions.py index fce040a..1f96497 100644 --- a/tests/test_misc_functions.py +++ b/tests/test_misc_functions.py @@ -83,3 +83,14 @@ class test(unittest.TestCase): else: self.assertEqual(len(converted), bytelen) self.assertEqual(hash(converted), hash(bytestring)) + + def test_byte_size(self): + from agutil import byteSize + from math import log + import re + pattern = re.compile(r'(\d+(\.\d)?)([A-Z]i)?B') + for trial in range(25): + num = random.randint(0, sys.maxsize) + formatted = byteSize(num) + self.assertRegex(formatted, pattern) + self.assertLess(float(pattern.match(formatted).group(1)), 1024.0)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 5 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/agraubert/agutil.git@4ec472cc162415a809bf16ef69e045351b44c59e#egg=agutil exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work pyasn1==0.6.1 pycrypto==2.6.1 pytest @ file:///croot/pytest_1738938843180/work rsa==4.9 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: agutil channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - pyasn1==0.6.1 - pycrypto==2.6.1 - rsa==4.9 prefix: /opt/conda/envs/agutil
[ "tests/test_misc_functions.py::test::test_byte_size" ]
[]
[ "tests/test_misc_functions.py::test::test_byte_xor", "tests/test_misc_functions.py::test::test_compilation", "tests/test_misc_functions.py::test::test_int_byte_conversion", "tests/test_misc_functions.py::test::test_sequence_splitting" ]
[]
MIT License
1,215
[ "agutil/security/src/connection.py", "agutil/src/misc.py", "README.md", "agutil/security/src/protocols.py", "agutil/__init__.py" ]
[ "agutil/security/src/connection.py", "agutil/src/misc.py", "README.md", "agutil/security/src/protocols.py", "agutil/__init__.py" ]
google__mobly-194
5960e218c4006d8b7681ffe9698cbef160ad112f
2017-04-28 05:46:23
5960e218c4006d8b7681ffe9698cbef160ad112f
adorokhine: Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. --- *[mobly/controllers/android_device.py, line 762 at r1](https://reviewable.io:443/reviews/google/mobly/194#-Kin5wTIpvyhcpSOfSyt:-Kin5wTJNBtMJIyFu1bh:b-twcozc) ([raw file](https://github.com/google/mobly/blob/7d4fb4ef105e2e00a9657f4c9dc45c4dc953a501/mobly/controllers/android_device.py#L762)):* > ```Python > extra_params = self.adb_logcat_param > except AttributeError: > extra_params = '-b main -b crash -b system -b radio' > ``` Are we leaving out 'events' on purpose? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. --- *[mobly/controllers/android_device.py, line 762 at r1](https://reviewable.io:443/reviews/google/mobly/194#-Kin5wTIpvyhcpSOfSyt:-KinHEozjaAsJESifOf6:bjhi5gh) ([raw file](https://github.com/google/mobly/blob/7d4fb4ef105e2e00a9657f4c9dc45c4dc953a501/mobly/controllers/android_device.py#L762)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Are we leaving out 'events' on purpose? </blockquote></details> I just realized that `-b radio` will not work for tablets... Perhaps we should drop the custom '-b' values for good and use default?... But that means all internal users would need to supply `-b radio` to get radio logs... --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5Th6VbQv3k2tRBlhx:b-2ypkyj) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* > ```Python > try: > process = utils.start_standing_subprocess( > cmd, check_health_delay=0.1, shell=True) > ``` Instead of assuming 100ms is enough for logcat to start up on a potentially overloaded machine and potentially slow phone, and dropping all log buffers, is there a way to detect which buffers are available so we can solve both problems? Does it perhaps show up in logcat --help? --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5UlCJxa19whyjUC1-:b-2w7mwb) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Instead of assuming 100ms is enough for logcat to start up on a potentially overloaded machine and potentially slow phone, and dropping all log buffers, is there a way to detect which buffers are available so we can solve both problems? Does it perhaps show up in logcat --help? </blockquote></details> there is no reliable way. parsing the help menu is not reliable bc each manufacturer may have different text for it. We don't need to wait for logcat to start up though, the wait is to make sure the process didn't die. Or could you think of other ways. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5VWTp0QWe-4A_lrD3:bwaslzj) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> there is no reliable way. parsing the help menu is not reliable bc each manufacturer may have different text for it. We don't need to wait for logcat to start up though, the wait is to make sure the process didn't die. Or could you think of other ways. </blockquote></details> Can we add the buffers to the `logcat -c` call and wait for it to complete? According to the documentation, `logcat -c` takes the same set of buffers so it should be possible to use its success as a gauge for what buffers are supported right? https://developer.android.com/studio/command-line/logcat.html I want to get away from time-based checks. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5X8lbdIYnw5sMxRDw:b-u395ce) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> Can we add the buffers to the `logcat -c` call and wait for it to complete? According to the documentation, `logcat -c` takes the same set of buffers so it should be possible to use its success as a gauge for what buffers are supported right? https://developer.android.com/studio/command-line/logcat.html I want to get away from time-based checks. </blockquote></details> We actually can't bc the failure does not cause ret code to be non-zero........ --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj6-Y3nqYU7kijXUXdC:beebema) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> We actually can't bc the failure does not cause ret code to be non-zero........ </blockquote></details> What does it print in the correct and incorrect case? Anything we can key off of? I really want to move away from blanket catching all errors and doing something else. In my experience, especially when it comes to Android, the thing you "expect" went wrong is actually totally unrelated to what actually went wrong. :) --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj9LLZZp_DzFKO9mzNl:b-7n246i) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> What does it print in the correct and incorrect case? Anything we can key off of? I really want to move away from blanket catching all errors and doing something else. In my experience, especially when it comes to Android, the thing you "expect" went wrong is actually totally unrelated to what actually went wrong. :) </blockquote></details> It prints the help menu, which we shouldn't really rely on. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-KjA1vWp7SbQlXNZHUPd:basxykf) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> It prints the help menu, which we shouldn't really rely on. </blockquote></details> And what does it print if it does work correctly? My concern with this approach is twofold: a) 100ms is not necessarily enough time to make sure logcat started on an arbitrarily slow system and phone; recall our unit test flake b) we shouldn't blanket catching all errors and assuming the cause was anything in particular without some type of validation. I've seen cases already where our blanket catch was squashing exceptions for the wrong reason. So I would like to find something we can do to make sure the issue is what we think it is. I would much rather have a solution that works 100% of the time on 90% of the phones (because we can always improve the check) than a solution that works 90% of the time on 100% of the phones (because people will abandon our framework). If there's absolutely no way to do this automatically we could just use `-b all` by default and expose a config param to completely override it; let people manage it manually in case they have a non-compliant phone. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> xpconanfan: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-KjA36Jgtf8-r1sqc9C5:b-w4xiel) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote> And what does it print if it does work correctly? My concern with this approach is twofold: a) 100ms is not necessarily enough time to make sure logcat started on an arbitrarily slow system and phone; recall our unit test flake b) we shouldn't blanket catching all errors and assuming the cause was anything in particular without some type of validation. I've seen cases already where our blanket catch was squashing exceptions for the wrong reason. So I would like to find something we can do to make sure the issue is what we think it is. I would much rather have a solution that works 100% of the time on 90% of the phones (because we can always improve the check) than a solution that works 90% of the time on 100% of the phones (because people will abandon our framework). If there's absolutely no way to do this automatically we could just use `-b all` by default and expose a config param to completely override it; let people manage it manually in case they have a non-compliant phone. </blockquote></details> It doesn't print anything on my phone if it works fine, but this is no guarantee that it won't print on other NBU devices. Maybe we should not use '-b all' as a default in the first place. If somebody has a special need for extra buffer like 'radio', they should use the param option to enable radio buffer collection. For the default behavior, the default logcat option should be used, which is to not pass '-b' at all. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io --> adorokhine: Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. --- *[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-KjA4yUN5r_m01yPfUdZ:b9lhgqa) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):* <details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote> It doesn't print anything on my phone if it works fine, but this is no guarantee that it won't print on other NBU devices. Maybe we should not use '-b all' as a default in the first place. If somebody has a special need for extra buffer like 'radio', they should use the param option to enable radio buffer collection. For the default behavior, the default logcat option should be used, which is to not pass '-b' at all. </blockquote></details> Sure, default logcat settings unless manually overridden sgtm as long as it's ok by David. --- *Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)* <!-- Sent from Reviewable.io -->
diff --git a/docs/tutorial.md b/docs/tutorial.md index 67f66b0..2c64dae 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -9,18 +9,13 @@ various devices and you can also use your own custom hardware/equipment. * A computer with at least 2 USB ports. * Mobly package and its system dependencies installed on the computer. -* One or two Android devices with the app SL4A* installed. +* One or two Android devices with the [Mobly Bundled Snippets] + (https://github.com/google/mobly-bundled-snippets) (MBS) installed. We will + use MBS to trigger actions on the Android devices. * A working adb setup. To check, connect one Android device to the computer and make sure it has "USB debugging" enabled. Make sure the device shows up in the list printed by `adb devices`. -\* You can get SL4A from the -[Android repo](https://source.android.com/source/downloading.html), under -project `<aosp>/external/sl4a` - -It can be built like a regular system app with `mm` commands. It needs to be -signed with the build you use on your Android devices. - # Example 1: Hello World!   Let's start with the simple example of posting "Hello World" on the Android @@ -51,10 +46,11 @@ class HelloWorldTest(base_test.BaseTestClass): # object is created from this. self.ads = self.register_controller(android_device) self.dut = self.ads[0] - self.dut.load_sl4a() # starts sl4a. + # Start Mobly Bundled Snippets (MBS). + self.dut.load_snippet('mbs', 'com.google.android.mobly.snippet.bundled')   def test_hello(self): - self.dut.sl4a.makeToast('Hello World!') + self.dut.mbs.makeToast('Hello World!')   if __name__ == '__main__': test_runner.main() @@ -97,13 +93,13 @@ class HelloWorldTest(base_test.BaseTestClass): def setup_class(self): self.ads = self.register_controller(android_device) self.dut = self.ads[0] - self.dut.load_sl4a() + self.dut.load_snippet('mbs', 'com.google.android.mobly.snippet.bundled')   def test_hello(self): - self.dut.sl4a.makeToast('Hello World!') + self.dut.mbs.makeToast('Hello World!')   def test_bye(self): - self.dut.sl4a.makeToast('Goodbye!') + self.dut.mbs.makeToast('Goodbye!')   if __name__ == '__main__': test_runner.main() @@ -152,9 +148,9 @@ In the test script, you could access the user parameter: def test_favorite_food(self): food = self.user_params.get('favorite_food') if food: - self.dut.sl4a.makeToast("I'd like to eat %s." % food) + self.dut.mbs.makeToast("I'd like to eat %s." % food) else: - self.dut.sl4a.makeToast("I'm not hungry.") + self.dut.mbs.makeToast("I'm not hungry.") ```   # Example 4: Multiple Test Beds and Default Test Parameters @@ -201,7 +197,7 @@ screen.   In this example, we use one Android device to discover another Android device via bluetooth. This test demonstrates several essential elements in test -writing, like logging and asserts. +writing, like asserts, device debug tag, and general logging vs logging with device tag.   **sample_config.yml**   @@ -211,111 +207,90 @@ TestBeds: Controllers: AndroidDevice: - serial: xyz, - label: dut + label: target - serial: abc, label: discoverer TestParams: bluetooth_name: MagicBluetooth, bluetooth_timeout: 5 -  -  + ```   **sample_test.py**     ```python +import logging +import pprint + +from mobly import asserts from mobly import base_test from mobly import test_runner -from mobly.controllerse import android_device -  +from mobly.controllers import android_device + +# Number of seconds for the target to stay discoverable on Bluetooth. +DISCOVERABLE_TIME = 60 + + class HelloWorldTest(base_test.BaseTestClass): -  -  - def setup_class(self): - # Registering android_device controller module, and declaring that the test - # requires at least two Android devices. - self.ads = self.register_controller(android_device, min_number=2) - self.dut = android_device.get_device(self.ads, label='dut') - self.dut.load_sl4a() - self.discoverer = android_device.get_device(self.ads, label='discoverer') - self.discoverer.load_sl4a() - self.dut.ed.clear_all_events() - self.discoverer.ed.clear_all_events() -  - def setup_test(self): - # Make sure bluetooth is on - self.dut.sl4a.bluetoothToggleState(True) - self.discoverer.sl4a.bluetoothToggleState(True) - self.dut.ed.pop_event(event_name='BluetoothStateChangedOn', - timeout=10) - self.discoverer.ed.pop_event(event_name='BluetoothStateChangedOn', - timeout=10) - if (not self.dut.sl4a.bluetoothCheckState() or - not self.discoverer.sl4a.bluetoothCheckState()): - asserts.abort_class('Could not turn on Bluetooth on both devices.') -  - # Set the name of device #1 and verify the name properly registered. - self.dut.sl4a.bluetoothSetLocalName(self.bluetooth_name) - asserts.assert_equal(self.dut.sl4a.bluetoothGetLocalName(), - self.bluetooth_name, - 'Failed to set bluetooth name to %s on %s' % - (self.bluetooth_name, self.dut.serial)) -  - def test_bluetooth_discovery(self): - # Make dut discoverable. - self.dut.sl4a.bluetoothMakeDiscoverable() - scan_mode = self.dut.sl4a.bluetoothGetScanMode() - asserts.assert_equal( - scan_mode, 3, # 3 signifies CONNECTABLE and DISCOVERABLE - 'Android device %s failed to make blueooth discoverable.' % - self.dut.serial) -  - # Start the discovery process on #discoverer. - self.discoverer.ed.clear_all_events() - self.discoverer.sl4a.bluetoothStartDiscovery() - self.discoverer.ed.pop_event( - event_name='BluetoothDiscoveryFinished', - timeout=self.bluetooth_timeout) -  - # The following log entry demonstrates AndroidDevice log object, which - # prefixes log entries with "[AndroidDevice|<serial>] " - self.discoverer.log.info('Discovering other bluetooth devices.') -  - # Get a list of discovered devices - discovered_devices = self.discoverer.sl4a.bluetoothGetDiscoveredDevices() - self.discoverer.log.info('Found devices: %s', discovered_devices) - matching_devices = [d for d in discovered_devices - if d.get('name') == self.bluetooth_name] - if not matching_devices: - asserts.fail('Android device %s did not discover %s.' % - (self.discoverer.serial, self.dut.serial)) - self.discoverer.log.info('Discovered at least 1 device named ' - '%s: %s', self.bluetooth_name, matching_devices) -  + def setup_class(self): + # Registering android_device controller module, and declaring that the test + # requires at least two Android devices. + self.ads = self.register_controller(android_device, min_number=2) + # The device used to discover Bluetooth devices. + self.discoverer = android_device.get_device( + self.ads, label='discoverer') + # Sets the tag that represents this device in logs. + self.discoverer.debug_tag = 'discoverer' + # The device that is expected to be discovered + self.target = android_device.get_device(self.ads, label='target') + self.target.debug_tag = 'target' + self.target.load_snippet('mbs', + 'com.google.android.mobly.snippet.bundled') + self.discoverer.load_snippet( + 'mbs', 'com.google.android.mobly.snippet.bundled') + + def setup_test(self): + # Make sure bluetooth is on. + self.target.mbs.btEnable() + self.discoverer.mbs.btEnable() + # Set Bluetooth name on target device. + self.target.mbs.btSetName('LookForMe!') + + def test_bluetooth_discovery(self): + target_name = self.target.mbs.btGetName() + self.target.log.info('Become discoverable with name "%s" for %ds.', + target_name, DISCOVERABLE_TIME) + self.target.mbs.btBecomeDiscoverable(DISCOVERABLE_TIME) + self.discoverer.log.info('Looking for Bluetooth devices.') + discovered_devices = self.discoverer.mbs.btDiscoverAndGetResults() + self.discoverer.log.debug('Found Bluetooth devices: %s', + pprint.pformat(discovered_devices, indent=2)) + discovered_names = [device['Name'] for device in discovered_devices] + logging.info('Verifying the target is discovered by the discoverer.') + asserts.assert_true( + target_name in discovered_names, + 'Failed to discover the target device %s over Bluetooth.' % + target_name) + + def teardown_test(self): + # Turn Bluetooth off on both devices after test finishes. + self.target.mbs.btDisable() + self.discoverer.mbs.btDisable() + + if __name__ == '__main__': - test_runner.main() + test_runner.main() + ``` -  -One will notice that this is not the most robust test (another nearby device -could be using the same name), but in the interest of simplicity, we've limited -the number of RPCs sent to each Android device to just two: -  -* For `self.dut`, we asked it to make itself discoverable and checked that it - did it. -* For `self.discoverer`, we asked it to start scanning for nearby bluetooth - devices, and then we pulled the list of devices seen. -  -There's potentially a lot more we could do to write a thorough test (e.g., check -the hardware address, see whether we can pair devices, transfer files, etc.). -  -# Event Dispatcher -  -You'll notice above that we've used `self.{device_alias}.ed.pop_event()`. The -`ed` attribute of an Android device object is an EventDispatcher, which provides -APIs to interact with async events. -  -For example, `pop_event` is a function which will block until either a -specified event is seen or the call times out, and by using it we avoid the use -of busy loops that constantly check the device state. For more, see the APIs in -`mobly.controllers.android_device_lib.event_dispatcher`. + +There's potentially a lot more we could do in this test, e.g. check +the hardware address, see whether we can pair devices, transfer files, etc. + +To learn more about the features included in MBS, go to [MBS repo] +(https://github.com/google/mobly-bundled-snippets) to see how to check its help +menu. + +To learn more about Mobly Snippet Lib, including features like Espresso support +and asynchronous calls, see the [snippet lib examples] +(https://github.com/google/mobly-snippet-lib/tree/master/examples). diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py index 159f587..a77e787 100644 --- a/mobly/controllers/android_device.py +++ b/mobly/controllers/android_device.py @@ -350,7 +350,7 @@ class AndroidDevice(object): android device should be stored. log: A logger adapted from root logger with an added prefix specific to an AndroidDevice instance. The default prefix is - [AndroidDevice|<serial>]. Use self.set_debug_tag to use a + [AndroidDevice|<serial>]. Use self.debug_tag = 'tag' to use a different tag in the prefix. adb_logcat_file_path: A string that's the full path to the adb logcat file collected, if any. @@ -408,6 +408,7 @@ class AndroidDevice(object): The tag can be customized with `ad.debug_tag = 'Caller'`: 'INFO [AndroidDevice|Caller] One pending call ringing.' """ + self.log.info('Logging debug tag set to "%s"', tag) self._debug_tag = tag self.log.extra['tag'] = tag @@ -759,11 +760,11 @@ class AndroidDevice(object): try: extra_params = self.adb_logcat_param except AttributeError: - extra_params = '-b all' + extra_params = '' cmd = 'adb -s %s logcat -v threadtime %s >> %s' % ( self.serial, extra_params, logcat_file_path) - self._adb_logcat_process = utils.start_standing_subprocess( - cmd, shell=True) + process = utils.start_standing_subprocess(cmd, shell=True) + self._adb_logcat_process = process self.adb_logcat_file_path = logcat_file_path def stop_adb_logcat(self):
logcat is empty for some NBU devices When starting adb logcat, we use `-b all` to catch all buffers. But some NBU devices (like HTC Desire 526g+) don't have the buffer option "all", and their adb logcat would only have one line saying "Unable to open log device '/dev/log/all': No such file or directory". We need to handle this properly so we get the logs from the buffers the device does have, like 'main', 'system', 'radio', and 'events'.
google/mobly
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py index 136bbba..b1cd7fe 100755 --- a/tests/mobly/controllers/android_device_test.py +++ b/tests/mobly/controllers/android_device_test.py @@ -280,7 +280,7 @@ class AndroidDeviceTest(unittest.TestCase): "AndroidDevice%s" % ad.serial, "adblog,fakemodel,%s.txt" % ad.serial) creat_dir_mock.assert_called_with(os.path.dirname(expected_log_path)) - adb_cmd = 'adb -s %s logcat -v threadtime -b all >> %s' + adb_cmd = 'adb -s %s logcat -v threadtime >> %s' start_proc_mock.assert_called_with( adb_cmd % (ad.serial, expected_log_path), shell=True) self.assertEqual(ad.adb_logcat_file_path, expected_log_path)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 2 }
1.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work future==1.0.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/google/mobly.git@5960e218c4006d8b7681ffe9698cbef160ad112f#egg=mobly mock==1.0.1 packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work portpicker==1.6.0 psutil==7.0.0 pytest @ file:///croot/pytest_1738938843180/work pytz==2025.2 PyYAML==6.0.2 timeout-decorator==0.5.0 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
name: mobly channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - future==1.0.0 - mock==1.0.1 - portpicker==1.6.0 - psutil==7.0.0 - pytz==2025.2 - pyyaml==6.0.2 - timeout-decorator==0.5.0 prefix: /opt/conda/envs/mobly
[ "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat" ]
[]
[ "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_build_info", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_cat_adb_log", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_debug_tag", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_instantiation", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_attribute_name", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_package", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_snippet_name", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_snippet_cleanup", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fail", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fallback", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat_with_user_param", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_dict_list", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_empty_config", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_no_valid_config", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_not_list_config", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_pickup_all", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_string_list", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_no_match", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial_and_extra_field", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_too_many_matches", "tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_start_services_on_ads" ]
[]
Apache License 2.0
1,216
[ "mobly/controllers/android_device.py", "docs/tutorial.md" ]
[ "mobly/controllers/android_device.py", "docs/tutorial.md" ]
dask__dask-2274
c136b9dde885ba35dde85ba84afe2ad03c20e32d
2017-04-28 19:24:50
bdb021c7dcd94ae1fa51c82fae6cf4cf7319aa14
diff --git a/dask/array/core.py b/dask/array/core.py index 9bf4edb3e..83c5160b4 100644 --- a/dask/array/core.py +++ b/dask/array/core.py @@ -514,7 +514,8 @@ def map_blocks(func, *args, **kwargs): drop_axis : number or iterable, optional Dimensions lost by the function. new_axis : number or iterable, optional - New dimensions created by the function. + New dimensions created by the function. Note that these are applied + after ``drop_axis`` (if present). name : string, optional The key name to use for the array. If not provided, will be determined by a hash of the arguments. @@ -611,9 +612,6 @@ def map_blocks(func, *args, **kwargs): if isinstance(new_axis, Number): new_axis = [new_axis] - if drop_axis and new_axis: - raise ValueError("Can't specify drop_axis and new_axis together") - arrs = [a for a in args if isinstance(a, Array)] other = [(i, a) for i, a in enumerate(args) if not isinstance(a, Array)] @@ -666,15 +664,22 @@ def map_blocks(func, *args, **kwargs): if i - 1 not in drop_axis), v) for k, v in dsk.items()) numblocks = [n for i, n in enumerate(numblocks) if i not in drop_axis] - elif new_axis: + if new_axis: + new_axis = sorted(new_axis) + for i in new_axis: + if not 0 <= i <= len(numblocks): + ndim = len(numblocks) + raise ValueError("Can't add axis %d when current " + "axis are %r. Missing axis: " + "%r" % (i, list(range(ndim)), + list(range(ndim, i)))) + numblocks.insert(i, 1) dsk, old_dsk = dict(), dsk for key in old_dsk: new_key = list(key) for i in new_axis: new_key.insert(i + 1, 0) dsk[tuple(new_key)] = old_dsk[key] - for i in sorted(new_axis): - numblocks.insert(i, 1) if chunks: if len(chunks) != len(numblocks): @@ -702,7 +707,7 @@ def map_blocks(func, *args, **kwargs): "`chunks` kwarg.") if drop_axis: chunks2 = [c for (i, c) in enumerate(chunks2) if i not in drop_axis] - elif new_axis: + if new_axis: for i in sorted(new_axis): chunks2.insert(i, (1,)) @@ -2255,6 +2260,9 @@ def stack(seq, axis=0): uc_args = list(concat((x, ind) for x in seq)) _, seq = unify_chunks(*uc_args) + dt = reduce(np.promote_types, [a.dtype for a in seq]) + seq = [x.astype(dt) for x in seq] + assert len(set(a.chunks for a in seq)) == 1 # same chunks chunks = (seq[0].chunks[:axis] + ((1,) * n,) + seq[0].chunks[axis:]) @@ -2271,8 +2279,6 @@ def stack(seq, axis=0): dsk = dict(zip(keys, values)) dsk2 = sharedict.merge((name, dsk), *[a.dask for a in seq]) - dt = reduce(np.promote_types, [a.dtype for a in seq]) - return Array(dsk2, name, chunks, dtype=dt)
da.stack dtype Greetings dask dudes, I'm using `dask` version `0.14.1` I stumbled across the following behaviour with respect to the `dtype` of a **computed** `stack`, and I was curious as to whether it is as expected: First, create some data ... ```python import dask.array as da import numpy as np # integer i = np.array(np.arange(3), dtype='i4') # float f = np.array(np.arange(3), dtype='f4') di = da.from_array(i, chunks=i.shape) df = da.from_array(f, chunks=f.shape) ``` Now, `stack` the arrays in alternate orders ... ```python didf = da.stack([di, df], axis=0) dfdi = da.stack([df, di], axis=0) ``` And show the results, paying attention to the lazy `dtype` and the computed `dtype` ... ```python print(didf) print(dfdi) print(didf.compute().dtype) print(dfdi.compute().dtype) ``` Yields ... ```python dask.array<stack, shape=(2, 3), dtype=float64, chunksize=(1, 3)> dask.array<stack, shape=(2, 3), dtype=float64, chunksize=(1, 3)> int32 float32 ``` Comparing this with `concatenate`, we see a different result, but a result I would expect ... ```python didf = da.concatenate([di, df], axis=0) dfdi = da.concatenate([df, di], axis=0) print(didf) print(dfdi) print(didf.compute().dtype) print(dfdi.compute().dtype) ``` Yields ... ```python dask.array<concatenate, shape=(6,), dtype=float64, chunksize=(3,)> dask.array<concatenate, shape=(6,), dtype=float64, chunksize=(3,)> float64 float64 ``` Is this non-symmetric `dtype` behaviour of `stack` as you would expect? Many thanks!
dask/dask
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py index b31efda9f..8feff88cb 100644 --- a/dask/array/tests/test_array_core.py +++ b/dask/array/tests/test_array_core.py @@ -277,6 +277,15 @@ def test_stack_scalars(): assert s.compute().tolist() == [np.arange(4).mean(), np.arange(4).sum()] +def test_stack_promote_type(): + i = np.arange(10, dtype='i4') + f = np.arange(10, dtype='f4') + di = da.from_array(i, chunks=5) + df = da.from_array(f, chunks=5) + res = da.stack([di, df]) + assert_eq(res, np.stack([i, f])) + + @pytest.mark.skipif(LooseVersion(np.__version__) < '1.10.0', reason="NumPy doesn't yet support stack") def test_stack_rechunk(): @@ -2106,9 +2115,9 @@ def test_map_blocks_with_changed_dimension(): with pytest.raises(ValueError): d.map_blocks(lambda b: b.sum(axis=1), drop_axis=1, dtype=d.dtype) - # Can't use both drop_axis and new_axis + # Adding axis with a gap with pytest.raises(ValueError): - d.map_blocks(lambda b: b, drop_axis=1, new_axis=1) + d.map_blocks(lambda b: b, new_axis=(3, 4)) d = da.from_array(x, chunks=(4, 8)) e = d.map_blocks(lambda b: b.sum(axis=1), drop_axis=1, dtype=d.dtype) @@ -2127,6 +2136,19 @@ def test_map_blocks_with_changed_dimension(): assert e.chunks == ((1,), (4, 4), (4, 4), (1,)) assert_eq(e, x[None, :, :, None]) + # Both new_axis and drop_axis + d = da.from_array(x, chunks=(8, 4)) + e = d.map_blocks(lambda b: b.sum(axis=0)[:, None, None], + drop_axis=0, new_axis=(1, 2), dtype=d.dtype) + assert e.chunks == ((4, 4), (1,), (1,)) + assert_eq(e, x.sum(axis=0)[:, None, None]) + + d = da.from_array(x, chunks=(4, 8)) + e = d.map_blocks(lambda b: b.sum(axis=1)[:, None, None], + drop_axis=1, new_axis=(1, 2), dtype=d.dtype) + assert e.chunks == ((4, 4), (1,), (1,)) + assert_eq(e, x.sum(axis=1)[:, None, None]) + def test_broadcast_chunks(): assert broadcast_chunks(((5, 5),), ((5, 5),)) == ((5, 5),)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 1 }
1.16
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[complete]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "flake8", "pandas_datareader" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiobotocore==2.1.2 aiohttp==3.8.6 aioitertools==0.11.0 aiosignal==1.2.0 async-timeout==4.0.2 asynctest==0.13.0 attrs==22.2.0 botocore==1.23.24 certifi==2021.5.30 charset-normalizer==2.0.12 click==8.0.4 cloudpickle==2.2.1 -e git+https://github.com/dask/dask.git@c136b9dde885ba35dde85ba84afe2ad03c20e32d#egg=dask distributed==1.19.3 flake8==5.0.4 frozenlist==1.2.0 fsspec==2022.1.0 HeapDict==1.0.1 idna==3.10 idna-ssl==1.1.0 importlib-metadata==4.2.0 iniconfig==1.1.1 jmespath==0.10.0 locket==1.0.0 lxml==5.3.1 mccabe==0.7.0 msgpack-python==0.5.6 multidict==5.2.0 numpy==1.19.5 packaging==21.3 pandas==1.1.5 pandas-datareader==0.10.0 partd==1.2.0 pluggy==1.0.0 psutil==7.0.0 py==1.11.0 pycodestyle==2.9.1 pyflakes==2.5.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 requests==2.27.1 s3fs==2022.1.0 six==1.17.0 sortedcontainers==2.4.0 tblib==1.7.0 tomli==1.2.3 toolz==0.12.0 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 wrapt==1.16.0 yarl==1.7.2 zict==2.1.0 zipp==3.6.0
name: dask channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiobotocore==2.1.2 - aiohttp==3.8.6 - aioitertools==0.11.0 - aiosignal==1.2.0 - async-timeout==4.0.2 - asynctest==0.13.0 - attrs==22.2.0 - botocore==1.23.24 - charset-normalizer==2.0.12 - click==8.0.4 - cloudpickle==2.2.1 - distributed==1.19.3 - flake8==5.0.4 - frozenlist==1.2.0 - fsspec==2022.1.0 - heapdict==1.0.1 - idna==3.10 - idna-ssl==1.1.0 - importlib-metadata==4.2.0 - iniconfig==1.1.1 - jmespath==0.10.0 - locket==1.0.0 - lxml==5.3.1 - mccabe==0.7.0 - msgpack-python==0.5.6 - multidict==5.2.0 - numpy==1.19.5 - packaging==21.3 - pandas==1.1.5 - pandas-datareader==0.10.0 - partd==1.2.0 - pluggy==1.0.0 - psutil==7.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - requests==2.27.1 - s3fs==2022.1.0 - six==1.17.0 - sortedcontainers==2.4.0 - tblib==1.7.0 - tomli==1.2.3 - toolz==0.12.0 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - wrapt==1.16.0 - yarl==1.7.2 - zict==2.1.0 - zipp==3.6.0 prefix: /opt/conda/envs/dask
[ "dask/array/tests/test_array_core.py::test_stack_promote_type", "dask/array/tests/test_array_core.py::test_map_blocks_with_changed_dimension" ]
[ "dask/array/tests/test_array_core.py::test_field_access", "dask/array/tests/test_array_core.py::test_field_access_with_shape", "dask/array/tests/test_array_core.py::test_setitem_mixed_d" ]
[ "dask/array/tests/test_array_core.py::test_getem", "dask/array/tests/test_array_core.py::test_top", "dask/array/tests/test_array_core.py::test_top_supports_broadcasting_rules", "dask/array/tests/test_array_core.py::test_concatenate3_on_scalars", "dask/array/tests/test_array_core.py::test_chunked_dot_product", "dask/array/tests/test_array_core.py::test_chunked_transpose_plus_one", "dask/array/tests/test_array_core.py::test_transpose", "dask/array/tests/test_array_core.py::test_broadcast_dimensions_works_with_singleton_dimensions", "dask/array/tests/test_array_core.py::test_broadcast_dimensions", "dask/array/tests/test_array_core.py::test_Array", "dask/array/tests/test_array_core.py::test_uneven_chunks", "dask/array/tests/test_array_core.py::test_numblocks_suppoorts_singleton_block_dims", "dask/array/tests/test_array_core.py::test_keys", "dask/array/tests/test_array_core.py::test_Array_computation", "dask/array/tests/test_array_core.py::test_stack", "dask/array/tests/test_array_core.py::test_short_stack", "dask/array/tests/test_array_core.py::test_stack_scalars", "dask/array/tests/test_array_core.py::test_stack_rechunk", "dask/array/tests/test_array_core.py::test_concatenate", "dask/array/tests/test_array_core.py::test_concatenate_rechunk", "dask/array/tests/test_array_core.py::test_concatenate_fixlen_strings", "dask/array/tests/test_array_core.py::test_vstack", "dask/array/tests/test_array_core.py::test_hstack", "dask/array/tests/test_array_core.py::test_dstack", "dask/array/tests/test_array_core.py::test_take", "dask/array/tests/test_array_core.py::test_compress", "dask/array/tests/test_array_core.py::test_binops", "dask/array/tests/test_array_core.py::test_isnull", "dask/array/tests/test_array_core.py::test_isclose", "dask/array/tests/test_array_core.py::test_broadcast_shapes", "dask/array/tests/test_array_core.py::test_elemwise_on_scalars", "dask/array/tests/test_array_core.py::test_partial_by_order", "dask/array/tests/test_array_core.py::test_elemwise_with_ndarrays", "dask/array/tests/test_array_core.py::test_elemwise_differently_chunked", "dask/array/tests/test_array_core.py::test_operators", "dask/array/tests/test_array_core.py::test_operator_dtype_promotion", "dask/array/tests/test_array_core.py::test_tensordot", "dask/array/tests/test_array_core.py::test_tensordot_2[0]", "dask/array/tests/test_array_core.py::test_tensordot_2[1]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes2]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes3]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes4]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes5]", "dask/array/tests/test_array_core.py::test_tensordot_2[axes6]", "dask/array/tests/test_array_core.py::test_dot_method", "dask/array/tests/test_array_core.py::test_T", "dask/array/tests/test_array_core.py::test_norm", "dask/array/tests/test_array_core.py::test_choose", "dask/array/tests/test_array_core.py::test_where", "dask/array/tests/test_array_core.py::test_where_has_informative_error", "dask/array/tests/test_array_core.py::test_coarsen", "dask/array/tests/test_array_core.py::test_coarsen_with_excess", "dask/array/tests/test_array_core.py::test_insert", "dask/array/tests/test_array_core.py::test_multi_insert", "dask/array/tests/test_array_core.py::test_broadcast_to", "dask/array/tests/test_array_core.py::test_ravel", "dask/array/tests/test_array_core.py::test_roll[None-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks1]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks0]", "dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks1]", "dask/array/tests/test_array_core.py::test_reshape[original_shape0-new_shape0-chunks0]", "dask/array/tests/test_array_core.py::test_reshape[original_shape1-new_shape1-5]", "dask/array/tests/test_array_core.py::test_reshape[original_shape2-new_shape2-5]", "dask/array/tests/test_array_core.py::test_reshape[original_shape3-new_shape3-12]", "dask/array/tests/test_array_core.py::test_reshape[original_shape4-new_shape4-12]", "dask/array/tests/test_array_core.py::test_reshape[original_shape5-new_shape5-chunks5]", "dask/array/tests/test_array_core.py::test_reshape[original_shape6-new_shape6-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape7-new_shape7-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape8-new_shape8-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape9-new_shape9-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape10-new_shape10-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape11-new_shape11-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape12-new_shape12-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape13-new_shape13-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape14-new_shape14-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape15-new_shape15-2]", "dask/array/tests/test_array_core.py::test_reshape[original_shape16-new_shape16-chunks16]", "dask/array/tests/test_array_core.py::test_reshape[original_shape17-new_shape17-3]", "dask/array/tests/test_array_core.py::test_reshape[original_shape18-new_shape18-4]", "dask/array/tests/test_array_core.py::test_reshape[original_shape19-new_shape19-chunks19]", "dask/array/tests/test_array_core.py::test_reshape[original_shape20-new_shape20-1]", "dask/array/tests/test_array_core.py::test_reshape[original_shape21-new_shape21-1]", "dask/array/tests/test_array_core.py::test_reshape[original_shape22-new_shape22-24]", "dask/array/tests/test_array_core.py::test_reshape[original_shape23-new_shape23-6]", "dask/array/tests/test_array_core.py::test_reshape[original_shape24-new_shape24-6]", "dask/array/tests/test_array_core.py::test_reshape[original_shape25-new_shape25-6]", "dask/array/tests/test_array_core.py::test_reshape[original_shape26-new_shape26-chunks26]", "dask/array/tests/test_array_core.py::test_reshape[original_shape27-new_shape27-chunks27]", "dask/array/tests/test_array_core.py::test_reshape[original_shape28-new_shape28-chunks28]", "dask/array/tests/test_array_core.py::test_reshape[original_shape29-new_shape29-chunks29]", "dask/array/tests/test_array_core.py::test_reshape[original_shape30-new_shape30-chunks30]", "dask/array/tests/test_array_core.py::test_reshape[original_shape31-new_shape31-chunks31]", "dask/array/tests/test_array_core.py::test_reshape[original_shape32-new_shape32-chunks32]", "dask/array/tests/test_array_core.py::test_reshape[original_shape33-new_shape33-chunks33]", "dask/array/tests/test_array_core.py::test_reshape[original_shape34-new_shape34-chunks34]", "dask/array/tests/test_array_core.py::test_reshape_exceptions", "dask/array/tests/test_array_core.py::test_reshape_splat", "dask/array/tests/test_array_core.py::test_reshape_fails_for_dask_only", "dask/array/tests/test_array_core.py::test_reshape_unknown_dimensions", "dask/array/tests/test_array_core.py::test_full", "dask/array/tests/test_array_core.py::test_map_blocks", "dask/array/tests/test_array_core.py::test_map_blocks2", "dask/array/tests/test_array_core.py::test_map_blocks_with_constants", "dask/array/tests/test_array_core.py::test_map_blocks_with_kwargs", "dask/array/tests/test_array_core.py::test_map_blocks_with_chunks", "dask/array/tests/test_array_core.py::test_map_blocks_dtype_inference", "dask/array/tests/test_array_core.py::test_fromfunction", "dask/array/tests/test_array_core.py::test_from_function_requires_block_args", "dask/array/tests/test_array_core.py::test_repr", "dask/array/tests/test_array_core.py::test_slicing_with_ellipsis", "dask/array/tests/test_array_core.py::test_slicing_with_ndarray", "dask/array/tests/test_array_core.py::test_dtype", "dask/array/tests/test_array_core.py::test_blockdims_from_blockshape", "dask/array/tests/test_array_core.py::test_coerce", "dask/array/tests/test_array_core.py::test_store_delayed_target", "dask/array/tests/test_array_core.py::test_store", "dask/array/tests/test_array_core.py::test_store_regions", "dask/array/tests/test_array_core.py::test_store_compute_false", "dask/array/tests/test_array_core.py::test_store_locks", "dask/array/tests/test_array_core.py::test_np_array_with_zero_dimensions", "dask/array/tests/test_array_core.py::test_unique", "dask/array/tests/test_array_core.py::test_dtype_complex", "dask/array/tests/test_array_core.py::test_astype", "dask/array/tests/test_array_core.py::test_arithmetic", "dask/array/tests/test_array_core.py::test_elemwise_consistent_names", "dask/array/tests/test_array_core.py::test_optimize", "dask/array/tests/test_array_core.py::test_slicing_with_non_ndarrays", "dask/array/tests/test_array_core.py::test_getarray", "dask/array/tests/test_array_core.py::test_squeeze", "dask/array/tests/test_array_core.py::test_size", "dask/array/tests/test_array_core.py::test_nbytes", "dask/array/tests/test_array_core.py::test_itemsize", "dask/array/tests/test_array_core.py::test_Array_normalizes_dtype", "dask/array/tests/test_array_core.py::test_from_array_with_lock", "dask/array/tests/test_array_core.py::test_from_array_slicing_results_in_ndarray", "dask/array/tests/test_array_core.py::test_asarray", "dask/array/tests/test_array_core.py::test_from_func", "dask/array/tests/test_array_core.py::test_topk", "dask/array/tests/test_array_core.py::test_topk_k_bigger_than_chunk", "dask/array/tests/test_array_core.py::test_bincount", "dask/array/tests/test_array_core.py::test_bincount_with_weights", "dask/array/tests/test_array_core.py::test_bincount_raises_informative_error_on_missing_minlength_kwarg", "dask/array/tests/test_array_core.py::test_digitize", "dask/array/tests/test_array_core.py::test_histogram", "dask/array/tests/test_array_core.py::test_histogram_alternative_bins_range", "dask/array/tests/test_array_core.py::test_histogram_return_type", "dask/array/tests/test_array_core.py::test_histogram_extra_args_and_shapes", "dask/array/tests/test_array_core.py::test_concatenate3_2", "dask/array/tests/test_array_core.py::test_map_blocks3", "dask/array/tests/test_array_core.py::test_from_array_with_missing_chunks", "dask/array/tests/test_array_core.py::test_cache", "dask/array/tests/test_array_core.py::test_take_dask_from_numpy", "dask/array/tests/test_array_core.py::test_normalize_chunks", "dask/array/tests/test_array_core.py::test_raise_on_no_chunks", "dask/array/tests/test_array_core.py::test_chunks_is_immutable", "dask/array/tests/test_array_core.py::test_raise_on_bad_kwargs", "dask/array/tests/test_array_core.py::test_long_slice", "dask/array/tests/test_array_core.py::test_ellipsis_slicing", "dask/array/tests/test_array_core.py::test_point_slicing", "dask/array/tests/test_array_core.py::test_point_slicing_with_full_slice", "dask/array/tests/test_array_core.py::test_slice_with_floats", "dask/array/tests/test_array_core.py::test_vindex_errors", "dask/array/tests/test_array_core.py::test_vindex_merge", "dask/array/tests/test_array_core.py::test_empty_array", "dask/array/tests/test_array_core.py::test_array", "dask/array/tests/test_array_core.py::test_cov", "dask/array/tests/test_array_core.py::test_corrcoef", "dask/array/tests/test_array_core.py::test_memmap", "dask/array/tests/test_array_core.py::test_to_npy_stack", "dask/array/tests/test_array_core.py::test_view", "dask/array/tests/test_array_core.py::test_view_fortran", "dask/array/tests/test_array_core.py::test_broadcast_chunks", "dask/array/tests/test_array_core.py::test_chunks_error", "dask/array/tests/test_array_core.py::test_array_compute_forward_kwargs", "dask/array/tests/test_array_core.py::test_dont_fuse_outputs", "dask/array/tests/test_array_core.py::test_dont_dealias_outputs", "dask/array/tests/test_array_core.py::test_timedelta_op", "dask/array/tests/test_array_core.py::test_to_delayed", "dask/array/tests/test_array_core.py::test_cumulative", "dask/array/tests/test_array_core.py::test_eye", "dask/array/tests/test_array_core.py::test_diag", "dask/array/tests/test_array_core.py::test_tril_triu", "dask/array/tests/test_array_core.py::test_tril_triu_errors", "dask/array/tests/test_array_core.py::test_atop_names", "dask/array/tests/test_array_core.py::test_atop_new_axes", "dask/array/tests/test_array_core.py::test_atop_kwargs", "dask/array/tests/test_array_core.py::test_atop_chunks", "dask/array/tests/test_array_core.py::test_from_delayed", "dask/array/tests/test_array_core.py::test_A_property", "dask/array/tests/test_array_core.py::test_copy_mutate", "dask/array/tests/test_array_core.py::test_npartitions", "dask/array/tests/test_array_core.py::test_astype_gh1151", "dask/array/tests/test_array_core.py::test_elemwise_name", "dask/array/tests/test_array_core.py::test_map_blocks_name", "dask/array/tests/test_array_core.py::test_from_array_names", "dask/array/tests/test_array_core.py::test_array_picklable", "dask/array/tests/test_array_core.py::test_swapaxes", "dask/array/tests/test_array_core.py::test_from_array_raises_on_bad_chunks", "dask/array/tests/test_array_core.py::test_concatenate_axes", "dask/array/tests/test_array_core.py::test_atop_concatenate", "dask/array/tests/test_array_core.py::test_common_blockdim", "dask/array/tests/test_array_core.py::test_uneven_chunks_that_fit_neatly", "dask/array/tests/test_array_core.py::test_elemwise_uneven_chunks", "dask/array/tests/test_array_core.py::test_uneven_chunks_atop", "dask/array/tests/test_array_core.py::test_warn_bad_rechunking", "dask/array/tests/test_array_core.py::test_optimize_fuse_keys", "dask/array/tests/test_array_core.py::test_round", "dask/array/tests/test_array_core.py::test_repeat", "dask/array/tests/test_array_core.py::test_tile[0-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[0-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[1-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[1-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[2-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[2-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[3-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[3-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile[5-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile[5-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape0-chunks0]", "dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape1-chunks1]", "dask/array/tests/test_array_core.py::test_concatenate_stack_dont_warn", "dask/array/tests/test_array_core.py::test_map_blocks_delayed", "dask/array/tests/test_array_core.py::test_no_chunks", "dask/array/tests/test_array_core.py::test_no_chunks_2d", "dask/array/tests/test_array_core.py::test_no_chunks_yes_chunks", "dask/array/tests/test_array_core.py::test_raise_informative_errors_no_chunks", "dask/array/tests/test_array_core.py::test_no_chunks_slicing_2d", "dask/array/tests/test_array_core.py::test_index_array_with_array_1d", "dask/array/tests/test_array_core.py::test_index_array_with_array_2d", "dask/array/tests/test_array_core.py::test_setitem_1d", "dask/array/tests/test_array_core.py::test_setitem_2d", "dask/array/tests/test_array_core.py::test_setitem_errs", "dask/array/tests/test_array_core.py::test_zero_slice_dtypes", "dask/array/tests/test_array_core.py::test_zero_sized_array_rechunk", "dask/array/tests/test_array_core.py::test_atop_zero_shape", "dask/array/tests/test_array_core.py::test_atop_zero_shape_new_axes", "dask/array/tests/test_array_core.py::test_broadcast_against_zero_shape", "dask/array/tests/test_array_core.py::test_fast_from_array", "dask/array/tests/test_array_core.py::test_random_from_array", "dask/array/tests/test_array_core.py::test_concatenate_errs", "dask/array/tests/test_array_core.py::test_stack_errs", "dask/array/tests/test_array_core.py::test_transpose_negative_axes", "dask/array/tests/test_array_core.py::test_atop_with_numpy_arrays", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-100]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-6]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-100]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-6]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-100]", "dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-6]", "dask/array/tests/test_array_core.py::test_constructor_plugin" ]
[]
BSD 3-Clause "New" or "Revised" License
1,217
[ "dask/array/core.py" ]
[ "dask/array/core.py" ]
pre-commit__pre-commit-529
1be4e4f82e31336fa5fca096c962c72ac0041537
2017-04-29 21:32:56
e3b14c35f782ed464e3f96b44e8509048187689f
diff --git a/pre_commit/main.py b/pre_commit/main.py index 8a77316..baaf84b 100644 --- a/pre_commit/main.py +++ b/pre_commit/main.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import argparse +import logging import os import sys @@ -20,6 +21,8 @@ from pre_commit.logging_handler import add_logging_handler from pre_commit.runner import Runner +logger = logging.getLogger('pre_commit') + # https://github.com/pre-commit/pre-commit/issues/217 # On OSX, making a virtualenv using pyvenv at . causes `virtualenv` and `pip` # to install packages to the wrong place. We don't want anything to deal with @@ -117,7 +120,14 @@ def main(argv=None): _add_color_option(autoupdate_parser) _add_config_option(autoupdate_parser) autoupdate_parser.add_argument( - '--tags-only', action='store_true', help='Update to tags only.', + '--tags-only', action='store_true', help='LEGACY: for compatibility', + ) + autoupdate_parser.add_argument( + '--bleeding-edge', action='store_true', + help=( + 'Update to the bleeding edge of `master` instead of the latest ' + 'tagged version (the default behavior).' + ), ) run_parser = subparsers.add_parser('run', help='Run hooks.') @@ -209,7 +219,9 @@ def main(argv=None): elif args.command == 'clean': return clean(runner) elif args.command == 'autoupdate': - return autoupdate(runner, args.tags_only) + if args.tags_only: + logger.warning('--tags-only is the default') + return autoupdate(runner, tags_only=not args.bleeding_edge) elif args.command == 'run': return run(runner, args) elif args.command == 'sample-config':
[RFC] Make the default of `pre-commit autoupdate` use `--tags-only`? I find that `--tags-only` to be much better than the default. My proposal: - Make the `--tags-only` behaviour the default behaviour - Make `--tags-only` a noop argument which produces a warning and does the default - Add a `--bleeding-edge` which does the current default behaviour @chriskuehl thoughts?
pre-commit/pre-commit
diff --git a/tests/conftest.py b/tests/conftest.py index 23eddb5..140463b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -186,3 +186,12 @@ def cap_out(): with mock.patch.object(output, 'write', write): with mock.patch.object(output, 'write_line', write_line): yield Fixture(stream) + + [email protected]_fixture +def fake_log_handler(): + handler = mock.Mock(level=logging.INFO) + logger = logging.getLogger('pre_commit') + logger.addHandler(handler) + yield handler + logger.removeHandler(handler) diff --git a/tests/main_test.py b/tests/main_test.py index 8cc6121..0425b8d 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -127,3 +127,8 @@ def test_expected_fatal_error_no_git_repo( 'Is it installed, and are you in a Git repository directory?\n' 'Check the log at ~/.pre-commit/pre-commit.log\n' ) + + +def test_warning_on_tags_only(mock_commands, cap_out): + main.main(('autoupdate', '--tags-only')) + assert '--tags-only is the default' in cap_out.get() diff --git a/tests/repository_test.py b/tests/repository_test.py index 4cb2e4e..f91642e 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -2,7 +2,6 @@ from __future__ import absolute_import from __future__ import unicode_literals import io -import logging import os.path import re import shutil @@ -680,15 +679,6 @@ def test_local_python_repo(store): assert ret[1].replace(b'\r\n', b'\n') == b"['filename']\nHello World\n" [email protected]_fixture -def fake_log_handler(): - handler = mock.Mock(level=logging.INFO) - logger = logging.getLogger('pre_commit') - logger.addHandler(handler) - yield handler - logger.removeHandler(handler) - - def test_hook_id_not_present(tempdir_factory, store, fake_log_handler): path = make_repo(tempdir_factory, 'script_hooks_repo') config = make_config_from_repo(path)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 2 }, "num_modified_files": 1 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements-dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aspy.yaml==1.3.0 cached-property==2.0.1 coverage==7.8.0 distlib==0.3.9 exceptiongroup==1.2.2 filelock==3.18.0 flake8==7.2.0 iniconfig==2.1.0 mccabe==0.7.0 mock==5.2.0 nodeenv==1.9.1 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 -e git+https://github.com/pre-commit/pre-commit.git@1be4e4f82e31336fa5fca096c962c72ac0041537#egg=pre_commit pycodestyle==2.13.0 pyflakes==3.3.1 pytest==8.3.5 pytest-env==1.1.5 PyYAML==6.0.2 six==1.17.0 tomli==2.2.1 virtualenv==20.29.3
name: pre-commit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aspy-yaml==1.3.0 - cached-property==2.0.1 - coverage==7.8.0 - distlib==0.3.9 - exceptiongroup==1.2.2 - filelock==3.18.0 - flake8==7.2.0 - iniconfig==2.1.0 - mccabe==0.7.0 - mock==5.2.0 - nodeenv==1.9.1 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - pycodestyle==2.13.0 - pyflakes==3.3.1 - pytest==8.3.5 - pytest-env==1.1.5 - pyyaml==6.0.2 - setuptools==18.4 - six==1.17.0 - tomli==2.2.1 - virtualenv==20.29.3 prefix: /opt/conda/envs/pre-commit
[ "tests/main_test.py::test_warning_on_tags_only" ]
[ "tests/repository_test.py::test_switch_language_versions_doesnt_clobber", "tests/repository_test.py::test_versioned_python_hook", "tests/repository_test.py::test_run_a_ruby_hook", "tests/repository_test.py::test_run_versioned_ruby_hook", "tests/repository_test.py::test_run_ruby_hook_with_disable_shared_gems", "tests/repository_test.py::test_golang_hook", "tests/repository_test.py::test_additional_ruby_dependencies_installed", "tests/repository_test.py::test_additional_golang_dependencies_installed" ]
[ "tests/main_test.py::test_overall_help", "tests/main_test.py::test_help_command", "tests/main_test.py::test_help_other_command", "tests/main_test.py::test_install_command[autoupdate]", "tests/main_test.py::test_install_command[clean]", "tests/main_test.py::test_install_command[install]", "tests/main_test.py::test_install_command[install-hooks]", "tests/main_test.py::test_install_command[run]", "tests/main_test.py::test_install_command[sample-config]", "tests/main_test.py::test_install_command[uninstall]", "tests/main_test.py::test_help_cmd_in_empty_directory", "tests/main_test.py::test_expected_fatal_error_no_git_repo", "tests/repository_test.py::test_python_hook", "tests/repository_test.py::test_python_hook_args_with_spaces", "tests/repository_test.py::test_python_hook_weird_setup_cfg", "tests/repository_test.py::test_run_a_node_hook", "tests/repository_test.py::test_run_versioned_node_hook", "tests/repository_test.py::test_system_hook_with_spaces", "tests/repository_test.py::test_repo_with_legacy_hooks_yaml", "tests/repository_test.py::test_missing_executable", "tests/repository_test.py::test_missing_pcre_support", "tests/repository_test.py::test_run_a_script_hook", "tests/repository_test.py::test_run_hook_with_spaced_args", "tests/repository_test.py::test_run_hook_with_curly_braced_arguments", "tests/repository_test.py::test_pcre_hook_no_match", "tests/repository_test.py::test_pcre_hook_matching", "tests/repository_test.py::test_pcre_hook_case_insensitive_option", "tests/repository_test.py::test_pcre_many_files", "tests/repository_test.py::test_cwd_of_hook", "tests/repository_test.py::test_lots_of_files", "tests/repository_test.py::test_venvs", "tests/repository_test.py::test_additional_dependencies", "tests/repository_test.py::test_additional_dependencies_duplicated", "tests/repository_test.py::test_additional_python_dependencies_installed", "tests/repository_test.py::test_additional_dependencies_roll_forward", "tests/repository_test.py::test_additional_node_dependencies_installed", "tests/repository_test.py::test_reinstall", "tests/repository_test.py::test_control_c_control_c_on_install", "tests/repository_test.py::test_really_long_file_paths", "tests/repository_test.py::test_config_overrides_repo_specifics", "tests/repository_test.py::test_tags_on_repositories", "tests/repository_test.py::test_local_repository", "tests/repository_test.py::test_local_python_repo", "tests/repository_test.py::test_hook_id_not_present", "tests/repository_test.py::test_too_new_version", "tests/repository_test.py::test_versions_ok[0.1.0]", "tests/repository_test.py::test_versions_ok[0.13.6]" ]
[]
MIT License
1,218
[ "pre_commit/main.py" ]
[ "pre_commit/main.py" ]
colour-science__colour-321
901712f4c25bac410c19cce0aabdac855c29de4e
2017-04-30 09:40:47
3cd6ab8d4c3483bcdeb2d7ef33967160808c0bb2
diff --git a/colour/__init__.py b/colour/__init__.py index 9a861e285..e8b3fec8d 100644 --- a/colour/__init__.py +++ b/colour/__init__.py @@ -13,6 +13,7 @@ Subpackages - adaptation: Chromatic adaptation models and transformations. - algebra: Algebra utilities. - appearance: Colour appearance models. +- biochemistry: Biochemistry computations. - characterisation: Colour fitting and camera characterisation. - colorimetry: Core objects for colour computations. - constants: *CIE* and *CODATA* constants. @@ -40,6 +41,8 @@ from .adaptation import * # noqa from . import adaptation # noqa from .algebra import * # noqa from . import algebra # noqa +from .biochemistry import * # noqa +from . import biochemistry # noqa from .colorimetry import * # noqa from . import colorimetry # noqa from .appearance import * # noqa @@ -80,6 +83,7 @@ __all__ = [] __all__ += utilities.__all__ __all__ += adaptation.__all__ __all__ += algebra.__all__ +__all__ += biochemistry.__all__ __all__ += colorimetry.__all__ __all__ += appearance.__all__ __all__ += constants.__all__ diff --git a/colour/biochemistry/__init__.py b/colour/biochemistry/__init__.py new file mode 100644 index 000000000..3ab70e5e2 --- /dev/null +++ b/colour/biochemistry/__init__.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +from .michaelis_menten import ( + reaction_rate_MichealisMenten, + substrate_concentration_MichealisMenten) + +__all__ = [] +__all__ += ['reaction_rate_MichealisMenten', + 'substrate_concentration_MichealisMenten'] diff --git a/colour/biochemistry/michaelis_menten.py b/colour/biochemistry/michaelis_menten.py new file mode 100644 index 000000000..48b5d172a --- /dev/null +++ b/colour/biochemistry/michaelis_menten.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Michaelis–Menten Kinetics +========================= + +Implements support for *Michaelis–Menten* kinetics, a model of enzyme kinetics: + +- :func:`reaction_rate_MichealisMenten` +- :func:`substrate_concentration_MichealisMenten` + +References +---------- +.. [1] Wikipedia. (n.d.). Michaelis–Menten kinetics. Retrieved April 29, 2017, + from https://en.wikipedia.org/wiki/Michaelis–Menten_kinetics +""" + +from __future__ import division, unicode_literals + +import numpy as np + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2017 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = '[email protected]' +__status__ = 'Production' + +__all__ = ['reaction_rate_MichealisMenten', + 'substrate_concentration_MichealisMenten'] + + +def reaction_rate_MichealisMenten(S, V_max, K_m): + """ + Describes the rate of enzymatic reactions, by relating reaction rate + :math:`v` to concentration of a substrate :math:`S`. + + Parameters + ---------- + S : array_like + Concentration of a substrate :math:`S`. + V_max : array_like + Maximum rate :math:`V_{max}` achieved by the system, at saturating + substrate concentration. + K_m : array_like + Substrate concentration :math:`V_{max}` at which the reaction rate is + half of :math:`V_{max}`. + + Returns + ------- + array_like + Reaction rate :math:`v`. + + Examples + -------- + >>> reaction_rate_MichealisMenten(0.5, 2.5, 0.8) # doctest: +ELLIPSIS + 0.9615384... + """ + + S = np.asarray(S) + V_max = np.asarray(V_max) + K_m = np.asarray(K_m) + + v = (V_max * S) / (K_m + S) + + return v + + +def substrate_concentration_MichealisMenten(v, V_max, K_m): + """ + Describes the rate of enzymatic reactions, by relating concentration of a + substrate :math:`S` to reaction rate :math:`v`. + + Parameters + ---------- + v : array_like + Reaction rate :math:`v`. + V_max : array_like + Maximum rate :math:`V_{max}` achieved by the system, at saturating + substrate concentration. + K_m : array_like + Substrate concentration :math:`V_{max}` at which the reaction rate is + half of :math:`V_{max}`. + + Returns + ------- + array_like + Concentration of a substrate :math:`S`. + + Examples + -------- + >>> substrate_concentration_MichealisMenten( + ... 0.961538461538461, 2.5, 0.8) # doctest: +ELLIPSIS + 0.4999999... + """ + + v = np.asarray(v) + V_max = np.asarray(V_max) + K_m = np.asarray(K_m) + + S = (v * K_m) / (V_max - v) + + return S diff --git a/colour/colorimetry/__init__.py b/colour/colorimetry/__init__.py index d9bfe21e7..6b133de94 100644 --- a/colour/colorimetry/__init__.py +++ b/colour/colorimetry/__init__.py @@ -37,13 +37,15 @@ from .lightness import lightness from .lightness import ( lightness_Glasser1958, lightness_Wyszecki1963, - lightness_CIE1976) + lightness_CIE1976, + lightness_Fairchild2010) from .luminance import LUMINANCE_METHODS from .luminance import luminance from .luminance import ( luminance_Newhall1943, luminance_ASTMD153508, - luminance_CIE1976) + luminance_CIE1976, + luminance_Fairchild2010) from .dominant import ( dominant_wavelength, complementary_wavelength, @@ -111,12 +113,14 @@ __all__ += ['LIGHTNESS_METHODS'] __all__ += ['lightness'] __all__ += ['lightness_Glasser1958', 'lightness_Wyszecki1963', - 'lightness_CIE1976'] + 'lightness_CIE1976', + 'lightness_Fairchild2010'] __all__ += ['LUMINANCE_METHODS'] __all__ += ['luminance'] __all__ += ['luminance_Newhall1943', 'luminance_ASTMD153508', - 'luminance_CIE1976'] + 'luminance_CIE1976', + 'luminance_Fairchild2010'] __all__ += ['dominant_wavelength', 'complementary_wavelength', 'excitation_purity', diff --git a/colour/colorimetry/lightness.py b/colour/colorimetry/lightness.py index f4837b5f1..9f4e944d3 100644 --- a/colour/colorimetry/lightness.py +++ b/colour/colorimetry/lightness.py @@ -2,20 +2,22 @@ # -*- coding: utf-8 -*- """ -Lightness :math:`L^*` -===================== +Lightness :math:`L` +=================== -Defines *Lightness* :math:`L^*` computation objects. +Defines *Lightness* :math:`L` computation objects. The following methods are available: -- :func:`lightness_Glasser1958`: *Lightness* :math:`L^*` computation of given - *luminance* :math:`Y` using *Glasser, Mckinney, Reilly and Schnelle (1958) - method*. +- :func:`lightness_Glasser1958`: *Lightness* :math:`L` computation of given + *luminance* :math:`Y` using *Glasser, Mckinney, Reilly and Schnelle (1958)* + method. - :func:`lightness_Wyszecki1963`: *Lightness* :math:`W` computation of given *luminance* :math:`Y` using *Wyszecki (1963)⁠⁠⁠⁠* method. - :func:`lightness_CIE1976`: *Lightness* :math:`L^*` computation of given *luminance* :math:`Y` as per *CIE 1976* recommendation. +- :func:`lightness_Fairchild2010`: *Lightness* :math:`L_{hdr}` computation + of given *luminance* :math:`Y` using *Fairchild and Wyble (2010)* method. See Also -------- @@ -33,6 +35,7 @@ from __future__ import division, unicode_literals import numpy as np +from colour.biochemistry import reaction_rate_MichealisMenten from colour.constants import CIE_E, CIE_K from colour.utilities import CaseInsensitiveMapping, filter_kwargs, warning @@ -46,6 +49,7 @@ __status__ = 'Production' __all__ = ['lightness_Glasser1958', 'lightness_Wyszecki1963', 'lightness_CIE1976', + 'lightness_Fairchild2010', 'LIGHTNESS_METHODS', 'lightness'] @@ -182,15 +186,63 @@ def lightness_CIE1976(Y, Y_n=100): return Lstar +def lightness_Fairchild2010(Y, epsilon=2): + """ + Computes *Lightness* :math:`L_{hdr}` of given *luminance* :math:`Y` using + *Fairchild and Wyble (2010)* method accordingly to *Michealis-Menten* + kinetics. + + Parameters + ---------- + Y : array_like + *luminance* :math:`Y`. + epsilon : numeric or array_like, optional + :math:`\epsilon` exponent. + + Returns + ------- + array_like + *Lightness* :math:`L_{hdr}`. + + Warning + ------- + The input domain of that definition is non standard! + + Notes + ----- + - Input *luminance* :math:`Y` is in domain [0, :math:`\infty`]. + + References + ---------- + .. [6] Fairchild, M. D., & Wyble, D. R. (2010). hdr-CIELAB and hdr-IPT: + Simple Models for Describing the Color of High-Dynamic-Range and + Wide-Color-Gamut Images. In Proc. of Color and Imaging Conference + (pp. 322–326). ISBN:9781629932156 + + Examples + -------- + >>> lightness_Fairchild2010(10.08 / 100, 1.836) # doctest: +ELLIPSIS + 24.9022902... + """ + + Y = np.asarray(Y) + + L_hdr = reaction_rate_MichealisMenten( + Y ** epsilon, 100, 0.184 ** epsilon) + 0.02 + + return L_hdr + + LIGHTNESS_METHODS = CaseInsensitiveMapping( {'Glasser 1958': lightness_Glasser1958, 'Wyszecki 1963': lightness_Wyszecki1963, - 'CIE 1976': lightness_CIE1976}) + 'CIE 1976': lightness_CIE1976, + 'Fairchild 2010': lightness_Fairchild2010}) """ Supported *Lightness* computations methods. LIGHTNESS_METHODS : CaseInsensitiveMapping - **{'Glasser 1958', 'Wyszecki 1963', 'CIE 1976'}** + **{'Glasser 1958', 'Wyszecki 1963', 'CIE 1976', 'Fairchild 2010'}** Aliases: @@ -201,14 +253,14 @@ LIGHTNESS_METHODS['Lstar1976'] = LIGHTNESS_METHODS['CIE 1976'] def lightness(Y, method='CIE 1976', **kwargs): """ - Returns the *Lightness* :math:`L^*` using given method. + Returns the *Lightness* :math:`L` using given method. Parameters ---------- Y : numeric or array_like *luminance* :math:`Y`. method : unicode, optional - **{'CIE 1976', 'Glasser 1958', 'Wyszecki 1963'}**, + **{'CIE 1976', 'Glasser 1958', 'Wyszecki 1963', 'Fairchild 2010'}**, Computation method. Other Parameters @@ -216,17 +268,20 @@ def lightness(Y, method='CIE 1976', **kwargs): Y_n : numeric or array_like, optional {:func:`lightness_CIE1976`}, White reference *luminance* :math:`Y_n`. + epsilon : numeric or array_like, optional + {:func:`lightness_Fairchild2010`}, + :math:`\epsilon` exponent. Returns ------- numeric or array_like - *Lightness* :math:`L^*`. + *Lightness* :math:`L`. Notes ----- - Input *luminance* :math:`Y` and optional :math:`Y_n` are in domain - [0, 100]. - - Output *Lightness* :math:`L^*` is in range [0, 100]. + [0, 100] or [0, :math:`\infty`]. + - Output *Lightness* :math:`L` is in range [0, 100]. Examples -------- @@ -240,6 +295,11 @@ def lightness(Y, method='CIE 1976', **kwargs): 36.2505626... >>> lightness(10.08, method='Wyszecki 1963') # doctest: +ELLIPSIS 37.0041149... + >>> lightness( + ... 10.08 / 100, + ... epsilon=1.836, + ... method='Fairchild 2010') # doctest: +ELLIPSIS + 24.9022902... """ function = LIGHTNESS_METHODS[method] diff --git a/colour/colorimetry/luminance.py b/colour/colorimetry/luminance.py index 323220e8a..9316e6831 100644 --- a/colour/colorimetry/luminance.py +++ b/colour/colorimetry/luminance.py @@ -16,6 +16,8 @@ The following methods are available: *Munsell* value :math:`V` using *ASTM D1535-08e1* method. - :func:`luminance_CIE1976`: *luminance* :math:`Y` computation of given *Lightness* :math:`L^*` as per *CIE 1976* recommendation. +- :func:`luminance_Fairchild2010`: *luminance* :math:`Y` computation of given + *Lightness* :math:`L_{hdr}` using *Fairchild and Wyble (2010)* method. See Also -------- @@ -28,6 +30,7 @@ from __future__ import division, unicode_literals import numpy as np +from colour.biochemistry import substrate_concentration_MichealisMenten from colour.constants import CIE_E, CIE_K from colour.utilities import CaseInsensitiveMapping, filter_kwargs @@ -41,6 +44,7 @@ __status__ = 'Production' __all__ = ['luminance_Newhall1943', 'luminance_ASTMD153508', 'luminance_CIE1976', + 'luminance_Fairchild2010', 'LUMINANCE_METHODS', 'luminance'] @@ -174,15 +178,64 @@ def luminance_CIE1976(Lstar, Y_n=100): return Y +def luminance_Fairchild2010(L_hdr, epsilon=2): + """ + Computes *luminance* :math:`Y` of given *Lightness* :math:`L_{hdr}` using + *Fairchild and Wyble (2010)* method accordingly to *Michealis-Menten* + kinetics. + + Parameters + ---------- + L_hdr : array_like + *Lightness* :math:`L_{hdr}`. + epsilon : numeric or array_like, optional + :math:`\epsilon` exponent. + + Returns + ------- + array_like + *luminance* :math:`Y`. + + Warning + ------- + The output range of that definition is non standard! + + Notes + ----- + - Output *luminance* :math:`Y` is in range [0, math:`\infty`]. + + References + ---------- + .. [4] Fairchild, M. D., & Wyble, D. R. (2010). hdr-CIELAB and hdr-IPT: + Simple Models for Describing the Color of High-Dynamic-Range and + Wide-Color-Gamut Images. In Proc. of Color and Imaging Conference + (pp. 322–326). ISBN:9781629932156 + + Examples + -------- + >>> luminance_Fairchild2010( + ... 24.902290269546651, 1.836) # doctest: +ELLIPSIS + 0.1007999... + """ + + L_hdr = np.asarray(L_hdr) + + Y = np.exp(np.log(substrate_concentration_MichealisMenten( + L_hdr - 0.02, 100, 0.184 ** epsilon)) / epsilon) + + return Y + + LUMINANCE_METHODS = CaseInsensitiveMapping( {'Newhall 1943': luminance_Newhall1943, 'ASTM D1535-08': luminance_ASTMD153508, - 'CIE 1976': luminance_CIE1976}) + 'CIE 1976': luminance_CIE1976, + 'Fairchild 2010': luminance_Fairchild2010}) """ Supported *luminance* computations methods. LUMINANCE_METHODS : CaseInsensitiveMapping - **{'Newhall 1943', 'ASTM D1535-08', 'CIE 1976'}** + **{'Newhall 1943', 'ASTM D1535-08', 'CIE 1976', 'Fairchild 2010'}** Aliases: @@ -205,7 +258,7 @@ def luminance(LV, method='CIE 1976', **kwargs): LV : numeric or array_like *Lightness* :math:`L^*` or *Munsell* value :math:`V`. method : unicode, optional - **{'CIE 1976', 'Newhall 1943', 'ASTM D1535-08'}**, + **{'CIE 1976', 'Newhall 1943', 'ASTM D1535-08', 'Fairchild 2010'}**, Computation method. Other Parameters @@ -213,6 +266,9 @@ def luminance(LV, method='CIE 1976', **kwargs): Y_n : numeric or array_like, optional {:func:`luminance_CIE1976`}, White reference *luminance* :math:`Y_n`. + epsilon : numeric or array_like, optional + {:func:`lightness_Fairchild2010`}, + :math:`\epsilon` exponent. Returns ------- @@ -221,9 +277,10 @@ def luminance(LV, method='CIE 1976', **kwargs): Notes ----- - - Input *LV* is in domain [0, 100] or [0, 10] and optional *luminance* - :math:`Y_n` is in domain [0, 100]. - - Output *luminance* :math:`Y` is in range [0, 100]. + - Input *LV* is in domain [0, 100], [0, 10] or [0, 1] and optional + *luminance* :math:`Y_n` is in domain [0, 100]. + - Output *luminance* :math:`Y` is in range [0, 100] or + [0, math:`\infty`]. Examples -------- @@ -237,6 +294,11 @@ def luminance(LV, method='CIE 1976', **kwargs): 10.4089874... >>> luminance(3.74629715, method='ASTM D1535-08') # doctest: +ELLIPSIS 10.1488096... + >>> luminance( + ... 24.902290269546651, + ... epsilon=1.836, + ... method='Fairchild 2010') # doctest: +ELLIPSIS + 0.1007999... """ function = LUMINANCE_METHODS[method] diff --git a/colour/examples/colorimetry/examples_lightness.py b/colour/examples/colorimetry/examples_lightness.py index 0876d315f..0a51c834c 100644 --- a/colour/examples/colorimetry/examples_lightness.py +++ b/colour/examples/colorimetry/examples_lightness.py @@ -38,6 +38,14 @@ print(colour.lightness(Y, method='Wyszecki 1963')) print('\n') +message_box(('Computing "Lightness" using "Fairchild and Wyble (2010)" method ' + 'for given "luminance" value:\n' + '\n\t{0}'.format(Y))) +print(colour.lightness_Fairchild2010(Y / 100.0)) +print(colour.lightness(Y / 100.0, method='Fairchild 2010')) + +print('\n') + message_box(('Computing "Lightness" using "CIE 1976" method for ' 'given "luminance" value:\n' '\n\t{0}'.format(Y))) diff --git a/colour/examples/colorimetry/examples_luminance.py b/colour/examples/colorimetry/examples_luminance.py index 48766b16f..447033a0b 100644 --- a/colour/examples/colorimetry/examples_luminance.py +++ b/colour/examples/colorimetry/examples_luminance.py @@ -30,6 +30,15 @@ print(colour.luminance(L)) print('\n') +L = 23.10363383 +message_box(('Computing "luminance" using "Fairchild and Wyble (2010)" method ' + 'for given "Lightness":\n' + '\n\t{0}'.format(L))) +print(colour.luminance_Fairchild2010(L) * 100) +print(colour.luminance(L, method='Fairchild 2010') * 100) + +print('\n') + message_box(('Computing "luminance" using "ASTM D1535-08e1" method for given ' '"Munsell" value:\n' '\n\t{0}'.format(V))) diff --git a/colour/examples/models/examples_models.py b/colour/examples/models/examples_models.py index 8169f0832..dad1cc90d 100644 --- a/colour/examples/models/examples_models.py +++ b/colour/examples/models/examples_models.py @@ -240,3 +240,31 @@ message_box(('Converting to "CIE XYZ" tristimulus values from given "IPT" ' print(colour.IPT_to_XYZ(IPT)) print('\n') + +message_box(('Converting to "hdr-CIELab" colourspace from given "CIE XYZ" ' + 'tristimulus values:\n' + '\n\t{0}'.format(XYZ))) +print(colour.XYZ_to_hdr_CIELab(XYZ)) + +print('\n') + +Lab_hdr = (95.74235944, 5.52263656, 11.72798167) +message_box(('Converting to "CIE XYZ" tristimulus values from given ' + '"hdr-CIELab" colourspace values:\n' + '\n\t{0}'.format(Lab_hdr))) +print(colour.hdr_CIELab_to_XYZ(Lab_hdr)) + +print('\n') + +message_box(('Converting to "hdr-IPT" colourspace from given "CIE XYZ" ' + 'tristimulus values:\n' + '\n\t{0}'.format(XYZ))) +print(colour.XYZ_to_hdr_IPT(XYZ)) + +print('\n') + +IPT_hdr = (92.21400245, 3.0073719, 14.7243821) +message_box(('Converting to "CIE XYZ" tristimulus values from given "hdr-IPT" ' + 'colourspace values:\n' + '\n\t{0}'.format(IPT_hdr))) +print(colour.hdr_IPT_to_XYZ(IPT_hdr)) diff --git a/colour/models/__init__.py b/colour/models/__init__.py index 3594e72d9..cbb51e7c3 100644 --- a/colour/models/__init__.py +++ b/colour/models/__init__.py @@ -20,12 +20,14 @@ from .cie_luv import ( LCHuv_to_Luv) from .cie_ucs import XYZ_to_UCS, UCS_to_XYZ, UCS_to_uv, UCS_uv_to_xy from .cie_uvw import XYZ_to_UVW +from .hdr_cie_lab import XYZ_to_hdr_CIELab, hdr_CIELab_to_XYZ from .hunter_lab import ( XYZ_to_K_ab_HunterLab1966, XYZ_to_Hunter_Lab, Hunter_Lab_to_XYZ) from .hunter_rdab import XYZ_to_Hunter_Rdab from .ipt import XYZ_to_IPT, IPT_to_XYZ, IPT_hue_angle +from .hdr_ipt import XYZ_to_hdr_IPT, hdr_IPT_to_XYZ from .ucs_luo2006 import ( JMh_CIECAM02_to_CAM02LCD, CAM02LCD_to_JMh_CIECAM02, @@ -57,12 +59,14 @@ __all__ += ['XYZ_to_Luv', 'LCHuv_to_Luv'] __all__ += ['XYZ_to_UCS', 'UCS_to_XYZ', 'UCS_to_uv', 'UCS_uv_to_xy'] __all__ += ['XYZ_to_UVW'] +__all__ += ['XYZ_to_hdr_CIELab', 'hdr_CIELab_to_XYZ'] __all__ += ['XYZ_to_K_ab_HunterLab1966', 'XYZ_to_Hunter_Lab', 'Hunter_Lab_to_XYZ', 'XYZ_to_Hunter_Rdab'] __all__ += ['XYZ_to_Hunter_Rdab'] __all__ += ['XYZ_to_IPT', 'IPT_to_XYZ', 'IPT_hue_angle'] +__all__ += ['XYZ_to_hdr_IPT', 'hdr_IPT_to_XYZ'] __all__ += ['JMh_CIECAM02_to_CAM02LCD', 'CAM02LCD_to_JMh_CIECAM02', 'JMh_CIECAM02_to_CAM02SCD', diff --git a/colour/models/hdr_cie_lab.py b/colour/models/hdr_cie_lab.py new file mode 100644 index 000000000..31363b246 --- /dev/null +++ b/colour/models/hdr_cie_lab.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +hdr-CIELAB Colourspace +====================== + +Defines the *hdr-CIELAB* colourspace transformations: + +- :func:`XYZ_to_hdr_CIELab` +- :func:`hdr_CIELab_to_XYZ` + +See Also +-------- +`hdr-CIELAB Colourspace Jupyter Notebook +<http://nbviewer.jupyter.org/github/colour-science/colour-notebooks/\ +blob/master/notebooks/models/hdr_cie_lab.ipynb>`_ + +References +---------- +.. [1] Fairchild, M. D., & Wyble, D. R. (2010). hdr-CIELAB and hdr-IPT: + Simple Models for Describing the Color of High-Dynamic-Range and + Wide-Color-Gamut Images. In Proc. of Color and Imaging Conference + (pp. 322–326). ISBN:9781629932156 +""" + +from __future__ import division, unicode_literals + +import numpy as np + +from colour.colorimetry import ( + ILLUMINANTS, + lightness_Fairchild2010, + luminance_Fairchild2010) +from colour.models import xy_to_xyY, xyY_to_XYZ +from colour.utilities import tsplit, tstack + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2017 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = '[email protected]' +__status__ = 'Production' + +__all__ = ['XYZ_to_hdr_CIELab', + 'hdr_CIELab_to_XYZ', + 'exponent_hdr_CIELab'] + + +def XYZ_to_hdr_CIELab( + XYZ, + illuminant=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50'], + Y_s=0.2, + Y_abs=100): + """ + Converts from *CIE XYZ* tristimulus values to *hdr-CIELAB* colourspace. + + Parameters + ---------- + XYZ : array_like + *CIE XYZ* tristimulus values. + illuminant : array_like, optional + Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + colourspace array. + Y_s : numeric or array_like + Relative luminance :math:`Y_s` of the surround in domain [0, 1]. + Y_abs : numeric or array_like + Absolute luminance :math:`Y_{abs}` of the scene diffuse white in + :math:`cd/m^2`. + + Returns + ------- + ndarray + *hdr-CIELAB* colourspace array. + + Notes + ----- + - Conversion to polar coordinates to compute the *chroma* :math:`C_{hdr}` + and *hue* :math:`h_{hdr}` correlates can be safely performed with + :func:`colour.Lab_to_LCHab` definition. + - Conversion to cartesian coordinates from the *Lightness* + :math:`L_{hdr}`, *chroma* :math:`C_{hdr}` and *hue* :math:`h_{hdr}` + correlates can be safely performed with :func:`colour.LCHab_to_Lab` + definition. + - Input *CIE XYZ* tristimulus values are in domain [0, math:`\infty`]. + - Input *illuminant* *xy* chromaticity coordinates or *CIE xyY* + colourspace array are in domain [0, :math:`\infty`]. + + Examples + -------- + >>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313]) + >>> XYZ_to_hdr_CIELab(XYZ) # doctest: +ELLIPSIS + array([ 24.9020664..., -46.8312760..., -10.14274843]) + """ + + X, Y, Z = tsplit(XYZ) + X_n, Y_n, Z_n = tsplit(xyY_to_XYZ(xy_to_xyY(illuminant))) + + e = exponent_hdr_CIELab(Y_s, Y_abs) + + L_hdr = lightness_Fairchild2010(Y / Y_n, e) + a_hdr = 5 * (lightness_Fairchild2010(X / X_n, e) - L_hdr) + b_hdr = 2 * (L_hdr - lightness_Fairchild2010(Z / Z_n, e)) + + Lab_hdr = tstack((L_hdr, a_hdr, b_hdr)) + + return Lab_hdr + + +def hdr_CIELab_to_XYZ( + Lab_hdr, + illuminant=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50'], + Y_s=0.2, + Y_abs=100): + """ + Converts from *hdr-CIELAB* colourspace to *CIE XYZ* tristimulus values. + + Parameters + ---------- + Lab_hdr : array_like + *hdr-CIELAB* colourspace array. + illuminant : array_like, optional + Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + colourspace array. + Y_s : numeric or array_like + Relative luminance :math:`Y_s` of the surround in domain [0, 1]. + Y_abs : numeric or array_like + Absolute luminance :math:`Y_{abs}` of the scene diffuse white in + :math:`cd/m^2`. + + Returns + ------- + ndarray + *CIE XYZ* tristimulus values. + + Notes + ----- + - Input *illuminant* *xy* chromaticity coordinates or *CIE xyY* + colourspace array are in domain [0, :math:`\infty`]. + - Output *CIE XYZ* tristimulus values are in range [0, math:`\infty`]. + + Examples + -------- + >>> Lab_hdr = np.array([24.90206646, -46.83127607, -10.14274843]) + >>> hdr_CIELab_to_XYZ(Lab_hdr) # doctest: +ELLIPSIS + array([ 0.0704953..., 0.1008 , 0.0955831...]) + """ + + L_hdr, a_hdr, b_hdr = tsplit(Lab_hdr) + X_n, Y_n, Z_n = tsplit(xyY_to_XYZ(xy_to_xyY(illuminant))) + + e = exponent_hdr_CIELab(Y_s, Y_abs) + + Y = luminance_Fairchild2010(L_hdr, e) * Y_n + X = luminance_Fairchild2010((a_hdr + 5 * L_hdr) / 5, e) * X_n + Z = luminance_Fairchild2010((-b_hdr + 2 * L_hdr) / 2, e) * Z_n + + XYZ = tstack((X, Y, Z)) + + return XYZ + + +def exponent_hdr_CIELab(Y_s, Y_abs): + """ + Computes *hdr-CIELAB* colourspace *Lightness* :math:`\epsilon` exponent. + + Parameters + ---------- + Y_s : numeric or array_like + Relative luminance :math:`Y_s` of the surround in range [0, 1]. + Y_abs : numeric or array_like + Absolute luminance :math:`Y_{abs}` of the scene diffuse white in + :math:`cd/m^2`. + + Returns + ------- + array_like + *hdr-CIELAB* colourspace *Lightness* :math:`\epsilon` exponent. + + Examples + -------- + >>> exponent_hdr_CIELab(0.2, 100) # doctest: +ELLIPSIS + 1.8360198... + """ + + Y_s = np.asarray(Y_s) + Y_abs = np.asarray(Y_abs) + + lf = np.log(318) / np.log(Y_abs) + sf = 1.25 - 0.25 * (Y_s / 0.184) + epsilon = 1.50 * sf * lf + + return epsilon diff --git a/colour/models/hdr_ipt.py b/colour/models/hdr_ipt.py new file mode 100644 index 000000000..830fd25ef --- /dev/null +++ b/colour/models/hdr_ipt.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +hdr-IPT Colourspace +=================== + +Defines the *hdr-IPT* colourspace transformations: + +- :func:`XYZ_to_hdr_IPT` +- :func:`hdr_IPT_to_XYZ` + +See Also +-------- +`hdr-IPT Colourspace Jupyter Notebook +<http://nbviewer.jupyter.org/github/colour-science/colour-notebooks/\ +blob/master/notebooks/models/hdr_IPT.ipynb>`_ + +References +---------- +.. [1] Fairchild, M. D., & Wyble, D. R. (2010). hdr-CIELAB and hdr-IPT: + Simple Models for Describing the Color of High-Dynamic-Range and + Wide-Color-Gamut Images. In Proc. of Color and Imaging Conference + (pp. 322–326). ISBN:9781629932156 +""" + +from __future__ import division, unicode_literals + +import numpy as np + +from colour.colorimetry import lightness_Fairchild2010, luminance_Fairchild2010 +from colour.models.ipt import ( + IPT_XYZ_TO_LMS_MATRIX, + IPT_LMS_TO_XYZ_MATRIX, + IPT_LMS_TO_IPT_MATRIX, + IPT_IPT_TO_LMS_MATRIX) +from colour.utilities import dot_vector + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2017 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = '[email protected]' +__status__ = 'Production' + +__all__ = ['XYZ_to_hdr_IPT', + 'hdr_IPT_to_XYZ', + 'exponent_hdr_IPT'] + + +def XYZ_to_hdr_IPT(XYZ, Y_s=0.2, Y_abs=100): + """ + Converts from *CIE XYZ* tristimulus values to *hdr-IPT* colourspace. + + Parameters + ---------- + XYZ : array_like + *CIE XYZ* tristimulus values. + Y_s : numeric or array_like + Relative luminance :math:`Y_s` of the surround in domain [0, 1]. + Y_abs : numeric or array_like + Absolute luminance :math:`Y_{abs}` of the scene diffuse white in + :math:`cd/m^2`. + + Returns + ------- + ndarray + *hdr-IPT* colourspace array. + + Notes + ----- + - Input *CIE XYZ* tristimulus values needs to be adapted for + *CIE Standard Illuminant D Series* *D65*. + + Examples + -------- + >>> XYZ = np.array([0.96907232, 1.00000000, 1.12179215]) + >>> XYZ_to_hdr_IPT(XYZ) # doctest: +ELLIPSIS + array([ 94.6592917..., 0.3804177..., -0.2673118...]) + """ + + e = exponent_hdr_IPT(Y_s, Y_abs)[..., np.newaxis] + + LMS = dot_vector(IPT_XYZ_TO_LMS_MATRIX, XYZ) + LMS_prime = np.sign(LMS) * np.abs(lightness_Fairchild2010(LMS, e)) + IPT = dot_vector(IPT_LMS_TO_IPT_MATRIX, LMS_prime) + + return IPT + + +def hdr_IPT_to_XYZ(IPT_hdr, Y_s=0.2, Y_abs=100): + """ + Converts from *hdr-IPT* colourspace to *CIE XYZ* tristimulus values. + + Parameters + ---------- + IPT_hdr : array_like + *hdr-IPT* colourspace array. + Y_s : numeric or array_like + Relative luminance :math:`Y_s` of the surround in domain [0, 1]. + Y_abs : numeric or array_like + Absolute luminance :math:`Y_{abs}` of the scene diffuse white in + :math:`cd/m^2`. + + Returns + ------- + ndarray + *CIE XYZ* tristimulus values. + + Examples + -------- + >>> IPT_hdr = np.array([94.65929175, 0.38041773, -0.26731187]) + >>> hdr_IPT_to_XYZ(IPT_hdr) # doctest: +ELLIPSIS + array([ 0.9690723..., 1. , 1.1217921...]) + """ + + e = exponent_hdr_IPT(Y_s, Y_abs)[..., np.newaxis] + + LMS = dot_vector(IPT_IPT_TO_LMS_MATRIX, IPT_hdr) + LMS_prime = np.sign(LMS) * np.abs(luminance_Fairchild2010(LMS, e)) + XYZ = dot_vector(IPT_LMS_TO_XYZ_MATRIX, LMS_prime) + + return XYZ + + +def exponent_hdr_IPT(Y_s, Y_abs): + """ + Computes *hdr-IPT* colourspace *Lightness* :math:`\epsilon` exponent. + + Parameters + ---------- + Y_s : numeric or array_like + Relative luminance :math:`Y_s` of the surround in range [0, 1]. + Y_abs : numeric or array_like + Absolute luminance :math:`Y_{abs}` of the scene diffuse white in + :math:`cd/m^2`. + + Returns + ------- + array_like + *hdr-IPT* colourspace *Lightness* :math:`\epsilon` exponent. + + Examples + -------- + >>> exponent_hdr_IPT(0.2, 100) # doctest: +ELLIPSIS + 1.6891383... + """ + + Y_s = np.asarray(Y_s) + Y_abs = np.asarray(Y_abs) + + lf = np.log(318) / np.log(Y_abs) + sf = 1.25 - 0.25 * (Y_s / 0.184) + epsilon = 1.38 * sf * lf + + return epsilon
Implement support for "hdr-CIELab" and "hdr-IPT" colourspaces. References ----------- - http://www.ingentaconnect.com/content/ist/cic/2010/00002010/00000001/art00057?crawler=true - https://www.youtube.com/watch?v=fjt7VHarVu4
colour-science/colour
diff --git a/colour/biochemistry/tests/__init__.py b/colour/biochemistry/tests/__init__.py new file mode 100644 index 000000000..faa18be5b --- /dev/null +++ b/colour/biochemistry/tests/__init__.py @@ -0,0 +1,2 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- diff --git a/colour/biochemistry/tests/tests_michaelis_menten.py b/colour/biochemistry/tests/tests_michaelis_menten.py new file mode 100644 index 000000000..c56d5ef87 --- /dev/null +++ b/colour/biochemistry/tests/tests_michaelis_menten.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Defines unit tests for :mod:`colour.biochemistry.michaelis_menten` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.biochemistry import ( + reaction_rate_MichealisMenten, + substrate_concentration_MichealisMenten) +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2017 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = '[email protected]' +__status__ = 'Production' + +__all__ = ['TestReactionRateMichealisMenten', + 'TestSubstrateConcentrationMichealisMenten'] + + +class TestReactionRateMichealisMenten(unittest.TestCase): + """ + Defines :func:`colour.biochemistry.michaelis_menten.\ +reaction_rate_MichealisMenten` definition unit tests methods. + """ + + def test_reaction_rate_MichealisMenten(self): + """ + Tests :func:`colour.biochemistry.michaelis_menten.\ +reaction_rate_MichealisMenten` definition. + """ + + self.assertAlmostEqual( + reaction_rate_MichealisMenten(0.25, 0.5, 0.25), + 0.250000000000000, + places=7) + + self.assertAlmostEqual( + reaction_rate_MichealisMenten(0.5, 0.5, 0.25), + 0.333333333333333, + places=7) + + self.assertAlmostEqual( + reaction_rate_MichealisMenten(0.65, 0.75, 0.35), + 0.487500000000000, + places=7) + + def test_n_dimensional_reaction_rate_MichealisMenten(self): + """ + Tests :func:`colour.biochemistry.michaelis_menten.\ +reaction_rate_MichealisMenten` definition n-dimensional arrays + support. + """ + + v = 0.5 + V_max = 0.5 + K_m = 0.25 + S = 0.333333333333333 + np.testing.assert_almost_equal( + reaction_rate_MichealisMenten(v, V_max, K_m), + S, + decimal=7) + + v = np.tile(v, (6, 1)) + S = np.tile(S, (6, 1)) + np.testing.assert_almost_equal( + reaction_rate_MichealisMenten(v, V_max, K_m), + S, + decimal=7) + + V_max = np.tile(V_max, (6, 1)) + K_m = np.tile(K_m, (6, 1)) + np.testing.assert_almost_equal( + reaction_rate_MichealisMenten(v, V_max, K_m), + S, + decimal=7) + + v = np.reshape(v, (2, 3, 1)) + V_max = np.reshape(V_max, (2, 3, 1)) + K_m = np.reshape(K_m, (2, 3, 1)) + S = np.reshape(S, (2, 3, 1)) + np.testing.assert_almost_equal( + reaction_rate_MichealisMenten(v, V_max, K_m), + S, + decimal=7) + + @ignore_numpy_errors + def test_nan_reaction_rate_MichealisMenten(self): + """ + Tests :func:`colour.biochemistry.michaelis_menten.\ +reaction_rate_MichealisMenten` definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=3)) + for case in cases: + v = np.array(case) + V_max = np.array(case) + K_m = np.array(case) + reaction_rate_MichealisMenten(v, V_max, K_m) + + +class TestSubstrateConcentrationMichealisMenten(unittest.TestCase): + """ + Defines :func:`colour.biochemistry.michaelis_menten.\ +reaction_rate_MichealisMenten` definition unit tests methods. + """ + + def test_substrate_concentration_MichealisMenten(self): + """ + Tests :func:`colour.biochemistry.michaelis_menten.\ +substrate_concentration_MichealisMenten` definition. + """ + + self.assertAlmostEqual( + substrate_concentration_MichealisMenten(0.25, 0.5, 0.25), + 0.250000000000000, + places=7) + + self.assertAlmostEqual( + substrate_concentration_MichealisMenten(1 / 3, 0.5, 0.25), + 0.500000000000000, + places=7) + + self.assertAlmostEqual( + substrate_concentration_MichealisMenten(0.4875, 0.75, 0.35), + 0.650000000000000, + places=7) + + def test_n_dimensional_substrate_concentration_MichealisMenten(self): + """ + Tests :func:`colour.biochemistry.michaelis_menten.\ +substrate_concentration_MichealisMenten` definition n-dimensional arrays + support. + """ + + S = 1 / 3 + V_max = 0.5 + K_m = 0.25 + v = 0.5 + np.testing.assert_almost_equal( + substrate_concentration_MichealisMenten(S, V_max, K_m), + v, + decimal=7) + + S = np.tile(S, (6, 1)) + v = np.tile(v, (6, 1)) + np.testing.assert_almost_equal( + substrate_concentration_MichealisMenten(S, V_max, K_m), + v, + decimal=7) + + V_max = np.tile(V_max, (6, 1)) + K_m = np.tile(K_m, (6, 1)) + np.testing.assert_almost_equal( + substrate_concentration_MichealisMenten(S, V_max, K_m), + v, + decimal=7) + + S = np.reshape(S, (2, 3, 1)) + V_max = np.reshape(V_max, (2, 3, 1)) + K_m = np.reshape(K_m, (2, 3, 1)) + v = np.reshape(v, (2, 3, 1)) + np.testing.assert_almost_equal( + substrate_concentration_MichealisMenten(S, V_max, K_m), + v, + decimal=7) + + @ignore_numpy_errors + def test_nan_substrate_concentration_MichealisMenten(self): + """ + Tests :func:`colour.biochemistry.michaelis_menten.\ +substrate_concentration_MichealisMenten` definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=3)) + for case in cases: + s = np.array(case) + V_max = np.array(case) + K_m = np.array(case) + substrate_concentration_MichealisMenten(s, V_max, K_m) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/colorimetry/tests/tests_lightness.py b/colour/colorimetry/tests/tests_lightness.py index 242e1d9f4..104a055ab 100644 --- a/colour/colorimetry/tests/tests_lightness.py +++ b/colour/colorimetry/tests/tests_lightness.py @@ -13,7 +13,8 @@ import unittest from colour.colorimetry import ( lightness_Glasser1958, lightness_Wyszecki1963, - lightness_CIE1976) + lightness_CIE1976, + lightness_Fairchild2010) from colour.utilities import ignore_numpy_errors __author__ = 'Colour Developers' @@ -25,7 +26,8 @@ __status__ = 'Production' __all__ = ['TestLightnessGlasser1958', 'TestLightnessWyszecki1963', - 'TestLightnessCIE1976'] + 'TestLightnessCIE1976', + 'TestLightnessFairchild2010'] class TestLightnessGlasser1958(unittest.TestCase): @@ -259,5 +261,92 @@ class TestLightnessCIE1976(unittest.TestCase): np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) +class TestLightnessFairchild2010(unittest.TestCase): + """ + Defines :func:`colour.colorimetry.lightness.lightness_Fairchild2010` + definition unit tests methods. + """ + + def test_lightness_Fairchild2010(self): + """ + Tests :func:`colour.colorimetry.lightness.lightness_Fairchild2010` + definition. + """ + + self.assertAlmostEqual( + lightness_Fairchild2010(10.08 / 100), + 23.10363383, + places=7) + + self.assertAlmostEqual( + lightness_Fairchild2010(56.76 / 100), + 90.51057574, + places=7) + + self.assertAlmostEqual( + lightness_Fairchild2010(98.32 / 100), + 96.636221285, + places=7) + + self.assertAlmostEqual( + lightness_Fairchild2010(10.08 / 100, 2.75), + 16.06420271, + places=7) + + self.assertAlmostEqual( + lightness_Fairchild2010(1008), + 100.01999667, + places=7) + + self.assertAlmostEqual( + lightness_Fairchild2010(100800), + 100.01999999, + places=7) + + def test_n_dimensional_lightness_Fairchild2010(self): + """ + Tests :func:`colour.colorimetry.lightness.lightness_Fairchild2010` + definition n-dimensional arrays support. + """ + + Y = 10.08 / 100 + L = 23.10363383 + np.testing.assert_almost_equal( + lightness_Fairchild2010(Y), + L, + decimal=7) + + Y = np.tile(Y, 6) + L = np.tile(L, 6) + np.testing.assert_almost_equal( + lightness_Fairchild2010(Y), + L, + decimal=7) + + Y = np.reshape(Y, (2, 3)) + L = np.reshape(L, (2, 3)) + np.testing.assert_almost_equal( + lightness_Fairchild2010(Y), + L, + decimal=7) + + Y = np.reshape(Y, (2, 3, 1)) + L = np.reshape(L, (2, 3, 1)) + np.testing.assert_almost_equal( + lightness_Fairchild2010(Y), + L, + decimal=7) + + @ignore_numpy_errors + def test_nan_lightness_Fairchild2010(self): + """ + Tests :func:`colour.colorimetry.lightness.lightness_Fairchild2010` + definition nan support. + """ + + lightness_Fairchild2010( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + if __name__ == '__main__': unittest.main() diff --git a/colour/colorimetry/tests/tests_luminance.py b/colour/colorimetry/tests/tests_luminance.py index 6a16c9bd8..ec7963a00 100644 --- a/colour/colorimetry/tests/tests_luminance.py +++ b/colour/colorimetry/tests/tests_luminance.py @@ -13,7 +13,8 @@ import unittest from colour.colorimetry.luminance import ( luminance_Newhall1943, luminance_CIE1976, - luminance_ASTMD153508) + luminance_ASTMD153508, + luminance_Fairchild2010) from colour.utilities import ignore_numpy_errors __author__ = 'Colour Developers' @@ -25,7 +26,8 @@ __status__ = 'Production' __all__ = ['TestLuminanceNewhall1943', 'TestLuminanceASTMD153508', - 'TestLuminanceCIE1976'] + 'TestLuminanceCIE1976', + 'TestLuminanceFairchild2010'] class TestLuminanceNewhall1943(unittest.TestCase): @@ -259,5 +261,92 @@ class TestLuminanceCIE1976(unittest.TestCase): np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) +class TestLuminanceFairchild2010(unittest.TestCase): + """ + Defines :func:`colour.colorimetry.luminance.luminance_Fairchild2010` + definition unit tests methods. + """ + + def test_luminance_Fairchild2010(self): + """ + Tests :func:`colour.colorimetry.luminance.luminance_Fairchild2010` + definition. + """ + + self.assertAlmostEqual( + luminance_Fairchild2010(23.103633825753175), + 0.10079999, + places=7) + + self.assertAlmostEqual( + luminance_Fairchild2010(90.510575738115122), + 0.56759999, + places=7) + + self.assertAlmostEqual( + luminance_Fairchild2010(96.636221285055527), + 0.98319999, + places=7) + + self.assertAlmostEqual( + luminance_Fairchild2010(16.064202706248068, 2.75), + 0.10079999, + places=7) + + self.assertAlmostEqual( + luminance_Fairchild2010(100.01999666792653), + 1007.99999963, + places=7) + + self.assertAlmostEqual( + luminance_Fairchild2010(100.01999999966679), + 100800.82383352, + places=7) + + def test_n_dimensional_luminance_Fairchild2010(self): + """ + Tests :func:`colour.colorimetry.lightness.luminance_Fairchild2010` + definition n-dimensional arrays support. + """ + + L_hdr = 23.103633825753175 + Y = 10.08 / 100 + np.testing.assert_almost_equal( + luminance_Fairchild2010(L_hdr), + Y, + decimal=7) + + L_hdr = np.tile(L_hdr, 6) + Y = np.tile(Y, 6) + np.testing.assert_almost_equal( + luminance_Fairchild2010(L_hdr), + Y, + decimal=7) + + L_hdr = np.reshape(L_hdr, (2, 3)) + Y = np.reshape(Y, (2, 3)) + np.testing.assert_almost_equal( + luminance_Fairchild2010(L_hdr), + Y, + decimal=7) + + L_hdr = np.reshape(L_hdr, (2, 3, 1)) + Y = np.reshape(Y, (2, 3, 1)) + np.testing.assert_almost_equal( + luminance_Fairchild2010(L_hdr), + Y, + decimal=7) + + @ignore_numpy_errors + def test_nan_luminance_Fairchild2010(self): + """ + Tests :func:`colour.colorimetry.luminance.luminance_Fairchild2010` + definition nan support. + """ + + luminance_Fairchild2010( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + if __name__ == '__main__': unittest.main() diff --git a/colour/models/tests/tests_hdr_cie_lab.py b/colour/models/tests/tests_hdr_cie_lab.py new file mode 100644 index 000000000..b8e64ecd7 --- /dev/null +++ b/colour/models/tests/tests_hdr_cie_lab.py @@ -0,0 +1,299 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Defines unit tests for :mod:`colour.models.hdr_cie_lab` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.models import XYZ_to_hdr_CIELab, hdr_CIELab_to_XYZ +from colour.models.hdr_cie_lab import exponent_hdr_CIELab +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2017 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = '[email protected]' +__status__ = 'Production' + +__all__ = ['TestXYZ_to_hdr_CIELab', + 'TestHdr_CIELab_to_XYZ', + 'TestExponent_hdr_CIELab'] + + +class TestXYZ_to_hdr_CIELab(unittest.TestCase): + """ + Defines :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition unit + tests methods. + """ + + def test_XYZ_to_hdr_CIELab(self): + """ + Tests :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition. + """ + + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab( + np.array([0.07049534, 0.10080000, 0.09558313])), + np.array([24.90206646, -46.83127607, -10.14274843]), + decimal=7) + + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab( + np.array([0.07049534, 0.10080000, 0.09558313]), + np.array([0.44757, 0.40745])), + np.array([24.90206646, -61.24983919, -83.63902870]), + decimal=7) + + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab( + np.array([0.07049534, 0.10080000, 0.09558313]), + Y_s=0.5), + np.array([34.44227938, -36.51485775, -6.87279617]), + decimal=7) + + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab( + np.array([0.07049534, 0.10080000, 0.09558313]), + Y_abs=1000), + np.array([32.39463250, -39.77445283, -7.66690737]), + decimal=7) + + def test_n_dimensional_XYZ_to_hdr_CIELab(self): + """ + Tests :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition + n-dimensions support. + """ + + XYZ = np.array([0.07049534, 0.10080000, 0.09558313]) + illuminant = np.array([0.34570, 0.35850]) + Y_s = 0.2 + Y_abs = 100 + Lab_hdr = np.array([24.90206646, -46.83127607, -10.14274843]) + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab(XYZ, illuminant, Y_s, Y_abs), + Lab_hdr, + decimal=7) + + XYZ = np.tile(XYZ, (6, 1)) + Lab_hdr = np.tile(Lab_hdr, (6, 1)) + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab(XYZ, illuminant, Y_s, Y_abs), + Lab_hdr, + decimal=7) + + illuminant = np.tile(illuminant, (6, 1)) + Y_s = np.tile(Y_s, 6) + Y_abs = np.tile(Y_abs, 6) + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab(XYZ, illuminant, Y_s, Y_abs), + Lab_hdr, + decimal=7) + + XYZ = np.reshape(XYZ, (2, 3, 3)) + illuminant = np.reshape(illuminant, (2, 3, 2)) + Y_s = np.reshape(Y_s, (2, 3)) + Y_abs = np.reshape(Y_abs, (2, 3)) + Lab_hdr = np.reshape(Lab_hdr, (2, 3, 3)) + np.testing.assert_almost_equal( + XYZ_to_hdr_CIELab(XYZ, illuminant, Y_s, Y_abs), + Lab_hdr, + decimal=7) + + @ignore_numpy_errors + def test_nan_XYZ_to_hdr_CIELab(self): + """ + Tests :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition + nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=3)) + for case in cases: + XYZ = np.array(case) + illuminant = np.array(case[0:2]) + Y_s = case[0] + Y_abs = case[0] + XYZ_to_hdr_CIELab(XYZ, illuminant, Y_s, Y_abs) + + +class TestHdr_CIELab_to_XYZ(unittest.TestCase): + """ + Defines :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition unit + tests methods. + """ + + def test_hdr_CIELab_to_XYZ(self): + """ + Tests :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition. + """ + + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ( + np.array([24.90206646, -46.83127607, -10.14274843])), + np.array([0.07049534, 0.10080000, 0.09558313]), + decimal=7) + + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ( + np.array([24.90206646, -61.24983919, -83.63902870]), + np.array([0.44757, 0.40745])), + np.array([0.07049534, 0.10080000, 0.09558313]), + decimal=7) + + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ( + np.array([34.44227938, -36.51485775, -6.87279617]), + Y_s=0.5), + np.array([0.07049534, 0.10080000, 0.09558313]), + decimal=7) + + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ( + np.array([32.39463250, -39.77445283, -7.66690737]), + Y_abs=1000), + np.array([0.07049534, 0.10080000, 0.09558313]), + decimal=7) + + def test_n_dimensional_hdr_CIELab_to_XYZ(self): + """ + Tests :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition + n-dimensions support. + """ + + Lab_hdr = np.array([24.90206646, -46.83127607, -10.14274843]) + illuminant = np.array([0.34570, 0.35850]) + Y_s = 0.2 + Y_abs = 100 + XYZ = np.array([0.07049534, 0.10080000, 0.09558313]) + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ(Lab_hdr, illuminant, Y_s, Y_abs), + XYZ, + decimal=7) + + Lab_hdr = np.tile(Lab_hdr, (6, 1)) + XYZ = np.tile(XYZ, (6, 1)) + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ(Lab_hdr, illuminant, Y_s, Y_abs), + XYZ, + decimal=7) + + illuminant = np.tile(illuminant, (6, 1)) + Y_s = np.tile(Y_s, 6) + Y_abs = np.tile(Y_abs, 6) + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ(Lab_hdr, illuminant, Y_s, Y_abs), + XYZ, + decimal=7) + + Lab_hdr = np.reshape(Lab_hdr, (2, 3, 3)) + illuminant = np.reshape(illuminant, (2, 3, 2)) + Y_s = np.reshape(Y_s, (2, 3)) + Y_abs = np.reshape(Y_abs, (2, 3)) + XYZ = np.reshape(XYZ, (2, 3, 3)) + np.testing.assert_almost_equal( + hdr_CIELab_to_XYZ(Lab_hdr, illuminant, Y_s, Y_abs), + XYZ, + decimal=7) + + @ignore_numpy_errors + def test_nan_hdr_CIELab_to_XYZ(self): + """ + Tests :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition + nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=3)) + for case in cases: + Lab_hdr = np.array(case) + illuminant = np.array(case[0:2]) + Y_s = case[0] + Y_abs = case[0] + hdr_CIELab_to_XYZ(Lab_hdr, illuminant, Y_s, Y_abs) + + +class TestExponent_hdr_CIELab(unittest.TestCase): + """ + Defines :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` + definition unit tests methods. + """ + + def test_exponent_hdr_CIELab(self): + """ + Tests :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` + definition. + """ + + self.assertAlmostEqual( + exponent_hdr_CIELab(0.2, 100), + 1.836019897814665, + places=7) + + self.assertAlmostEqual( + exponent_hdr_CIELab(0.4, 100), + 1.326014370643925, + places=7) + + self.assertAlmostEqual( + exponent_hdr_CIELab(0.2, 1000), + 1.224013265209777, + places=7) + + def test_n_dimensional_exponent_hdr_CIELab(self): + """ + Tests :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` + definition n-dimensional arrays support. + """ + + Y_s = 0.2 + Y_abs = 100 + e = 1.836019897814665 + np.testing.assert_almost_equal( + exponent_hdr_CIELab(Y_s, Y_abs), + e, + decimal=7) + + Y_s = np.tile(Y_s, 6) + Y_abs = np.tile(Y_abs, 6) + e = np.tile(e, 6) + np.testing.assert_almost_equal( + exponent_hdr_CIELab(Y_s, Y_abs), + e, + decimal=7) + + Y_s = np.reshape(Y_s, (2, 3)) + Y_abs = np.reshape(Y_abs, (2, 3)) + e = np.reshape(e, (2, 3)) + np.testing.assert_almost_equal( + exponent_hdr_CIELab(Y_s, Y_abs), + e, + decimal=7) + + Y_s = np.reshape(Y_s, (2, 3, 1)) + Y_abs = np.reshape(Y_abs, (2, 3, 1)) + e = np.reshape(e, (2, 3, 1)) + np.testing.assert_almost_equal( + exponent_hdr_CIELab(Y_s, Y_abs), + e, + decimal=7) + + @ignore_numpy_errors + def test_nan_exponent_hdr_CIELab(self): + """ + Tests :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` + definition nan support. + """ + + cases = np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]) + exponent_hdr_CIELab(cases, cases) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/models/tests/tests_hdr_ipt.py b/colour/models/tests/tests_hdr_ipt.py new file mode 100644 index 000000000..6c205f2da --- /dev/null +++ b/colour/models/tests/tests_hdr_ipt.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Defines unit tests for :mod:`colour.models.hdr_ipt` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.models import XYZ_to_hdr_IPT, hdr_IPT_to_XYZ +from colour.models.hdr_ipt import exponent_hdr_IPT +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2017 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = '[email protected]' +__status__ = 'Production' + +__all__ = ['TestXYZ_to_hdr_IPT', + 'TestHdr_IPT_to_XYZ', + 'TestExponent_hdr_IPT'] + + +class TestXYZ_to_hdr_IPT(unittest.TestCase): + """ + Defines :func:`colour.models.hdr_ipt.TestXYZ_to_hdr_IPT` definition unit + tests methods. + """ + + def test_XYZ_to_hdr_IPT(self): + """ + Tests :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition. + """ + + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT( + np.array([0.07049534, 0.10080000, 0.09558313])), + np.array([25.18261761, -22.62111297, 3.18511729]), + decimal=7) + + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT( + np.array([0.07049534, 0.10080000, 0.09558313]), + Y_s=0.5), + np.array([34.60312115, -15.70974390, 2.26601353]), + decimal=7) + + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT( + np.array([0.25506814, 0.19150000, 0.08849752]), + Y_abs=1000), + np.array([47.18074546, 32.38073691, 29.13827648]), + decimal=7) + + def test_n_dimensional_XYZ_to_hdr_IPT(self): + """ + Tests :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition + n-dimensions support. + """ + + XYZ = np.array([0.07049534, 0.10080000, 0.09558313]) + Y_s = 0.2 + Y_abs = 100 + IPT_hdr = np.array([25.18261761, -22.62111297, 3.18511729]) + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT(XYZ, Y_s, Y_abs), + IPT_hdr, + decimal=7) + + XYZ = np.tile(XYZ, (6, 1)) + IPT_hdr = np.tile(IPT_hdr, (6, 1)) + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT(XYZ, Y_s, Y_abs), + IPT_hdr, + decimal=7) + + Y_s = np.tile(Y_s, 6) + Y_abs = np.tile(Y_abs, 6) + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT(XYZ, Y_s, Y_abs), + IPT_hdr, + decimal=7) + + XYZ = np.reshape(XYZ, (2, 3, 3)) + Y_s = np.reshape(Y_s, (2, 3)) + Y_abs = np.reshape(Y_abs, (2, 3)) + IPT_hdr = np.reshape(IPT_hdr, (2, 3, 3)) + np.testing.assert_almost_equal( + XYZ_to_hdr_IPT(XYZ, Y_s, Y_abs), + IPT_hdr, + decimal=7) + + @ignore_numpy_errors + def test_nan_XYZ_to_hdr_IPT(self): + """ + Tests :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition nan + support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=3)) + for case in cases: + XYZ = np.array(case) + Y_s = case[0] + Y_abs = case[0] + XYZ_to_hdr_IPT(XYZ, Y_s, Y_abs) + + +class TestHdr_IPT_to_XYZ(unittest.TestCase): + """ + Defines :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition unit tests + methods. + """ + + def test_hdr_IPT_to_XYZ(self): + """ + Tests :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition. + """ + + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ( + np.array([25.18261761, -22.62111297, 3.18511729])), + np.array([0.07049534, 0.10080000, 0.09558313]), + decimal=7) + + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ( + np.array([34.60312115, -15.70974390, 2.26601353]), + Y_s=0.5), + np.array([0.07049534, 0.10080000, 0.09558313]), + decimal=7) + + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ( + np.array([47.18074546, 32.38073691, 29.13827648]), + Y_abs=1000), + np.array([0.25506814, 0.19150000, 0.08849752]), + decimal=7) + + def test_n_dimensional_hdr_IPT_to_XYZ(self): + """ + Tests :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition + n-dimensions support. + """ + + IPT_hdr = np.array([25.18261761, -22.62111297, 3.18511729]) + Y_s = 0.2 + Y_abs = 100 + XYZ = np.array([0.07049534, 0.10080000, 0.09558313]) + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ(IPT_hdr, Y_s, Y_abs), + XYZ, + decimal=7) + + IPT_hdr = np.tile(IPT_hdr, (6, 1)) + XYZ = np.tile(XYZ, (6, 1)) + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ(IPT_hdr, Y_s, Y_abs), + XYZ, + decimal=7) + + Y_s = np.tile(Y_s, 6) + Y_abs = np.tile(Y_abs, 6) + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ(IPT_hdr, Y_s, Y_abs), + XYZ, + decimal=7) + + IPT_hdr = np.reshape(IPT_hdr, (2, 3, 3)) + Y_s = np.reshape(Y_s, (2, 3)) + Y_abs = np.reshape(Y_abs, (2, 3)) + XYZ = np.reshape(XYZ, (2, 3, 3)) + np.testing.assert_almost_equal( + hdr_IPT_to_XYZ(IPT_hdr, Y_s, Y_abs), + XYZ, + decimal=7) + + @ignore_numpy_errors + def test_nan_hdr_IPT_to_XYZ(self): + """ + Tests :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition nan + support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=3)) + for case in cases: + IPT_hdr = np.array(case) + Y_s = case[0] + Y_abs = case[0] + hdr_IPT_to_XYZ(IPT_hdr, Y_s, Y_abs) + + +class TestExponent_hdr_IPT(unittest.TestCase): + """ + Defines :func:`colour.models.hdr_ipt.exponent_hdr_IPT` + definition unit tests methods. + """ + + def test_exponent_hdr_IPT(self): + """ + Tests :func:`colour.models.hdr_ipt.exponent_hdr_IPT` + definition. + """ + + self.assertAlmostEqual( + exponent_hdr_IPT(0.2, 100), + 1.689138305989492, + places=7) + + self.assertAlmostEqual( + exponent_hdr_IPT(0.4, 100), + 1.219933220992410, + places=7) + + self.assertAlmostEqual( + exponent_hdr_IPT(0.2, 1000), + 1.126092203992995, + places=7) + + def test_n_dimensional_exponent_hdr_IPT(self): + """ + Tests :func:`colour.models.hdr_ipt.exponent_hdr_IPT` + definition n-dimensional arrays support. + """ + + Y_s = 0.2 + Y_abs = 100 + e = 1.689138305989492 + np.testing.assert_almost_equal( + exponent_hdr_IPT(Y_s, Y_abs), + e, + decimal=7) + + Y_s = np.tile(Y_s, 6) + Y_abs = np.tile(Y_abs, 6) + e = np.tile(e, 6) + np.testing.assert_almost_equal( + exponent_hdr_IPT(Y_s, Y_abs), + e, + decimal=7) + + Y_s = np.reshape(Y_s, (2, 3)) + Y_abs = np.reshape(Y_abs, (2, 3)) + e = np.reshape(e, (2, 3)) + np.testing.assert_almost_equal( + exponent_hdr_IPT(Y_s, Y_abs), + e, + decimal=7) + + Y_s = np.reshape(Y_s, (2, 3, 1)) + Y_abs = np.reshape(Y_abs, (2, 3, 1)) + e = np.reshape(e, (2, 3, 1)) + np.testing.assert_almost_equal( + exponent_hdr_IPT(Y_s, Y_abs), + e, + decimal=7) + + @ignore_numpy_errors + def test_nan_exponent_hdr_IPT(self): + """ + Tests :func:`colour.models.hdr_ipt.exponent_hdr_IPT` + definition nan support. + """ + + cases = np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]) + exponent_hdr_IPT(cases, cases) + + +if __name__ == '__main__': + unittest.main()
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 8 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[tests]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 -e git+https://github.com/colour-science/colour.git@901712f4c25bac410c19cce0aabdac855c29de4e#egg=colour_science coverage==6.2 execnet==1.9.0 flake8==5.0.4 importlib-metadata==4.2.0 iniconfig==1.1.1 mccabe==0.7.0 nose==1.3.7 numpy==1.19.5 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycodestyle==2.9.1 pyflakes==2.5.0 pyparsing==3.1.4 pytest==7.0.1 pytest-asyncio==0.16.0 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 scipy==1.5.4 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: colour channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - coverage==6.2 - execnet==1.9.0 - flake8==5.0.4 - importlib-metadata==4.2.0 - iniconfig==1.1.1 - mccabe==0.7.0 - nose==1.3.7 - numpy==1.19.5 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-asyncio==0.16.0 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - scipy==1.5.4 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/colour
[ "colour/biochemistry/tests/tests_michaelis_menten.py::TestReactionRateMichealisMenten::test_n_dimensional_reaction_rate_MichealisMenten", "colour/biochemistry/tests/tests_michaelis_menten.py::TestReactionRateMichealisMenten::test_nan_reaction_rate_MichealisMenten", "colour/biochemistry/tests/tests_michaelis_menten.py::TestReactionRateMichealisMenten::test_reaction_rate_MichealisMenten", "colour/biochemistry/tests/tests_michaelis_menten.py::TestSubstrateConcentrationMichealisMenten::test_n_dimensional_substrate_concentration_MichealisMenten", "colour/biochemistry/tests/tests_michaelis_menten.py::TestSubstrateConcentrationMichealisMenten::test_nan_substrate_concentration_MichealisMenten", "colour/biochemistry/tests/tests_michaelis_menten.py::TestSubstrateConcentrationMichealisMenten::test_substrate_concentration_MichealisMenten", "colour/colorimetry/tests/tests_lightness.py::TestLightnessGlasser1958::test_lightness_Glasser1958", "colour/colorimetry/tests/tests_lightness.py::TestLightnessGlasser1958::test_n_dimensional_lightness_Glasser1958", "colour/colorimetry/tests/tests_lightness.py::TestLightnessGlasser1958::test_nan_lightness_Glasser1958", "colour/colorimetry/tests/tests_lightness.py::TestLightnessWyszecki1963::test_lightness_Wyszecki1963", "colour/colorimetry/tests/tests_lightness.py::TestLightnessWyszecki1963::test_n_dimensional_lightness_Wyszecki1963", "colour/colorimetry/tests/tests_lightness.py::TestLightnessWyszecki1963::test_nan_lightness_Wyszecki1963", "colour/colorimetry/tests/tests_lightness.py::TestLightnessCIE1976::test_lightness_CIE1976", "colour/colorimetry/tests/tests_lightness.py::TestLightnessCIE1976::test_n_dimensional_lightness_CIE1976", "colour/colorimetry/tests/tests_lightness.py::TestLightnessCIE1976::test_nan_lightness_CIE1976", "colour/colorimetry/tests/tests_lightness.py::TestLightnessFairchild2010::test_lightness_Fairchild2010", "colour/colorimetry/tests/tests_lightness.py::TestLightnessFairchild2010::test_n_dimensional_lightness_Fairchild2010", "colour/colorimetry/tests/tests_lightness.py::TestLightnessFairchild2010::test_nan_lightness_Fairchild2010", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceNewhall1943::test_luminance_Newhall1943", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceNewhall1943::test_n_dimensional_luminance_Newhall1943", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceNewhall1943::test_nan_luminance_Newhall1943", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceASTMD153508::test_luminance_ASTMD153508", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceASTMD153508::test_n_dimensional_luminance_ASTMD153508", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceASTMD153508::test_nan_luminance_ASTMD153508", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceCIE1976::test_luminance_CIE1976", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceCIE1976::test_n_dimensional_luminance_CIE1976", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceCIE1976::test_nan_luminance_CIE1976", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceFairchild2010::test_luminance_Fairchild2010", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceFairchild2010::test_n_dimensional_luminance_Fairchild2010", "colour/colorimetry/tests/tests_luminance.py::TestLuminanceFairchild2010::test_nan_luminance_Fairchild2010", "colour/models/tests/tests_hdr_cie_lab.py::TestXYZ_to_hdr_CIELab::test_XYZ_to_hdr_CIELab", "colour/models/tests/tests_hdr_cie_lab.py::TestXYZ_to_hdr_CIELab::test_n_dimensional_XYZ_to_hdr_CIELab", "colour/models/tests/tests_hdr_cie_lab.py::TestXYZ_to_hdr_CIELab::test_nan_XYZ_to_hdr_CIELab", "colour/models/tests/tests_hdr_cie_lab.py::TestHdr_CIELab_to_XYZ::test_hdr_CIELab_to_XYZ", "colour/models/tests/tests_hdr_cie_lab.py::TestHdr_CIELab_to_XYZ::test_n_dimensional_hdr_CIELab_to_XYZ", "colour/models/tests/tests_hdr_cie_lab.py::TestHdr_CIELab_to_XYZ::test_nan_hdr_CIELab_to_XYZ", "colour/models/tests/tests_hdr_cie_lab.py::TestExponent_hdr_CIELab::test_exponent_hdr_CIELab", "colour/models/tests/tests_hdr_cie_lab.py::TestExponent_hdr_CIELab::test_n_dimensional_exponent_hdr_CIELab", "colour/models/tests/tests_hdr_cie_lab.py::TestExponent_hdr_CIELab::test_nan_exponent_hdr_CIELab", "colour/models/tests/tests_hdr_ipt.py::TestXYZ_to_hdr_IPT::test_XYZ_to_hdr_IPT", "colour/models/tests/tests_hdr_ipt.py::TestXYZ_to_hdr_IPT::test_n_dimensional_XYZ_to_hdr_IPT", "colour/models/tests/tests_hdr_ipt.py::TestXYZ_to_hdr_IPT::test_nan_XYZ_to_hdr_IPT", "colour/models/tests/tests_hdr_ipt.py::TestHdr_IPT_to_XYZ::test_hdr_IPT_to_XYZ", "colour/models/tests/tests_hdr_ipt.py::TestHdr_IPT_to_XYZ::test_n_dimensional_hdr_IPT_to_XYZ", "colour/models/tests/tests_hdr_ipt.py::TestHdr_IPT_to_XYZ::test_nan_hdr_IPT_to_XYZ", "colour/models/tests/tests_hdr_ipt.py::TestExponent_hdr_IPT::test_exponent_hdr_IPT", "colour/models/tests/tests_hdr_ipt.py::TestExponent_hdr_IPT::test_n_dimensional_exponent_hdr_IPT", "colour/models/tests/tests_hdr_ipt.py::TestExponent_hdr_IPT::test_nan_exponent_hdr_IPT" ]
[]
[]
[]
BSD 3-Clause "New" or "Revised" License
1,219
[ "colour/colorimetry/__init__.py", "colour/colorimetry/luminance.py", "colour/colorimetry/lightness.py", "colour/examples/models/examples_models.py", "colour/biochemistry/__init__.py", "colour/models/hdr_ipt.py", "colour/__init__.py", "colour/examples/colorimetry/examples_lightness.py", "colour/models/hdr_cie_lab.py", "colour/examples/colorimetry/examples_luminance.py", "colour/biochemistry/michaelis_menten.py", "colour/models/__init__.py" ]
[ "colour/colorimetry/__init__.py", "colour/colorimetry/luminance.py", "colour/colorimetry/lightness.py", "colour/examples/models/examples_models.py", "colour/biochemistry/__init__.py", "colour/models/hdr_ipt.py", "colour/__init__.py", "colour/examples/colorimetry/examples_lightness.py", "colour/models/hdr_cie_lab.py", "colour/examples/colorimetry/examples_luminance.py", "colour/biochemistry/michaelis_menten.py", "colour/models/__init__.py" ]
edelooff__kalpa-9
c351347bec34e43a01572d9cc5490bafc7be8ea9
2017-04-30 21:07:52
c351347bec34e43a01572d9cc5490bafc7be8ea9
diff --git a/README.rst b/README.rst index 1fe1c2f..fe1556a 100644 --- a/README.rst +++ b/README.rst @@ -20,10 +20,10 @@ Pyramid's traversal. class UserCollection(Branch): """User collection, for listings, or loading single users.""" - def __load__(self, path): + def __load__(self, key): """Return child resource with requested user included.""" - user = USERS[path] # Load user or raise KeyError. - return self._sprout(key, user=user) + user = USERS[key] # Load user or raise KeyError. + return self._child(key, user=user) @UserCollection.child_resource diff --git a/kalpa/__init__.py b/kalpa/__init__.py index ef7ddf2..61e6403 100644 --- a/kalpa/__init__.py +++ b/kalpa/__init__.py @@ -67,18 +67,29 @@ class Branch(with_metaclass(BranchType, Leaf)): """Dynamic resource loader for custom Branch classes. This method should either raise a KeyError or return an instantiated - resource class. Through one of _sprout(), _sprout_resource() or manual - instantiation. The response will be cached by the caller, __getitem__. + resource class. This can be achieved with the _child() method or manual + instantiation. The response will be cached by __getitem__(). """ raise KeyError(path) - def _sprout(self, _name, **attrs): - """Returns a child resource of the registered type.""" - return self._CHILD_CLS(_name, self, **attrs) + def _child(self, *args, **attrs): + """Returns a newly instantiated child resource. - def _sprout_resource(self, _resource_cls, _name, **attrs): - """Returns a child resource of the provided type, with given name.""" - return _resource_cls(_name, self, **attrs) + Positional arguments are either type+name or just a name. If the type + is not given, this defaults to the registered child resource class. + + Additional named parameters are passed verbatim to the new instance. + """ + if len(args) == 1: + if self._CHILD_CLS is None: + raise TypeError( + 'No child resource class is associated with %r. ' + 'Provide one as the first argument' % self) + resource_class = self._CHILD_CLS + name, = args + else: + resource_class, name = args + return resource_class(name, self, **attrs) @classmethod def attach(cls, canonical_path, aliases=()): @@ -92,7 +103,7 @@ class Branch(with_metaclass(BranchType, Leaf)): @classmethod def child_resource(cls, child_cls): - """Adds a resource class as the default child resource to sprout.""" + """Adds a resource class as the default child class to instantiate.""" cls._CHILD_CLS = child_cls return child_cls diff --git a/setup.py b/setup.py index a40c7f6..8691cf4 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ def contents(filename): setup( name='kalpa', - version='0.3', + version='0.4', packages=find_packages(), author='Elmer de Looff', author_email='[email protected]',
Roll child-class spawning methods into one The `_sprout` and `_sprout_resource` methods can be rolled into one with a variable number of positional arguments. The first one should be the key, the second (optional) argument is the resource class to use, which falls back to the child resource class.
edelooff/kalpa
diff --git a/kalpa/tests/test_kalpa.py b/kalpa/tests/test_kalpa.py index 9f33402..615596c 100644 --- a/kalpa/tests/test_kalpa.py +++ b/kalpa/tests/test_kalpa.py @@ -44,12 +44,12 @@ def branching_tree(): @Root.attach('objects') class Collection(Branch): def __load__(self, path): - return self._sprout(path, fruit='apple', twice=path * 2) + return self._child(path, fruit='apple', twice=path * 2) @Root.attach('people') class People(Branch): def __load__(self, path): - return self._sprout_resource(Person, path, first=path[0].upper()) + return self._child(Person, path, first=path[0].upper()) @Collection.child_resource class Object(Branch): @@ -85,7 +85,7 @@ def mixed_tree(): class Root(Root): def __load__(self, path): - return self._sprout(path) + return self._child(path) @Root.attach('spam') @Root.attach('eggs') @@ -103,6 +103,43 @@ def mixed_tree(): 'static_cls': Static} [email protected] +def alternate_child_tree(): + """Returns a resource tree where sub-resources can be of multiple types. + + This implicitly tests the following parts of kalpa: + + - Child resource assignment to Branch classes + - Child resource creation using the registered class + """ + from kalpa import Root, Leaf + + class Root(Root): + def __load__(self, name): + if name in ('adam', 'eve'): + return self._child(Admin, name) + return self._child(name) + + class BadRoot(Root): + def __load__(self, name): + if name == 'explicit_none': + return self._child(None, name) + return self._child(name) + + class Admin(Leaf): + pass + + @Root.child_resource + class User(Leaf): + pass + + return { + 'root': Root(None), + 'bad_root': BadRoot(None), + 'admin_cls': Admin, + 'user_cls': User} + + class TestBasicResource(object): def test_sub_resource_type(self, basic_tree): """Leaf is an instance of the Leaf class, for context selection.""" @@ -210,6 +247,33 @@ class TestMixedResource(object): assert isinstance(root['bacon'], mixed_tree['dynamic_cls']) +class TestAlternateResourceClasses(object): + def test_common_child_resource(self, alternate_child_tree): + """"Retrieves an instance of the associated child class.""" + root = alternate_child_tree['root'] + assert type(root['john']) is alternate_child_tree['user_cls'] + + def test_alternate_child_resource(self, alternate_child_tree): + """Retrieves an instance of a loader-selected resource class.""" + root = alternate_child_tree['root'] + assert type(root['eve']) is alternate_child_tree['admin_cls'] + + def test_missing_child_resource(self, alternate_child_tree): + root = alternate_child_tree['bad_root'] + with pytest.raises(TypeError) as excinfo: + root['adam'] + # Check for the more informative message for the bad-config case + assert 'No child resource class is associated' in str(excinfo.value) + assert 'not callable' not in str(excinfo.value) + + def test_bad_child_resource_class(self, alternate_child_tree): + root = alternate_child_tree['bad_root'] + with pytest.raises(TypeError) as excinfo: + root['explicit_none'] + # Check for the default Python non-callable error message + assert 'not callable' in str(excinfo.value) + + class TestAttributeAccess(object): def test_simple_attribute_access(self, branching_tree): """Keywords given for object creation are available as attributes."""
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 3 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work hupper==1.12.1 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/edelooff/kalpa.git@c351347bec34e43a01572d9cc5490bafc7be8ea9#egg=kalpa packaging @ file:///croot/packaging_1734472117206/work PasteDeploy==3.1.0 plaster==1.1.2 plaster-pastedeploy==1.0.1 pluggy @ file:///croot/pluggy_1733169602837/work pyramid==2.0.2 pytest @ file:///croot/pytest_1738938843180/work pytest-runner==6.0.1 six==1.17.0 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work translationstring==1.4 venusian==3.1.1 WebOb==1.8.9 zope.deprecation==5.1 zope.interface==7.2
name: kalpa channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - hupper==1.12.1 - pastedeploy==3.1.0 - plaster==1.1.2 - plaster-pastedeploy==1.0.1 - pyramid==2.0.2 - pytest-runner==6.0.1 - six==1.17.0 - translationstring==1.4 - venusian==3.1.1 - webob==1.8.9 - zope-deprecation==5.1 - zope-interface==7.2 prefix: /opt/conda/envs/kalpa
[ "kalpa/tests/test_kalpa.py::TestBranchingResource::test_loaded_object_type", "kalpa/tests/test_kalpa.py::TestBranchingResource::test_alternate_loaded_object_type", "kalpa/tests/test_kalpa.py::TestBranchingResource::test_object_lineage", "kalpa/tests/test_kalpa.py::TestBranchingResource::test_alternate_object_lineage", "kalpa/tests/test_kalpa.py::TestBranchingResource::test_object_caching", "kalpa/tests/test_kalpa.py::TestBranchingResource::test_alternate_object_caching", "kalpa/tests/test_kalpa.py::TestMixedResource::test_dynamic_resource_load", "kalpa/tests/test_kalpa.py::TestAlternateResourceClasses::test_common_child_resource", "kalpa/tests/test_kalpa.py::TestAlternateResourceClasses::test_alternate_child_resource", "kalpa/tests/test_kalpa.py::TestAlternateResourceClasses::test_missing_child_resource", "kalpa/tests/test_kalpa.py::TestAlternateResourceClasses::test_bad_child_resource_class", "kalpa/tests/test_kalpa.py::TestAttributeAccess::test_simple_attribute_access", "kalpa/tests/test_kalpa.py::TestAttributeAccess::test_delegated_attribute_access", "kalpa/tests/test_kalpa.py::TestAttributeAccess::test_attribute_cached_access", "kalpa/tests/test_kalpa.py::TestAttributeAccess::test_only_delegate_initial_attributes", "kalpa/tests/test_kalpa.py::TestAttributeAccess::test_only_delegate_initial_attribute_values", "kalpa/tests/test_kalpa.py::TestAttributeAccess::test_attributes_for_custom_children", "kalpa/tests/test_kalpa.py::TestPyramidTraversalIntegration::test_find_root", "kalpa/tests/test_kalpa.py::TestPyramidTraversalIntegration::test_find_resource", "kalpa/tests/test_kalpa.py::TestPyramidTraversalIntegration::test_resource_path", "kalpa/tests/test_kalpa.py::test_util_lineage", "kalpa/tests/test_kalpa.py::test_find_parent_by_class", "kalpa/tests/test_kalpa.py::test_find_parent_by_name" ]
[]
[ "kalpa/tests/test_kalpa.py::TestBasicResource::test_sub_resource_type", "kalpa/tests/test_kalpa.py::TestBasicResource::test_sub_resource_lineage", "kalpa/tests/test_kalpa.py::TestBasicResource::test_keyerror_for_nonexistant_sub_resource", "kalpa/tests/test_kalpa.py::TestBasicResource::test_multiple_lookups_same_resource", "kalpa/tests/test_kalpa.py::TestBranchAliasing::test_alias_access", "kalpa/tests/test_kalpa.py::TestBranchAliasing::test_alias_resouce_caching", "kalpa/tests/test_kalpa.py::TestBranchAliasing::test_alias_are_separate_instances", "kalpa/tests/test_kalpa.py::TestMixedResource::test_static_resource_load", "kalpa/tests/test_kalpa.py::TestPyramidTraversalIntegration::test_resource_path_aliased", "kalpa/tests/test_kalpa.py::test_separate_subpath_registries", "kalpa/tests/test_kalpa.py::test_find_parent_by_class_no_match", "kalpa/tests/test_kalpa.py::test_find_parent_by_name_no_match" ]
[]
BSD 2-Clause "Simplified" License
1,220
[ "README.rst", "kalpa/__init__.py", "setup.py" ]
[ "README.rst", "kalpa/__init__.py", "setup.py" ]
Stranger6667__postmarker-138
62cc043528a344477ee4b8117e08865c52aa50fe
2017-05-01 11:31:40
ac98da890863eea01eaf7424c4e255bc72900ccf
codecov[bot]: # [Codecov](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=h1) Report > Merging [#138](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=desc) into [master](https://codecov.io/gh/Stranger6667/postmarker/commit/62cc043528a344477ee4b8117e08865c52aa50fe?src=pr&el=desc) will **not change** coverage. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/Stranger6667/postmarker/pull/138/graphs/tree.svg?width=650&height=150&src=pr&token=ntmpbnZMPl)](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #138 +/- ## ===================================== Coverage 100% 100% ===================================== Files 20 20 Lines 790 795 +5 Branches 63 63 ===================================== + Hits 790 795 +5 ``` | [Impacted Files](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [postmarker/core.py](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=tree#diff-cG9zdG1hcmtlci9jb3JlLnB5) | `100% <100%> (ø)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=footer). Last update [62cc043...574f2de](https://codecov.io/gh/Stranger6667/postmarker/pull/138?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/docs/changelog.rst b/docs/changelog.rst index 067a7e1..fd2198f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,6 +10,7 @@ Added ~~~~~ - ``message`` property for ``Bounce``, ``Delivery`` and ``Open`` classes to access corresponding ``OutboundMessage`` instance. `#119`_ +- An ability to control timeout and retries behaviour. `#82`_ `0.10.1`_ - 2017-04-03 ---------------------- @@ -299,6 +300,7 @@ Fixed .. _#92: https://github.com/Stranger6667/postmarker/issues/92 .. _#87: https://github.com/Stranger6667/postmarker/issues/87 .. _#83: https://github.com/Stranger6667/postmarker/issues/83 +.. _#82: https://github.com/Stranger6667/postmarker/issues/82 .. _#78: https://github.com/Stranger6667/postmarker/issues/78 .. _#76: https://github.com/Stranger6667/postmarker/issues/76 .. _#75: https://github.com/Stranger6667/postmarker/issues/75 diff --git a/docs/usage.rst b/docs/usage.rst index 9c427b1..f901781 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -20,4 +20,8 @@ By default, logging is configured to be silent. To enable it, pass ``verbosity`` >>> postmark = PostmarkClient(server_token='SERVER_TOKEN', account_token='ACCOUNT_TOKEN', verbosity=3) -With ``verbosity=3`` every request and response will be logged to the console. \ No newline at end of file +With ``verbosity=3`` every request and response will be logged to the console. + +For timeouts and max_retries handling there are two parameters - ``max_retries`` and ``timeout``. +The ``timeout`` value is passed to `requests.Session.request <http://docs.python-requests.org/en/master/api/#requests.Session.request>`_. +``max_retries`` is passed to `requests.adapters.HTTPAdapter <http://docs.python-requests.org/en/master/api/#requests.adapters.HTTPAdapter>`_. diff --git a/postmarker/core.py b/postmarker/core.py index 6dbe3d4..5d56837 100644 --- a/postmarker/core.py +++ b/postmarker/core.py @@ -41,10 +41,12 @@ class PostmarkClient(object): TriggersManager, ) - def __init__(self, server_token=None, account_token=None, verbosity=0): + def __init__(self, server_token=None, account_token=None, verbosity=0, max_retries=0, timeout=None): assert server_token, 'You have to provide token to use Postmark API' self.server_token = server_token self.account_token = account_token + self.max_retries = max_retries + self.timeout = timeout self.logger = get_logger('Postmarker', verbosity) self._setup_managers() @@ -67,6 +69,9 @@ class PostmarkClient(object): def session(self): if not hasattr(self, '_session'): self._session = requests.Session() + adapter = requests.adapters.HTTPAdapter(max_retries=self.max_retries) + self._session.mount('http://', adapter) + self._session.mount('https://', adapter) return self._session def call(self, method, endpoint, token_type='server', data=None, **kwargs): @@ -104,7 +109,9 @@ class PostmarkClient(object): default_headers.update(headers) url = urljoin(root, endpoint) self.logger.debug('Request: %s %s, Data: %s', method, url, data) - response = self.session.request(method, url, json=data, params=kwargs, headers=default_headers) + response = self.session.request( + method, url, json=data, params=kwargs, headers=default_headers, timeout=self.timeout + ) self.logger.debug('Response: %s', response.text) self.check_response(response) return response.json()
Configurable resend on fail
Stranger6667/postmarker
diff --git a/tests/test_core.py b/tests/test_core.py index 9e90535..8a6fbba 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -14,7 +14,7 @@ class TestClient: 'GET', 'https://api.postmarkapp.com/endpoint', headers={'X-Postmark-Server-Token': server_token, 'Accept': 'application/json', 'User-Agent': USER_AGENT}, - params={}, json=None, + params={}, json=None, timeout=None ) def test_no_token(self):
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 3 }
0.10
{ "env_vars": null, "env_yml_path": [], "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "", "pip_packages": [ "pytest", "pytest-cov", "pytest-django", "betamax", "betamax_serializers" ], "pre_install": [], "python": "3.6", "reqs_path": [], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 betamax==0.8.1 betamax-serializers==0.2.1 certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 -e git+https://github.com/Stranger6667/postmarker.git@62cc043528a344477ee4b8117e08865c52aa50fe#egg=postmarker py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 pytest-django==4.5.2 requests==2.27.1 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: postmarker channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - betamax==0.8.1 - betamax-serializers==0.2.1 - charset-normalizer==2.0.12 - coverage==6.2 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-django==4.5.2 - requests==2.27.1 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/postmarker
[ "tests/test_core.py::TestClient::test_server_client" ]
[]
[ "tests/test_core.py::TestClient::test_no_token", "tests/test_core.py::TestClient::test_repr", "tests/test_core.py::TestManagersSetup::test_duplicate_names[PostmarkClient]", "tests/test_core.py::TestManagersSetup::test_duplicate_names[OutboundMessageManager]", "tests/test_core.py::TestManagersSetup::test_duplicate_names[MessageManager]", "tests/test_core.py::TestManagersSetup::test_duplicate_names[TriggersManager]", "tests/test_core.py::TestManagersSetup::test_names_overriding[PostmarkClient]", "tests/test_core.py::TestManagersSetup::test_names_overriding[OutboundMessageManager]", "tests/test_core.py::TestManagersSetup::test_names_overriding[MessageManager]", "tests/test_core.py::TestManagersSetup::test_names_overriding[TriggersManager]" ]
[]
MIT License
1,221
[ "docs/changelog.rst", "postmarker/core.py", "docs/usage.rst" ]
[ "docs/changelog.rst", "postmarker/core.py", "docs/usage.rst" ]
internap__python-hostsresolver-5
d9e94459b05e323b9bf8e28b696ca8a7f920dc91
2017-05-01 17:43:59
d9e94459b05e323b9bf8e28b696ca8a7f920dc91
diff --git a/hostsresolver/cache.py b/hostsresolver/cache.py index 1318ecb..45c6ad6 100644 --- a/hostsresolver/cache.py +++ b/hostsresolver/cache.py @@ -41,13 +41,19 @@ def create_connection(address, *args, **kwargs): class SocketType(_SocketType): + def _use_host_cache(self, address): + try: + return (gethostbyname(address[0]), address[1]) + except socket.gaierror: + # The address[0] could be an unknown host to socket.gethostbyname + # but known to socket.connect, such cases include unix sockets. + return address + def connect(self, address): - new_address = (gethostbyname(address[0]), address[1]) - return _SocketType.connect(self, new_address) + return _SocketType.connect(self, self._use_host_cache(address)) def connect_ex(self, address): - new_address = (gethostbyname(address[0]), address[1]) - return _SocketType.connect_ex(self, new_address) + return _SocketType.connect_ex(self, self._use_host_cache(address)) def update(hosts):
gaierror when using docker-py Hello! I stumbled on a little problem while using the host resolver and docker-py at the same time: ``` ConnectionError: ('Connection aborted.', gaierror(8, 'nodename nor servname provided, or not known')) ``` Seems like docker-py speaks to the docker engine via unix socket and have a unix socket such as `/var/run/docker.sock` so when this pass into gethostbyname (https://github.com/internap/python-hostsresolver/blob/master/hostsresolver/cache.py#L26) and it's not in the host cache, it invokes socket.gethostbyname which raises a gaierror.... BUT if you pass the socket to socket.connect it will be fine. Fix incoming soon :)
internap/python-hostsresolver
diff --git a/tests/test_cache.py b/tests/test_cache.py index 612edbe..ecb0024 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -15,6 +15,8 @@ import socket import unittest +import mock + from hostsresolver import cache @@ -103,3 +105,33 @@ class TestGetAddrInfo(unittest.TestCase): (10, 1, 6, '', ('2001:4860:4860::8888', 53, 0, 0)), (10, 2, 17, '', ('2001:4860:4860::8888', 53, 0, 0)), (10, 3, 0, '', ('2001:4860:4860::8888', 53, 0, 0))]) + + +class TestConnect(unittest.TestCase): + def setUp(self): + cache.install() + + def tearDown(self): + cache.uninstall() + + @mock.patch("hostsresolver.cache._gethostbyname") + @mock.patch("hostsresolver.cache._SocketType") + def test_uses_real_gethostname_result(self, socket_mock, gethost_mock): + gethost_mock.return_value = "1.1.1.1" + + s = socket.SocketType() + s.connect(("some_url", 123)) + + socket_mock.connect.assert_called_once_with(s, ("1.1.1.1", 123)) + gethost_mock.assert_called_once_with("some_url") + + @mock.patch("hostsresolver.cache._gethostbyname") + @mock.patch("hostsresolver.cache._SocketType") + def test_ignore_unresolved_hosts_and_pass_them_to_connect(self, socket_mock, gethost_mock): + gethost_mock.side_effect = socket.gaierror + + s = socket.SocketType() + s.connect(("/var/run/something", 123)) + + socket_mock.connect.assert_called_once_with(s, ("/var/run/something", 123)) + gethost_mock.assert_called_once_with("/var/run/something")
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "nose>=1.2.1", "mock>=1.0.1", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 iniconfig==2.1.0 mock==5.2.0 nose==1.3.7 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 -e git+https://github.com/internap/python-hostsresolver.git@d9e94459b05e323b9bf8e28b696ca8a7f920dc91#egg=python_hostsresolver python-vagrant==1.0.0 tomli==2.2.1
name: python-hostsresolver channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - mock==5.2.0 - nose==1.3.7 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - python-vagrant==1.0.0 - tomli==2.2.1 prefix: /opt/conda/envs/python-hostsresolver
[ "tests/test_cache.py::TestConnect::test_ignore_unresolved_hosts_and_pass_them_to_connect" ]
[ "tests/test_cache.py::TestGetAddrInfo::test_initial_state", "tests/test_cache.py::TestGetAddrInfo::test_uninstall_returns_original_state" ]
[ "tests/test_cache.py::TestGetHostByName::test_initial_state", "tests/test_cache.py::TestGetHostByName::test_install_overrides", "tests/test_cache.py::TestGetHostByName::test_uninstall_returns_original_state", "tests/test_cache.py::TestGetAddrInfo::test_install_overrides", "tests/test_cache.py::TestConnect::test_uses_real_gethostname_result" ]
[]
Apache License 2.0
1,222
[ "hostsresolver/cache.py" ]
[ "hostsresolver/cache.py" ]
bokeh__bokeh-6229
ca485c9a048fb353d7b1662f8a844f9ad266ee15
2017-05-02 15:41:50
44b63d65efec1e06fb565a9a81e0f2f21315e85a
diff --git a/bokeh/core/enums.py b/bokeh/core/enums.py index 107cf475c..2087556b1 100644 --- a/bokeh/core/enums.py +++ b/bokeh/core/enums.py @@ -229,6 +229,9 @@ NumeralLanguage = enumeration("be-nl", "chs", "cs", "da-dk", "de-ch", "de", "en" "fr", "hu", "it", "ja", "nl-nl", "pl", "pt-br", "pt-pt", "ru", "ru-UA", "sk", "th", "tr", "uk-UA") +#: Specify an output backend to render a plot area onto +OutputBackend = enumeration("canvas", "svg") + #: Specify a position in the render order for a Bokeh renderer RenderLevel = enumeration("image", "underlay", "glyph", "annotation", "overlay") diff --git a/bokeh/models/plots.py b/bokeh/models/plots.py index bd1ba3913..a7c948fc4 100644 --- a/bokeh/models/plots.py +++ b/bokeh/models/plots.py @@ -5,7 +5,7 @@ from __future__ import absolute_import from six import string_types -from ..core.enums import Location +from ..core.enums import Location, OutputBackend from ..core.properties import Bool, Dict, Enum, Include, Instance, Int, List, Override, String from ..core.property_mixins import LineProps, FillProps from ..core.query import find @@ -697,3 +697,7 @@ class Plot(LayoutDOM): Whether WebGL is enabled for this plot. If True, the glyphs that support this will render via WebGL instead of the 2D canvas. """) + + output_backend = Enum(OutputBackend, default="canvas", help=""" + Specify the output backend for the plot area. Default is HTML5 Canvas. + """) diff --git a/bokehjs/package.json b/bokehjs/package.json index 730fa9b01..de29eb92f 100644 --- a/bokehjs/package.json +++ b/bokehjs/package.json @@ -125,6 +125,7 @@ "jquery-mousewheel": "^3.1.12", "jquery-ui": "~1.10.5", + "canvas2svg": "https://github.com/bokeh/canvas2svg#v1.0.20", "numbro": "https://github.com/bokeh/numbro.git#e1b6c52", "kiwi": "https://github.com/bokeh/kiwi.git#6941045", "root-require": "^0.3.1" diff --git a/bokehjs/src/coffee/core/enums.coffee b/bokehjs/src/coffee/core/enums.coffee index c556fbe0e..b6a578105 100644 --- a/bokehjs/src/coffee/core/enums.coffee +++ b/bokehjs/src/coffee/core/enums.coffee @@ -24,6 +24,8 @@ export LegendLocation = [ export Orientation = ["vertical", "horizontal"] +export OutputBackend = ["canvas", "svg"] + export RenderLevel = ["image", "underlay", "glyph", "annotation", "overlay"] export RenderMode = ["canvas", "css"] diff --git a/bokehjs/src/coffee/core/properties.coffee b/bokehjs/src/coffee/core/properties.coffee index 663b90967..86a5590ed 100644 --- a/bokehjs/src/coffee/core/properties.coffee +++ b/bokehjs/src/coffee/core/properties.coffee @@ -194,6 +194,8 @@ export class LegendLocation extends enum_prop("LegendLocation", enums.LegendLoca export class Location extends enum_prop("Location", enums.Location) +export class OutputBackend extends enum_prop("OutputBackend", enums.OutputBackend) + export class Orientation extends enum_prop("Orientation", enums.Orientation) export class TextAlign extends enum_prop("TextAlign", enums.TextAlign) diff --git a/bokehjs/src/coffee/core/util/canvas.coffee b/bokehjs/src/coffee/core/util/canvas.coffee index 327babe21..1f699691b 100644 --- a/bokehjs/src/coffee/core/util/canvas.coffee +++ b/bokehjs/src/coffee/core/util/canvas.coffee @@ -69,8 +69,10 @@ export fixup_ctx = (ctx) -> fixup_measure_text(ctx) fixup_ellipse(ctx) -export get_scale_ratio = (ctx, hidpi) -> - if hidpi +export get_scale_ratio = (ctx, hidpi, backend) -> + if backend == "svg" + return 1 + else if hidpi devicePixelRatio = window.devicePixelRatio || 1 backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || diff --git a/bokehjs/src/coffee/models/canvas/canvas.coffee b/bokehjs/src/coffee/models/canvas/canvas.coffee index 990985b8d..54b451553 100644 --- a/bokehjs/src/coffee/models/canvas/canvas.coffee +++ b/bokehjs/src/coffee/models/canvas/canvas.coffee @@ -8,6 +8,8 @@ import {div, canvas} from "core/dom" import {isEqual} from "core/util/eq" import {fixup_ctx, get_scale_ratio} from "core/util/canvas" +import * as canvas2svg from "canvas2svg" + # fixes up a problem with some versions of IE11 # ref: http://stackoverflow.com/questions/22062313/imagedata-set-in-internetexplorer if window.CanvasPixelArray? @@ -24,11 +26,16 @@ export class CanvasView extends DOMView @map_el = if @model.map then @el.appendChild(div({class: "bk-canvas-map"})) else null @events_el = @el.appendChild(div({class: "bk-canvas-events"})) @overlays_el = @el.appendChild(div({class: "bk-canvas-overlays"})) - @canvas_el = @el.appendChild(canvas({class: "bk-canvas"})) - # create the canvas context that gets passed around for drawing - @ctx = @get_ctx() + switch @model.output_backend + when "canvas" + @canvas_el = @el.appendChild(canvas({class: "bk-canvas"})) + @_ctx = @canvas_el.getContext('2d') + when "svg" + @_ctx = new canvas2svg() + @canvas_el = @el.appendChild(@_ctx.getSvg()) + @ctx = @get_ctx() # work around canvas incompatibilities fixup_ctx(@ctx) @@ -37,10 +44,10 @@ export class CanvasView extends DOMView @connect(@solver.layout_reset, () => @_add_constraints()) - get_canvas_element: () -> @canvas_el + # Method exists so that context can be stubbed in unit tests + get_ctx: () -> return @_ctx - get_ctx: () -> - return @canvas_el.getContext('2d') + get_canvas_element: () -> return @canvas_el prepare_canvas: () -> # Ensure canvas has the correct size, taking HIDPI into account @@ -50,7 +57,7 @@ export class CanvasView extends DOMView @el.style.width = "#{width}px" @el.style.height = "#{height}px" - pixel_ratio = get_scale_ratio(@ctx, @model.use_hidpi) + pixel_ratio = get_scale_ratio(@ctx, @model.use_hidpi, @model.output_backend) @model.pixel_ratio = pixel_ratio @canvas_el.style.width = "#{width}px" @@ -108,6 +115,7 @@ export class Canvas extends LayoutCanvas initial_height: [ p.Number ] use_hidpi: [ p.Boolean, true ] pixel_ratio: [ p.Number, 1 ] + output_backend: [ p.OutputBackend, "canvas"] } initialize: (attrs, options) -> diff --git a/bokehjs/src/coffee/models/plots/plot.coffee b/bokehjs/src/coffee/models/plots/plot.coffee index 6a7d4aca4..d5772f8bd 100644 --- a/bokehjs/src/coffee/models/plots/plot.coffee +++ b/bokehjs/src/coffee/models/plots/plot.coffee @@ -339,6 +339,7 @@ export class Plot extends LayoutDOM webgl: [ p.Bool, false ] hidpi: [ p.Bool, true ] + output_backend: [ p.OutputBackend, "canvas" ] min_border: [ p.Number, 5 ] min_border_top: [ p.Number, null ] diff --git a/bokehjs/src/coffee/models/plots/plot_canvas.coffee b/bokehjs/src/coffee/models/plots/plot_canvas.coffee index b642e3bab..8e417f510 100644 --- a/bokehjs/src/coffee/models/plots/plot_canvas.coffee +++ b/bokehjs/src/coffee/models/plots/plot_canvas.coffee @@ -613,11 +613,10 @@ export class PlotCanvasView extends DOMView _render_levels: (ctx, levels, clip_region) -> ctx.save() - if clip_region? + if clip_region? and @model.plot.output_backend == "canvas" ctx.beginPath() ctx.rect.apply(ctx, clip_region) ctx.clip() - ctx.beginPath() indices = {} for renderer, i in @model.plot.renderers @@ -646,17 +645,28 @@ export class PlotCanvasView extends DOMView ctx.fillRect(frame_box...) save: (name) -> - canvas = @canvas_view.get_canvas_element() - - if canvas.msToBlob? - blob = canvas.msToBlob() - window.navigator.msSaveBlob(blob, name) - else - link = document.createElement('a') - link.href = canvas.toDataURL('image/png') - link.download = name - link.target = "_blank" - link.dispatchEvent(new MouseEvent('click')) + if @model.plot.output_backend == "canvas" + canvas = @canvas_view.get_canvas_element() + if canvas.msToBlob? + blob = canvas.msToBlob() + window.navigator.msSaveBlob(blob, name) + else + link = document.createElement('a') + link.href = canvas.toDataURL('image/png') + link.download = name + ".png" + link.target = "_blank" + link.dispatchEvent(new MouseEvent('click')) + else if @model.plot.output_backend == "svg" + svg = @canvas_view.ctx.getSerializedSvg(true) + svgblob = new Blob([svg], {type:'text/plain'}) + downloadLink = document.createElement("a") + downloadLink.download = name + ".svg" + downloadLink.innerHTML = "Download svg" + downloadLink.href = window.URL.createObjectURL(svgblob) + downloadLink.onclick = (event) -> document.body.removeChild(event.target) + downloadLink.style.display = "none" + document.body.appendChild(downloadLink) + downloadLink.click() export class PlotCanvas extends LayoutDOM type: 'PlotCanvas' @@ -669,7 +679,8 @@ export class PlotCanvas extends LayoutDOM map: @use_map ? false initial_width: @plot.plot_width, initial_height: @plot.plot_height, - use_hidpi: @plot.hidpi + use_hidpi: @plot.hidpi, + output_backend: @plot.output_backend }) @frame = new CartesianFrame({ diff --git a/bokehjs/src/coffee/models/tools/actions/save_tool.coffee b/bokehjs/src/coffee/models/tools/actions/save_tool.coffee index c6f225dd7..83b272b4b 100644 --- a/bokehjs/src/coffee/models/tools/actions/save_tool.coffee +++ b/bokehjs/src/coffee/models/tools/actions/save_tool.coffee @@ -2,7 +2,7 @@ import {ActionTool, ActionToolView} from "./action_tool" export class SaveToolView extends ActionToolView - doit: () -> @plot_view.save("bokeh_plot.png") + doit: () -> @plot_view.save("bokeh_plot") export class SaveTool extends ActionTool default_view: SaveToolView
Headless static (svg, png) image generation Enable generation of PNG images directly on the server, similar to the Vega.js headless mode (https://github.com/trifacta/vega/wiki/Headless-Mode).
bokeh/bokeh
diff --git a/bokeh/core/tests/test_enums.py b/bokeh/core/tests/test_enums.py index 50a60d0ff..4f52314fd 100644 --- a/bokeh/core/tests/test_enums.py +++ b/bokeh/core/tests/test_enums.py @@ -62,6 +62,7 @@ def test_enums_contents(): 'NamedColor', 'NumeralLanguage', 'Orientation', + 'OutputBackend', 'PaddingUnits', 'Palette', 'RenderLevel',
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 10 }
0.12
{ "env_vars": null, "env_yml_path": null, "install": "pip install bokeh", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
bokeh==3.4.3 contourpy==1.3.0 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work Jinja2==3.1.6 MarkupSafe==3.0.2 numpy==2.0.2 packaging @ file:///croot/packaging_1734472117206/work pandas==2.2.3 pillow==11.1.0 pluggy @ file:///croot/pluggy_1733169602837/work pytest @ file:///croot/pytest_1738938843180/work python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==6.0.2 six==1.17.0 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work tornado==6.4.2 tzdata==2025.2 xyzservices==2025.1.0
name: bokeh channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - bokeh==3.4.3 - contourpy==1.3.0 - jinja2==3.1.6 - markupsafe==3.0.2 - numpy==2.0.2 - pandas==2.2.3 - pillow==11.1.0 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyyaml==6.0.2 - six==1.17.0 - tornado==6.4.2 - tzdata==2025.2 - xyzservices==2025.1.0 prefix: /opt/conda/envs/bokeh
[ "bokeh/core/tests/test_enums.py::test_enums_contents" ]
[]
[ "bokeh/core/tests/test_enums.py::test_Enumeration_default", "bokeh/core/tests/test_enums.py::test_enumeration_basic", "bokeh/core/tests/test_enums.py::test_enumeration_case", "bokeh/core/tests/test_enums.py::test_enumeration_default", "bokeh/core/tests/test_enums.py::test_accept_left_right_center" ]
[]
BSD 3-Clause "New" or "Revised" License
1,223
[ "bokehjs/src/coffee/core/util/canvas.coffee", "bokehjs/package.json", "bokehjs/src/coffee/models/canvas/canvas.coffee", "bokehjs/src/coffee/models/tools/actions/save_tool.coffee", "bokeh/core/enums.py", "bokehjs/src/coffee/core/properties.coffee", "bokehjs/src/coffee/models/plots/plot_canvas.coffee", "bokeh/models/plots.py", "bokehjs/src/coffee/models/plots/plot.coffee", "bokehjs/src/coffee/core/enums.coffee" ]
[ "bokehjs/src/coffee/core/util/canvas.coffee", "bokehjs/package.json", "bokehjs/src/coffee/models/canvas/canvas.coffee", "bokehjs/src/coffee/models/tools/actions/save_tool.coffee", "bokeh/core/enums.py", "bokehjs/src/coffee/core/properties.coffee", "bokehjs/src/coffee/models/plots/plot_canvas.coffee", "bokeh/models/plots.py", "bokehjs/src/coffee/models/plots/plot.coffee", "bokehjs/src/coffee/core/enums.coffee" ]
lbl-srg__BuildingsPy-156
ef15ad34246ac1d4cddf7a45feb1bfeac69936bf
2017-05-03 14:44:15
923b1087e255f7f35224aa7c1653abf9c038f849
diff --git a/buildingspy/development/validator.py b/buildingspy/development/validator.py index 2e9cf30..f34224a 100644 --- a/buildingspy/development/validator.py +++ b/buildingspy/development/validator.py @@ -184,14 +184,14 @@ Modelica package. Expected file '%s'." return (document, errors) def _recursive_glob(self, rootdir='.', suffix=''): - """ + """ Return all files with given extension. - + :param rootdir: Root directory. :param suffix: File extension. :return: List of files with given extension. - + """ return [os.path.join(rootdir, filename) for rootdir, dirnames, @@ -200,15 +200,15 @@ Modelica package. Expected file '%s'." and ("ConvertBuildings_from" not in filename)) ] def _check_experiment(self, name, val, value, model_path, mos_file): - """ + """ Check experiment annotation parameters in mo file. - + :param name: Parameter name. :param val: Value found in mo file. :param value: Value found in mos file. :param model_path: Path to mo file. :param mos_file: Path to mos file. - + """ if("*" in str(val)): @@ -230,14 +230,14 @@ Modelica package. Expected file '%s'." raise ValueError(s) def _missing_parameter(self, name, value, model_path, mos_file): - """ + """ Check missing experiment annotation parameter in mo file. - + :param name: Parameter name. :param value: Value found in mos file. :param model_path: Path to mo file. :param mos_file: Path to mos file. - + """ s = ("Found mo file={!s} without parameter {!s} defined.\n" @@ -248,24 +248,24 @@ Modelica package. Expected file '%s'." raise ValueError(s) def _capitalize_first(self, name): - """ + """ Capitalize the first letter of the given word. Return a word with first letter capitalized. - + :param name: Word to be capitalized. :return: Word with first letter capitalized. - + """ lst = [word[0].upper() + word[1:] for word in name.split()] return " ".join(lst) def _missing_experiment_stoptime(self, mos_files): - """ + """ Check missing experiment and StopTime annotation in mo file. Return number of mo files with experiment. - + :param mos_files: List of mos files. - + """ n_mo_files = 0 @@ -300,16 +300,16 @@ Modelica package. Expected file '%s'." return n_mo_files def _separate_mos_files(self, mos_files): - """ + """ Return number of files with tolerance parameter and two lists of mos files file, one with the simulateModel and the other one with the translateModelFMU command. - + :param mos_files: file path. :return: Number of files with tolerance parameter, and two lists of mos files file, one with the simulateModel and the other one with the translateModelFMU command. - + """ mos_non_fmus = [] @@ -348,27 +348,27 @@ Modelica package. Expected file '%s'." return n_tols, mos_non_fmus, mos_fmus def _check_tolerance(self, content, name, value, mos_file): - """ + """ Check value of tolerance in file. - + :param content: file content. :param name: variable name. :param value: variable value. :param mos_file: mos file. - + """ if (name + "=" == "tolerance=" and float(value) > 1e-6): self._wrong_parameter (mos_file, name, value) def _wrong_parameter (self, mos_file, name, value): - """ + """ Stop if invalid parameter is found. - + :param mos_file: mos file. :param name: parameter name. :param value: parameter value. - + """ if (name + "=" == "tolerance="): @@ -390,13 +390,13 @@ Modelica package. Expected file '%s'." raise ValueError(s) def _getValue (self, name, line, fil_nam): - """ + """ Get value of input parameter. - + :param name: Parameter name. :param line: Line with parameter name. :param fil_nam: File with parameter. - + """ # Split the name value1 = line.split(name+"=") @@ -413,27 +413,25 @@ Modelica package. Expected file '%s'." return value3[0] def _wrong_literal (self, mos_file, name): - """ + """ Stop if invalid literal is found. - + :param mos_file: mos file. :param name: Parameter name. - + """ s = ("Found mos file={!s} with invalid expression={!s}.\n" + "This is not allowed for cross validation with JModelica.\n").format(mos_file, name+'='+name) raise ValueError(s) - def _validate_model_parameters (self, name, mos_files, root_dir): - """ - Validate parameter settings. - + def _validate_experiment_setup (self, name, mos_files): + """ + Validate experiment setup. + :param name: Parameter name. :param mos_files: List of mos files. - :param root_dir: Root directory. - - """ + """ N_mos_defect = 0 @@ -538,12 +536,12 @@ Modelica package. Expected file '%s'." f.close() - def validateModelParameters(self, root_dir): - """ - Validate parameter of mo and mos files. - + def validateExperimentSetup(self, root_dir): + """ + Validate the experiment setup in ``.mo`` and ``.mos`` files. + :param root_dir: Root directory. - + """ # Make sure that the parameter root_dir points to a Modelica package. @@ -567,7 +565,7 @@ Modelica package. Expected file '%s'." # Validate model parameters for i in ["stopTime", "tolerance", "startTime"]: - self._validate_model_parameters(i, mos_non_fmus, root_dir) + self._validate_experiment_setup(i, mos_non_fmus) if(n_tols != n_mo_files): s = ("The number of tolerances in the mos files={!s} does no match " +
change function names that validate experiment setup The newly introduced functions are called `validateModelParameters` but in fact they validate the experiment setup which are not a Modelica parameter. This branch is to refactor the names.
lbl-srg/BuildingsPy
diff --git a/buildingspy/tests/test_development_Validator.py b/buildingspy/tests/test_development_Validator.py index b985da6..f5e881a 100644 --- a/buildingspy/tests/test_development_Validator.py +++ b/buildingspy/tests/test_development_Validator.py @@ -32,7 +32,7 @@ end {{model_name}} MOS_TEMPLATE = """simulateModel("MyModelicaLibrary.Examples.{{model_name}}", method="dassl", {{parameter}} resultFile="{{model_name}}"); createPlot( - id=1, + id=1, y={"p1", "p2"} ) """ @@ -57,15 +57,15 @@ class Test_development_Validator(unittest.TestCase): def run_case(self, val, mod_lib, mo_param, mos_param, err_msg): """ Create and validate mo and mos files - - + + :param: val Validator object. :param: mod_lib Path to model library. :param: mo_param Parameter of mo file. - :param: mos_param Parameter of mos file. - :param: mos_param Parameter of mos file. - :param: mos_param Expected error message. - + :param: mos_param Parameter of mos file. + :param: mos_param Parameter of mos file. + :param: mos_param Expected error message. + """ model_name = ''.join(random.choice(string.ascii_uppercase + string.digits) @@ -90,14 +90,14 @@ class Test_development_Validator(unittest.TestCase): mos_fil.close() with self.assertRaises(ValueError) as context: - val.validateModelParameters(mod_lib) + val.validateExperimentSetup(mod_lib) for path in [path_mo, path_mos]: if os.path.exists(path): os.remove(path) self.assertTrue(err_msg in str(context.exception)) - def test_validateModelParameters(self): + def test_validateExperimentSetup(self): import buildingspy.development.validator as v val = v.Validator() @@ -105,7 +105,7 @@ class Test_development_Validator(unittest.TestCase): ######################################### # Checking default library - val.validateModelParameters(myMoLib) + val.validateExperimentSetup(myMoLib) ######################################### # Checking missing experiment
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 1 }
1.6
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-cov" ], "pre_install": [ "apt-get update", "apt-get install -y gcc tidy" ], "python": "3.6", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 -e git+https://github.com/lbl-srg/BuildingsPy.git@ef15ad34246ac1d4cddf7a45feb1bfeac69936bf#egg=buildingspy certifi==2021.5.30 coverage==6.2 future==1.0.0 gitdb==4.0.9 GitPython==3.1.18 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 pytidylib==0.3.2 smmap==5.0.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: BuildingsPy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - coverage==6.2 - future==1.0.0 - gitdb==4.0.9 - gitpython==3.1.18 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pytidylib==0.3.2 - smmap==5.0.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/BuildingsPy
[ "buildingspy/tests/test_development_Validator.py::Test_development_Validator::test_validateExperimentSetup" ]
[]
[ "buildingspy/tests/test_development_Validator.py::Test_development_Validator::test_validateHTMLInPackage" ]
[]
null
1,224
[ "buildingspy/development/validator.py" ]
[ "buildingspy/development/validator.py" ]
juju-solutions__charms.reactive-106
59b07bd9447d8a4cb027ea2515089216b8d20549
2017-05-03 21:00:14
59b07bd9447d8a4cb027ea2515089216b8d20549
diff --git a/charms/reactive/relations.py b/charms/reactive/relations.py index f81b23c..969e7af 100644 --- a/charms/reactive/relations.py +++ b/charms/reactive/relations.py @@ -14,7 +14,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. +import os import sys +import importlib from inspect import isclass from charmhelpers.core import hookenv @@ -25,6 +27,7 @@ from charms.reactive.bus import get_state from charms.reactive.bus import set_state from charms.reactive.bus import remove_state from charms.reactive.bus import StateList +from charms.reactive.bus import _append_path # arbitrary obj instances to use as defaults instead of None @@ -200,10 +203,14 @@ class RelationBase(object, metaclass=AutoAccessors): """ # The module has already been discovered and imported. module = 'relations.{}.{}'.format(interface, role) - if module in sys.modules: - return cls._find_subclass(sys.modules[module]) - else: - return None + if module not in sys.modules: + try: + _append_path(hookenv.charm_dir()) + _append_path(os.path.join(hookenv.charm_dir(), 'hooks')) + importlib.import_module(module) + except ImportError: + return None + return cls._find_subclass(sys.modules[module]) @classmethod def _find_subclass(cls, module):
0.4.6 breaks charms.openstack (AttributeError: 'NoneType' object has no attribute 'relation_name') #### Built with charms.reactive 0.4.5: Apr 26 (ok): https://openstack-ci-reports.ubuntu.com/artifacts/test_charm_pipeline_amulet_full/openstack/charm-tempest/458466/5/16/index.html #### Built with charms.reactive 0.4.6: Today (fail): https://openstack-ci-reports.ubuntu.com/artifacts/test_charm_pipeline/openstack/charm-tempest/458466/5/206/index.html The tempest-0-var-log.tar.bz2 artifact is of interest for both.
juju-solutions/charms.reactive
diff --git a/tests/test_relations.py b/tests/test_relations.py index 8f84616..48a664d 100644 --- a/tests/test_relations.py +++ b/tests/test_relations.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. +import os import sys import mock import unittest @@ -98,8 +99,23 @@ class TestRelationBase(unittest.TestCase): self.assertEqual(res.conversations(), ['conv.join']) @mock.patch.dict('sys.modules') + @mock.patch.object(relations.Conversation, 'join') + @mock.patch.object(relations, 'hookenv') + def test_cold_import(self, hookenv, conv_join): + tests_dir = os.path.dirname(__file__) + hookenv.charm_dir.return_value = os.path.join(tests_dir, 'data') + sys.modules.pop('relations.hyphen-ated.peer', None) + hookenv.relation_to_role_and_interface.return_value = ('peer', + 'hyphen-ated') + relations.RelationBase._cache.clear() + assert relations.RelationBase.from_name('test') is not None + + @mock.patch.dict('sys.modules') + @mock.patch.object(relations, 'hookenv') @mock.patch.object(relations.RelationBase, '_find_subclass') - def test_find_impl(self, find_subclass): + def test_find_impl(self, find_subclass, hookenv): + tests_dir = os.path.dirname(__file__) + hookenv.charm_dir.return_value = os.path.join(tests_dir, 'data') self.assertIsNone(relations.RelationBase._find_impl('role', 'interface')) assert not find_subclass.called
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 1 }
0.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "coverage", "mock", "nose", "flake8", "ipython", "ipdb", "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 backcall==0.2.0 certifi==2021.5.30 charmhelpers==1.2.1 -e git+https://github.com/juju-solutions/charms.reactive.git@59b07bd9447d8a4cb027ea2515089216b8d20549#egg=charms.reactive coverage==6.2 decorator==5.1.1 flake8==5.0.4 importlib-metadata==4.2.0 importlib-resources==5.4.0 iniconfig==1.1.1 ipdb==0.13.13 ipython==7.16.3 ipython-genutils==0.2.0 jedi==0.17.2 Jinja2==3.0.3 MarkupSafe==2.0.1 mccabe==0.7.0 mock==5.2.0 netaddr==0.10.1 nose==1.3.7 packaging==21.3 parso==0.7.1 pbr==6.1.1 pexpect==4.9.0 pickleshare==0.7.5 pluggy==1.0.0 prompt-toolkit==3.0.36 ptyprocess==0.7.0 py==1.11.0 pyaml==23.5.8 pycodestyle==2.9.1 pyflakes==2.5.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 PyYAML==6.0.1 six==1.17.0 tomli==1.2.3 traitlets==4.3.3 typing_extensions==4.1.1 wcwidth==0.2.13 zipp==3.6.0
name: charms.reactive channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - backcall==0.2.0 - charmhelpers==1.2.1 - coverage==6.2 - decorator==5.1.1 - flake8==5.0.4 - importlib-metadata==4.2.0 - importlib-resources==5.4.0 - iniconfig==1.1.1 - ipdb==0.13.13 - ipython==7.16.3 - ipython-genutils==0.2.0 - jedi==0.17.2 - jinja2==3.0.3 - markupsafe==2.0.1 - mccabe==0.7.0 - mock==5.2.0 - netaddr==0.10.1 - nose==1.3.7 - packaging==21.3 - parso==0.7.1 - pbr==6.1.1 - pexpect==4.9.0 - pickleshare==0.7.5 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - ptyprocess==0.7.0 - py==1.11.0 - pyaml==23.5.8 - pycodestyle==2.9.1 - pyflakes==2.5.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pyyaml==6.0.1 - six==1.17.0 - tomli==1.2.3 - traitlets==4.3.3 - typing-extensions==4.1.1 - wcwidth==0.2.13 - zipp==3.6.0 prefix: /opt/conda/envs/charms.reactive
[ "tests/test_relations.py::TestRelationBase::test_cold_import" ]
[]
[ "tests/test_relations.py::TestAutoAccessors::test_accessor", "tests/test_relations.py::TestAutoAccessors::test_accessor_doc", "tests/test_relations.py::TestRelationBase::test_conversation", "tests/test_relations.py::TestRelationBase::test_find_impl", "tests/test_relations.py::TestRelationBase::test_find_subclass", "tests/test_relations.py::TestRelationBase::test_from_name", "tests/test_relations.py::TestRelationBase::test_from_state", "tests/test_relations.py::TestRelationBase::test_get_local", "tests/test_relations.py::TestRelationBase::test_get_remote", "tests/test_relations.py::TestRelationBase::test_is_state", "tests/test_relations.py::TestRelationBase::test_remove_state", "tests/test_relations.py::TestRelationBase::test_set_local", "tests/test_relations.py::TestRelationBase::test_set_remote", "tests/test_relations.py::TestRelationBase::test_set_state", "tests/test_relations.py::TestRelationBase::test_toggle_state", "tests/test_relations.py::TestConversation::test_depart", "tests/test_relations.py::TestConversation::test_get_local", "tests/test_relations.py::TestConversation::test_get_remote", "tests/test_relations.py::TestConversation::test_get_remote_departed", "tests/test_relations.py::TestConversation::test_is_state", "tests/test_relations.py::TestConversation::test_join", "tests/test_relations.py::TestConversation::test_key", "tests/test_relations.py::TestConversation::test_load", "tests/test_relations.py::TestConversation::test_relation_ids", "tests/test_relations.py::TestConversation::test_remove_state", "tests/test_relations.py::TestConversation::test_set_local", "tests/test_relations.py::TestConversation::test_set_remote", "tests/test_relations.py::TestConversation::test_set_state", "tests/test_relations.py::TestConversation::test_toggle_state", "tests/test_relations.py::TestMigrateConvs::test_migrate", "tests/test_relations.py::TestRelationCall::test_call_conversations", "tests/test_relations.py::TestRelationCall::test_call_name", "tests/test_relations.py::TestRelationCall::test_call_state", "tests/test_relations.py::TestRelationCall::test_no_impl" ]
[]
Apache License 2.0
1,225
[ "charms/reactive/relations.py" ]
[ "charms/reactive/relations.py" ]
killerbat00__opalescence-4
97124cb717d4258fe5fea7dcc088844ea9348b5e
2017-05-04 04:48:36
0b6d8a2c73b27cb2ffe10e7e20e92adbe9e90bb7
diff --git a/.editorconfig b/.editorconfig index d4a2c44..552a4f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,3 @@ -# http://editorconfig.org - root = true [*] @@ -17,5 +15,3 @@ end_of_line = crlf [LICENSE] insert_final_newline = false -[Makefile] -indent_style = tab diff --git a/.gitignore b/.gitignore index 6301ec1..5006da6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,12 @@ -.idea/* *.torrent *.txt +*.pyc +# Setuptools distribution folder. +/dist/ +# Python egg metadata +/*.egg-info test_torrent_dir/* /tests/test_torrent_data/ .idea/ __pycache__/ -config.pyc -opalescence/__pycache__/* -opalescence/btlib/__pycache__/* -opalescence/btlib/protocol/__pycache__/* -tests/__pycache__/* + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..139a411 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include LICENSE +include VERSION +include README.md diff --git a/README.md b/README.md index a9d5b5d..50817b2 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ install using pip ## using opalescence download a torrent -`python3 <path-to-opalescence>/main.py download <.torrent-file> <destination>` +`python3 <path-to-opalescence>/opl.py download <.torrent-file> <destination>` ## testing opalescence -`python3 <path-to-opalescence>/main.py test` +`python3 <path-to-opalescence>/opl.py test` diff --git a/VERSION b/VERSION deleted file mode 100644 index 0c62199..0000000 --- a/VERSION +++ /dev/null @@ -1,1 +0,0 @@ -0.2.1 diff --git a/config.ini b/config.ini deleted file mode 100644 index ab109a1..0000000 --- a/config.ini +++ /dev/null @@ -1,1 +0,0 @@ -[default] diff --git a/config/logging.ini b/config/logging.ini deleted file mode 100644 index f4174d6..0000000 --- a/config/logging.ini +++ /dev/null @@ -1,28 +0,0 @@ -[loggers] -keys = root,opalescence - -[handlers] -keys = stdout - -[formatters] -keys = basic - -[logger_root] -level = DEBUG -handlers = stdout - -[logger_opalescence] -level = DEBUG -handlers = stdout -qualname = opalescence -propagate = 0 - -[handler_stdout] -class = StreamHandler -level = DEBUG -formatter = basic -args = (sys.stdout,) - -[formatter_basic] -format = %(asctime)s : %(name)s : [%(levelname)s] %(message)s -datefmt = diff --git a/config/opalescence.ini b/config/opalescence.ini deleted file mode 100644 index e69de29..0000000 diff --git a/main.py b/main.py deleted file mode 100644 index 9ac7217..0000000 --- a/main.py +++ /dev/null @@ -1,101 +0,0 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- - -""" -Opalescence is a simple torrent client. -""" - -import argparse -import asyncio -import logging -import logging.config -import os -import unittest - -from opalescence.btlib.client import Client -from opalescence.btlib.torrent import Torrent - - -def create_logger(): - """ - Creates and configures the root logger - Configuration is pulled from config/logging.ini - """ - full_path = os.path.realpath(__file__) - dirname = os.path.dirname(full_path) - log_conf_path = os.path.join(dirname, "config", "logging.ini") - logging.config.fileConfig(log_conf_path) - logging.info("Initialized logging") - - -def create_argparser() -> argparse.ArgumentParser: - """ - Initializes the root argument parser and all relevant subparsers for supported commands. - :return: argparse.ArgumentParser instance that's ready to make things happen - """ - parser = argparse.ArgumentParser() - subparsers = parser.add_subparsers() - test_parser = subparsers.add_parser("test", help="Run the test suite") - test_parser.set_defaults(func=run_tests) - download_parser = subparsers.add_parser("download", help="Download a .torrent file") - download_parser.add_argument('torrent_file') - download_parser.add_argument('destination') - download_parser.set_defaults(func=download_file) - return parser - - -def main(): - """ - Main entry-point into Opalescence. - """ - create_logger() - logging.info("Initializing argument parser and subparsers") - argparser = create_argparser() - - try: - args = argparser.parse_args() - args.func(args) - except AttributeError: - logging.debug("Program invoked with no arguments") - argparser.print_help() - - -def run_tests(_) -> None: - """ - Runs the test suite found in the tests/ directory - :param _: unused - """ - logging.debug("Running the test suite") - - loader = unittest.defaultTestLoader - runner = unittest.TextTestRunner() - suite = loader.discover(os.path.abspath(os.path.join(os.path.dirname(__file__), "tests"))) - runner.run(suite) - - -def download_file(file_path) -> None: - """ - Downloads a .torrent file - :param file_path: .torrent filepath argparse.Namespace object - """ - logging.debug(f"Downloading {file_path}") - logging.debug(f"Downloading {file_path.torrent_file}\n" - f"to {file_path.destination}") - - loop = asyncio.get_event_loop() - loop.set_debug(True) - torrent = Torrent.from_file(file_path.torrent_file) - client = Client() - client.download(torrent) - - try: - loop.run_forever() - # loop.run_until_complete(task) - except asyncio.CancelledError: - logging.warning("Event loop was cancelled") - finally: - loop.close() - -if __name__ == '__main__': - main() - logging.shutdown() diff --git a/opalescence/__init__.py b/opalescence/__init__.py index 6630122..8dde347 100644 --- a/opalescence/__init__.py +++ b/opalescence/__init__.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- """ -Package containing the main opalescence logic +Package containing the main opalescence application logic. """ -from .btlib import * - __author__ = """Brian Houston Morrow""" -___email___ = "[email protected]" -__version__ = "0.1.2" - +__email__ = "[email protected]" +__version__ = "0.2.1" diff --git a/opalescence/btlib/__init__.py b/opalescence/btlib/__init__.py index a2d8f0d..228f37c 100644 --- a/opalescence/btlib/__init__.py +++ b/opalescence/btlib/__init__.py @@ -1,26 +1,6 @@ # -*- coding: utf-8 -*- """ -Module containing library code for the BitTorrent protocol +Library code for the bittorrent protocol. """ -import logging -__all__ = ["bencode", "protocol", "torrent", "tracker", "client"] - - -def log_and_raise(msg: str, log: logging.Logger, exc: Exception, from_e: Exception = None) -> None: - """ - Logs a message, then raises the specified exception, optionally from another exception. - - :param msg: message to log on the module's logger - :param log: logger on which to log - :param exc: exception to raise - :param from_e: exception from which to raise - :raises exc: - """ - if from_e: - log.exception(msg) - raise exc(msg) from from_e - - log.error(msg) - raise exc(msg) diff --git a/opalescence/btlib/bencode.py b/opalescence/btlib/bencode.py index e28e4a2..69b07ef 100644 --- a/opalescence/btlib/bencode.py +++ b/opalescence/btlib/bencode.py @@ -3,22 +3,12 @@ """ Provides support for decoding a bencoded string into a python OrderedDict, bencoding a decoded OrderedDict, and pretty printing said OrderedDict. - -public classes: - Encoder() - Decoder() - -public Exceptions: - BencodeRecursionError() - DecodeError() - EncodeError() """ + import logging from collections import OrderedDict from io import BytesIO -from typing import Union - -from . import log_and_raise +from typing import Union, Optional logger = logging.getLogger(__name__) @@ -43,7 +33,7 @@ class EncodeError(Exception): class BencodeDelimiters: """ - Delimiters used for bencoding + Delimiters used in the bencoding spec. """ dict_start = b'd' end = b'e' @@ -51,27 +41,31 @@ class BencodeDelimiters: num_start = b'i' divider = b':' digits = [b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9'] - eof = b"!" + eof = b"!" # custom eof marker used to break out of empty containers class Decoder: """ - Decodes a bencoded bytestring, returning it's equivalent python object representation. + Decodes a bencoded bytestring, returning its equivalent python + representation. """ - def __init__(self, data: bytes, recursion_limit: int = 99999): + def __init__(self, data: bytes, *, recursion_limit: int = 99999): """ Creates a new Decoder object. :param data: the bencoded bytes to decode - :param recursion_limit: the number of times we'll recursively call into the decoding methods + :param recursion_limit: recursion limit for decoding methods :raises DecodeError: if recursion limit is < 0 or no data received """ if recursion_limit <= 0: - log_and_raise("Recursion limit should be greater than 0.", logger, DecodeError) + logger.error(f"Cannot decode. Recursion limit should be greater " + f"than 0.") + raise DecodeError if not data: - log_and_raise("No data received.", logger, DecodeError) + logger.error(f"Cannot decode. No data received.") + raise DecodeError self._recursion_limit = recursion_limit self._current_iter = 0 @@ -80,7 +74,8 @@ class Decoder: def _set_data(self, data: bytes) -> None: """ Sets the data used by the decoder. - Warning: _set_data does not check if the data passed in as an argument exists. + Warning: _set_data does not check if the data passed in as an argument + exists. calling decode() after setting no data will return None. :param data: bytes of data to decode @@ -89,7 +84,9 @@ class Decoder: self.data = BytesIO(data) self._current_iter = 0 except TypeError as te: - log_and_raise(f"Cannot set data. Invalid type of {type(data)}", logger, DecodeError, te) + logger.error(f"Expected bytes, received {type(data)}") + logger.info(te, exc_info=True) + raise DecodeError from te def decode(self) -> Union[OrderedDict, list, bytes, int, None]: """ @@ -111,17 +108,18 @@ class Decoder: :return: torrent info decoded into a python object """ if self._current_iter > self._recursion_limit: - log_and_raise("Recursion limit reached.", logger, BencodeRecursionError) + logger.error(f"Recursion limit reached.") + raise BencodeRecursionError else: self._current_iter += 1 char = self.data.read(1) if not char: - # ends the recursive madness. eof is used to signal we've decoded as far as we can go + # eof is used to signal we've decoded as far as we can go return BencodeDelimiters.eof if char == BencodeDelimiters.end: - # extraneous end delimiters are ignored -> d3:num3:valee = {"num", "val"} + # extra end delimiters are ignored -> d3:num3:valee = {"num", "val"} return BencodeDelimiters.eof elif char == BencodeDelimiters.num_start: return self._decode_int() @@ -132,7 +130,8 @@ class Decoder: elif char == BencodeDelimiters.list_start: return self._decode_list() else: - log_and_raise(f"Unable to bdecode {char}. Invalid bencoding key.", logger, DecodeError) + logger.error(f"Unable to bdecode {char}. Invalid bencoding key.") + raise DecodeError def _decode_dict(self) -> OrderedDict: """ @@ -151,21 +150,25 @@ class Decoder: if key == BencodeDelimiters.eof: break if not isinstance(key, bytes): - log_and_raise(f"Dictionary key must be bytes. Not {type(key)}.", logger, DecodeError) + logger.error(f"Dictionary key must be bytes. Not {type(key)}") + raise DecodeError + val = self._decode() decoded_dict.setdefault(key, val) keys.append(key) if keys != sorted(keys): - log_and_raise(f"Invalid dictionary. Keys {keys} are not sorted.", logger, DecodeError) + logger.error(f"Invalid dictionary. Keys {keys} not sorted.") + raise DecodeError return decoded_dict def _decode_list(self) -> list: """ Decodes a bencoded list into a python list - lists can contain any other bencoded types (bytestring, integer, list, dictionary) + lists can contain any other bencoded types: + (bytestring, integer, list, dictionary) :return: list of decoded data """ @@ -188,24 +191,26 @@ class Decoder: def _decode_bytestr(self) -> bytes: """ decodes a bencoded string from the BytesIO buffer. - whitespace only strings are allowed if there is the proper number of whitespace characters to read. + whitespace only strings are allowed if there is + the proper number of whitespace characters to read. :raises DecodeError: if we are unable to read enough data for the string :return: decoded string """ - # we've already consumed the byte that will start the string length, go back and get it + # we've already consumed the string length, go back and get it self.data.seek(-1, 1) string_len = self._parse_num(BencodeDelimiters.divider) string_val = self.data.read(string_len) if len(string_val) != string_len: - log_and_raise(f"Unable to read specified string length {string_len}", logger, DecodeError) + logger.error(f"Unable to read specified string {string_len}") + raise DecodeError return string_val def _parse_num(self, delimiter: bytes) -> int: """ - parses an bencoded integer up to specified delimiter from the BytesIO buffer. + parses an bencoded integer up to specified delimiter from the buffer. :param delimiter: delimiter do indicate the end of the number :raises DecodeError: when an invalid character occurs @@ -214,20 +219,25 @@ class Decoder: parsed_num = bytes() while True: char = self.data.read(1) - if char in BencodeDelimiters.digits + [b"-"]: # allow negative integers + # allow negative integers + if char in BencodeDelimiters.digits + [b"-"]: parsed_num += char else: if char != delimiter: - log_and_raise(f"Invalid character while parsing int {char}. Expected {delimiter}", logger, - DecodeError) + logger.error(f"Invalid character while parsing int" + f"{char}. Expected {delimiter}") + raise DecodeError break num_str = parsed_num.decode("UTF-8") if len(num_str) == 0: - log_and_raise("Empty strings are not allowed for int keys.", logger, DecodeError) + logger.error("Empty strings are not allowed for int keys.") + raise DecodeError elif len(num_str) > 1 and (num_str[0] == '0' or num_str[:2] == '-0'): - log_and_raise("Leading or negative zeros are not allowed for int keys.", logger, DecodeError) + logger.error("Leading or negative zeros are not allowed for int " + "keys.") + raise DecodeError return int(num_str) @@ -245,7 +255,8 @@ class Encoder: :raises EncodeError: when null data received """ if not data: - log_and_raise("No data received.", logger, EncodeError) + logger.error("Cannot encode. No data received.") + raise EncodeError self._set_data(data) @@ -258,7 +269,7 @@ class Encoder: """ self.data = data - def encode(self) -> Union[bytes, None]: + def encode(self) -> Optional[bytes]: """ Bencodes a python object and returns the bencoded string. @@ -285,16 +296,18 @@ class Encoder: elif isinstance(obj, bytes): return self._encode_bytestr(obj) elif isinstance(obj, bool): - log_and_raise("Boolean values not supported.", logger, EncodeError) + logger.error("Boolean values not supported.") + raise EncodeError elif isinstance(obj, int): return self._encode_int(obj) else: - log_and_raise(f"Unexpected object found {obj}", logger, EncodeError) + logger.error(f"Unexpected object found {obj}") + raise EncodeError def _encode_dict(self, obj: dict) -> bytes: """ - bencodes a python dictionary. - Keys may only be bytestrings and they must be in ascending order according to their bytes. + bencodes a python dictionary. Keys may only be bytestrings and they + must be in ascending order according to their bytes. :param obj: dictionary to encode :raises EncodeError: @@ -304,14 +317,16 @@ class Encoder: keys = [] for k, v in obj.items(): if not isinstance(k, bytes): - log_and_raise(f"Dictionary keys must be bytes. Not {type(k)}", logger, EncodeError) + logger.error(f"Dictionary keys must be bytes. Not {type(k)}") + raise EncodeError keys.append(k) key = self._encode_bytestr(k) contents += key contents += self._encode(v) contents += BencodeDelimiters.end if keys != sorted(keys): - log_and_raise(f"Invalid dictionary. Keys {keys} not sorted.", logger, EncodeError) + logger.error(f"Invalid dictionary. Keys {keys} are not sorted.") + raise EncodeError return contents def _encode_list(self, obj: list) -> bytes: diff --git a/opalescence/btlib/client.py b/opalescence/btlib/client.py index 5e60aaa..031beb2 100644 --- a/opalescence/btlib/client.py +++ b/opalescence/btlib/client.py @@ -7,10 +7,9 @@ The client is responsible for orchestrating communication with the tracker and b import asyncio import logging -from . import log_and_raise +from .metainfo import MetaInfoFile from .protocol.peer import PeerError, Peer from .protocol.piece_handler import Requester -from .torrent import Torrent from .tracker import Tracker, TrackerError logger = logging.getLogger(__name__) @@ -27,7 +26,8 @@ class ClientTorrent: A torrent currently being handled by the client. This wraps the tracker, requester, and peers into a single API. """ - def __init__(self, torrent: Torrent): + + def __init__(self, torrent: MetaInfoFile): self.torrent = torrent self.tracker = Tracker(self.torrent) self.requester = Requester(self.torrent) @@ -66,8 +66,9 @@ class ClientTorrent: self.peer_list = p except TrackerError as te: - log_and_raise(f"Unable to make announce call to {self.tracker} for {self.torrent.name}", logger, - ClientError, te) + logger.error(f"Unable to announce to {self.tracker}.") + logger.info(te, exc_info=True) + raise ClientError from te def assign_peers(self) -> None: """ @@ -107,7 +108,7 @@ class Client: self.tasks = [] self.torrents = {} - def download(self, torrent: Torrent): + def download(self, torrent: MetaInfoFile): """ Starts downloading the torrent. Multiple torrents can be downloaded simultaneously. :param torrent: Torrent to download. @@ -115,7 +116,7 @@ class Client: if torrent not in self.torrents: self.torrents[torrent] = ClientTorrent(torrent) - async def stop(self, torrent: Torrent = None): + async def stop(self, torrent: MetaInfoFile = None): """ Stops downloading the specified torrent, or all torrents if none specified. :param torrent: torrent to stop downloading. Default = None = ALL torrents diff --git a/opalescence/btlib/torrent.py b/opalescence/btlib/metainfo.py similarity index 55% rename from opalescence/btlib/torrent.py rename to opalescence/btlib/metainfo.py index ff8c01e..13205f2 100644 --- a/opalescence/btlib/torrent.py +++ b/opalescence/btlib/metainfo.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """ -Support for representing a .torrent file as a python class and creating a Torrent class (or .torrent file) from -a specified file or directory. +Support for representing a .torrent file as a python class and +creating a Torrent class (or .torrent file) from a specified file or directory. """ import hashlib @@ -11,7 +11,6 @@ import os from collections import OrderedDict from typing import NamedTuple, Union -from . import log_and_raise from .bencode import Decoder, Encoder, DecodeError, EncodeError logger = logging.getLogger(__name__) @@ -21,32 +20,33 @@ class CreationError(Exception): """ Raised when we encounter problems creating a torrent """ - pass -""" -An individual file within a torrent -""" -FileItem = NamedTuple("FileItem", [("path", str), ("size", int)]) +class FileItem(NamedTuple): + """ + An individual file within a torrent. + """ + path: str + size: int def _pc(piece_string: bytes, *, length: int = 20, start: int = 0): """ - pieces a bytestring into pieces of specified length. - by default pieces into 20byte (160 bit) pieces - typically used to piece the hashlist contained within the torrent info's pieces key + Pieces a bytestring into pieces of specified length. :param piece_string: string to piece :param length: piece length - :return: generator expression yielding pieces of specified length + :return: generator expression yielding pieces """ - return (piece_string[0 + i:length + i] for i in range(start, len(piece_string), length)) + return (piece_string[0 + i:length + i] for i in + range(start, len(piece_string), length)) def _validate_torrent_dict(decoded_dict: OrderedDict) -> bool: """ - Verifies a given decoded dictionary contains valid keys to describe a torrent we can do something with. - Currently only checks for the minimum required torrent keys for torrents describing files and directories. + Verifies a given decoded dictionary contains valid keys. + + Currently only checks for the minimum required torrent keys. If a dictionary contains all valid keys + extra keys, it will be validated. :param decoded_dict: dict representing bencoded .torrent file @@ -57,26 +57,34 @@ def _validate_torrent_dict(decoded_dict: OrderedDict) -> bool: min_info_req_keys = [b"piece length", b"pieces", b"name"] min_files_req_keys = [b"length", b"path"] - logger.debug("Validating torrent metainfo dictionary {d}".format(d=decoded_dict)) + logger.debug( + "Validating torrent metainfo dictionary {d}".format(d=decoded_dict)) dict_keys = list(decoded_dict.keys()) if not dict_keys: - log_and_raise("No valid keys in dictionary.", logger, CreationError) + logger.error("No valid keys in dictionary.") + raise CreationError + for key in min_req_keys: if key not in dict_keys: - log_and_raise(f"Required key not found: {key}", logger, CreationError) + logger.error(f"Required key not found: {key}") + raise CreationError info_keys = list(decoded_dict[b"info"].keys()) if not info_keys: - log_and_raise("No valid keys in info dictionary.", logger, CreationError) + logger.error("No valid keys in info dictionary.") + raise CreationError + for key in min_info_req_keys: if key not in info_keys: - log_and_raise(f"Required key not found: {key}", logger, CreationError) + logger.error(f"Required key not found: {key}") + raise CreationError if len(decoded_dict[b"info"][b"pieces"]) % 20 != 0: - log_and_raise("Piece length not a multiple of 20.", logger, CreationError) + logger.error("Piece length not a multiple of 20.") + raise CreationError multiple_files = b"files" in info_keys @@ -84,19 +92,24 @@ def _validate_torrent_dict(decoded_dict: OrderedDict) -> bool: file_list = decoded_dict[b"info"][b"files"] if not file_list: - log_and_raise("No file list.", logger, CreationError) + logger.error("No file list.") + raise CreationError + for f in file_list: for key in min_files_req_keys: if key not in f.keys(): - log_and_raise(f"Required key not found: {key}", logger, CreationError) + logger.error(f"Required key not found: {key}") + raise CreationError else: if b"length" not in info_keys: - log_and_raise("Required key not found: b'length'", logger, CreationError) + logger.error("Required key not found: b'length'") + raise CreationError + # we made it! return True -class Torrent: +class MetaInfoFile: """ Wrapper around the torrent's metainfo. Doesn't include any download state. Torrents are created from files. @@ -106,17 +119,13 @@ class Torrent: """ def __init__(self): - """ - Creates the lightweight representation of the torrent's metainfo and validates it - """ - self.filename = None self.files = [] self.meta_info = None self.info_hash = None self.pieces = [] @classmethod - def from_file(cls, filename: str) -> "Torrent": + def from_file(cls, filename: str) -> "MetaInfoFile": """ Class method to create a torrent object from a .torrent metainfo file @@ -125,19 +134,21 @@ class Torrent: :return: Torrent instance """ torrent = cls() - torrent.filename = filename - if not os.path.exists(torrent.filename): - log_and_raise(f"Path does not exist {filename}", logger, CreationError) + if not os.path.exists(filename): + logger.error(f"Path does not exist {filename}") + raise CreationError try: - with open(torrent.filename, 'rb') as f: + with open(filename, 'rb') as f: data = f.read() torrent.meta_info = Decoder(data).decode() _validate_torrent_dict(torrent.meta_info) info = Encoder(torrent.meta_info[b"info"]).encode() torrent.info_hash = hashlib.sha1(info).digest() except (EncodeError, DecodeError, IOError) as e: + logger.error(f"Encountered error creating MetaInfoFile.") + logger.info(e, exc_info=True) raise CreationError from e torrent._gather_files() @@ -147,7 +158,8 @@ class Torrent: @classmethod def from_path(cls, path: str, trackers: list, *, - comment: str = "", piece_size: int = 16384, private: bool = False) -> "Torrent": + comment: str = "", piece_size: int = 16384, + private: bool = False) -> "MetaInfoFile": """ Class method to create a torrent object from a specified filepath. The path can be a single file or a directory @@ -169,38 +181,6 @@ class Torrent: :raises CreationError: """ raise NotImplementedError - # if not self.base_location: - # logger.error("Unable to create_torrent torrent. No base path specified. This is a programmer error.") - # raise CreationError - - # base_path = self.base_location - # left_in_piece = 0 - # next_pc = b"" - - ## how can I make this better? it'd be nice to have a generator that - ## abstracts away the file handling and just gives me the - ## sha1 digest of a self.piece_length chunk of the file - # for file_itm in self.files: - # with open(os.path.join(base_path, file_itm.path[0]), mode="rb") as f: - # current_pos = 0 - # if left_in_piece > 0: - # next_pc += f.read(left_in_piece) - # self.pieces.append(hashlib.sha1(next_pc).digest().decode("ISO-8859-1")) - # current_pos = left_in_piece - # next_pc = b"" - # left_in_piece = 0 - - # while True: - # if current_pos + self.piece_length <= file_itm.size: - # self.pieces.append(hashlib.sha1(f.read(self.piece_length)).digest().decode("ISO-8859-1")) - # current_pos += self.piece_length - # else: - # remainder_to_read = file_itm.size - current_pos - # if remainder_to_read < 0: - # break - # next_pc += f.read(remainder_to_read) - # left_in_piece = self.piece_length - remainder_to_read - # break @classmethod def from_path(cls, path: str, trackers: list, *, comment: str = "", @@ -217,37 +197,6 @@ class Torrent: :return: Torrent object """ raise NotImplementedError - # files = [] - - # if not os.path.exists(path): - # logger.error("Path does not exist {path}".format(path=path)) - # raise CreationError - - ## gather files - # if os.path.isfile(path): - # base_path = os.path.dirname(path) - # name = os.path.basename(path) - # size = os.path.getsize(path) - # files.append(FileItem(name, size)) - # elif os.path.isdir(path): - # base_path = path - # name = os.path.basename(path) - - # # os.listdir returns paths in arbitrary order - possible danger here - # for f in os.listdir(path): - # size = os.path.getsize(os.path.join(path, f)) - # fi = FileItem(f, size) - # fi.path = [fi.path] - # files.append(fi) - # else: - # logger.error("Error creating Torrent instance. Invalid file keys in metainfo dictionary.") - # raise CreationError - - # logger.debug("Creating Torrent instance from path {path}".format(path=path)) - # torrent = cls(trackers, files, name, location=base_path, comment=comment, private=private, - # piece_length=piece_size) - # logger.debug("Created Torrent instance from path {path} {torrent}".format(path=path, torrent=torrent.info_hash)) - # return torrent def to_file(self, output_filename: str): """ @@ -257,13 +206,16 @@ class Torrent: :raises CreationError: """ if not output_filename: - log_and_raise("Torrent must have an output filename.", logger, CreationError) + logger.error("No output filename provided.") + raise CreationError with open(output_filename, 'wb+') as f: try: data = Encoder(self.meta_info).encode() f.write(data) except EncodeError as ee: + logger.error("Unable to write metainfo file {output_filename}") + logger.info(ee, exc_info=True) raise CreationError from ee logger.debug(f"Wrote .torrent file: {output_filename}") @@ -272,7 +224,7 @@ class Torrent: """ Gathers the files located in the torrent """ - # TODO: filepaths are a list containing string elements that represent the path and filename + # TODO: filepaths are a list containing string elements if b"files" in self.meta_info[b"info"]: for f in self.meta_info[b"info"][b"files"]: path = None @@ -284,19 +236,23 @@ class Torrent: else: self.files.append( - FileItem(self.meta_info[b"info"][b"name"].decode("UTF-8"), self.meta_info[b"info"][b"length"])) + FileItem(self.meta_info[b"info"][b"name"].decode("UTF-8"), + self.meta_info[b"info"][b"length"])) @property def multi_file(self) -> bool: """ TODO: proper handling of multi-file torrents. - For a single file torrent, the meta_info["info"]["name"] is the torrent's content's file basename and - meta_info["info"]["length"] is its size + For a single file torrent, + the meta_info["info"]["name"] is the torrent's + content's file basename and meta_info["info"]["length"] is its size - For multiple file torrents, the meta_info["info"]["name"] is the torrent's content's directory name and - meta_info["info"]["files"] contains the content's file basename - meta_info["info"]["files"]["length"] is the file's size - meta_info["info"]["length"] doesn't contribute anything here + For multiple file torrents, + the meta_info["info"]["name"] is the torrent's + content's directory name and + meta_info["info"]["files"] contains the content's file basename + meta_info["info"]["files"]["length"] is the file's size + meta_info["info"]["length"] doesn't contribute anything here """ return b"files" in self.meta_info[b"info"] @@ -304,8 +260,8 @@ class Torrent: def announce_urls(self) -> list: """ The announce URL of the tracker. - According to BEP 0012 (http://bittorrent.org/beps/bep_0012.html), if announce-list is present, it is used - instead of announce. + According to BEP 0012 (http://bittorrent.org/beps/bep_0012.html), + if announce-list is present, it is used instead of announce. :return: a list of announce URLs for the tracker """ urls = [] @@ -371,14 +327,13 @@ class Torrent: @property def name(self) -> int: """ - :return: the torrent's name; either the single filename or the directory name. + :return: the torrent's name; either the single filename or the directory + name. """ return self.meta_info[b"info"][b"name"].decode("UTF-8") def __str__(self): - """ - Returns a readable string representing the torrent + return f"{self.name}:{self.info_hash}" - :return: readable string of data - """ - return "<Torrent object: {name} : {info_hash}>{".format(name=self.name, info_hash=self.info_hash) + def __repr__(self): + return f"<Torrent: {self.name}:{self.info_hash}" diff --git a/opalescence/btlib/protocol/peer.py b/opalescence/btlib/protocol/peer.py index f618ca2..ba4d966 100644 --- a/opalescence/btlib/protocol/peer.py +++ b/opalescence/btlib/protocol/peer.py @@ -7,12 +7,9 @@ The coordination with peers is handled in ../client.py No data is currently sent to the remote protocol. """ -import asyncio import logging -from opalescence.btlib import log_and_raise -from .messages import Handshake, KeepAlive, Choke, Unchoke, Interested, NotInterested, Have, Bitfield, \ - Request, Block, Cancel, MessageReader +from .messages import * logger = logging.getLogger(__name__) @@ -113,7 +110,8 @@ class Peer: else: message = self.requester.next_request(self.peer_id) if not message: - logger.debug(f"{self}: No requests available. Closing connection.") + logger.debug( + f"{self}: No requests available. Closing connection.") self.cancel() return @@ -126,12 +124,9 @@ class Peer: logger.debug( f"Cancelling piece {message.index}:{message.begin}:{message.length} from {self}") - # TODO: Narrow down exceptions that are safely consumed - # Eat exceptions here so we'll move to the next protocol. - # We'll eventually try this protocol again anyway if the number of peers is low - except Exception as e: - logger.debug(f"{self}: Unable to open connection.\n{e}") - raise PeerError from e + except OSError as oe: + logger.debug(f"{self}: Exception with connection.\n{oe}") + raise PeerError from oe async def handshake(self) -> bytes: """ @@ -149,14 +144,14 @@ class Peer: while len(data) < Handshake.msg_len: data = await self.reader.read(MessageReader.CHUNK_SIZE) if not data: - log_and_raise(f"{self}: Unable to initiate handshake", logger, - PeerError) + logger.error(f"{self}: Unable to initiate handshake") + raise PeerError rcvd = Handshake.decode(data[:Handshake.msg_len]) if rcvd.info_hash != self.info_hash: - log_and_raise(f"{self}: Incorrect info hash received.", logger, - PeerError) + logger.error(f"{self}: Incorrect info hash received.") + raise PeerError logger.debug(f"{self}: Successfully negotiated handshake.") return data[Handshake.msg_len:] diff --git a/opalescence/btlib/protocol/piece_handler.py b/opalescence/btlib/protocol/piece_handler.py index 986f206..4ac0446 100644 --- a/opalescence/btlib/protocol/piece_handler.py +++ b/opalescence/btlib/protocol/piece_handler.py @@ -12,8 +12,8 @@ from typing import Union, Dict, List import bitstring as bitstring -from .messages import Request, Block, Piece, Cancel -from ..torrent import Torrent +from .messages import Request, Block, Piece +from ..metainfo import MetaInfoFile logger = logging.getLogger(__name__) @@ -24,7 +24,7 @@ class Writer: Will eventually flush data to the disk. """ - def __init__(self, torrent: Torrent): + def __init__(self, torrent: MetaInfoFile): self.filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), torrent.name) self.piece_length = torrent.piece_length self.buffer = io.BytesIO() @@ -54,7 +54,7 @@ class Requester: We currently use a naive sequential strategy. """ - def __init__(self, torrent: Torrent): + def __init__(self, torrent: MetaInfoFile): self.torrent = torrent self.piece_length = torrent.piece_length self.piece_writer = Writer(torrent) @@ -62,7 +62,6 @@ class Requester: self.downloaded_pieces: Dict(int, Piece) = {} self.downloading_pieces: Dict(int, Union(Piece, None)) = {i: None for i in range(len(self.torrent.pieces))} self.pending_requests: List(Request) = [] - self.cancelling_requests: List(Cancel) = [] def add_available_piece(self, peer_id: str, index: int) -> None: """ @@ -108,7 +107,6 @@ class Requester: r = Request(block.index, block.begin) if r in self.pending_requests: index = self.pending_requests.index(r) - self.cancelling_requests.append(self.pending_requests[index]) del self.pending_requests[index] piece = self.downloading_pieces.get(block.index) @@ -183,13 +181,6 @@ class Requester: :param peer_id: The remote peer who's asking for a new request's id :return: A new request, or None if that isn't possible. """ - # First, check if we need to cancel any requests to the peer - indices = [self.cancelling_requests.index(r) for r in self.cancelling_requests if r.peer_id == peer_id] - if indices: - r = self.cancelling_requests[indices[0]] - del self.cancelling_requests[indices[0]] - return Cancel.from_request(r) - # Find the next piece index for which the peer has an available piece piece_index = self._next_piece_index_for_peer(peer_id) if piece_index is None: diff --git a/opalescence/btlib/tracker.py b/opalescence/btlib/tracker.py index 6a0ea8e..5d20348 100644 --- a/opalescence/btlib/tracker.py +++ b/opalescence/btlib/tracker.py @@ -6,17 +6,16 @@ Support for communication with an external tracker. import asyncio import logging -import random import socket import struct -from typing import Union +from random import randint +from typing import Union, Optional from urllib.parse import urlencode import aiohttp from opalescence.btlib import bencode -from . import log_and_raise -from .torrent import Torrent +from .metainfo import MetaInfoFile logger = logging.getLogger(__name__) @@ -31,7 +30,8 @@ class TrackerError(Exception): class Tracker: """ Communication with the tracker. - Does not currently support the announce-list extension from BEP 0012: http://bittorrent.org/beps/bep_0012.html + Does not currently support the announce-list extension from + BEP 0012: http://bittorrent.org/beps/bep_0012.html Does not support the scrape convention. """ @@ -39,10 +39,11 @@ class Tracker: # TODO: implement scrape convention support. DEFAULT_INTERVAL = 60 # 1 minute - def __init__(self, torrent: Torrent): + def __init__(self, torrent: MetaInfoFile): self.torrent = torrent self.http_client = aiohttp.ClientSession(loop=asyncio.get_event_loop()) - self.peer_id = ("-OP0001-" + ''.join([str(random.randint(0, 9)) for _ in range(12)])).encode("UTF-8") + self.peer_id = ("-OP0001-" + ''.join(str(randint(0, 9)) for _ in + range(12))).encode("UTF-8") self.tracker_id = None self.port = 6881 self.uploaded = 0 @@ -54,31 +55,37 @@ class Tracker: """ Makes an announce request to the tracker. - :raises TrackerError: if the tracker's HTTP code is not 200, the tracker sent a failure, or we + :raises TrackerError: if the tracker's HTTP code is not 200, + the tracker sent a failure, or we are unable to bdecode the tracker's response. :returns: Response object representing the tracker's response """ url = self._make_url() - decoded_data = None - logger.debug(f"Making {self.event} announce to: {url}") async with self.http_client.get(url) as r: data = await r.read() if r.status != 200: - log_and_raise(f"Unable to connect to the tracker.\n{data}", logger, TrackerError) + logger.error(f"{url}: Unable to connect to tracker.") + raise TrackerError - try: - decoded_data = bencode.Decoder(data).decode() - except bencode.DecodeError as e: - log_and_raise(f"Unable to decode tracker response.\n{data}", logger, TrackerError, e) + try: + decoded_data = bencode.Decoder(data).decode() + except bencode.DecodeError as e: + logger.error(f"{url}: Unable to decode tracker response.") + logger.info(e, exc_info=True) + raise TrackerError - tr = Response(decoded_data) - if tr.failed: - log_and_raise(f"Failed announce call to tracker {url}\n{tr.failure_reason}", logger, TrackerError) + tr = Response(decoded_data) + if tr.failed: + logger.error(f"{url}: Failed announce call to tracker.") + raise TrackerError - if self.event: - self.event = "" - return Response(decoded_data) + logger.debug(f"Made {self.event} announce to: {url}") + + if self.event: + self.event = "" + + return Response(decoded_data) async def cancel(self) -> None: """ @@ -87,7 +94,6 @@ class Tracker: """ self.event = "stopped" await self.announce() - return async def completed(self) -> None: """ @@ -96,7 +102,6 @@ class Tracker: """ self.event = "completed" await self.announce() - return def _make_url(self) -> str: """ @@ -104,14 +109,15 @@ class Tracker: Currently only uses the announce key :raises TrackerError: - :return: tracker's announce url with correctly escaped and encoded parameters + :return: tracker's announce url with urlencoded parameters """ # TODO: implement proper announce-list handling - return self.torrent.meta_info[b"announce"].decode("UTF-8") + "?" + urlencode(self._make_params()) + return self.torrent.meta_info[b"announce"].decode("UTF-8") + \ + "?" + urlencode(self._make_params()) def _make_params(self) -> dict: """ - Builds the parameter dictionary the tracker expects for announce requests. + Builds the parameters the tracker expects for announce requests. :return: dictionary of properly encoded parameters """ @@ -161,12 +167,12 @@ class Response: @property def min_interval(self) -> int: """ - :return: the minimum interval, if specified we can't make requests more frequently than this + :return: the minimum interval """ return self.data.get(b"min interval", 0) @property - def tracker_id(self) -> Union[str, None]: # or maybe bytes? + def tracker_id(self) -> Optional[str]: # or maybe bytes? """ :return: the tracker id """ @@ -190,10 +196,11 @@ class Response: return self.data.get(b"incomplete", 0) @property - def peers(self) -> Union[list, None]: + def peers(self) -> Optional[list]: """ :raises TrackerError: - :return: the list of peers. The response can be given as a list of dictionaries about the peers, or a string + :return: the list of peers. The response can be given as a + list of dictionaries about the peers, or a string encoding the ip address and ports for the peers """ peers = self.data.get(b"peers") @@ -202,11 +209,15 @@ class Response: return if isinstance(peers, bytes): - logger.debug("Decoding binary model peers.") split_peers = [peers[i:i + 6] for i in range(0, len(peers), 6)] - return [(socket.inet_ntoa(p[:4]), struct.unpack(">H", p[4:])[0]) for p in split_peers] + p = [(socket.inet_ntoa(p[:4]), struct.unpack(">H", p[4:])[0]) for + p in split_peers] + logger.debug("Decoded binary model peers.") + return p elif isinstance(peers, list): - logger.debug("Decoding dictionary model peers.") - return [(p[b"ip"].decode("UTF-8"), p[b"port"]) for p in peers] + p = [(p[b"ip"].decode("UTF-8"), p[b"port"]) for p in peers] + logger.debug("Decoded dictionary model peers.") + return p else: - log_and_raise(f"Unable to decode peers {peers}", logger, TrackerError) + logger.error(f"Unable to decode peers {peers}") + raise TrackerError diff --git a/opalescence/ui/__init__.py b/opalescence/ui/__init__.py new file mode 100644 index 0000000..7e97c83 --- /dev/null +++ b/opalescence/ui/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +""" +The UI for opalescence is implemented in this package. +Currently, only a cli is provided. +""" diff --git a/opalescence/ui/cli.py b/opalescence/ui/cli.py new file mode 100644 index 0000000..93e11ab --- /dev/null +++ b/opalescence/ui/cli.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Command Line Interface for Opalescence (Clifo) +""" + +import argparse +import asyncio +import logging +import logging.config +import os +import unittest + +import opalescence +from ..btlib.client import Client +from ..btlib.metainfo import MetaInfoFile + +_LoggingConfig = { + "version": 1, + "formatters": { + "basic": { + "format": "%(asctime)s : %(name)s : [%(levelname)s] %(message)s" + } + }, + "handlers": { + "stdout": { + "class": "logging.StreamHandler", + "level": "DEBUG", + "formatter": "basic", + "stream": "ext://sys.stdout" + + } + }, + "loggers": { + "opalescence": { + "level": "DEBUG", + "handlers": ["stdout"] + } + }, + "root": { + "level": "DEBUG", + "handlers": ["stdout"] + } +} + +logger = None + + +def main(): + """ + CLI entry point + """ + global logger + argparser = create_argparser() + + try: + args = argparser.parse_args() + _LoggingConfig["root"]["level"] = args.loglevel + logging.config.dictConfig(_LoggingConfig) + logger = logging.getLogger("opalescence") + args.func(args) + except AttributeError: + argparser.print_help() + + +def create_argparser() -> argparse.ArgumentParser: + """ + Initializes the root argument parser and any necessary + subparsers for supported subcommands. + :return: argparse.ArgumentParser instance + """ + parser = argparse.ArgumentParser() + parser.add_argument("--version", action="version", + version=opalescence.__version__) + parser.add_argument("-d", "--debug", help="Print debug-level output.", + action="store_const", dest="loglevel", + const=logging.DEBUG, default=logging.WARNING) + parser.add_argument("-v", "--verbose", help="Print verbose output (but " + "still less verbose than " + "debug-level.", + action="store_const", dest="loglevel", + const=logging.INFO) + + subparsers = parser.add_subparsers() + test_parser = subparsers.add_parser("test", help="Run the test suite") + test_parser.set_defaults(func=test) + download_parser = subparsers.add_parser("download", + help="Download a .torrent file.") + download_parser.add_argument('torrent_file', + help="Path to the .torrent file to download.") + download_parser.add_argument('destination', + help="File destination path.") + download_parser.set_defaults(func=download) + return parser + + +def test(_) -> None: + """ + Runs the test suite found in the tests/ directory + :param _: unused + """ + logger.info(f"Running the test suite on the files in development.") + + loader = unittest.defaultTestLoader() + runner = unittest.TextTestRunner() + suite = loader.discover( + os.path.abspath(os.path.join(os.path.dirname(__file__), "tests"))) + runner.run(suite) + + +def download(file_path) -> None: + """ + Downloads a .torrent file + :param file_path: .torrent filepath argparse.Namespace object + """ + logger.info(f"Downloading {file_path.torrent_file} to " + f"{file_path.destination}") + + loop = asyncio.get_event_loop() + loop.set_debug(True) + torrent = MetaInfoFile.from_file(file_path.torrent_file) + client = Client() + client.download(torrent) + + try: + loop.run_forever() + except asyncio.CancelledError: + logger.warning("Event loop was cancelled") + except KeyboardInterrupt: + logger.warning("Keyboard Interrupt received.") + finally: + loop.close() diff --git a/opl.py b/opl.py new file mode 100644 index 0000000..28c2e3a --- /dev/null +++ b/opl.py @@ -0,0 +1,10 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Opalescence is a simple torrent client written using Python3.6. +""" +from opalescence.ui import cli + +if __name__ == "__main__": + cli.main() diff --git a/setup.py b/setup.py index e552900..52ee3fb 100644 --- a/setup.py +++ b/setup.py @@ -4,31 +4,26 @@ """ setuptools script for opalescence """ - from setuptools import setup +import opalescence + with open("README.md") as readme_file: readme = readme_file.read() -with open("VERSION") as version_file: - version = version_file.read() - requirements = [ - "requests", 'aiohttp', 'bitstring' + "requests", "aiohttp", "bitstring" ] setup( name="opalescence", - version=version, - description="Torrent client offering basic functionality.", + version=opalescence.__version__, + description="A torrent client written using Python 3.6 and asyncio", long_description=readme, author="brian houston morrow", author_email="[email protected]", url="https://github.com/killerbat00/opalescence", - packages=[ - "opalescence" - ], - package_dir={"opalescence": "opalescence"}, + packages=["opalescence"], install_requires=requirements, license="MIT license", zip_safe=False, @@ -39,4 +34,5 @@ setup( "Programming Language :: Python :: 3.6" ], test_suite="tests", + include_package_data=True, )
Get rid of the log_and_raise antipattern Previously, I handled logging and raising events through a utility function, log_and_raise. This really just makes it less clear where in the code an exception might be raised.
killerbat00/opalescence
diff --git a/tests/context.py b/tests/context.py index fc82054..16de67c 100644 --- a/tests/context.py +++ b/tests/context.py @@ -12,7 +12,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..') # noinspection PyUnresolvedReferences from opalescence.btlib import bencode # noinspection PyUnresolvedReferences -from opalescence.btlib import torrent +from opalescence.btlib import metainfo # noinspection PyUnresolvedReferences from opalescence.btlib import tracker # noinspection PyUnresolvedReferences diff --git a/tests/test_peer.py b/tests/test_peer.py index 9d458e3..a7604da 100644 --- a/tests/test_peer.py +++ b/tests/test_peer.py @@ -9,7 +9,7 @@ from unittest import TestCase from requests import get import opalescence.btlib.protocol.peer -from tests.context import torrent, tracker +from tests.context import metainfo, tracker from tests.utils import async_run @@ -33,7 +33,7 @@ class TestPeer(TestCase): file_data = r.content with open(cls.external_torrent_path, "wb+") as f: f.write(file_data) - cls.torrent = torrent.Torrent.from_file(cls.external_torrent_path) + cls.torrent = metainfo.MetaInfoFile.from_file(cls.external_torrent_path) cls.tracker = tracker.Tracker(cls.torrent) @classmethod diff --git a/tests/test_torrent.py b/tests/test_torrent.py index 781b90f..01d23fd 100644 --- a/tests/test_torrent.py +++ b/tests/test_torrent.py @@ -12,7 +12,7 @@ from unittest import TestCase from requests import get -from tests.context import torrent, bencode +from tests.context import metainfo, bencode class TestTorrent(TestCase): @@ -41,15 +41,17 @@ class TestTorrent(TestCase): """ invalid_path = "Doesn't exist" with self.subTest(msg="Invalid path"): - with self.assertRaises(torrent.CreationError): - torrent.Torrent.from_file(invalid_path) + with self.assertRaises(metainfo.CreationError): + metainfo.MetaInfoFile.from_file(invalid_path) def test_valid_path(self): """ Test that we get a torrent object from a valid path. """ with self.subTest(msg="Valid path"): - self.assertIsInstance(torrent.Torrent.from_file(self.external_torrent_path), torrent.Torrent) + self.assertIsInstance( + metainfo.MetaInfoFile.from_file(self.external_torrent_path), + metainfo.MetaInfoFile) def test_invalid_torrent_metainfo(self): """ @@ -64,8 +66,8 @@ class TestTorrent(TestCase): f.truncate(file_size // 2) # the metainfo dictionary is entirely corrupted now, so we should expect a CreationError - with self.assertRaises(torrent.CreationError): - torrent.Torrent.from_file(copy_file_name) + with self.assertRaises(metainfo.CreationError): + metainfo.MetaInfoFile.from_file(copy_file_name) os.remove(copy_file_name) @@ -73,7 +75,8 @@ class TestTorrent(TestCase): """ Test that we gathered files appropriately. """ - external_torrent = torrent.Torrent.from_file(self.external_torrent_path) + external_torrent = metainfo.MetaInfoFile.from_file( + self.external_torrent_path) filename = ".".join(os.path.basename(self.external_torrent_path).split(".")[:-1]) for f in external_torrent.files: self.assertEqual(f.path, filename) @@ -83,7 +86,7 @@ class TestTorrent(TestCase): Tests the properties of the torrent metainfo file. """ announce_urls = [["http://torrent.ubuntu.com:6969/announce"], ["http://ipv6.torrent.ubuntu.com:6969/announce"]] - t = torrent.Torrent.from_file(self.external_torrent_path) + t = metainfo.MetaInfoFile.from_file(self.external_torrent_path) for f in announce_urls: self.assertIn(f, t.announce_urls) comment = "Ubuntu CD releases.ubuntu.com" @@ -101,7 +104,7 @@ class TestTorrent(TestCase): Tests that the torrent's info hash property returns the correct info hash. """ infohash_digest = b"\xdaw^J\xafV5\xefrX:9\x19w\xe5\xedo\x14a~" - t = torrent.Torrent.from_file(self.external_torrent_path) + t = metainfo.MetaInfoFile.from_file(self.external_torrent_path) self.assertEqual(infohash_digest, t.info_hash) def test_decode_recode_compare(self): @@ -129,7 +132,8 @@ class TestTorrent(TestCase): Tests that we can open an externally created .torrent file, decode it, create a torrent instance, then rewrite it into another file. The resulting two files should be equal. """ - external_torrent = torrent.Torrent.from_file(self.external_torrent_path) + external_torrent = metainfo.MetaInfoFile.from_file( + self.external_torrent_path) file_copy = os.path.abspath(os.path.join(os.path.dirname(__file__), "copy.torrent")) external_torrent.to_file(file_copy) self.assertTrue(cmp(self.external_torrent_path, file_copy)) @@ -140,11 +144,13 @@ class TestTorrent(TestCase): Decodes a torrent file created using an external program, reencodes that file to a .torrent, decodes the resulting torrent and compares its dictionary with the original decoded dictionary. """ - external_torrent = torrent.Torrent.from_file(self.external_torrent_path) + external_torrent = metainfo.MetaInfoFile.from_file( + self.external_torrent_path) original_data = external_torrent.meta_info temp_output_filename = os.path.abspath(os.path.join(os.path.dirname(__file__), "copy.torrent")) external_torrent.to_file(temp_output_filename) - new_data = torrent.Torrent.from_file(temp_output_filename).meta_info + new_data = metainfo.MetaInfoFile.from_file( + temp_output_filename).meta_info self.assertEqual(original_data, new_data) os.remove(temp_output_filename) @@ -172,5 +178,5 @@ class TestTorrent(TestCase): invalid_file_list] for b in bad_data: with self.subTest(b=b): - with self.assertRaises(torrent.CreationError): - torrent._validate_torrent_dict(b) + with self.assertRaises(metainfo.CreationError): + metainfo._validate_torrent_dict(b) diff --git a/tests/test_tracker.py b/tests/test_tracker.py index 87febe2..a2da6cc 100644 --- a/tests/test_tracker.py +++ b/tests/test_tracker.py @@ -12,7 +12,7 @@ from urllib.parse import urlencode from requests import get -from tests.context import torrent +from tests.context import metainfo from tests.context import tracker from tests.utils import async_run, create_async_mock @@ -36,7 +36,7 @@ class TestTracker(TestCase): file_data = r.content with open(cls.external_torrent_path, "wb+") as f: f.write(file_data) - cls.torrent = torrent.Torrent.from_file(cls.external_torrent_path) + cls.torrent = metainfo.MetaInfoFile.from_file(cls.external_torrent_path) def test_creation(self): """
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_added_files", "has_removed_files", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 3, "test_score": 2 }, "num_modified_files": 12 }
0.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiohappyeyeballs==2.6.1 aiohttp==3.11.14 aiosignal==1.3.2 async-timeout==5.0.1 attrs==25.3.0 bitarray==3.3.0 bitstring==4.3.1 certifi==2025.1.31 charset-normalizer==3.4.1 exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work frozenlist==1.5.0 idna==3.10 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work multidict==6.2.0 -e git+https://github.com/killerbat00/opalescence.git@97124cb717d4258fe5fea7dcc088844ea9348b5e#egg=opalescence packaging @ file:///croot/packaging_1734472117206/work pluggy @ file:///croot/pluggy_1733169602837/work propcache==0.3.1 pytest @ file:///croot/pytest_1738938843180/work requests==2.32.3 tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work typing_extensions==4.13.0 urllib3==2.3.0 yarl==1.18.3
name: opalescence channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - exceptiongroup=1.2.0=py39h06a4308_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - packaging=24.2=py39h06a4308_0 - pip=25.0=py39h06a4308_0 - pluggy=1.5.0=py39h06a4308_0 - pytest=8.3.4=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tomli=2.0.1=py39h06a4308_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiohappyeyeballs==2.6.1 - aiohttp==3.11.14 - aiosignal==1.3.2 - async-timeout==5.0.1 - attrs==25.3.0 - bitarray==3.3.0 - bitstring==4.3.1 - certifi==2025.1.31 - charset-normalizer==3.4.1 - frozenlist==1.5.0 - idna==3.10 - multidict==6.2.0 - propcache==0.3.1 - requests==2.32.3 - typing-extensions==4.13.0 - urllib3==2.3.0 - yarl==1.18.3 prefix: /opt/conda/envs/opalescence
[ "tests/test_torrent.py::TestTorrent::test__validate_torrent_dict", "tests/test_torrent.py::TestTorrent::test_invalid_path", "tests/test_tracker.py::TestResponse::test_creation", "tests/test_tracker.py::TestResponse::test_failure", "tests/test_tracker.py::TestResponse::test_peer_dict", "tests/test_tracker.py::TestResponse::test_peer_string" ]
[ "tests/test_torrent.py::TestTorrent::test__gather_files", "tests/test_torrent.py::TestTorrent::test_decode_recode_compare", "tests/test_torrent.py::TestTorrent::test_decode_recode_decode_compare", "tests/test_torrent.py::TestTorrent::test_info_hash", "tests/test_torrent.py::TestTorrent::test_invalid_torrent_metainfo", "tests/test_torrent.py::TestTorrent::test_open_file_rewrite", "tests/test_torrent.py::TestTorrent::test_properties", "tests/test_torrent.py::TestTorrent::test_valid_path" ]
[]
[]
MIT License
1,226
[ "config/opalescence.ini", "MANIFEST.in", "VERSION", "opalescence/btlib/__init__.py", ".gitignore", "config.ini", "opl.py", "opalescence/btlib/torrent.py", "opalescence/__init__.py", "opalescence/btlib/client.py", "opalescence/btlib/protocol/piece_handler.py", "setup.py", "opalescence/ui/cli.py", ".editorconfig", "opalescence/btlib/tracker.py", "README.md", "opalescence/ui/__init__.py", "main.py", "config/logging.ini", "opalescence/btlib/bencode.py", "opalescence/btlib/protocol/peer.py" ]
[ "config/opalescence.ini", "MANIFEST.in", "VERSION", "opalescence/btlib/__init__.py", ".gitignore", "config.ini", "opl.py", "opalescence/__init__.py", "opalescence/btlib/client.py", "opalescence/btlib/protocol/piece_handler.py", "opalescence/btlib/metainfo.py", "setup.py", "opalescence/ui/cli.py", ".editorconfig", "opalescence/btlib/tracker.py", "README.md", "opalescence/ui/__init__.py", "main.py", "config/logging.ini", "opalescence/btlib/bencode.py", "opalescence/btlib/protocol/peer.py" ]
Azure__azure-cli-3164
0c5e91ca52cf0ed5f9284968dd3272275020ce89
2017-05-04 19:54:32
eb12ac454cbe1ddb59c86cdf2045e1912660e750
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=h1) Report > Merging [#3164](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/0c5e91ca52cf0ed5f9284968dd3272275020ce89?src=pr&el=desc) will **increase** coverage by `<.01%`. > The diff coverage is `92.59%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/3164/graphs/tree.svg?width=650&height=150&src=pr&token=2pog0TKvF8)](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #3164 +/- ## ========================================== + Coverage 71.11% 71.12% +<.01% ========================================== Files 362 362 Lines 23914 23929 +15 Branches 3653 3658 +5 ========================================== + Hits 17006 17019 +13 Misses 5812 5812 - Partials 1096 1098 +2 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/azure-cli-core/azure/cli/core/\_profile.py](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL19wcm9maWxlLnB5) | `87.64% <92.59%> (-0.04%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=footer). Last update [0c5e91c...d097884](https://codecov.io/gh/Azure/azure-cli/pull/3164?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/src/azure-cli-core/HISTORY.rst b/src/azure-cli-core/HISTORY.rst index 0db20c494..49f585169 100644 --- a/src/azure-cli-core/HISTORY.rst +++ b/src/azure-cli-core/HISTORY.rst @@ -6,6 +6,7 @@ Release History ^^^^^^^^^^^^^^^^^^ * core: capture exceptions caused by unregistered provider and auto-register it * login: avoid the bad exception when the user account has no subscription and no tenants +* perf: persist adal token cache in memory till process exits (#2603) 2.0.4 (2017-04-28) ^^^^^^^^^^^^^^^^^^ diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index b5a6c77a6..4cae579da 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -93,11 +93,20 @@ class CredentialType(Enum): # pylint: disable=too-few-public-methods rbac = CLOUD.endpoints.active_directory_graph_resource_id +_GLOBAL_CREDS_CACHE = None + + class Profile(object): - def __init__(self, storage=None, auth_ctx_factory=None): + def __init__(self, storage=None, auth_ctx_factory=None, use_global_creds_cache=True): self._storage = storage or ACCOUNT self.auth_ctx_factory = auth_ctx_factory or _AUTH_CTX_FACTORY - self._creds_cache = CredsCache(self.auth_ctx_factory) + if use_global_creds_cache: + global _GLOBAL_CREDS_CACHE # pylint: disable=global-statement + if _GLOBAL_CREDS_CACHE is None: + _GLOBAL_CREDS_CACHE = CredsCache(self.auth_ctx_factory, async_persist=True) + self._creds_cache = _GLOBAL_CREDS_CACHE + else: + self._creds_cache = CredsCache(self.auth_ctx_factory, async_persist=False) self._management_resource_uri = CLOUD.endpoints.management self._ad_resource_uri = CLOUD.endpoints.active_directory_resource_id @@ -470,29 +479,39 @@ class CredsCache(object): also be handled ''' - def __init__(self, auth_ctx_factory=None): + def __init__(self, auth_ctx_factory=None, async_persist=True): # AZURE_ACCESS_TOKEN_FILE is used by Cloud Console and not meant to be user configured self._token_file = (os.environ.get('AZURE_ACCESS_TOKEN_FILE', None) or os.path.join(get_config_dir(), 'accessTokens.json')) self._service_principal_creds = [] self._auth_ctx_factory = auth_ctx_factory or _AUTH_CTX_FACTORY self._adal_token_cache_attr = None + self._should_flush_to_disk = False + self._async_persist = async_persist + if async_persist: + import atexit + atexit.register(self.flush_to_disk) def persist_cached_creds(self): - with os.fdopen(os.open(self._token_file, os.O_RDWR | os.O_CREAT | os.O_TRUNC, 0o600), - 'w+') as cred_file: - items = self.adal_token_cache.read_items() - all_creds = [entry for _, entry in items] + self._should_flush_to_disk = True + if not self._async_persist: + self.flush_to_disk() + self.adal_token_cache.has_state_changed = False - # trim away useless fields (needed for cred sharing with xplat) - for i in all_creds: - for key in TOKEN_FIELDS_EXCLUDED_FROM_PERSISTENCE: - i.pop(key, None) + def flush_to_disk(self): + if self._should_flush_to_disk: + with os.fdopen(os.open(self._token_file, os.O_RDWR | os.O_CREAT | os.O_TRUNC, 0o600), + 'w+') as cred_file: + items = self.adal_token_cache.read_items() + all_creds = [entry for _, entry in items] - all_creds.extend(self._service_principal_creds) - cred_file.write(json.dumps(all_creds)) + # trim away useless fields (needed for cred sharing with xplat) + for i in all_creds: + for key in TOKEN_FIELDS_EXCLUDED_FROM_PERSISTENCE: + i.pop(key, None) - self.adal_token_cache.has_state_changed = False + all_creds.extend(self._service_principal_creds) + cred_file.write(json.dumps(all_creds)) def retrieve_token_for_user(self, username, tenant, resource): authority = get_authority_url(tenant)
auth: cache adal token cache in memory The goal is to use a single copy of token cache across the same process, rather dump it after getting a token. Building up a token cache is non trivial involving reading and writing the ~/.azure/accesstoken.json. For some commands which involves 1000+ rest call, like datalake, the perf hit is not trivial.
Azure/azure-cli
diff --git a/src/azure-cli-core/tests/test_profile.py b/src/azure-cli-core/tests/test_profile.py index 6f25f61de..ea3648494 100644 --- a/src/azure-cli-core/tests/test_profile.py +++ b/src/azure-cli-core/tests/test_profile.py @@ -76,7 +76,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_update_add_two_different_subscriptions(self): storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) # add the first and verify consolidated = Profile._normalize_properties(self.user1, @@ -127,7 +127,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_update_with_same_subscription_added_twice(self): storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) # add one twice and verify we will have one but with new token consolidated = Profile._normalize_properties(self.user1, @@ -149,7 +149,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_set_active_subscription(self): storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], @@ -169,7 +169,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_default_active_subscription_to_non_disabled_one(self): storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) subscriptions = profile._normalize_properties( self.user2, [self.subscription2, self.subscription1], False) @@ -182,7 +182,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_get_subscription(self): storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], @@ -200,7 +200,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_get_expanded_subscription_info(self): storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], @@ -236,7 +236,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method lambda _: mock_arm_client) storage_mock = {'subscriptions': []} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) profile._management_resource_uri = 'https://management.core.windows.net/' profile.find_subscriptions_on_login(False, '1234', @@ -264,7 +264,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method lambda _: mock_arm_client) storage_mock = {'subscriptions': []} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) profile._management_resource_uri = 'https://management.core.windows.net/' # action @@ -288,7 +288,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method finder = mock.MagicMock() finder.find_through_interactive_flow.return_value = [] storage_mock = {'subscriptions': []} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) # action result = profile.find_subscriptions_on_login(True, @@ -308,7 +308,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_read_cred_file.return_value = [Test_Profile.token_entry1] storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], False) @@ -322,7 +322,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method @mock.patch('azure.cli.core._profile._load_tokens_from_file', return_value=None) def test_create_token_cache(self, mock_read_file): mock_read_file.return_value = [] - profile = Profile() + profile = Profile(use_global_creds_cache=False) cache = profile._creds_cache.adal_token_cache self.assertFalse(cache.read_items()) self.assertTrue(mock_read_file.called) @@ -330,7 +330,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method @mock.patch('azure.cli.core._profile._load_tokens_from_file', autospec=True) def test_load_cached_tokens(self, mock_read_file): mock_read_file.return_value = [Test_Profile.token_entry1] - profile = Profile() + profile = Profile(use_global_creds_cache=False) cache = profile._creds_cache.adal_token_cache matched = cache.find({ "_authority": "https://login.microsoftonline.com/common", @@ -348,7 +348,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_get_token.return_value = (some_token_type, Test_Profile.raw_token1) # setup storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], False) @@ -375,7 +375,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_get_token.return_value = (some_token_type, Test_Profile.raw_token1) # setup storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], False) profile._set_subscriptions(consolidated) @@ -395,7 +395,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_read_cred_file.return_value = [Test_Profile.token_entry1] storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], False) @@ -413,7 +413,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method def test_logout_all(self, mock_delete_cred_file): # setup storage_mock = {'subscriptions': None} - profile = Profile(storage_mock) + profile = Profile(storage_mock, use_global_creds_cache=False) consolidated = Profile._normalize_properties(self.user1, [self.subscription1], False) @@ -584,7 +584,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_read_file.return_value = [self.token_entry1, test_sp] # action - creds_cache = CredsCache() + creds_cache = CredsCache(async_persist=False) # assert token_entries = [entry for _, entry in creds_cache.load_adal_token_cache().read_items()] @@ -601,7 +601,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_read_file.return_value = [test_sp] # action - creds_cache = CredsCache() + creds_cache = CredsCache(async_persist=False) creds_cache.load_adal_token_cache() # assert @@ -623,7 +623,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method } mock_open_for_write.return_value = FileHandleStub() mock_read_file.return_value = [self.token_entry1, test_sp] - creds_cache = CredsCache() + creds_cache = CredsCache(async_persist=False) # action creds_cache.save_service_principal_cred(test_sp2) @@ -645,7 +645,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method } mock_open_for_write.return_value = FileHandleStub() mock_read_file.return_value = [test_sp] - creds_cache = CredsCache() + creds_cache = CredsCache(async_persist=False) # action creds_cache.save_service_principal_cred(test_sp) @@ -664,7 +664,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method } mock_open_for_write.return_value = FileHandleStub() mock_read_file.return_value = [self.token_entry1, test_sp] - creds_cache = CredsCache() + creds_cache = CredsCache(async_persist=False) # action #1, logout a user creds_cache.remove_cached_creds(self.user1) @@ -704,7 +704,7 @@ class Test_Profile(unittest.TestCase): # pylint: disable=too-many-public-method mock_adal_auth_context.acquire_token.side_effect = acquire_token_side_effect mock_open_for_write.return_value = FileHandleStub() mock_read_file.return_value = [self.token_entry1] - creds_cache = CredsCache(auth_ctx_factory=get_auth_context) + creds_cache = CredsCache(auth_ctx_factory=get_auth_context, async_persist=False) # action mgmt_resource = 'https://management.core.windows.net/'
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 2 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.1 -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices azure-cli-command-modules-nspkg==2.0.3 -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure azure-cli-container==0.3.18 -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_shell&subdirectory=src/command_modules/azure-cli-shell -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@0c5e91ca52cf0ed5f9284968dd3272275020ce89#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.8 azure-graphrbac==0.30.0rc6 azure-keyvault==0.2.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.1 azure-mgmt-cognitiveservices==1.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-containerinstance==1.4.0 azure-mgmt-containerregistry==0.2.1 azure-mgmt-datalake-analytics==0.1.4 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.4 azure-mgmt-devtestlabs==2.0.0 azure-mgmt-dns==1.0.1 azure-mgmt-documentdb==0.1.3 azure-mgmt-iothub==0.2.2 azure-mgmt-keyvault==0.31.0 azure-mgmt-loganalytics==0.2.0 azure-mgmt-monitor==0.2.1 azure-mgmt-network==3.0.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.0.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0 azure-mgmt-web==0.32.0 azure-monitor==0.3.0 azure-multiapi-storage==0.1.0 azure-nspkg==1.0.0 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 prompt-toolkit==3.0.36 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pydocumentdb==2.3.5 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.5 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 vsts-cd-manager==1.0.2 wcwidth==0.2.13 websocket-client==1.3.1 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.1 - azure-cli-command-modules-nspkg==2.0.3 - azure-cli-container==0.3.18 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.8 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.2.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.1 - azure-mgmt-cognitiveservices==1.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-containerinstance==1.4.0 - azure-mgmt-containerregistry==0.2.1 - azure-mgmt-datalake-analytics==0.1.4 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.4 - azure-mgmt-devtestlabs==2.0.0 - azure-mgmt-dns==1.0.1 - azure-mgmt-documentdb==0.1.3 - azure-mgmt-iothub==0.2.2 - azure-mgmt-keyvault==0.31.0 - azure-mgmt-loganalytics==0.2.0 - azure-mgmt-monitor==0.2.1 - azure-mgmt-network==3.0.0 - azure-mgmt-nspkg==3.0.2 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.0.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0 - azure-mgmt-web==0.32.0 - azure-monitor==0.3.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==1.0.0 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pydocumentdb==2.3.5 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.5 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - vsts-cd-manager==1.0.2 - wcwidth==0.2.13 - websocket-client==1.3.1 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_create_account_without_subscriptions", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_create_account_without_subscriptions_without_tenant", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_create_token_cache", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_add_new_sp_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_add_preexisting_sp_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds_with_cert", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_load_tokens_and_sp_creds_with_secret", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_new_token_added_by_adal", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_credscache_remove_creds", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_default_active_subscription_to_non_disabled_one", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_current_account_user", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_expanded_subscription_info_for_logged_in_service_principal", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_login_credentials", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_login_credentials_for_graph_client", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_get_subscription", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_load_cached_tokens", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_logout", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_logout_all", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_set_active_subscription", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_update_add_two_different_subscriptions", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_update_with_same_subscription_added_twice" ]
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_using_cert", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_service_principal_auth_client_cert" ]
[ "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_particular_tenent", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_from_service_principal_id", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_interactive_from_particular_tenent", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_through_interactive_flow", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_find_subscriptions_thru_username_password_with_account_disabled", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_normalize", "src/azure-cli-core/tests/test_profile.py::Test_Profile::test_service_principal_auth_client_secret" ]
[]
MIT License
1,228
[ "src/azure-cli-core/HISTORY.rst", "src/azure-cli-core/azure/cli/core/_profile.py" ]
[ "src/azure-cli-core/HISTORY.rst", "src/azure-cli-core/azure/cli/core/_profile.py" ]
typesafehub__conductr-cli-446
7239e444785144797043e16a9d045e7aa0902783
2017-05-04 21:18:45
39719b38ec6fc0f598756700a8a815b56bd8bc59
longshorej: Here's a manual test showing that we no longer show the prompt when providing a token: ``` $ conduct load-license <<< 1235 Error: Your credentials are no longer valid. Please visit https://www.lightbend.com/account/access-token to renew them. -> 1 ```
diff --git a/conductr_cli/license_auth.py b/conductr_cli/license_auth.py index b1d2128..1ab3c67 100644 --- a/conductr_cli/license_auth.py +++ b/conductr_cli/license_auth.py @@ -1,5 +1,6 @@ from conductr_cli.constants import DEFAULT_AUTH_TOKEN_FILE import os +import sys try: import readline except ImportError: @@ -7,7 +8,7 @@ except ImportError: AUTH_TOKEN_PROMPT = '\nAn access token is required. Please visit https://www.lightbend.com/account/access-token to \n' \ - 'obtain one, and a free license or your commercial one.\n' \ + 'obtain one for free and commercial licenses.\n' \ '\n' \ 'Please enter your access token: ' @@ -34,7 +35,10 @@ def prompt_for_auth_token(): readline.clear_history() try: - return input(AUTH_TOKEN_PROMPT).strip() + if sys.stdin.isatty(): + return input(AUTH_TOKEN_PROMPT).strip() + else: + return input().strip() except EOFError: return ''
load-license message not needed? Encountered this while upgrading conductr cluster from alpha1 to alpha3: ``` conduct load-license -f <<< '...' An access token is required. Please visit https://www.lightbend.com/account/access-token to obtain one, and a free license or your commercial one. Please enter your access token: Loading license into ConductR at 172.31.60.175 Licensed To: 1d1400b6-3e12-45fe-b0cc-15790b5a9b73 Expires In: 364 days (Fri 04 May 2018 01:21AM) Grants: akka-sbr, cinnamon, conductr License successfully loaded ``` The initial message is confusing. 1) I'm loading a new access token so the message is out of place to begin with. 2) What does " and a free license or your commercial one" mean? Perhaps just omit that?
typesafehub/conductr-cli
diff --git a/conductr_cli/test/test_license_auth.py b/conductr_cli/test/test_license_auth.py index 727cf24..0c7b5b1 100644 --- a/conductr_cli/test/test_license_auth.py +++ b/conductr_cli/test/test_license_auth.py @@ -39,11 +39,25 @@ class TestPromptForAuthToken(TestCase): mock_input = MagicMock(return_value=auth_token) with patch('builtins.print', mock_print), \ - patch('builtins.input', mock_input): + patch('builtins.input', mock_input), \ + patch('sys.stdin.isatty', lambda: True): self.assertEqual(auth_token, license_auth.prompt_for_auth_token()) mock_input.assert_called_once_with(license_auth.AUTH_TOKEN_PROMPT) + def test_no_tty_dont_prompt_for_auth_token(self): + auth_token = 'test auth token' + + mock_print = MagicMock() + mock_input = MagicMock(return_value=auth_token) + + with patch('builtins.print', mock_print), \ + patch('builtins.input', mock_input), \ + patch('sys.stdin.isatty', lambda: False): + self.assertEqual(auth_token, license_auth.prompt_for_auth_token()) + + mock_input.assert_called_once_with() + class TestRemoveCachedAuthToken(TestCase): def test_cached_token_exists(self):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 1 }
1.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "tox", "pytest" ], "pre_install": null, "python": "3.5", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
argcomplete==3.1.2 arrow==1.2.3 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 charset-normalizer==2.0.12 colorama==0.4.5 -e git+https://github.com/typesafehub/conductr-cli.git@7239e444785144797043e16a9d045e7aa0902783#egg=conductr_cli distlib==0.3.9 filelock==3.4.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work jsonschema==2.6.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pager==3.3 platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work prettytable==0.7.2 psutil==5.9.8 py @ file:///opt/conda/conda-bld/py_1644396412707/work Pygments==2.14.0 pyhocon==0.3.35 PyJWT==1.4.2 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pyreadline==2.1 pytest==6.2.4 python-dateutil==2.9.0.post0 requests==2.27.1 requests-toolbelt==1.0.0 six==1.17.0 sseclient==0.0.14 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tox==3.28.0 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 virtualenv==20.17.1 www-authenticate==0.9.2 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: conductr-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - argcomplete==3.1.2 - arrow==1.2.3 - charset-normalizer==2.0.12 - colorama==0.4.5 - distlib==0.3.9 - filelock==3.4.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - jsonschema==2.6.0 - pager==3.3 - platformdirs==2.4.0 - prettytable==0.7.2 - psutil==5.9.8 - pygments==2.14.0 - pyhocon==0.3.35 - pyjwt==1.4.2 - pyreadline==2.1 - python-dateutil==2.9.0.post0 - requests==2.27.1 - requests-toolbelt==1.0.0 - six==1.17.0 - sseclient==0.0.14 - tox==3.28.0 - urllib3==1.26.20 - virtualenv==20.17.1 - www-authenticate==0.9.2 prefix: /opt/conda/envs/conductr-cli
[ "conductr_cli/test/test_license_auth.py::TestPromptForAuthToken::test_no_tty_dont_prompt_for_auth_token" ]
[]
[ "conductr_cli/test/test_license_auth.py::TestGetCachedAuthToken::test_cached_token_exists", "conductr_cli/test/test_license_auth.py::TestGetCachedAuthToken::test_cached_token_missing", "conductr_cli/test/test_license_auth.py::TestPromptForAuthToken::test_prompt_for_auth_token", "conductr_cli/test/test_license_auth.py::TestRemoveCachedAuthToken::test_cached_token_exists", "conductr_cli/test/test_license_auth.py::TestRemoveCachedAuthToken::test_cached_token_missing", "conductr_cli/test/test_license_auth.py::TestSaveAuthToken::test_save_auth_token" ]
[]
Apache License 2.0
1,229
[ "conductr_cli/license_auth.py" ]
[ "conductr_cli/license_auth.py" ]
uccser__verto-192
cdb3a1980c8da9fcc8bda839cb130c2975c46c50
2017-05-05 00:56:07
8bc823e411316374c5c63deb99a414182eb968be
diff --git a/verto/processors/GlossaryLinkPattern.py b/verto/processors/GlossaryLinkPattern.py index b9b25b5..502a632 100644 --- a/verto/processors/GlossaryLinkPattern.py +++ b/verto/processors/GlossaryLinkPattern.py @@ -51,9 +51,10 @@ class GlossaryLinkPattern(Pattern): 'text': text } + glossary_reference = self.ext_glossary_terms[term] if reference is not None: identifier = self.unique_slugify('glossary-' + term) - self.ext_glossary_terms[term].append((reference, identifier)) + glossary_reference.append((reference, identifier)) context['id'] = identifier html_string = self.template.render(context)
Fix 'required-glossary-terms' in documentation In the documentation the key `required-glossary-terms` does not exist in the result object, the correct value is `required_glossary_terms`.
uccser/verto
diff --git a/verto/tests/ConfigurationTest.py b/verto/tests/ConfigurationTest.py index 8d26a45..f4405d2 100644 --- a/verto/tests/ConfigurationTest.py +++ b/verto/tests/ConfigurationTest.py @@ -64,7 +64,9 @@ class ConfigurationTest(BaseTest): children=() ), ), - required_glossary_terms=defaultdict(list) + required_glossary_terms={ + 'algorithm': [] + } ) ), ('some_processors.md', @@ -116,6 +118,7 @@ class ConfigurationTest(BaseTest): children=(), ),), required_glossary_terms={ + 'hello': [], 'algorithm': [('computer program', 'glossary-algorithm'), ('algorithm cost', 'glossary-algorithm-2'), @@ -126,15 +129,15 @@ class ConfigurationTest(BaseTest): ) ] - for test in test_cases: + for filename, expected_result in test_cases: verto = Verto() - test_string = self.read_test_file(self.test_name, test[0]) + test_string = self.read_test_file(self.test_name, filename) verto_result = verto.convert(test_string) - self.assertEqual(verto_result.title, test[1].title) - self.assertEqual(verto_result.required_files, test[1].required_files) - self.assertTupleEqual(verto_result.heading_tree, test[1].heading_tree) - self.assertDictEqual(verto_result.required_glossary_terms, test[1].required_glossary_terms) + self.assertEqual(verto_result.title, expected_result.title) + self.assertEqual(verto_result.required_files, expected_result.required_files) + self.assertTupleEqual(verto_result.heading_tree, expected_result.heading_tree) + self.assertDictEqual(verto_result.required_glossary_terms, expected_result.required_glossary_terms) def test_custom_processors_and_custom_templates_on_creation(self): '''Checks if custom processors and custom templates work diff --git a/verto/tests/GlossaryLinkTest.py b/verto/tests/GlossaryLinkTest.py index f019f5d..c1a9267 100644 --- a/verto/tests/GlossaryLinkTest.py +++ b/verto/tests/GlossaryLinkTest.py @@ -35,7 +35,9 @@ class GlossaryLinkTest(ProcessorTest): self.assertEqual(expected_string, converted_test_string) glossary_terms = self.verto_extension.glossary_terms - expected_glossary_terms = dict() + expected_glossary_terms = { + 'quicksort': [] + } self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_multiple_word_term(self): @@ -51,7 +53,9 @@ class GlossaryLinkTest(ProcessorTest): self.assertEqual(expected_string, converted_test_string) glossary_terms = self.verto_extension.glossary_terms - expected_glossary_terms = dict() + expected_glossary_terms = { + 'digital-signature': [] + } self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_reference_text_given(self): @@ -88,7 +92,9 @@ class GlossaryLinkTest(ProcessorTest): self.assertEqual(expected_string, converted_test_string) glossary_terms = self.verto_extension.glossary_terms - expected_glossary_terms = dict() + expected_glossary_terms = { + 'grammar': [] + } self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_trailing_inline_text(self): @@ -105,7 +111,9 @@ class GlossaryLinkTest(ProcessorTest): self.assertEqual(expected_string, converted_test_string) glossary_terms = self.verto_extension.glossary_terms - expected_glossary_terms = dict() + expected_glossary_terms = { + 'finite state automaton': [] + } self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_leading_and_trailing_inline_text(self): @@ -122,7 +130,9 @@ class GlossaryLinkTest(ProcessorTest): self.assertEqual(expected_string, converted_test_string) glossary_terms = self.verto_extension.glossary_terms - expected_glossary_terms = dict() + expected_glossary_terms = { + 'Regular expression': [] + } self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_multiple_terms(self): @@ -141,6 +151,8 @@ class GlossaryLinkTest(ProcessorTest): glossary_terms = self.verto_extension.glossary_terms expected_glossary_terms = { + 'grammar': [], + 'regular-expression': [], 'finite-state-automaton': [('Formal languages', 'glossary-finite-state-automaton')] } @@ -162,6 +174,7 @@ class GlossaryLinkTest(ProcessorTest): glossary_terms = self.verto_extension.glossary_terms expected_glossary_terms = { + 'hello': [], 'algorithm': [('computer program', 'glossary-algorithm'), ('algorithm cost', 'glossary-algorithm-2'), @@ -187,7 +200,9 @@ class GlossaryLinkTest(ProcessorTest): self.assertEqual(expected_string, converted_test_string) glossary_terms = self.verto_extension.glossary_terms - expected_glossary_terms = dict() + expected_glossary_terms = { + 'algorithm': [] + } self.assertDictEqual(expected_glossary_terms, glossary_terms) def test_doc_example_override_html(self):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 1 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 appdirs==1.4.4 attrs==22.2.0 Babel==2.11.0 beautifulsoup4==4.5.3 certifi==2021.5.30 charset-normalizer==2.0.12 docutils==0.18.1 idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==2.9.6 Markdown==2.6.8 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 python-slugify==1.2.3 pytz==2025.2 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==1.5.5 sphinx-rtd-theme==0.2.4 tomli==1.2.3 typing_extensions==4.1.1 Unidecode==1.3.8 urllib3==1.26.20 -e git+https://github.com/uccser/verto.git@cdb3a1980c8da9fcc8bda839cb130c2975c46c50#egg=verto zipp==3.6.0
name: verto channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - appdirs==1.4.4 - attrs==22.2.0 - babel==2.11.0 - beautifulsoup4==4.5.3 - charset-normalizer==2.0.12 - docutils==0.18.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==2.9.6 - markdown==2.6.8 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-slugify==1.2.3 - pytz==2025.2 - requests==2.27.1 - setuptools==35.0.2 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==1.5.5 - sphinx-rtd-theme==0.2.4 - tomli==1.2.3 - typing-extensions==4.1.1 - unidecode==1.3.8 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/verto
[ "verto/tests/ConfigurationTest.py::ConfigurationTest::test_multiple_calls", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_doc_example_basic", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_leading_and_trailing_inline_text", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_leading_inline_text", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_multiple_reference_text", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_multiple_terms", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_multiple_word_term", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_single_word_term", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_trailing_inline_text" ]
[]
[ "verto/tests/ConfigurationTest.py::ConfigurationTest::test_custom_processors_after_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_custom_processors_and_custom_templates_after_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_custom_processors_and_custom_templates_on_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_custom_processors_on_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_custom_templates_after_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_custom_templates_on_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_default_processors_on_creation", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_multiline_custom_templates", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_reset_templates_after_custom", "verto/tests/ConfigurationTest.py::ConfigurationTest::test_unique_custom_processors", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_doc_example_override_html", "verto/tests/GlossaryLinkTest.py::GlossaryLinkTest::test_reference_text_given" ]
[]
MIT License
1,230
[ "verto/processors/GlossaryLinkPattern.py" ]
[ "verto/processors/GlossaryLinkPattern.py" ]
dask__dask-2301
db7bee4cdd4eeabcf192f3f6c65ee34ac7865ccb
2017-05-05 02:54:12
c560965c8fc0da7cbc0920d43b7011d2721307d3
mrocklin: @shoyer @pelson @niallrobinson @rabernat @pwolfram this may interest you or others within your respective organizations mrocklin: The special-casing of `np.ma` in dask here is somewhat concerning. This seems fine if masked arrays are a priority (as those cc'ed above may be able to support) but puts us down an odd path where we might have a lot of highly branching code to support a few in-memory arrays. Are there ways around this through dispatching and such? rabernat: Looks very cool! However, it will be of limited use to xarray, since xarray does not use masked arrays internally. (It uses NaN to represent masked elements.) jcrist: This PR is falling out of sync with master. Before I take the time to fix the merge conflicts, is this of actual use to anyone? It would be good to hear from @shoyer, @pelson, @niallrobinson, @pwolfram, or @bjlittle on whether this would be useful for any of the work y'all do. FWIW I think the maintenance costs here are fairly minimal, but it'd be good to have a real world use case before actually merging. dkillick: @jcrist Iris is interested in this work! Thanks muchly for the effort you've put into it -- hopefully @bjlittle or @pelson will be able to respond with something more concrete soon :+1: mrocklin: How does Iris handle masked arrays today? Also @njsmith, do you have a sense for the planned longevity of the `numpy.ma` module? bjlittle: @mrocklin At the moment, `iris` will either use `numpy.ma` for the concrete case, or `biggus` to handle masked arrays in a lazy way. But change is afoot ... We're in the process of replacing `biggus` with `dask`, and opting for use `numpy.nan` to fudge support for lazy, mask like behaviour ... with pimple on the princess is the lazy, masked integral/bool case, where we need to change `dtype` to use `numpy.nan`. To be honest, if `numpy.nan` was `dtype` agnostic, then that would make life a heck of a lot easier, but instead to support that corner case, we need to deal with it explicitly, which isn't particularly pleasant. mrocklin: How would life change if dask.array supported masked arrays? Would this have near-term positive impact on Iris and the Met office? bjlittle: IMO we're committed to cutting the next release of `iris` with the current `numpy.nan` approach and `dask` as a replacement for `biggus`. If we don't do that, well then, that's news to me. So we've totally bought into the benefits of `dask`, and commited to it as a means to underpin our needs for deferred loading and lazy evaluation. Naturally, from our next release, users of `iris` will be exposed to `dask`. If they choose to use `dask` natively (without `iris` getting in the way) then they may also be exposed to the `numpy.nan` approach to masking ... and perhaps the lazy, masked integral/bool case stings them, forcing them to deal with that explicitly. I really can't quantify the cost of that to them or others in the community. So, for me, the near-term positive impact for `dask.array` supporting masked arrays is that it provides a minimal overhead to us in supporting the lazy, masked integral/bool case, which has been the biggest bane of our endeavor to replace `biggus` with `dask` in `iris`, and we would also be able to pass-off all masked array handling naturally to `dask` and not jump through the `numpy.nan` hoop .... an issue that others i.e. `xarray` at least, also have to address. So, I guess the question is, should all users of `dask` accept `numpy.nan` as a given approach to dealing with masking, or can the problem be addressed in one place, but not a the cost of compromising the design of `dask`? jakirkham: Wanted to add something here. From past experience there are many functions operating on NumPy's masked arrays that have bugs, strange behavior, or are incomplete somehow. Feel free to take a look at NumPy's issue tracker for examples. A relevant search of these is linked below. So taking on Masked Array support means handling these sorts of cases somehow or at a bare minimum directing feedback to upstream. This isn't an argument against it. Just trying to make sure you are aware of these problems. Admittedly people that are already using `numpy.ma` are probably aware of these shortcomings. ref: https://github.com/numpy/numpy/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3A%22component%3A%20numpy.ma%22%20 > ...do you have a sense for the planned longevity of the numpy.ma module? While I can't speak for Nathaniel, my understanding is Matplotlib makes use of Masked Arrays throughout. So NumPy couldn't drop Masked Arrays without breaking Matplotlib in a pretty big way, which seems like incentive enough to leave it alone. This in spite of occasional rumblings on the NumPy issue tracker to the contrary. shoyer: NumPy tries *very* hard to avoid breaking backwards compatibility. You can count on masked arrays being around for the indefinite future, despite all of their issues. We haven't even gotten rid of np.matrix, even though all the NumPy developers agree that it shouldn't be used for new code. On Thu, Jun 1, 2017 at 8:21 AM, jakirkham <[email protected]> wrote: > Wanted to add something here. From past experience there are many > functions operating on NumPy's masked arrays that have bugs, strange > behavior, or are incomplete somehow. Feel free to take a look at NumPy's > issue tracker for examples. A relevant search of these is linked below. > > So taking on Masked Array support means handling these sorts of cases > somehow or at a bare minimum directing feedback to upstream. This isn't an > argument against it. Just trying to make sure you are aware of these > problems. Admittedly people that are already using numpy.ma are probably > aware of these shortcomings. > > ref: https://github.com/numpy/numpy/issues?utf8=%E2%9C%93&q= > is%3Aissue%20is%3Aopen%20label%3A%22component%3A%20numpy.ma%22%20 > > ...do you have a sense for the planned longevity of the numpy.ma module? > > While I can't speak for Nathaniel, my understanding is Matplotlib makes > use of Masked Arrays throughout. So NumPy couldn't drop Masked Arrays > without breaking Matplotlib in a pretty big way, which seems like incentive > enough to leave it alone. This in spite of occasional rumblings on the > NumPy issue tracker to the contrary. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/dask/dask/pull/2301#issuecomment-305527352>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/ABKS1qvIJDwQWcIcKWfQ9mVukjvQzyvZks5r_tcMgaJpZM4NRcMo> > . > mrocklin: Perhaps a more optimistic question is "is there likely to be a masked array alternative in the near future?" njsmith: I would very much like to see proper NA support in numpy. That definitely doesn't replace all use cases for `np.ma` (in particular the cases where people want to toggle elements back and forth between masked/unmasked without losing data), but it sounds like it's what `iris` really wants. I won't try to make any concrete estimate for when that will happen, though. In general, I'd strongly recommend against writing new code using `np.ma` just because the design is kind of inherently broken in several ways and will never be fixed. From the maintenance point of view we generally treat it like a museum piece that needs preservation, though some people do submit the occasional bugfix. As `__numpy_ufunc__` and any future follow-ups land then it will become more possible to write a better version of what `np.ma` does – perhaps someone will take up the challenge. In the mean time, @shoyer is right that it's not going away – at most we might eventually have a better replacement, and might then eventually deprecate it, and it's just barely possible that some time after that we might eventually split it out into a new package and make people update their dependencies. But the code isn't going to disappear. bjlittle: I'm in agreement with @shoyer and @njsmith Our whole `biggus` to `dask` migration and dealing with masking explicitly through `numpy.nan` has really highlighted some not very pleasant areas within `numpy` masked arrays. There are certainly a few dragons living there. I'm pretty much in awe of @jcrist's efforts to get this PR up :+1:. Totally awesome :beers: That said, this PR has forced the discussion on whether `dask` *should* support `numpy` masked arrays. Being impartial, I think it's a decision that shouldn't be taken lightly by the `dask` core devs. I see it as a pretty big, long term commitment - caveat emptor. jcrist: The changes here were mostly: - Remove the `package_of` function in favor of a method registry (still think this is a good idea) - Generalize a few small bits - Some masked array specific changes that I'm not sure how/if to generalize - Tests Of these, I'm only really in favor of adding the first separate from masked-array support. The rest would clutter up the code a bit without a specific reason behind them. I'm fine with letting this idle (even closed) until masked arrays are requested - shouldn't take long to bring back up to date. marqh: > Wait on Iris and XArray to tell us that they would prefer to use masked arrays if available Hello @mrocklin et al I'd like to share my perspective, as an Iris developer. I think that the adoption of Dask within Iris is a really positive and exciting step for us. The work to integrate dask into Iris has been fairly intensive, and working around the lack of masked arrays has formed a significant quantity of this work. Some of the work around code has been accepted as pragmatic, but does not feel ideal to me. There are concerns from our user community about some of the side effects of this implementation for some use cases. I think that in the short term, we will be working with dask and patching around the lack of masked array support. However, I feel that this represents a degree of technical debt for our implementation. So, in the near future, I'm interested in dask supporting numpy's masked array implementation, as it feels like the widely used implementation and many libraries using numpy rely on this implementation for their core functionality. If a future dask supports `numpy.ma` I would be very keen to adopt that in short order for our library, this would be a great benefit, I feel. I think that driving a conversation about how a future numpy and dask could handle the concept of missing data and processing in different ways is a really valuable conversation. I think that this is a long term activity, which would be informed by dask adopting numpy's masked array as is. I'd like to offer my encouragement for dask to adopt `numpy.ma`, with all its foibles and use this activity to explore what could be done better. Perhaps this would encourage a conversation across the numpy community about having a fresh look at this topic; I'd certainly be interested in engaging with such a discussion and offering key use cases if I can generate them. many thanks mark jcrist: Ok, I've brought this PR back in sync with master. I don't think this adds much complexity to `dask.array` internals, and think it'd be fine to merge. However, it might be nice to try it out on some simple problem to see if it solves real world needs. Specifically, the `fill_value` is not metadata on `dask.array`, and so can't be accessed statically (e.g. can't do `a.fill_value`). If this is needed for your work, then this PR doesn't satisfy that need. We could add a function to get it lazily (`ma.get_fill_value(x)`?), but having it as static metadata would require a redesign. @marqh, @bjlittle do you have examples of what kind of operations you'd like to do with masked arrays? Do you have time/motivation to try this PR out? pelson: @jcrist - great stuff! 👍 jakirkham: Did you try with `nomask`? jcrist: Thanks for the review @pelson. Responding to a few comments: --- The errors you're seeing in `masked_where` and `masked_outside` have to do with lack of support for numpy arrays as arguments. Will fix. One question is what do you expect to happen if you call a `da.ma.masked_*` function on *only* numpy arrays (as you did with `masked_outside`). Dask's convention so far is to call the equivalent numpy method in these cases. There's a question whether this should change (see https://github.com/dask/dask/issues/2103). --- The `from_array` issue is a bug in our tokenizing function (will fix), but even then `from_array` won't work as it always calls `np.asarray` on all chunks. A few options here: - Don't call `asarray` if the input is a masked array. I'm not as fond of this because it special cases an input type. - Add a keyword to turn off `asarray`. NumPy seems to use `subok` for this in places, but I'm tempted to use `asarray=True` instead because I think it's clearer. Thoughts? --- > I was somewhat concerned about the numerical accuracy of things like standard deviation We also work hard to implement numerically stable parallel algorithms. The one used here is from http://prod.sandia.gov/techlib/access-control.cgi/2008/086212.pdf and has been working well for us. It's used for computing all our moments (`var`, `skew`, `kurt`, etc...). > Which, just like the biggus implementation has a (necessary) bottleneck at the sqrt Just to clarify, depending on your chunking and reduction axis there may be multiple parallel calls to `sqrt`. In this case you're reducing down to a single chunk so there's only one call. pelson: > Dask's convention so far is to call the equivalent numpy method in these cases. Personally, I'd expect to *always* have a lazy dask thing if I've called dask functions/methods. If I wanted immediate, I'd call numpy directly... > bug in our tokenizing function (will fix)... Thoughts? At this moment, I'm afraid I don't have enough background to possibly give an educated answer. > We also work hard to implement numerically stable parallel algorithms. Great. Biggus used a method described in ```Welford, BP (August 1962). "Note on a Method for Calculating Corrected Sums of Squares and Products``` and needed a particular implementation for masked arrays, so I think it is a good sign to see that your implementation of ``moment_chunk`` has held up well with this extension. 👍 marqh: @jcrist many thanks for the updates > @marqh, @bjlittle do you have examples of what kind of operations you'd like to do with masked arrays? key operations I know about with masks include: * statistical aggregations that are mask aware * statistical aggregations of float arrays using masks and NaNs with different semantics * masked integer arrays * conditional masks, calculated differently based on metadata * plotting of masked data Are you interested in general problem statements like this, or are you more keen for actual examples of data processing which could form test cases? Our current implementation converts masked arrays to NaN filled float arrays, which gives partial support, but there are edge cases which are causing concerns and lacks of capability for some cases. > Do you have time/motivation to try this PR out? motivation, for sure, time is more of a challenge just now, i'll let you know if I make progress. jcrist: I'm running into some hard-to-solve issues with masked arrays if the `fill_value` isn't a scalar. In these cases it becomes unclear what the intended behavior is when concatenating blocks, and is tricky enough that I'd like to just forbid it/not handle it. It seems to only come up in `masked_equals` and `masked_values` (there's a few numpy issues about how this is confusing and bad but needs to remain for backwards compat). I'd like to not handle this case and only work with scalar `fill_value` - is that ok for your needs? I can make it work with arrays, but there'd probably be edge cases. If I can forbid it, what should the behavior be if an array fill_value shows up (say from some user function and `map_blocks`)? - Error explicitly with "unsupported, can't be consistent here with numpy". This would be hard to catch in all cases, we'd really only see it when merging blocks. - Silently reset `fill_value` to the default. This is what `np.ma.concatenate` does anyway, but seems like it could be unexpected. If given no direction, I plan to error explicitly where easy/possible, and forbid operations that could result in this case (e.g. forbid `masked_equal` with an array `value`). jcrist: > If given no direction, I plan to error explicitly where easy/possible, and forbid operations that could result in this case (e.g. forbid masked_equal with an array value). This is what I ended up doing. --- At this point this PR *may* be ready to go. Three things that may still need to be done: - Improve the test suite a bit. I think we're good, but I want to do a once-over one more time with fresh eyes tomorrow. - Add masked ufuncs? Currently we don't implement things like `np.ma.sin`. The top level ufuncs (e.g. `da.sin`) do work on masked arrays, *but* they are applied to the entire `.data` array, which the masked ufuncs avoid. I'm not sure how important this is in practice. The non-masked results are equivalent, but the data under the mask may be different. - Add some docs? I'd prefer to wait on this until it sees some use, as we may want to change things after it's tried out. Happy to add docs now though if desired. jcrist: Ok, I'm happy with this as is. I expect there will be future touch-ups as this feature gets use, but I think it'd be good to get it in so it's easier for others to try out. This could use a review if anyone has time (cc @mrocklin, @pelson, @bjlittle, or @marqh). mrocklin: Just planning things out here, @pelson, @bjlittle, or @marqh do any of you have time to test this against Iris? marqh: > I'd like to not handle this case and only work with scalar fill_value - is that ok for your needs? I can make it work with arrays, but there'd probably be edge cases. If I can forbid it, what should the behavior be if an array fill_value shows up (say from some user function and map_blocks)? > > Error explicitly with "unsupported, can't be consistent here with numpy". This would be hard to catch in all cases, we'd really only see it when merging blocks. > Silently reset fill_value to the default. This is what np.ma.concatenate does anyway, but seems like it could be unexpected. @jcrist in my view, single fill values are the only case I can see any reason to support I very much support failing with an exception if a case occurs where this is not the case, user of library intervention would be required at this stage marqh: > Just planning things out here, @pelson, @bjlittle, or @marqh do any of you have time to test this against Iris? @mrocklin I'd like to set up a testing framework to look at this @bjlittle @pelson may I suggest that we create an iris branch somewhere and build dask from this branch in situ? We can then apply changes to this iris branch to remove the work arounds for handling masked arrays and get the tests running in a place we can all see the results Would it make sense to have such a branch inside the scitools/iris project, where we all have eyes and permissions to change? marqh: @pp-mo for your interest and information lbdreyer: I have just created the iris branch [dask_mask_array](https://github.com/SciTools/iris/tree/dask_mask_array) that I will be targeting with my initial investigation into integrating this branch into Iris. jakirkham: Did `compress` and/or `nonzero` get defined for Masked Arrays? lbdreyer: Hi @jcrist We're sprinting this week with the goal of having a POC of using your branch in Iris. We'll feedback any questions we have. We have come across one thing we wanted to check with you regarding fill value. The following is using your most recent commit (d504e35) ``` >>> import dask.array.ma as dma >>> >>> x = ma.masked_array([1,2,3,4], mask=[1,0,0,0]) >>> dx = da.from_array(x, chunks=(2,), asarray=False) >>> dma.set_fill_value(dx, 8) >>> print dx.compute().fill_value 8 ``` However, if we call compute, then set the fill value, the next time we call compute the array fill value hasn't been changed, e.g. ``` >>> x = ma.masked_array([1,2,3,4], mask=[1,0,0,0]) >>> dx = da.from_array(x, chunks=(2,), asarray=False) >>> print dx.compute().fill_value 999999 >>> >>> dma.set_fill_value(dx, 8) >>> >>> print dx.compute().fill_value 999999 ``` Is this as you would expect? jcrist: Thanks for the issue report, this was a tricky bug that affected other parts of `dask.array` too. Fixed in #2572. ```python In [1]: import numpy as np In [2]: import dask.array as da In [3]: x = np.ma.masked_array([1, 2, 3, 4], mask=[1, 0, 0, 0]) In [4]: dx = da.from_array(x, chunks=2, asarray=False) In [5]: dx.compute().fill_value Out[5]: 999999 In [6]: da.ma.set_fill_value(dx, 8) In [7]: dx.compute().fill_value Out[7]: 8 ``` bjlittle: Hi @jcrist, We just stumbled across the following behaviour ... apologies, it's your old friend `fill_value` again: ```python >>> a = da.from_array(np.array([1, 2, 3]), chunks=(1,)) >>> from dask.array import ma as dma >>> dma.set_fill_value(a, 123) >>> a.compute() array([1, 2, 3]) ``` Silently ignores the `set_fill_value` on an `ndarray` ... seems reasonable, since we can't actually get a lazy `fill_value` anyways. This is just an observation really, not quite sure what your expectation is on how this type of use pattern should behave ... jcrist: I'm not sure what your expectation is here? In numpy, `set_fill_value` is a no-op on non-masked arrays: ```python In [1]: import numpy as np In [2]: x = np.array([1, 2, 3]) In [3]: np.ma.set_fill_value(x, 0.5) In [4]: x Out[4]: array([1, 2, 3]) ``` We just do the same here. What were you expecting to happen? bjlittle: Oh boy, numpy lets you set the value of a non-existent attribute and silently ignores the fact, of course it does ... I should've checked that first, apologies @jcrist. You're just honouring that behaviour, which if ideal. I guess my beef/misunderstanding is with numpy. No worries. btw @lbdreyer and I are actively re-engineering iris (in a feature branch) at this moment to use this PR #2301. If we discover any issues we'll be sure to let you know asap. We're hoping to be in a position by the end of this week to have a fully functional iris with all unit and integration tests passing. At that point, I guess we'll be keen to know "what's the blocker to #2301 being merged?" and "when is your next release?" mrocklin: > btw @lbdreyer and I are actively re-engineering iris (in a feature branch) at this moment to use this PR #2301. If we discover any issues we'll be sure to let you know asap. We're hoping to be in a position by the end of this week to have a fully functional iris with all unit and integration tests passing. At that point, I guess we'll be keen to know "what's the blocker to #2301 being merged?" and "when is your next release scheduled?" @bjlittle my understanding is that we're just waiting on you all for feedback. I don't think that there are any blockers to merging this. We can probably release within a week or two after that. pp-mo: Hi @mrocklin @jcrist + people Work is now progressing with our Iris "dask_mask_array" branch, using this dask to re-instate sensible masked operations. All this is good, but there are a couple of points currently causing some problems ... **One problem** is that we don't have the handling of fill_value that we'd like, in that ... * (a) it is not an available thing on lazy arrays (i.e. without calling `compute()`), and * (b) it is not a fixed value that applies to the whole of the array (e.g. `lazy[0].compute().fill_value` can be different from `lazy[0].compute().fill_value`) We are in any case struggling right now to suggest what might work better, so I'm just putting that one out for your thoughts. **A more obvious problem** is that some basic statistical operations don't seem work yet on masked data. For example: ``` >>> from numpy import ma >>> import dask.array as da >>> >>> masked_data = ma.masked_array([1, 2, 777, 3], mask=[0, 0, 1, 0]) >>> print 'masked mean = ', masked_data.mean() masked mean = 2.0 >>> >>> for array_cast in (True, False): ... print ... print 'asarray={}:'.format(array_cast) ... lazy_data = da.from_array(masked_data, chunks=masked_data.shape, asarray=array_cast) ... print ... print ' lazy data repr={!r}'.format(lazy_data) ... print ' lazy computed-result={!r}'.format(type(lazy_data.compute())) ... lazy_mean = lazy_data.mean() ... print ' lazy mean repr={!r}'.format(lazy_mean) ... print ' lazy mean computed-result={!r}'.format(lazy_mean.compute()) ... asarray=True: lazy data repr=dask.array<array, shape=(4,), dtype=int64, chunksize=(4,)> lazy computed-result=<type 'numpy.ndarray'> lazy mean repr=dask.array<mean_agg-aggregate, shape=(), dtype=float64, chunksize=()> lazy mean computed-result=195.75 asarray=False: lazy data repr=dask.array<array, shape=(4,), dtype=int64, chunksize=(4,)> lazy computed-result=<class 'numpy.ma.core.MaskedArray'> lazy mean repr=dask.array<mean_agg-aggregate, shape=(), dtype=float64, chunksize=()> Traceback (most recent call last): [[ . . . ]] File "/data/local/itpp/git/dask/dask/array/reductions.py", line 261, in mean_agg return divide(pair['total'].sum(dtype=dtype, **kwargs), File "/opt/scitools/environments/experimental/2017_07_14/lib/python2.7/site-packages/numpy/core/_methods.py", line 32, in _sum return umr_sum(a, axis, dtype, out, keepdims) ValueError: 'axis' entry is out of bounds >>> ``` Note that the 'asarray=True' case is not the correct result (!) In our code, the more normal case is that the 'lazy_data' is wrapped around a "proxy" object that yields data on request (which happens to be masked) ... The results are the same ... ``` >>> class DataProxy(object): ... def __init__(self, shape, dtype, deferred_data_call): ... self._fetch_call = deferred_data_call ... self.shape = shape ... self.dtype = dtype ... def __getitem__(self, keys): ... data = self._fetch_call() ... assert data.shape == self.shape and data.dtype == self.dtype ... return data ... >>> ma_proxy = DataProxy((4,), np.int64, lambda: masked_data) >>> >>> for array_cast in (True, False): ... print ... print 'asarray={}:'.format(array_cast) ... lazy_data = da.from_array(ma_proxy, chunks=(4,), asarray=array_cast) ... print ... print ' lazy data repr={!r}'.format(lazy_data) ... print ' lazy computed-result={!r}'.format(type(lazy_data.compute())) ... lazy_mean = lazy_data.mean() ... print ' lazy mean repr={!r}'.format(lazy_mean) ... print ' lazy mean computed-result={!r}'.format(lazy_mean.compute()) ... asarray=True: lazy data repr=dask.array<array, shape=(4,), dtype=int64, chunksize=(4,)> lazy computed-result=<type 'numpy.ndarray'> lazy mean repr=dask.array<mean_agg-aggregate, shape=(), dtype=float64, chunksize=()> lazy mean computed-result=195.75 asarray=False: lazy data repr=dask.array<array, shape=(4,), dtype=int64, chunksize=(4,)> lazy computed-result=<class 'numpy.ma.core.MaskedArray'> lazy mean repr=dask.array<mean_agg-aggregate, shape=(), dtype=float64, chunksize=()> Traceback (most recent call last): [[ . . . ]] ValueError: 'axis' entry is out of bounds >>> ``` jakirkham: The examples in `b` (e.g. `lazy[0].compute().fill_value`) don't appear to be different. Are they suppose to be? jcrist: > A more obvious problem is that some basic statistical operations don't seem work yet on masked data... A couple points here: - When calling `from_array` on `np.ma.masked_array` objects, you *must* pass in `asarray=False`. Otherwise `np.asarray` is called on the masked array, which results in a numpy array. When you say that the "'asarray=True' case is not the correct result" this is because the mean is being taken on all the data, not just the masked part: ```python In [1]: import numpy as np In [2]: masked_data = np.ma.masked_array([1, 2, 777, 3], mask=[0, 0, 1, 0]) In [3]: x = np.asarray(masked_data) # all the data, not just the masked bit In [4]: x.mean() Out[4]: 195.75 ``` - I'm unable to produce the error you give above. What version of numpy are you using? I suspect that this is a bug in old versions of `numpy.ma`. ```python In [5]: import dask.array as da In [6]: x = da.from_array(masked_data, chunks=(4,), asarray=False) In [7]: x.mean().compute() Out[7]: 2.0 In [8]: x Out[8]: dask.array<array, shape=(4,), dtype=int64, chunksize=(4,)> In [9]: np.__version__ Out[9]: '1.13.1' ``` --- > One problem is that we don't have the handling of fill_value that we'd like... This is something that I mentioned in a call with @pelson a few weeks ago. The current design doesn't keep track of the `fill_value` statically, so you have to compute something to query it. He mentioned that that might not matter for your code. If you *do* need it statically this would require a mild rewrite of the masked array support on our side (which is still doable if necessary). If you don't need to know the `fill_value`, but do want to set it to something consistent across all chunks, you can call `da.ma.set_fill_value`. This will change the fill_value for every chunk. Note that this is fine to call on `np.ndarray`s as well, they're passed through unchanged (matching numpy). ```python In [23]: m1 = np.ma.masked_array([1, 2, 3, 4], mask=[0, 1, 0, 1], fill_value=10) In [24]: m2 = np.ma.masked_array([5, 6, 7, 8], mask=[0, 1, 0, 1], fill_value=20) # different fill value In [25]: dm1 = da.from_array(m1, chunks=2, asarray=False) In [26]: dm2 = da.from_array(m2, chunks=2, asarray=False) In [27]: dm3 = da.concatenate([dm1, dm2]) # each chunk has a different fill value In [28]: dm3.compute() # because of this, the fill_value is reset on compute, since they're not consistent Out[28]: masked_array(data = [1 -- 3 -- 5 -- 7 --], mask = [False True False True False True False True], fill_value = 999999) In [29]: da.ma.set_fill_value(dm3, 25) # if you set it though, things work fine In [30]: dm3.compute() Out[30]: masked_array(data = [1 -- 3 -- 5 -- 7 --], mask = [False True False True False True False True], fill_value = 25) ``` pp-mo: > @jakirkham The examples in b (e.g. lazy[0].compute().fill_value) don't appear to be different (i.e. the code appears to be identical in both case). Are they suppose to be? Apologies, meant to be just lazy[0].compute().fill_value and lazy[**1**].compute().fill_value pp-mo: @jcrist thanks for your quick response. > When calling from_array on np.ma.masked_array objects, you must pass in asarray=False. Thanks, I think I get that now ! > I'm unable to produce the error you give above. What version of numpy are you using? I'm testing with 1.11.1 I'll look into testing against 1.13 instead. > > One problem is that we don't have the handling of fill_value that we'd like... > ... The current design doesn't keep track of the fill_value statically, so you have to compute something to query it ... If you do need it statically this would require a mild rewrite of the masked array support on our side (which is still doable if necessary). Thanks for your views. As I said, we still aren't sure what we *would* ideally like ! Latest thoughts are that we have some serious reservations about how this is managed in numpy.ma anyway, so we may need to go our own way to control it. Our original [with-nonmasked-dask version of Iris](https://github.com/SciTools/iris/tree/7ec22fa3f14b1aea454c5a51ac350de190603d9c/lib/iris) was actually managing fill-values *separately* from the data arrays. pp-mo: > I'm unable to produce the error you give above. What version of numpy are you using? Aha, it does works properly with 1.13.1 ! pp-mo: > @jcrist it does work properly with 1.13.1 Apologies for my panicking too soon : Not being involved earlier, I'm still playing catch-up. Digging further into what we need to re-factor the Iris usage, a thing has come up ... There are as yet no dask operations allowing us to work with the data and mask components of arrays separately, for example ... ``` >>> import numpy.ma as ma >>> masked = ma.masked_array([1, 2, 777, 3], mask=[0,0,1,0]) >>> da_mask = da.from_array(masked, chunks=masked.shape, asarray=False) >>> >>> # WANTED: something like ma.getmaskarray() >>> mask = masked.maskarray() >>> mask.compute() [False, False, True, False] >>> >>> # WANTED: something like da.filled() >>> filled = masked.filled(-99) >>> filled.compute() [1, 2, -99, 3] >>> >>> # WANTED: build from separate data + mask, like da.masked_array() >>> da_mask = da.from_array(np.array([0, 0, 0, 1]), chunks=4) >>> remasked = da.masked_data(masked.filled(55), mask=da_mask) >>> remasked.compute() [1, 2, 55, --] ``` The one I have immediate use for is the "maskarray" operation : For this we have previously been using `da.isnan()`. **Or, maybe you can make these things for yourself ?** Is it possible or wise to construct such operators yourself using something like `dask.array.core.elemwise` ? I note that this is a "public" function, but it is not mentioned in the docs. I have currently tried this, ... ``` >>> def getmask(dask_array): ... nd = dask_array.ndim ... allinds = 'ijklmnopqr'[:nd] ... result = da.atop(ma.getmaskarray, allinds, dask_array, allinds, dtype=dask_array.dtype) ... return result ``` That seems to function, but I strongly suspect I haven't really understood what I am doing here. Can anyone advise ? pp-mo: > I have currently tried this, ... da.atop( ... Update: using "elemwise" seems to work nicely. See [here](https://github.com/SciTools/iris/pull/2743) jcrist: Apologies for the late response, I've been away from my computer for a few days. > There are as yet no dask operations allowing us to work with the data and mask components of arrays separately `da.ma.getmaskarray`, `da.ma.getdata`, and `da.ma.filled` are already implemented. We don't have matching methods, because we don't have a `masked_array` class, but the function versions for those are already in the `da.ma` namespace. I'll add `da.ma.masked_array` as well. I suggest looking at what's in `da.ma` already. > Is it possible or wise to construct such operators yourself using something like `dask.array.core.elemwise` ? Yes. For functionality that matches those in `np.ma` though it'd be best to just add it to this PR. `elemwise`, `atop`, and `map_blocks` should all be considered public functions, feel free to use them. pp-mo: > da.ma.getmaskarray, da.ma.getdata, and da.ma.filled Again, I hadn't spotted that ! Very useful. Also, I see I should really be using `getdata` in my code. What about the "constructor" `ma.masked_array` method ? I am still needing that to reconstruct my final result. jcrist: > That would be great -- I am still needing that to reconstruct my final result. Added in latest commit. Please let me know if you need anything else. pp-mo: > Added in latest commit. Making for [slightly neater code](https://github.com/SciTools/iris/pull/2743/commits/7c71140985b63d50bf3091250eaba67160198c85) Great stuff, thanks @jcrist ! pp-mo: Just to be _really_ clear, we like this + we want it ! We were already 100% committed to using dask anyway, but this is generally neater and much less of a wrench for existing code. A lot of dust still to settle [here](https://github.com/SciTools/iris/projects/18), but basically 👍 👏 mrocklin: @pp-mo @pelson we're likely to issue a small release soon. We're now faced with the question of whether or not to include this or wait a bit for additional issues to crop up over the next week or two and release then. Do you have a sense for how much additional work you're likely to want on this? jcrist: My personal preference is to do the small release and merge this after. I suspect we'll want to iterate on this a bit more, and releases are cheap to do. Up to y'all though. pelson: Honestly, we have taken this to the point of where we are able to say with confidence that it has value and that we will be using it in iris 2.0. Additionally, we don't currently have any work planned for the next few weeks that will reveal any subsequent improvements/bugs. Given the above, I'd love to see this in the release. pp-mo: > I'd love to see this in the release. 👍 mrocklin: There are likely to be a few other large array improvements in the next release. I'm inclined to follow @jcrist's intuition here and wait for all of them to land before releasing a 0.X.0 release. This would likely be in a small number of weeks. On Fri, Aug 25, 2017 at 1:36 PM, Patrick Peglar <[email protected]> wrote: > I'd love to see this in the release. > > 👍 > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/dask/dask/pull/2301#issuecomment-324988108>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/AASszJB6SQClKEY-mAkKQwyiabMISEszks5sbwYIgaJpZM4NRcMo> > . > mrocklin: Dask 0.15.2 has been released.. Should we merge this? Is there additional work to do here? pelson: > Is there additional work to do here? We now have some confidence in saying that, even if it does transpire that there is more to do, it won't be a long way away from the functionality already provided by this PR. Given this, I'm an advocate getting this in the hands of users ASAP. jcrist: Fine by me. I've fixed the merge conflicts and updated some docs. I think this is good to go now. mrocklin: +1 from me
diff --git a/dask/array/__init__.py b/dask/array/__init__.py index febd61182..679c66d99 100644 --- a/dask/array/__init__.py +++ b/dask/array/__init__.py @@ -32,6 +32,8 @@ from .reductions import (sum, prod, mean, std, var, any, all, min, max, vnorm, from .percentile import percentile with ignoring(ImportError): from .reductions import nanprod, nancumprod, nancumsum +with ignoring(ImportError): + from . import ma from . import random, linalg, ghost, learn, fft from .wrap import ones, zeros, empty, full from .creation import ones_like, zeros_like, empty_like, full_like diff --git a/dask/array/core.py b/dask/array/core.py index 32d623d96..9cca27f99 100644 --- a/dask/array/core.py +++ b/dask/array/core.py @@ -33,7 +33,7 @@ from ..base import Base, tokenize, normalize_token from ..context import _globals from ..utils import (homogeneous_deepmap, ndeepmap, ignoring, concrete, is_integer, IndexCallable, funcname, derived_from, - SerializableLock, ensure_dict, package_of) + SerializableLock, ensure_dict, Dispatch) from ..compatibility import unicode, long, getargspec, zip_longest, apply from ..delayed import to_task_dask from .. import threaded, core @@ -41,6 +41,20 @@ from .. import sharedict from ..sharedict import ShareDict +concatenate_lookup = Dispatch('concatenate') +tensordot_lookup = Dispatch('tensordot') +concatenate_lookup.register((object, np.ndarray), np.concatenate) +tensordot_lookup.register((object, np.ndarray), np.tensordot) + + +@tensordot_lookup.register_lazy('sparse') +@concatenate_lookup.register_lazy('sparse') +def register_sparse(): + import sparse + concatenate_lookup.register(sparse.COO, sparse.concatenate) + tensordot_lookup.register(sparse.COO, sparse.tensordot) + + def getter(a, b, asarray=True, lock=None): if isinstance(b, tuple) and any(x is None for x in b): b2 = tuple(x for x in b if x is not None) @@ -477,8 +491,8 @@ def _concatenate2(arrays, axes=[]): return arrays if len(axes) > 1: arrays = [_concatenate2(a, axes=axes[1:]) for a in arrays] - module = package_of(type(max(arrays, key=lambda x: x.__array_priority__))) or np - return module.concatenate(arrays, axis=axes[0]) + concatenate = concatenate_lookup.dispatch(type(max(arrays, key=lambda x: x.__array_priority__))) + return concatenate(arrays, axis=axes[0]) def apply_infer_dtype(func, args, kwargs, funcname, suggest_dtype=True): @@ -2579,13 +2593,22 @@ def _enforce_dtype(*args, **kwargs): function = kwargs.pop('enforce_dtype_function') result = function(*args, **kwargs) - if dtype != object: + if dtype != result.dtype and dtype != object: + if not np.can_cast(result, dtype, casting='same_kind'): + raise ValueError("Inferred dtype from function %r was %r " + "but got %r, which can't be cast using " + "casting='same_kind'" % + (funcname(function), str(dtype), str(result.dtype))) if np.isscalar(result): # scalar astype method doesn't take the keyword arguments, so # have to convert via 0-dimensional array and back. - result = result[...].astype(dtype, casting='same_kind', copy=False)[()] + result = result.astype(dtype) else: - result = result.astype(dtype, casting='same_kind', copy=False) + try: + result = result.astype(dtype, copy=False) + except TypeError: + # Missing copy kwarg + result = result.astype(dtype) return result @@ -2832,8 +2855,7 @@ def concatenate3(arrays): advanced = max(core.flatten(arrays, container=(list, tuple)), key=lambda x: getattr(x, '__array_priority__', 0)) - module = package_of(type(advanced)) or np - if module is not np and hasattr(module, 'concatenate'): + if concatenate_lookup.dispatch(type(advanced)) is not np.concatenate: x = unpack_singleton(arrays) return _concatenate2(arrays, axes=list(range(x.ndim))) diff --git a/dask/array/ma.py b/dask/array/ma.py new file mode 100644 index 000000000..f656eaf97 --- /dev/null +++ b/dask/array/ma.py @@ -0,0 +1,251 @@ +from __future__ import absolute_import, division, print_function + +from functools import wraps +from distutils.version import LooseVersion + +import numpy as np + +from ..base import normalize_token +from .core import (concatenate_lookup, tensordot_lookup, map_blocks, + asanyarray, atop) + + +if LooseVersion(np.__version__) < '1.11.0': + raise ImportError("dask.array.ma requires numpy >= 1.11.0") + + +@normalize_token.register(np.ma.masked_array) +def normalize_masked_array(x): + data = normalize_token(x.data) + mask = normalize_token(x.mask) + fill_value = normalize_token(x.fill_value) + return (data, mask, fill_value) + + +@concatenate_lookup.register(np.ma.masked_array) +def _concatenate(arrays, axis=0): + out = np.ma.concatenate(arrays, axis=axis) + fill_values = [i.fill_value for i in arrays if hasattr(i, 'fill_value')] + if any(isinstance(f, np.ndarray) for f in fill_values): + raise ValueError("Dask doesn't support masked array's with " + "non-scalar `fill_value`s") + if fill_values: + # If all the fill_values are the same copy over the fill value + fill_values = np.unique(fill_values) + if len(fill_values) == 1: + out.fill_value = fill_values[0] + return out + + +@tensordot_lookup.register(np.ma.masked_array) +def _tensordot(a, b, axes=2): + # Much of this is stolen from numpy/core/numeric.py::tensordot + # Please see license at https://github.com/numpy/numpy/blob/master/LICENSE.txt + try: + iter(axes) + except TypeError: + axes_a = list(range(-axes, 0)) + axes_b = list(range(0, axes)) + else: + axes_a, axes_b = axes + try: + na = len(axes_a) + axes_a = list(axes_a) + except TypeError: + axes_a = [axes_a] + na = 1 + try: + nb = len(axes_b) + axes_b = list(axes_b) + except TypeError: + axes_b = [axes_b] + nb = 1 + + # a, b = asarray(a), asarray(b) # <--- modified + as_ = a.shape + nda = a.ndim + bs = b.shape + ndb = b.ndim + equal = True + if na != nb: + equal = False + else: + for k in range(na): + if as_[axes_a[k]] != bs[axes_b[k]]: + equal = False + break + if axes_a[k] < 0: + axes_a[k] += nda + if axes_b[k] < 0: + axes_b[k] += ndb + if not equal: + raise ValueError("shape-mismatch for sum") + + # Move the axes to sum over to the end of "a" + # and to the front of "b" + notin = [k for k in range(nda) if k not in axes_a] + newaxes_a = notin + axes_a + N2 = 1 + for axis in axes_a: + N2 *= as_[axis] + newshape_a = (-1, N2) + olda = [as_[axis] for axis in notin] + + notin = [k for k in range(ndb) if k not in axes_b] + newaxes_b = axes_b + notin + N2 = 1 + for axis in axes_b: + N2 *= bs[axis] + newshape_b = (N2, -1) + oldb = [bs[axis] for axis in notin] + + at = a.transpose(newaxes_a).reshape(newshape_a) + bt = b.transpose(newaxes_b).reshape(newshape_b) + res = np.ma.dot(at, bt) + return res.reshape(olda + oldb) + + +@wraps(np.ma.filled) +def filled(a, fill_value=None): + a = asanyarray(a) + return a.map_blocks(np.ma.filled, fill_value=fill_value) + + +def _wrap_masked(f): + + @wraps(f) + def _(a, value): + a = asanyarray(a) + value = asanyarray(value) + ainds = tuple(range(a.ndim))[::-1] + vinds = tuple(range(value.ndim))[::-1] + oinds = max(ainds, vinds, key=len) + return atop(f, oinds, a, ainds, value, vinds, dtype=a.dtype) + + return _ + + +masked_greater = _wrap_masked(np.ma.masked_greater) +masked_greater_equal = _wrap_masked(np.ma.masked_greater_equal) +masked_less = _wrap_masked(np.ma.masked_less) +masked_less_equal = _wrap_masked(np.ma.masked_less_equal) +masked_not_equal = _wrap_masked(np.ma.masked_not_equal) + + +@wraps(np.ma.masked_equal) +def masked_equal(a, value): + a = asanyarray(a) + if getattr(value, 'shape', ()): + raise ValueError("da.ma.masked_equal doesn't support array `value`s") + inds = tuple(range(a.ndim)) + return atop(np.ma.masked_equal, inds, a, inds, value, (), dtype=a.dtype) + + +@wraps(np.ma.masked_invalid) +def masked_invalid(a): + return asanyarray(a).map_blocks(np.ma.masked_invalid) + + +@wraps(np.ma.masked_inside) +def masked_inside(x, v1, v2): + x = asanyarray(x) + return x.map_blocks(np.ma.masked_inside, v1, v2) + + +@wraps(np.ma.masked_outside) +def masked_outside(x, v1, v2): + x = asanyarray(x) + return x.map_blocks(np.ma.masked_outside, v1, v2) + + +@wraps(np.ma.masked_where) +def masked_where(condition, a): + cshape = getattr(condition, 'shape', ()) + if cshape and cshape != a.shape: + raise IndexError("Inconsistant shape between the condition and the " + "input (got %s and %s)" % (cshape, a.shape)) + condition = asanyarray(condition) + a = asanyarray(a) + ainds = tuple(range(a.ndim)) + cinds = tuple(range(condition.ndim)) + return atop(np.ma.masked_where, ainds, condition, cinds, a, ainds, + dtype=a.dtype) + + +@wraps(np.ma.masked_values) +def masked_values(x, value, rtol=1e-05, atol=1e-08, shrink=True): + x = asanyarray(x) + if getattr(value, 'shape', ()): + raise ValueError("da.ma.masked_values doesn't support array `value`s") + return map_blocks(np.ma.masked_values, x, value, rtol=rtol, + atol=atol, shrink=shrink) + + +@wraps(np.ma.fix_invalid) +def fix_invalid(a, fill_value=None): + a = asanyarray(a) + return a.map_blocks(np.ma.fix_invalid, fill_value=fill_value) + + +@wraps(np.ma.getdata) +def getdata(a): + a = asanyarray(a) + return a.map_blocks(np.ma.getdata) + + +@wraps(np.ma.getmaskarray) +def getmaskarray(a): + a = asanyarray(a) + return a.map_blocks(np.ma.getmaskarray) + + +def _masked_array(data, mask=np.ma.nomask, **kwargs): + dtype = kwargs.pop('masked_dtype', None) + return np.ma.masked_array(data, mask=mask, dtype=dtype, **kwargs) + + +@wraps(np.ma.masked_array) +def masked_array(data, mask=np.ma.nomask, fill_value=None, + **kwargs): + data = asanyarray(data) + inds = tuple(range(data.ndim)) + arginds = [inds, data, inds] + + if getattr(fill_value, 'shape', ()): + raise ValueError("non-scalar fill_value not supported") + kwargs['fill_value'] = fill_value + + if mask is not np.ma.nomask: + mask = asanyarray(mask) + if mask.size == 1: + mask = mask.reshape((1,) * data.ndim) + elif data.shape != mask.shape: + raise np.ma.MaskError("Mask and data not compatible: data shape " + "is %s, and mask shape is " + "%s." % (repr(data.shape), repr(mask.shape))) + arginds.extend([mask, inds]) + + if 'dtype' in kwargs: + kwargs['masked_dtype'] = kwargs['dtype'] + else: + kwargs['dtype'] = data.dtype + + return atop(_masked_array, *arginds, **kwargs) + + +def _set_fill_value(x, fill_value): + if isinstance(x, np.ma.masked_array): + x = x.copy() + np.ma.set_fill_value(x, fill_value=fill_value) + return x + + +@wraps(np.ma.set_fill_value) +def set_fill_value(a, fill_value): + a = asanyarray(a) + if getattr(fill_value, 'shape', ()): + raise ValueError("da.ma.set_fill_value doesn't support array `value`s") + fill_value = np.ma.core._check_fill_value(fill_value, a.dtype) + res = a.map_blocks(_set_fill_value, fill_value) + a.dask = res.dask + a.name = res.name diff --git a/dask/array/numpy_compat.py b/dask/array/numpy_compat.py index 1ba08c302..7a289a88c 100644 --- a/dask/array/numpy_compat.py +++ b/dask/array/numpy_compat.py @@ -34,6 +34,7 @@ try: raise TypeError('Divide not working with dtype: ' 'https://github.com/numpy/numpy/issues/3484') divide = np.divide + ma_divide = np.ma.divide except TypeError: # Divide with dtype doesn't work on Python 3 @@ -47,6 +48,10 @@ except TypeError: x = x.astype(dtype) return x + ma_divide = np.ma.core._DomainedBinaryOperation(divide, + np.ma.core._DomainSafeDivide(), + 0, 1) + # functions copied from numpy try: from numpy import broadcast_to, nanprod, nancumsum, nancumprod diff --git a/dask/array/reductions.py b/dask/array/reductions.py index b9e76a5b5..2a9def705 100644 --- a/dask/array/reductions.py +++ b/dask/array/reductions.py @@ -12,14 +12,29 @@ from . import chunk from .core import _concatenate2, Array, atop, lol_tuples, handle_out from .ufunc import sqrt from .wrap import zeros, ones -from .numpy_compat import divide +from .numpy_compat import ma_divide, divide as np_divide from ..compatibility import getargspec, builtins from ..base import tokenize from ..context import _globals -from ..utils import ignoring, funcname +from ..utils import ignoring, funcname, Dispatch from .. import sharedict +# Generic functions to support chunks of different types +empty_lookup = Dispatch('empty') +empty_lookup.register((object, np.ndarray), np.empty) +empty_lookup.register(np.ma.masked_array, np.ma.empty) +divide_lookup = Dispatch('divide') +divide_lookup.register((object, np.ndarray), np_divide) +divide_lookup.register(np.ma.masked_array, ma_divide) + + +def divide(a, b, dtype=None): + key = lambda x: getattr(x, '__array_priority__', float('-inf')) + f = divide_lookup.dispatch(type(builtins.max(a, b, key=key))) + return f(a, b, dtype=dtype) + + def reduction(x, chunk, aggregate, axis=None, keepdims=None, dtype=None, split_every=None, combine=None, name=None, out=None): """ General version of reductions @@ -225,8 +240,8 @@ def nannumel(x, **kwargs): def mean_chunk(x, sum=chunk.sum, numel=numel, dtype='f8', **kwargs): n = numel(x, dtype=dtype, **kwargs) total = sum(x, dtype=dtype, **kwargs) - result = np.empty(shape=n.shape, - dtype=[('total', total.dtype), ('n', n.dtype)]) + empty = empty_lookup.dispatch(type(n)) + result = empty(n.shape, dtype=[('total', total.dtype), ('n', n.dtype)]) result['n'] = n result['total'] = total return result @@ -235,7 +250,8 @@ def mean_chunk(x, sum=chunk.sum, numel=numel, dtype='f8', **kwargs): def mean_combine(pair, sum=chunk.sum, numel=numel, dtype='f8', **kwargs): n = sum(pair['n'], **kwargs) total = sum(pair['total'], **kwargs) - result = np.empty(shape=n.shape, dtype=pair.dtype) + empty = empty_lookup.dispatch(type(n)) + result = empty(n.shape, dtype=pair.dtype) result['n'] = n result['total'] = total return result @@ -275,14 +291,15 @@ with ignoring(AttributeError): def moment_chunk(A, order=2, sum=chunk.sum, numel=numel, dtype='f8', **kwargs): total = sum(A, dtype=dtype, **kwargs) - n = numel(A, **kwargs).astype(np.int64, copy=False) + n = numel(A, **kwargs).astype(np.int64) u = total / n - M = np.empty(shape=n.shape + (order - 1,), dtype=dtype) + empty = empty_lookup.dispatch(type(n)) + M = empty(n.shape + (order - 1,), dtype=dtype) for i in range(2, order + 1): M[..., i - 2] = sum((A - u)**i, dtype=dtype, **kwargs) - result = np.empty(shape=n.shape, dtype=[('total', total.dtype), - ('n', n.dtype), - ('M', M.dtype, (order - 1,))]) + result = empty(n.shape, dtype=[('total', total.dtype), + ('n', n.dtype), + ('M', M.dtype, (order - 1,))]) result['total'] = total result['n'] = n result['M'] = M @@ -308,14 +325,15 @@ def moment_combine(data, order=2, ddof=0, dtype='f8', sum=np.sum, **kwargs): n = sum(ns, **kwargs) mu = divide(total, n, dtype=dtype) inner_term = divide(totals, ns, dtype=dtype) - mu - M = np.empty(shape=n.shape + (order - 1,), dtype=dtype) + empty = empty_lookup.dispatch(type(n)) + M = empty(n.shape + (order - 1,), dtype=dtype) for o in range(2, order + 1): M[..., o - 2] = _moment_helper(Ms, ns, inner_term, o, sum, kwargs) - result = np.zeros(shape=n.shape, dtype=[('total', total.dtype), - ('n', n.dtype), - ('M', Ms.dtype, (order - 1,))]) + result = empty(n.shape, dtype=[('total', total.dtype), + ('n', n.dtype), + ('M', Ms.dtype, (order - 1,))]) result['total'] = total result['n'] = n result['M'] = M @@ -471,6 +489,13 @@ def arg_chunk(func, argfunc, x, axis, offset_info): else: arg += offset_info + if isinstance(vals, np.ma.masked_array): + if 'min' in argfunc.__name__: + fill_value = np.ma.minimum_fill_value(vals) + else: + fill_value = np.ma.maximum_fill_value(vals) + vals = np.ma.filled(vals, fill_value) + result = np.empty(shape=vals.shape, dtype=[('vals', vals.dtype), ('arg', arg.dtype)]) result['vals'] = vals @@ -653,14 +678,28 @@ def cumreduction(func, binop, ident, x, axis, dtype=None, out=None): return handle_out(out, result) +def _cumsum_merge(a, b): + if isinstance(a, np.ma.masked_array) or isinstance(b, np.ma.masked_array): + values = np.ma.getdata(a) + np.ma.getdata(b) + return np.ma.masked_array(values, mask=np.ma.getmaskarray(b)) + return a + b + + +def _cumprod_merge(a, b): + if isinstance(a, np.ma.masked_array) or isinstance(b, np.ma.masked_array): + values = np.ma.getdata(a) * np.ma.getdata(b) + return np.ma.masked_array(values, mask=np.ma.getmaskarray(b)) + return a * b + + @wraps(np.cumsum) def cumsum(x, axis, dtype=None, out=None): - return cumreduction(np.cumsum, operator.add, 0, x, axis, dtype, out=out) + return cumreduction(np.cumsum, _cumsum_merge, 0, x, axis, dtype, out=out) @wraps(np.cumprod) def cumprod(x, axis, dtype=None, out=None): - return cumreduction(np.cumprod, operator.mul, 1, x, axis, dtype, out=out) + return cumreduction(np.cumprod, _cumprod_merge, 1, x, axis, dtype, out=out) def validate_axis(ndim, axis): diff --git a/dask/array/routines.py b/dask/array/routines.py index 53081d46a..e07082bb3 100644 --- a/dask/array/routines.py +++ b/dask/array/routines.py @@ -14,12 +14,11 @@ from toolz import concat, sliding_window, interleave from .. import sharedict from ..core import flatten from ..base import tokenize -from ..utils import package_of from . import numpy_compat, chunk from .core import (Array, map_blocks, elemwise, from_array, asarray, concatenate, stack, atop, broadcast_shapes, - is_scalar_for_elemwise, broadcast_to) + is_scalar_for_elemwise, broadcast_to, tensordot_lookup) @wraps(np.array) @@ -111,8 +110,8 @@ ALPHABET = alphabet.upper() def _tensordot(a, b, axes): x = max([a, b], key=lambda x: x.__array_priority__) - module = package_of(type(x)) or np - x = module.tensordot(a, b, axes=axes) + tensordot = tensordot_lookup.dispatch(type(x)) + x = tensordot(a, b, axes=axes) ind = [slice(None, None)] * x.ndim for a in sorted(axes[0]): ind.insert(a, None) diff --git a/dask/utils.py b/dask/utils.py index 51f703f2b..f16a3c283 100644 --- a/dask/utils.py +++ b/dask/utils.py @@ -824,28 +824,6 @@ def ensure_dict(d): return dict(d) -_packages = {} - - -def package_of(typ): - """ Return package containing type's definition - - Or return None if not found - """ - try: - return _packages[typ] - except KeyError: - # http://stackoverflow.com/questions/43462701/get-package-of-python-object/43462865#43462865 - mod = inspect.getmodule(typ) - if not mod: - result = None - else: - base, _sep, _stem = mod.__name__.partition('.') - result = sys.modules[base] - _packages[typ] = result - return result - - # XXX: Kept to keep old versions of distributed/dask in sync. After # distributed's dask requirement is updated to > this commit, this function can # be moved to dask.bytes.utils. diff --git a/docs/source/array-api.rst b/docs/source/array-api.rst index 2091bd746..98ff6fa02 100644 --- a/docs/source/array-api.rst +++ b/docs/source/array-api.rst @@ -192,6 +192,28 @@ Linear Algebra linalg.svd_compressed linalg.tsqr +Masked Arrays +~~~~~~~~~~~~~ + +.. autosummary:: + ma.filled + ma.fix_invalid + ma.getdata + ma.getmaskarray + ma.masked_array + ma.masked_equal + ma.masked_greater + ma.masked_greater_equal + ma.masked_inside + ma.masked_invalid + ma.masked_less + ma.masked_less_equal + ma.masked_not_equal + ma.masked_outside + ma.masked_values + ma.masked_where + ma.set_fill_value + Random ~~~~~~ @@ -458,6 +480,25 @@ Other functions .. autofunction:: svd_compressed .. autofunction:: tsqr +.. currentmodule:: dask.array.ma +.. autofunction:: filled +.. autofunction:: fix_invalid +.. autofunction:: getdata +.. autofunction:: getmaskarray +.. autofunction:: masked_array +.. autofunction:: masked_equal +.. autofunction:: masked_greater +.. autofunction:: masked_greater_equal +.. autofunction:: masked_inside +.. autofunction:: masked_invalid +.. autofunction:: masked_less +.. autofunction:: masked_less_equal +.. autofunction:: masked_not_equal +.. autofunction:: masked_outside +.. autofunction:: masked_values +.. autofunction:: masked_where +.. autofunction:: set_fill_value + .. currentmodule:: dask.array.ghost .. autofunction:: ghost diff --git a/docs/source/array-sparse.rst b/docs/source/array-sparse.rst index df2a2c8c7..952c9d591 100644 --- a/docs/source/array-sparse.rst +++ b/docs/source/array-sparse.rst @@ -55,18 +55,21 @@ following operations: 1. Simple slicing with slices, lists, and elements (for slicing, rechunking, reshaping, etc). -2. A ``concatenate`` function at the top level of the package (for assembling - results) +2. A ``concatenate`` function matching the interface of ``np.concatenate``. + This must be registered in ``dask.array.core.concatenate_lookup``. 3. All ufuncs must support the full ufunc interface, including ``dtype=`` and ``out=`` parameters (even if they don't function properly) 4. All reductions must support the full ``axis=`` and ``keepdims=`` keywords and behave like numpy in this respect 5. The array class should follow the ``__array_priority__`` protocol and be prepared to respond to other arrays of lower priority. +6. If ``dot`` support is desired, a ``tensordot`` function matching the + interface of ``np.tensordot`` should be registered in + ``dask.array.core.tensordot_lookup``. -The implementation of other operations like tensordot, reshape, transpose, etc. +The implementation of other operations like reshape, transpose, etc. should follow standard NumPy conventions regarding shape and dtype. Not -implementing these is fine; the parallel dask.array will err at runtime if +implementing these is fine; the parallel ``dask.array`` will err at runtime if these operations are attempted.
nan vs mask I have a use case where I want to perform some statistical processing over a large data set. So, naturally I want to leverage all the awesome goodness that's baked into dask ... however, my data has an MDI. I'm glad to see that there is nan support already in dask.array, and as a strategy that helps me move forward somewhat - although things are a wee bit clunky in the case of integral data types. Normally, I'd turn to masked arrays, but that's clearly not an option currently within dask. I've seen peppered requests over time from the community for masked support in dask, but it seems to be a big ask, otherwise I guess it would've been already implemented. Would it be possible to have some guidance/clarity from the dask devs as to whether such a feature is realistically and technically viable? and just as importantly, is it really desireable from your point of view? It would be most helpful to understand if there is a genuine appetite to have masked array support within dask, or whether the effort/issues involved simply outweigh the benefit, rendering such a feature request not feasible/worthwhile. Many thanks in advance
dask/dask
diff --git a/dask/array/tests/test_masked.py b/dask/array/tests/test_masked.py new file mode 100644 index 000000000..a594bbfb9 --- /dev/null +++ b/dask/array/tests/test_masked.py @@ -0,0 +1,315 @@ +import random +from itertools import product + +import numpy as np +import pytest + +import dask.array as da +from dask.base import tokenize +from dask.array.utils import assert_eq + +pytest.importorskip("dask.array.ma") + + +def test_tokenize_masked_array(): + m = np.ma.masked_array([1, 2, 3], mask=[True, True, False], fill_value=10) + m2 = np.ma.masked_array([1, 2, 3], mask=[True, True, False], fill_value=0) + m3 = np.ma.masked_array([1, 2, 3], mask=False, fill_value=10) + assert tokenize(m) == tokenize(m) + assert tokenize(m2) == tokenize(m2) + assert tokenize(m3) == tokenize(m3) + assert tokenize(m) != tokenize(m2) + assert tokenize(m) != tokenize(m3) + + +def test_from_array_masked_array(): + m = np.ma.masked_array([1, 2, 3], mask=[True, True, False], fill_value=10) + dm = da.from_array(m, chunks=(2,), asarray=False) + assert_eq(dm, m) + + +functions = [ + lambda x: x, + lambda x: da.expm1(x), + lambda x: 2 * x, + lambda x: x / 2, + lambda x: x**2, + lambda x: x + x, + lambda x: x * x, + lambda x: x[0], + lambda x: x[:, 1], + lambda x: x[:1, None, 1:3], + lambda x: x.T, + lambda x: da.transpose(x, (1, 2, 0)), + lambda x: x.sum(), + lambda x: x.dot(np.arange(x.shape[-1])), + lambda x: x.dot(np.eye(x.shape[-1])), + lambda x: da.tensordot(x, np.ones(x.shape[:2]), axes=[(0, 1), (0, 1)]), + lambda x: x.sum(axis=0), + lambda x: x.max(axis=0), + lambda x: x.sum(axis=(1, 2)), + lambda x: x.astype(np.complex128), + lambda x: x.map_blocks(lambda x: x * 2), + lambda x: x.round(1), + lambda x: x.reshape((x.shape[0] * x.shape[1], x.shape[2])), + lambda x: abs(x), + lambda x: x > 0.5, + lambda x: x.rechunk((4, 4, 4)), + lambda x: x.rechunk((2, 2, 1)), +] + + [email protected]('func', functions) +def test_basic(func): + x = da.random.random((2, 3, 4), chunks=(1, 2, 2)) + x[x < 0.4] = 0 + + y = da.ma.masked_equal(x, 0) + + xx = func(x) + yy = func(y) + + assert_eq(xx, da.ma.filled(yy, 0)) + + if yy.shape: + zz = yy.compute() + assert isinstance(zz, np.ma.masked_array) + + +def test_tensordot(): + x = da.random.random((2, 3, 4), chunks=(1, 2, 2)) + x[x < 0.4] = 0 + y = da.random.random((4, 3, 2), chunks=(2, 2, 1)) + y[y < 0.4] = 0 + + xx = da.ma.masked_equal(x, 0) + yy = da.ma.masked_equal(y, 0) + + assert_eq(da.tensordot(x, y, axes=(2, 0)), + da.ma.filled(da.tensordot(xx, yy, axes=(2, 0)), 0)) + assert_eq(da.tensordot(x, y, axes=(1, 1)), + da.ma.filled(da.tensordot(xx, yy, axes=(1, 1)), 0)) + assert_eq(da.tensordot(x, y, axes=((1, 2), (1, 0))), + da.ma.filled(da.tensordot(xx, yy, axes=((1, 2), (1, 0))), 0)) + + [email protected]('func', functions) +def test_mixed_concatenate(func): + x = da.random.random((2, 3, 4), chunks=(1, 2, 2)) + y = da.random.random((2, 3, 4), chunks=(1, 2, 2)) + + y[y < 0.4] = 0 + yy = da.ma.masked_equal(y, 0) + + d = da.concatenate([x, y], axis=0) + s = da.concatenate([x, yy], axis=0) + + dd = func(d) + ss = func(s) + assert_eq(dd, ss) + + [email protected]('func', functions) +def test_mixed_random(func): + d = da.random.random((4, 3, 4), chunks=(1, 2, 2)) + d[d < 0.4] = 0 + + fn = lambda x: np.ma.masked_equal(x, 0) if random.random() < 0.5 else x + s = d.map_blocks(fn) + + dd = func(d) + ss = func(s) + + assert_eq(dd, ss) + + +def test_mixed_output_type(): + y = da.random.random((10, 10), chunks=(5, 5)) + y[y < 0.4] = 0 + + y = da.ma.masked_equal(y, 0) + x = da.zeros((10, 1), chunks=(5, 1)) + + z = da.concatenate([x, y], axis=1) + assert z.shape == (10, 11) + zz = z.compute() + assert isinstance(zz, np.ma.masked_array) + + +def test_creation_functions(): + x = np.array([-2, -1, 0, 1, 2] * 20).reshape((10, 10)) + y = np.array([-2, 0, 1, 1, 0] * 2) + dx = da.from_array(x, chunks=5) + dy = da.from_array(y, chunks=4) + + sol = np.ma.masked_greater(x, y) + for (a, b) in product([dx, x], [dy, y]): + assert_eq(da.ma.masked_greater(a, b), sol) + + # These are all the same as masked_greater, just check for correct op + assert_eq(da.ma.masked_greater(dx, 0), np.ma.masked_greater(x, 0)) + assert_eq(da.ma.masked_greater_equal(dx, 0), np.ma.masked_greater_equal(x, 0)) + assert_eq(da.ma.masked_less(dx, 0), np.ma.masked_less(x, 0)) + assert_eq(da.ma.masked_less_equal(dx, 0), np.ma.masked_less_equal(x, 0)) + assert_eq(da.ma.masked_equal(dx, 0), np.ma.masked_equal(x, 0)) + assert_eq(da.ma.masked_not_equal(dx, 0), np.ma.masked_not_equal(x, 0)) + + # masked_where + assert_eq(da.ma.masked_where(False, dx), np.ma.masked_where(False, x)) + assert_eq(da.ma.masked_where(dx > 2, dx), np.ma.masked_where(x > 2, x)) + + with pytest.raises(IndexError): + da.ma.masked_where((dx > 2)[:, 0], dx) + + assert_eq(da.ma.masked_inside(dx, -1, 1), np.ma.masked_inside(x, -1, 1)) + assert_eq(da.ma.masked_outside(dx, -1, 1), np.ma.masked_outside(x, -1, 1)) + assert_eq(da.ma.masked_values(dx, -1), np.ma.masked_values(x, -1)) + + # masked_equal and masked_values in numpy sets the fill_value to `value`, + # which can sometimes be an array. This is hard to support in dask, so we + # forbid it. Check that this isn't supported: + with pytest.raises(ValueError): + da.ma.masked_equal(dx, dy) + + with pytest.raises(ValueError): + da.ma.masked_values(dx, dy) + + y = x.astype('f8') + y[0, 0] = y[7, 5] = np.nan + dy = da.from_array(y, chunks=5) + + assert_eq(da.ma.masked_invalid(dy), np.ma.masked_invalid(y)) + + my = np.ma.masked_greater(y, 0) + dmy = da.ma.masked_greater(dy, 0) + + assert_eq(da.ma.fix_invalid(dmy, fill_value=0), + np.ma.fix_invalid(my, fill_value=0)) + + +def test_filled(): + x = np.array([-2, -1, 0, 1, 2] * 20).reshape((10, 10)) + dx = da.from_array(x, chunks=5) + + mx = np.ma.masked_equal(x, 0) + mdx = da.ma.masked_equal(dx, 0) + + assert_eq(da.ma.filled(mdx), np.ma.filled(mx)) + assert_eq(da.ma.filled(mdx, -5), np.ma.filled(mx, -5)) + + +def assert_eq_ma(a, b): + res = a.compute() + assert type(res) == type(b) + if hasattr(res, 'mask'): + np.testing.assert_equal(res.mask, b.mask) + a = da.ma.filled(a) + b = np.ma.filled(b) + assert_eq(a, b, equal_nan=True) + + [email protected]('dtype', ('i8', 'f8')) [email protected]('reduction', ['sum', 'prod', 'mean', 'var', 'std', + 'min', 'max', 'any', 'all']) +def test_reductions(dtype, reduction): + x = (np.random.RandomState(42).rand(11, 11) * 10).astype(dtype) + dx = da.from_array(x, chunks=(4, 4)) + mx = np.ma.masked_greater(x, 5) + mdx = da.ma.masked_greater(dx, 5) + + dfunc = getattr(da, reduction) + func = getattr(np, reduction) + + assert_eq_ma(dfunc(mdx), func(mx)) + assert_eq_ma(dfunc(mdx, axis=0), func(mx, axis=0)) + assert_eq_ma(dfunc(mdx, keepdims=True, split_every=4), + func(mx, keepdims=True)) + assert_eq_ma(dfunc(mdx, axis=0, split_every=2), func(mx, axis=0)) + assert_eq_ma(dfunc(mdx, axis=0, keepdims=True, split_every=2), + func(mx, axis=0, keepdims=True)) + assert_eq_ma(dfunc(mdx, axis=1, split_every=2), func(mx, axis=1)) + assert_eq_ma(dfunc(mdx, axis=1, keepdims=True, split_every=2), + func(mx, axis=1, keepdims=True)) + + [email protected]('reduction', ['argmin', 'argmax']) +def test_arg_reductions(reduction): + x = np.random.random((10, 10, 10)) + dx = da.from_array(x, chunks=(3, 4, 5)) + mx = np.ma.masked_greater(x, 0.4) + dmx = da.ma.masked_greater(dx, 0.4) + + dfunc = getattr(da, reduction) + func = getattr(np, reduction) + + assert_eq_ma(dfunc(dmx), func(mx)) + assert_eq_ma(dfunc(dmx, 0), func(mx, 0)) + assert_eq_ma(dfunc(dmx, 1), func(mx, 1)) + assert_eq_ma(dfunc(dmx, 2), func(mx, 2)) + + +def test_cumulative(): + x = np.random.RandomState(0).rand(20, 24, 13) + dx = da.from_array(x, chunks=(6, 5, 4)) + mx = np.ma.masked_greater(x, 0.4) + dmx = da.ma.masked_greater(dx, 0.4) + + for axis in [0, 1, 2]: + assert_eq_ma(dmx.cumsum(axis=axis), mx.cumsum(axis=axis)) + assert_eq_ma(dmx.cumprod(axis=axis), mx.cumprod(axis=axis)) + + +def test_accessors(): + x = np.random.random((10, 10)) + dx = da.from_array(x, chunks=(3, 4)) + mx = np.ma.masked_greater(x, 0.4) + dmx = da.ma.masked_greater(dx, 0.4) + + assert_eq(da.ma.getmaskarray(dmx), np.ma.getmaskarray(mx)) + assert_eq(da.ma.getmaskarray(dx), np.ma.getmaskarray(x)) + assert_eq(da.ma.getdata(dmx), np.ma.getdata(mx)) + assert_eq(da.ma.getdata(dx), np.ma.getdata(x)) + + +def test_masked_array(): + x = np.random.random((10, 10)).astype('f4') + dx = da.from_array(x, chunks=(3, 4)) + f1 = da.from_array(np.array(1), chunks=()) + + fill_values = [(None, None), (0.5, 0.5), (1, f1)] + for data, (df, f) in product([x, dx], fill_values): + assert_eq(da.ma.masked_array(data, fill_value=df), + np.ma.masked_array(x, fill_value=f)) + assert_eq(da.ma.masked_array(data, mask=data > 0.4, fill_value=df), + np.ma.masked_array(x, mask=x > 0.4, fill_value=f)) + assert_eq(da.ma.masked_array(data, mask=data > 0.4, fill_value=df), + np.ma.masked_array(x, mask=x > 0.4, fill_value=f)) + assert_eq(da.ma.masked_array(data, fill_value=df, dtype='f8'), + np.ma.masked_array(x, fill_value=f, dtype='f8')) + + with pytest.raises(ValueError): + da.ma.masked_array(dx, fill_value=dx) + + with pytest.raises(np.ma.MaskError): + da.ma.masked_array(dx, mask=dx[:3, :3]) + + +def test_set_fill_value(): + x = np.random.randint(0, 10, (10, 10)) + dx = da.from_array(x, chunks=(3, 4)) + mx = np.ma.masked_greater(x, 3) + dmx = da.ma.masked_greater(dx, 3) + + da.ma.set_fill_value(dmx, -10) + np.ma.set_fill_value(mx, -10) + assert_eq_ma(dmx, mx) + + da.ma.set_fill_value(dx, -10) + np.ma.set_fill_value(x, -10) + assert_eq_ma(dx, x) + + with pytest.raises(TypeError): + da.ma.set_fill_value(dmx, 1e20) + + with pytest.raises(ValueError): + da.ma.set_fill_value(dmx, dx) diff --git a/dask/tests/test_utils.py b/dask/tests/test_utils.py index a7780279a..5258cccd4 100644 --- a/dask/tests/test_utils.py +++ b/dask/tests/test_utils.py @@ -8,7 +8,7 @@ from dask.sharedict import ShareDict from dask.utils import (takes_multiple_arguments, Dispatch, random_state_data, memory_repr, methodcaller, M, skip_doctest, SerializableLock, funcname, ndeepmap, ensure_dict, - package_of, extra_titles, asciitable, itemgetter) + extra_titles, asciitable, itemgetter) from dask.utils_test import inc @@ -304,17 +304,6 @@ def test_ensure_dict(): assert ensure_dict(md) == d -def test_package_of(): - import math - assert package_of(math.sin) is math - try: - import numpy - except ImportError: - pass - else: - assert package_of(numpy.memmap) is numpy - - def test_itemgetter(): data = [1, 2, 3] g = itemgetter(1)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 3, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 8 }
0.15
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[complete]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-xdist", "pytest-mock", "pytest-asyncio", "numpy>=1.16.0", "pandas>=1.0.0" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiobotocore==2.1.2 aiohttp==3.8.6 aioitertools==0.11.0 aiosignal==1.2.0 async-timeout==4.0.2 asynctest==0.13.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work botocore==1.23.24 certifi==2021.5.30 charset-normalizer==3.0.1 click==8.0.4 cloudpickle==2.2.1 -e git+https://github.com/dask/dask.git@db7bee4cdd4eeabcf192f3f6c65ee34ac7865ccb#egg=dask distributed==1.19.3 execnet==1.9.0 frozenlist==1.2.0 fsspec==2022.1.0 HeapDict==1.0.1 idna==3.10 idna-ssl==1.1.0 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work jmespath==0.10.0 locket==1.0.0 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work msgpack-python==0.5.6 multidict==5.2.0 numpy==1.19.5 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pandas==1.1.5 partd==1.2.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work psutil==7.0.0 py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-asyncio==0.16.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 python-dateutil==2.9.0.post0 pytz==2025.2 s3fs==2022.1.0 six==1.17.0 sortedcontainers==2.4.0 tblib==1.7.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work toolz==0.12.0 tornado==6.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 wrapt==1.16.0 yarl==1.7.2 zict==2.1.0 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: dask channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - aiobotocore==2.1.2 - aiohttp==3.8.6 - aioitertools==0.11.0 - aiosignal==1.2.0 - async-timeout==4.0.2 - asynctest==0.13.0 - botocore==1.23.24 - charset-normalizer==3.0.1 - click==8.0.4 - cloudpickle==2.2.1 - distributed==1.19.3 - execnet==1.9.0 - frozenlist==1.2.0 - fsspec==2022.1.0 - heapdict==1.0.1 - idna==3.10 - idna-ssl==1.1.0 - jmespath==0.10.0 - locket==1.0.0 - msgpack-python==0.5.6 - multidict==5.2.0 - numpy==1.19.5 - pandas==1.1.5 - partd==1.2.0 - psutil==7.0.0 - pytest-asyncio==0.16.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - python-dateutil==2.9.0.post0 - pytz==2025.2 - s3fs==2022.1.0 - six==1.17.0 - sortedcontainers==2.4.0 - tblib==1.7.0 - toolz==0.12.0 - tornado==6.1 - urllib3==1.26.20 - wrapt==1.16.0 - yarl==1.7.2 - zict==2.1.0 prefix: /opt/conda/envs/dask
[ "dask/array/tests/test_masked.py::test_tokenize_masked_array", "dask/array/tests/test_masked.py::test_from_array_masked_array", "dask/array/tests/test_masked.py::test_basic[<lambda>0]", "dask/array/tests/test_masked.py::test_basic[<lambda>1]", "dask/array/tests/test_masked.py::test_basic[<lambda>2]", "dask/array/tests/test_masked.py::test_basic[<lambda>3]", "dask/array/tests/test_masked.py::test_basic[<lambda>4]", "dask/array/tests/test_masked.py::test_basic[<lambda>5]", "dask/array/tests/test_masked.py::test_basic[<lambda>6]", "dask/array/tests/test_masked.py::test_basic[<lambda>7]", "dask/array/tests/test_masked.py::test_basic[<lambda>8]", "dask/array/tests/test_masked.py::test_basic[<lambda>9]", "dask/array/tests/test_masked.py::test_basic[<lambda>10]", "dask/array/tests/test_masked.py::test_basic[<lambda>11]", "dask/array/tests/test_masked.py::test_basic[<lambda>12]", "dask/array/tests/test_masked.py::test_basic[<lambda>13]", "dask/array/tests/test_masked.py::test_basic[<lambda>14]", "dask/array/tests/test_masked.py::test_basic[<lambda>15]", "dask/array/tests/test_masked.py::test_basic[<lambda>16]", "dask/array/tests/test_masked.py::test_basic[<lambda>17]", "dask/array/tests/test_masked.py::test_basic[<lambda>18]", "dask/array/tests/test_masked.py::test_basic[<lambda>19]", "dask/array/tests/test_masked.py::test_basic[<lambda>20]", "dask/array/tests/test_masked.py::test_basic[<lambda>21]", "dask/array/tests/test_masked.py::test_basic[<lambda>22]", "dask/array/tests/test_masked.py::test_basic[<lambda>23]", "dask/array/tests/test_masked.py::test_basic[<lambda>24]", "dask/array/tests/test_masked.py::test_basic[<lambda>25]", "dask/array/tests/test_masked.py::test_basic[<lambda>26]", "dask/array/tests/test_masked.py::test_tensordot", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>0]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>1]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>2]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>3]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>4]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>5]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>6]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>7]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>8]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>9]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>10]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>11]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>12]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>13]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>14]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>15]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>16]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>17]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>18]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>19]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>20]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>21]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>22]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>23]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>24]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>25]", "dask/array/tests/test_masked.py::test_mixed_concatenate[<lambda>26]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>0]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>1]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>2]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>3]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>4]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>5]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>6]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>7]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>8]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>9]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>10]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>11]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>12]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>13]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>14]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>15]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>16]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>17]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>18]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>19]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>20]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>21]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>22]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>23]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>24]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>25]", "dask/array/tests/test_masked.py::test_mixed_random[<lambda>26]", "dask/array/tests/test_masked.py::test_mixed_output_type", "dask/array/tests/test_masked.py::test_creation_functions", "dask/array/tests/test_masked.py::test_filled", "dask/array/tests/test_masked.py::test_arg_reductions[argmin]", "dask/array/tests/test_masked.py::test_arg_reductions[argmax]", "dask/array/tests/test_masked.py::test_cumulative", "dask/array/tests/test_masked.py::test_accessors", "dask/array/tests/test_masked.py::test_masked_array", "dask/array/tests/test_masked.py::test_set_fill_value" ]
[ "dask/array/tests/test_masked.py::test_reductions[sum-i8]", "dask/array/tests/test_masked.py::test_reductions[sum-f8]", "dask/array/tests/test_masked.py::test_reductions[prod-i8]", "dask/array/tests/test_masked.py::test_reductions[prod-f8]", "dask/array/tests/test_masked.py::test_reductions[mean-i8]", "dask/array/tests/test_masked.py::test_reductions[mean-f8]", "dask/array/tests/test_masked.py::test_reductions[var-i8]", "dask/array/tests/test_masked.py::test_reductions[var-f8]", "dask/array/tests/test_masked.py::test_reductions[std-i8]", "dask/array/tests/test_masked.py::test_reductions[std-f8]", "dask/array/tests/test_masked.py::test_reductions[min-i8]", "dask/array/tests/test_masked.py::test_reductions[min-f8]", "dask/array/tests/test_masked.py::test_reductions[max-i8]", "dask/array/tests/test_masked.py::test_reductions[max-f8]", "dask/array/tests/test_masked.py::test_reductions[any-i8]", "dask/array/tests/test_masked.py::test_reductions[any-f8]", "dask/array/tests/test_masked.py::test_reductions[all-i8]", "dask/array/tests/test_masked.py::test_reductions[all-f8]" ]
[ "dask/tests/test_utils.py::test_takes_multiple_arguments", "dask/tests/test_utils.py::test_dispatch", "dask/tests/test_utils.py::test_dispatch_lazy", "dask/tests/test_utils.py::test_random_state_data", "dask/tests/test_utils.py::test_memory_repr", "dask/tests/test_utils.py::test_method_caller", "dask/tests/test_utils.py::test_skip_doctest", "dask/tests/test_utils.py::test_extra_titles", "dask/tests/test_utils.py::test_asciitable", "dask/tests/test_utils.py::test_SerializableLock", "dask/tests/test_utils.py::test_SerializableLock_name_collision", "dask/tests/test_utils.py::test_funcname", "dask/tests/test_utils.py::test_funcname_toolz", "dask/tests/test_utils.py::test_ndeepmap", "dask/tests/test_utils.py::test_ensure_dict", "dask/tests/test_utils.py::test_itemgetter" ]
[]
BSD 3-Clause "New" or "Revised" License
1,231
[ "dask/array/numpy_compat.py", "dask/array/reductions.py", "docs/source/array-api.rst", "dask/array/routines.py", "dask/array/core.py", "docs/source/array-sparse.rst", "dask/array/__init__.py", "dask/array/ma.py", "dask/utils.py" ]
[ "dask/array/numpy_compat.py", "dask/array/reductions.py", "docs/source/array-api.rst", "dask/array/routines.py", "dask/array/core.py", "docs/source/array-sparse.rst", "dask/array/__init__.py", "dask/array/ma.py", "dask/utils.py" ]
streamlink__streamlink-886
d6a52a53a63ce2648781d529728f9fa9767d6522
2017-05-05 16:07:06
9ad8bb2f20ea86aaefae89483af8a4f1015e561a
diff --git a/.travis.yml b/.travis.yml index c6871830..874d4514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,9 @@ addons: packages: - nsis +before_deploy: + - ./script/bintrayconfig.sh + deploy: - provider: releases api_key: "${RELEASES_API_KEY}" @@ -54,15 +57,19 @@ deploy: on: tags: true condition: $BUILD_INSTALLER = yes - - provider: s3 + - provider: bintray + file: build/bintray-nightly.json + user: "${BINTRAY_USER}" + key: "${BINTRAY_KEY}" skip_cleanup: true - local_dir: $STREAMLINK_INSTALLER_DIST_DIR - bucket: streamlink-builds - upload-dir: nightly/windows on: branch: master - condition: $BUILD_INSTALLER = yes - secret_access_key: - secure: 3abBcpXNxhWDJyznMA/wDmQ+lUSaJVwi62aXHjFxA7Zrz/CidbHmXkNedViWTOivMyVcM4Ypej4JD1V74Uo78GN09TICRbSc9fTF08O8Hu+hKiAcVWepfmuV54nyoQHY5mcxBPwgUZwnTwSYLzKXCqDEmQXrUrM313m4f2cbDSQgo6VPoCqE+U7JTVaUI6asutsErvK7vfw9EqGSumndRNjQdD0triubs5kh6WPv5STpKrkUNWX95fjBbkuf5hy+DIQN22hLpHYwqV3DoTnhWzbPy8/OnCKoUjEAspLehkjr86brwuls1UfR1uC2uG53O2Rb3CCYkZSVC7GKdEw0SnbLNVfbhy500a8AiPbWC0AV75PidXNEe+1zye4n/xKdx0KA8aRXr7v/89x7KibHNpwf6rdpx7axYhlsWcFcyfoOTZJ3thhu7ib9QYJZ7gkRVGWbawZU6I370I5sMJLIwmzBXgZ2y8jFk7LUNbb2GUS3LKcw5gRYOqo+ZEHFdiLpPYXFHUslTkpaMNoPCNUR7Tsa2JPfJ29yEDMsdDs2lJbP+Km8hAnpkyJfpfPcVUcl8Ootd1cTe8iPdD1nqt3KvIy4sCjkCxvQFnmGOTWFqXY/UDD+Yqo3IVOG1aLPR3UxhzHtPX6M5FxtNB22kv8hrbN/QxhBEo/SfNhGIGZJNdI= - access_key_id: - secure: sjjc1tM756TvFbD8+0VCs/MOLFRhY+VZv/lq7pvNldtbGdv21lcJguvgg0gUwUZ7SihceyL1YagfUlDU2vWS1N5Si04z0VUcHO4lbj9nUJ4CXy27pMNFuk92HmblxYQ4bJw/xVqzsrT9Zeh4tIrbV+F3lYXtg7FDqjpm5bqrUJ5ULyWbhax31s2k8JRVnG2fxVmJiU+j4zwgzCqeZJXQkvXsfdzSe88mLyIrl7Otfjlp1rySocxStQ8qlmkvRAmsYmsKriUq+VgtX21HFAIJqHQp4WbL15eh0aFFzbmORf7OMIKmsmkyeYYeM6xp+Jm9m7ZcWHZ+7siplVM/9ksmumN3+CGp6pogduZ5zFH4BtRQa9o8N2SWnPiPvMrpoyLbHbQhg/uhcMJkYI1yrzj/s9MEH7DVnDEMmgc/UKsyTC2PRwZcgqYYPHxqRVWXzvBWDUe1wtxdNyaXWWKdD/1E7u8XF2+zPTPaUNAYAF1rSi5GNF38uRNMC+QSuEm8wZ/32KXFN4m+RW3NtpT9YHI8MCo4ofVxpRUMcEUwPDF/jV5zW7Krz7LEeL5/zcHMcNay/Ls8e3eApQShAcLAx1jZo+EjznVGXtlRbH9ABXmPO5AcxUH5+20tMiMoj0q6hJen03X8Jx+OMmcDNDufDgPikSym3KVC3Lvj65lG4G9pAyY= + condition: $BUILD_INSTALLER = yes && $TRAVIS_EVENT_TYPE == cron + - provider: bintray + file: build/bintray-latest.json + user: "${BINTRAY_USER}" + key: "${BINTRAY_KEY}" + skip_cleanup: true + on: + branch: master + condition: $BUILD_INSTALLER = yes && $TRAVIS_EVENT_TYPE == cron diff --git a/docs/install.rst b/docs/install.rst index f7385939..b864ae00 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -239,7 +239,7 @@ Windows binaries You can download the latest stable Windows installer from the `GitHub Releases Page <https://github.com/streamlink/streamlink/releases/latest>`__. -Alternatively, you can download the latest `nightly Windows installer <https://streamlink-builds.s3.amazonaws.com/nightly/windows/streamlink-latest.exe>`__. +Alternatively, you can download the latest `nightly Windows installer <https://dl.bintray.com/streamlink/streamlink-nightly/streamlink-latest.exe>`__. This is a installer which contains: diff --git a/script/bintrayconfig.sh b/script/bintrayconfig.sh new file mode 100755 index 00000000..f5c2f7ef --- /dev/null +++ b/script/bintrayconfig.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# +# Script to generate bintray config for nightly builds +# + +build_dir="$(pwd)/build" +nsis_dir="${build_dir}/nsis" +# get the dist directory from an environment variable, but default to the build/nsis directory +dist_dir="${STREAMLINK_INSTALLER_DIST_DIR:-$nsis_dir}" + +# TODO: extract this common version detection code in to a separate function +STREAMLINK_VERSION_PLAIN=$(python setup.py --version) +# For travis nightly builds generate a version number with commit hash +if [ -n "${TRAVIS_BRANCH}" ] && [ -z "${TRAVIS_TAG}" ]; then + STREAMLINK_VI_VERSION="${STREAMLINK_VERSION_PLAIN}.${TRAVIS_BUILD_NUMBER}" + STREAMLINK_INSTALLER="streamlink-${STREAMLINK_VERSION_PLAIN}-${TRAVIS_BUILD_NUMBER}-${TRAVIS_COMMIT:0:7}" + STREAMLINK_VERSION="${STREAMLINK_VERSION_PLAIN}+${TRAVIS_COMMIT:0:7}" +else + STREAMLINK_VI_VERSION="${STREAMLINK_VERSION_PLAIN}.${TRAVIS_BUILD_NUMBER:-0}" + STREAMLINK_VERSION="${STREAMLINK_VERSION_PLAIN}" + STREAMLINK_INSTALLER="streamlink-${STREAMLINK_VERSION}" +fi + +cat > "${build_dir}/bintray-latest.json" <<EOF +{ + "package": { + "subject": "streamlink", + "repo": "streamlink-nightly", + "name": "streamlink" + }, + + "version": { + "name": "latest", + "released": "$(date +'%Y-%m-%d')", + "desc": "Latest version of the installer (${STREAMLINK_VERSION})" + }, + + "files": [ + { + "includePattern": "${dist_dir}/${STREAMLINK_INSTALLER}.exe", + "uploadPattern": "streamlink-latest.exe", + "matrixParams": { + "override": 1, + "publish": 1 + } + } + ], + + "publish": true +} +EOF + +echo "Wrote Bintray config to: ${build_dir}/bintray-latest.json" + +cat > "${build_dir}/bintray-nightly.json" <<EOF +{ + "package": { + "subject": "streamlink", + "repo": "streamlink-nightly", + "name": "streamlink" + }, + + "version": { + "name": "$(date +'%Y.%m.%d')", + "released": "$(date +'%Y-%m-%d')", + "desc": "Streamlink Nightly based on ${STREAMLINK_VERSION}" + }, + + "files": [ + { + "includePattern": "${dist_dir}/${STREAMLINK_INSTALLER}.exe", + "uploadPattern": "streamlink-${STREAMLINK_VERSION_PLAIN}-$(date +'%Y%m%d').exe", + "matrixParams": { + "override": 1, + "publish": 1 + } + } + ], + + "publish": true +} +EOF + +echo "Wrote Bintray config to: ${build_dir}/bintray-nightly.json" diff --git a/script/makeinstaller.sh b/script/makeinstaller.sh index 935df9ee..259cce34 100755 --- a/script/makeinstaller.sh +++ b/script/makeinstaller.sh @@ -208,10 +208,5 @@ cp -r "win32/rtmpdump" "${nsis_dir}/" pynsist build/streamlink.cfg -# Make a copy of this build for the "latest" nightly -if [ -n "${TRAVIS_BRANCH}" ] && [ -z "${TRAVIS_TAG}" ]; then - cp "${dist_dir}/${STREAMLINK_INSTALLER}.exe" "${dist_dir}/streamlink-latest.exe" -fi - echo "Success!" 1>&2 echo "The installer should be in ${dist_dir}." 1>&2 diff --git a/src/streamlink/plugins/pcyourfreetv.py b/src/streamlink/plugins/pcyourfreetv.py index c116823b..968ac7d3 100644 --- a/src/streamlink/plugins/pcyourfreetv.py +++ b/src/streamlink/plugins/pcyourfreetv.py @@ -1,17 +1,19 @@ import re -from streamlink.compat import unquote +from streamlink.compat import parse_qsl, unquote from streamlink.plugin import Plugin, PluginOptions from streamlink.plugin.api import http from streamlink.stream import HLSStream class PCYourFreeTV(Plugin): + LIVE_TV_URL = 'http://pc-yourfreetv.com/indexlivetv.php?page_id=1' + _login_url = 'http://pc-yourfreetv.com/home.php' - _url_re = re.compile(r'http://pc-yourfreetv\.com/index_player\.php\?channel=.+?&page_id=\d+') - _iframe_re = re.compile(r"<iframe .*?\bsrc='(?P<iframe>.+?)'.*?</iframe>") + _url_re = re.compile(r'http://pc-yourfreetv\.com/indexplayer\.php\?channel=.+?&page_id=\d+') + _token_re = re.compile(r'\bsrc="indexplayer\.php\?channel=.+?&(?P<tokens>.+?)"') _player_re = re.compile(r"<script language=JavaScript>m='(?P<player>.+?)'", re.DOTALL) - _video_url_re = re.compile(r'new YourFreeTV.Player\({source: "(?P<video_url>[^"]+?)".+?}.*\);', re.DOTALL) + _video_url_re = re.compile(r"jwplayer\('.+?'\)\.setup\({.+?file: \"(?P<video_url>[^\"]+?)\".+?}\);", re.DOTALL) options = PluginOptions({ 'username': None, @@ -46,13 +48,14 @@ class PCYourFreeTV(Plugin): if self.login(username, password): self.logger.info("Successfully logged in as {0}", username) - # Retrieve URL iframe - res = http.get(self.url) - match = self._iframe_re.search(res.text) + # Get a fresh authorization token + res = http.get(self.LIVE_TV_URL) + match = self._token_re.search(res.text) if match is None: return - res = http.get(match.group('iframe')) + # Retrieve URL page and search for stream data + res = http.get(self.url, params=parse_qsl(match.group('tokens'))) match = self._player_re.search(res.text) if match is None: return
Nightly Hosting Costs I have been reviewing the costs for hosting the nightly builds of streamlink on S3. For the month of April, `streamlink-lastest.exe` was downloaded 11,228 times and used 133GB of transfer bandwidth. The cost of transfers was $11.98 and the cost of storage and HTTP requests was $0.69, with a total cost of $12.67+tax. With the gaining popularity of `streamlink` I can only see that cost increasing, I would like to reduce the cost a bit ($15 a month is fairly expensive for me.) With the addition of `ffmpeg` we added some nice features, and the possibility for further future enhancements, but we also bloated the installer (and the git repo, as discussed on other issues.) The installer is approx. 38MB including the `ffmpeg.exe`, and approx. 15MB without `ffmpeg.exe`. I was thinking we could remove `ffmpeg` from the installer and either allow the user to install it themselves, or download the `ffmpeg.exe` on demand in the installer. I prefer the download during the installer option as it means the user doesn't have to install it manually but the installer is smaller (we can download `ffmpeg.exe` from github). Alternatively we could set up a different repo with scheduled builds on travis, to build the nightly periodically and automatically add a release to that repo. Thoughts @gravyboat, @bastimeyer, @cdrage?
streamlink/streamlink
diff --git a/tests/test_plugin_pcyourfreetv.py b/tests/test_plugin_pcyourfreetv.py index d1ee96dc..f5664754 100644 --- a/tests/test_plugin_pcyourfreetv.py +++ b/tests/test_plugin_pcyourfreetv.py @@ -6,13 +6,13 @@ from streamlink.plugins.pcyourfreetv import PCYourFreeTV class TestPluginPCYourFreeTV(unittest.TestCase): def test_can_handle_url(self): # should match - self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=das%20erste&page_id=41")) - self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=srf%20eins&page_id=41")) - self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=bbc%20one&page_id=41")) - self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=tf1&page_id=41")) + self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=das%20erste&page_id=41")) + self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=srf%20eins&page_id=41")) + self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=bbc%20one&page_id=41")) + self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=tf1&page_id=41")) # shouldn't match self.assertFalse(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/home.php")) - self.assertFalse(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_livetv.php?page_id=1")) + self.assertFalse(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexlivetv.php?page_id=1")) self.assertFalse(PCYourFreeTV.can_handle_url("http://tvcatchup.com/")) self.assertFalse(PCYourFreeTV.can_handle_url("http://youtube.com/"))
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_added_files", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 4 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "codecov", "coverage", "mock", "pynsist" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
certifi==2025.1.31 charset-normalizer==3.4.1 codecov==2.1.13 coverage==7.8.0 distlib==0.3.9 exceptiongroup==1.2.2 idna==3.10 iniconfig==2.1.0 iso-639==0.4.5 iso3166==2.1.1 Jinja2==3.1.6 MarkupSafe==3.0.2 mock==5.2.0 packaging==24.2 pluggy==1.5.0 pycryptodome==3.22.0 pynsist==2.8 pytest==8.3.5 pytest-cov==6.0.0 requests==2.32.3 requests_download==0.1.2 -e git+https://github.com/streamlink/streamlink.git@d6a52a53a63ce2648781d529728f9fa9767d6522#egg=streamlink tomli==2.2.1 urllib3==2.3.0 yarg==0.1.10
name: streamlink channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - certifi==2025.1.31 - charset-normalizer==3.4.1 - codecov==2.1.13 - coverage==7.8.0 - distlib==0.3.9 - exceptiongroup==1.2.2 - idna==3.10 - iniconfig==2.1.0 - iso-639==0.4.5 - iso3166==2.1.1 - jinja2==3.1.6 - markupsafe==3.0.2 - mock==5.2.0 - packaging==24.2 - pluggy==1.5.0 - pycryptodome==3.22.0 - pynsist==2.8 - pytest==8.3.5 - pytest-cov==6.0.0 - requests==2.32.3 - requests-download==0.1.2 - tomli==2.2.1 - urllib3==2.3.0 - yarg==0.1.10 prefix: /opt/conda/envs/streamlink
[ "tests/test_plugin_pcyourfreetv.py::TestPluginPCYourFreeTV::test_can_handle_url" ]
[]
[]
[]
BSD 2-Clause "Simplified" License
1,232
[ ".travis.yml", "script/bintrayconfig.sh", "docs/install.rst", "src/streamlink/plugins/pcyourfreetv.py", "script/makeinstaller.sh" ]
[ ".travis.yml", "script/bintrayconfig.sh", "docs/install.rst", "src/streamlink/plugins/pcyourfreetv.py", "script/makeinstaller.sh" ]
davidhalter__jedi-922
c1c3f35e08a2404814d0463a648c562c15f1beb6
2017-05-06 12:19:45
c1c3f35e08a2404814d0463a648c562c15f1beb6
davidhalter: I like! Thanks man. Good test.
diff --git a/AUTHORS.txt b/AUTHORS.txt index b5619dcb..52204a8b 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -43,6 +43,7 @@ bstaint (@bstaint) Mathias Rav (@Mortal) <[email protected]> Daniel Fiterman (@dfit99) <[email protected]> Simon Ruggier (@sruggier) +Élie Gouzien (@ElieGouzien) Note: (@user) means a github user name. diff --git a/jedi/evaluate/compiled/mixed.py b/jedi/evaluate/compiled/mixed.py index dfb49657..1390ea47 100644 --- a/jedi/evaluate/compiled/mixed.py +++ b/jedi/evaluate/compiled/mixed.py @@ -116,8 +116,21 @@ def _load_module(evaluator, path, python_object): return module +def source_findable(python_object): + """Check if inspect.getfile has a chance to find the source.""" + return (inspect.ismodule(python_object) or + inspect.isclass(python_object) or + inspect.ismethod(python_object) or + inspect.isfunction(python_object) or + inspect.istraceback(python_object) or + inspect.isframe(python_object) or + inspect.iscode(python_object)) + + def find_syntax_node_name(evaluator, python_object): try: + if not source_findable(python_object): + raise TypeError # Prevents computation of `repr` within inspect. path = inspect.getsourcefile(python_object) except TypeError: # The type might not be known (e.g. class_with_dict.__weakref__)
Slow completion for existing object with long `__repr__` method Hi, For completion with existing objects it seems that the `__repr__()` method is evaluated for an error message within the inspect module which is afterward caught. This makes the completion as slow as `__repr__()` while this evaluation in unnecessary for the user. This method can bee rather slow with big pandas objects or custom class. This as been seen here : [qtconsole issue #90](https://github.com/jupyter/qtconsole/issues/90) A minimal code to reproduce it : ```python import jedi class Bugger(object): def __init__(self, size=10000): """Create bigg data.""" self.big_data = [list(range(i)) for i in range(size)] def easy_method(self): """Method that should be really fast.""" return self.big_data[-1][-1] def __repr__(self): output = "" for nested in self.big_data: for elem in nested: output += str(elem) output += '\n' return output test = Bugger() jedi.Interpreter('test.ea', [locals()]).completions() ``` And a more convenient working version : ```python import jedi, pdb, inspect class Bugger(object): def __init__(self, size=10): """Create bigg data.""" self.big_data = [list(range(i)) for i in range(size)] def easy_method(self): """Method that should be really fast.""" return self.big_data[-1][-1] def __repr__(self): frames = inspect.getouterframes(inspect.currentframe()) for frame in frames: print(frame) pdb.set_trace() output = "" for nested in self.big_data: for elem in nested: output += str(elem) output += '\n' return output test = Bugger() jedi.Interpreter('test.ea', [locals()]).completions() ``` Jedi seems to end here through jedi/evaluate/compiled/mixed.py, line 121. Maybe making checks before the calling `inspect.getsourcefile()` could fix it, but not I don't know jedi enough to claim it.
davidhalter/jedi
diff --git a/test/test_speed.py b/test/test_speed.py index dcb69840..8d5bc9a3 100644 --- a/test/test_speed.py +++ b/test/test_speed.py @@ -51,3 +51,19 @@ class TestSpeed(TestCase): with open('speed/precedence.py') as f: line = len(f.read().splitlines()) assert jedi.Script(line=line, path='speed/precedence.py').goto_definitions() + + @_check_speed(0.1) + def test_no_repr_computation(self): + """ + For Interpreter completion aquisition of sourcefile can trigger + unwanted computation of repr(). Exemple : big pandas data. + See issue #919. + """ + class SlowRepr(): + "class to test what happens if __repr__ is very slow." + def some_method(self): + pass + def __repr__(self): + time.sleep(0.2) + test = SlowRepr() + jedi.Interpreter('test.som', [locals()]).completions()
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 2 }
0.10
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work -e git+https://github.com/davidhalter/jedi.git@c1c3f35e08a2404814d0463a648c562c15f1beb6#egg=jedi more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: jedi channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 prefix: /opt/conda/envs/jedi
[ "test/test_speed.py::TestSpeed::test_no_repr_computation" ]
[]
[ "test/test_speed.py::TestSpeed::test_os_path_join", "test/test_speed.py::TestSpeed::test_precedence_slowdown", "test/test_speed.py::TestSpeed::test_scipy_speed" ]
[]
MIT License
1,233
[ "AUTHORS.txt", "jedi/evaluate/compiled/mixed.py" ]
[ "AUTHORS.txt", "jedi/evaluate/compiled/mixed.py" ]
jaywink__federation-73
3a2910afc2329fc4f052bd01a1eae6927a0c1ac8
2017-05-06 17:27:20
3a2910afc2329fc4f052bd01a1eae6927a0c1ac8
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ef04da..789ed19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,15 @@ Additionally, Diaspora entity mappers `message_to_objects` and `element_to_objec ### Other backwards incompatible changes * A failed payload signature verification now raises a `SignatureVerificationError` instead of a less specific `AssertionError`. -### Other additions - +### Added * Three new attributes added to entities. * Add protocol name to all entities to attribute `_source_protocol`. This might be useful for applications to know which protocol payload the entity was created from once multiple protocols are implemented. * Add source payload object to the entity at `_source_object` when processing it. * Add sender public key to the entity at `_sender_key`, but only if it was used for validating signatures. +* Add support for the new Diaspora payload properties coming in the next protocol version. Old XML payloads are and will be still supported. + +### Changed +* Refactor processing of Diaspora payload XML into entities. Diaspora protocol is dropping the `<XML><post></post></XML>` wrapper for the payloads. Payloads with the wrapper will still be parsed as before. ## [0.10.1] - 2017-03-09 diff --git a/federation/entities/diaspora/mappers.py b/federation/entities/diaspora/mappers.py index 1094513..66da0d5 100644 --- a/federation/entities/diaspora/mappers.py +++ b/federation/entities/diaspora/mappers.py @@ -21,19 +21,24 @@ MAPPINGS = { "retraction": DiasporaRetraction, } -BOOLEAN_KEYS = [ +TAGS = [ + # Order is important. Any top level tags should be before possibly child tags + "status_message", "comment", "like", "request", "profile", "retraction", "photo", +] + +BOOLEAN_KEYS = ( "public", "nsfw", -] +) -DATETIME_KEYS = [ +DATETIME_KEYS = ( "created_at", -] +) -INTEGER_KEYS = [ +INTEGER_KEYS = ( "height", "width", -] +) def xml_children_as_dict(node): """Turn the children of node <xml> into a dict, keyed by tag name. @@ -43,8 +48,8 @@ def xml_children_as_dict(node): return dict((e.tag, e.text) for e in node) -def element_to_objects(tree, sender_key_fetcher=None): - """Transform an Element tree to a list of entities recursively. +def element_to_objects(element, sender_key_fetcher=None): + """Transform an Element to a list of entities recursively. Possible child entities are added to each entity `_children` list. @@ -54,45 +59,45 @@ def element_to_objects(tree, sender_key_fetcher=None): :returns: list of entities """ entities = [] - for element in tree: - cls = MAPPINGS.get(element.tag, None) - if not cls: - continue - - attrs = xml_children_as_dict(element) - transformed = transform_attributes(attrs) - if hasattr(cls, "fill_extra_attributes"): - transformed = cls.fill_extra_attributes(transformed) - entity = cls(**transformed) - # Add protocol name - entity._source_protocol = "diaspora" - # Save element object to entity for possible later use - entity._source_object = element - # If relayable, fetch sender key for validation - if issubclass(cls, DiasporaRelayableMixin): - if sender_key_fetcher: - entity._sender_key = sender_key_fetcher(entity.handle) - else: - profile = retrieve_and_parse_profile(entity.handle) - if profile: - entity._sender_key = profile.public_key - try: - entity.validate() - except ValueError as ex: - logger.error("Failed to validate entity %s: %s", entity, ex, extra={ - "attrs": attrs, - "transformed": transformed, - }) - continue - # Do child elements - entity._children = element_to_objects(element) - # Add to entities list - entities.append(entity) - if cls == DiasporaRequest: - # We support sharing/following separately, so also generate base Relationship for the following part - transformed.update({"relationship": "following"}) - relationship = Relationship(**transformed) - entities.append(relationship) + cls = MAPPINGS.get(element.tag, None) + if not cls: + return [] + + attrs = xml_children_as_dict(element) + transformed = transform_attributes(attrs, cls) + if hasattr(cls, "fill_extra_attributes"): + transformed = cls.fill_extra_attributes(transformed) + entity = cls(**transformed) + # Add protocol name + entity._source_protocol = "diaspora" + # Save element object to entity for possible later use + entity._source_object = element + # If relayable, fetch sender key for validation + if issubclass(cls, DiasporaRelayableMixin): + if sender_key_fetcher: + entity._sender_key = sender_key_fetcher(entity.handle) + else: + profile = retrieve_and_parse_profile(entity.handle) + if profile: + entity._sender_key = profile.public_key + try: + entity.validate() + except ValueError as ex: + logger.error("Failed to validate entity %s: %s", entity, ex, extra={ + "attrs": attrs, + "transformed": transformed, + }) + return [] + # Do child elements + for child in element: + entity._children = element_to_objects(child) + # Add to entities list + entities.append(entity) + if cls == DiasporaRequest: + # We support sharing/following separately, so also generate base Relationship for the following part + transformed.update({"relationship": "following"}) + relationship = Relationship(**transformed) + entities.append(relationship) return entities @@ -106,22 +111,32 @@ def message_to_objects(message, sender_key_fetcher=None): :returns: list of entities """ doc = etree.fromstring(message) - if doc[0].tag == "post": - # Skip the top <post> element if it exists - doc = doc[0] - entities = element_to_objects(doc, sender_key_fetcher) - return entities - - -def transform_attributes(attrs): - """Transform some attribute keys.""" + # Future Diaspora protocol version contains the element at top level + if doc.tag in TAGS: + return element_to_objects(doc, sender_key_fetcher) + # Legacy Diaspora protocol wraps the element in <XML><post></post></XML>, so find the right element + for tag in TAGS: + element = doc.find(".//%s" % tag) + if element is not None: + return element_to_objects(element, sender_key_fetcher) + return [] + + +def transform_attributes(attrs, cls): + """Transform some attribute keys. + + :param attrs: Properties from the XML + :type attrs: dict + :param cls: Class of the entity + :type cls: class + """ transformed = {} for key, value in attrs.items(): if key in ["raw_message", "text"]: transformed["raw_content"] = value elif key in ["diaspora_handle", "sender_handle", "author"]: transformed["handle"] = value - elif key == "recipient_handle": + elif key in ["recipient_handle", "recipient"]: transformed["target_handle"] = value elif key == "parent_guid": transformed["target_guid"] = value @@ -145,7 +160,7 @@ def transform_attributes(attrs): transformed["raw_content"] = value elif key == "searchable": transformed["public"] = True if value == "true" else False - elif key == "target_type": + elif key in ["target_type", "type"] and cls == DiasporaRetraction: transformed["entity_type"] = DiasporaRetraction.entity_type_from_remote(value) elif key == "remote_photo_path": transformed["remote_path"] = value @@ -156,6 +171,8 @@ def transform_attributes(attrs): transformed["linked_type"] = "Post" elif key == "author_signature": transformed["signature"] = value + elif key == "post_guid": + transformed["target_guid"] = value elif key in BOOLEAN_KEYS: transformed[key] = True if value == "true" else False elif key in DATETIME_KEYS:
Ensure Diaspora entity converters understand all new attributes Diaspora is unifying the attributes for the entities (see https://github.com/diaspora/diaspora_federation/issues/29). Make sure our converters handle all the new entities since some of the converters have been built from example old entity XML's which are still sent. Old attributes should still be supported in the converters.
jaywink/federation
diff --git a/federation/tests/entities/diaspora/test_mappers.py b/federation/tests/entities/diaspora/test_mappers.py index 0dddc99..848cfc8 100644 --- a/federation/tests/entities/diaspora/test_mappers.py +++ b/federation/tests/entities/diaspora/test_mappers.py @@ -15,7 +15,7 @@ from federation.tests.fixtures.keys import get_dummy_private_key from federation.tests.fixtures.payloads import ( DIASPORA_POST_SIMPLE, DIASPORA_POST_COMMENT, DIASPORA_POST_LIKE, DIASPORA_REQUEST, DIASPORA_PROFILE, DIASPORA_POST_INVALID, DIASPORA_RETRACTION, - DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP) + DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY) def mock_fill(attributes): @@ -23,7 +23,7 @@ def mock_fill(attributes): return attributes -class TestDiasporaEntityMappersReceive(object): +class TestDiasporaEntityMappersReceive(): def test_message_to_objects_simple_post(self): entities = message_to_objects(DIASPORA_POST_SIMPLE) assert len(entities) == 1 @@ -37,6 +37,20 @@ class TestDiasporaEntityMappersReceive(object): assert post.created_at == datetime(2011, 7, 20, 1, 36, 7) assert post.provider_display_name == "Socialhome" + def test_message_to_objects_post_legacy(self): + # This is the previous XML schema used before renewal of protocol + entities = message_to_objects(DIASPORA_POST_LEGACY) + assert len(entities) == 1 + post = entities[0] + assert isinstance(post, DiasporaPost) + assert isinstance(post, Post) + assert post.raw_content == "((status message))" + assert post.guid == "((guidguidguidguidguidguidguid))" + assert post.handle == "[email protected]" + assert post.public == False + assert post.created_at == datetime(2011, 7, 20, 1, 36, 7) + assert post.provider_display_name == "Socialhome" + def test_message_to_objects_legact_timestamp(self): entities = message_to_objects(DIASPORA_POST_LEGACY_TIMESTAMP) post = entities[0] @@ -60,19 +74,6 @@ class TestDiasporaEntityMappersReceive(object): assert photo.handle == "[email protected]" assert photo.public == False assert photo.created_at == datetime(2011, 7, 20, 1, 36, 7) - photo = post._children[1] - assert isinstance(photo, Image) - assert photo.remote_path == "https://alice.diaspora.example.org/uploads/images/" - assert photo.remote_name == "12345.jpg" - assert photo.raw_content == "foobar" - assert photo.linked_type == "Post" - assert photo.linked_guid == "((guidguidguidguidguidguidguid))" - assert photo.height == 120 - assert photo.width == 120 - assert photo.guid == "((guidguidguidguidguidguidguig))" - assert photo.handle == "[email protected]" - assert photo.public == False - assert photo.created_at == datetime(2011, 7, 20, 1, 36, 7) @patch("federation.entities.diaspora.mappers.DiasporaComment._validate_signatures") def test_message_to_objects_comment(self, mock_validate): @@ -171,7 +172,7 @@ class TestDiasporaEntityMappersReceive(object): mock_retrieve.assert_called_once_with("[email protected]") -class TestGetOutboundEntity(object): +class TestGetOutboundEntity(): def test_already_fine_entities_are_returned_as_is(self): dummy_key = get_dummy_private_key() entity = DiasporaPost() diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py index a376140..97f88e6 100644 --- a/federation/tests/fixtures/payloads.py +++ b/federation/tests/fixtures/payloads.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - ENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?> <diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env"> <encrypted_header>{encrypted_header}</encrypted_header> @@ -28,7 +26,7 @@ UNENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?> """ -DIASPORA_POST_SIMPLE = """<XML> +DIASPORA_POST_LEGACY = """<XML> <post> <status_message> <raw_message>((status message))</raw_message> @@ -43,139 +41,115 @@ DIASPORA_POST_SIMPLE = """<XML> """ -DIASPORA_POST_LEGACY_TIMESTAMP = """<XML> - <post> - <status_message> - <raw_message>((status message))</raw_message> - <guid>((guidguidguidguidguidguidguid))</guid> - <diaspora_handle>[email protected]</diaspora_handle> - <public>false</public> - <created_at>2011-07-20 01:36:07 UTC</created_at> - <provider_display_name>Socialhome</provider_display_name> - </status_message> - </post> - </XML> +DIASPORA_POST_SIMPLE = """ + <status_message> + <text>((status message))</text> + <guid>((guidguidguidguidguidguidguid))</guid> + <author>[email protected]</author> + <public>false</public> + <created_at>2011-07-20T01:36:07Z</created_at> + <provider_display_name>Socialhome</provider_display_name> + </status_message> """ -DIASPORA_POST_WITH_PHOTOS = """<XML> - <post> - <status_message> - <raw_message>((status message))</raw_message> - <guid>((guidguidguidguidguidguidguid))</guid> - <diaspora_handle>[email protected]</diaspora_handle> - <public>false</public> - <created_at>2011-07-20T01:36:07Z</created_at> - <provider_display_name>Socialhome</provider_display_name> - <photo> - <guid>((guidguidguidguidguidguidguif))</guid> - <diaspora_handle>[email protected]</diaspora_handle> - <public>false</public> - <created_at>2011-07-20T01:36:07Z</created_at> - <remote_photo_path>https://alice.diaspora.example.org/uploads/images/</remote_photo_path> - <remote_photo_name>1234.jpg</remote_photo_name> - <text/> - <status_message_guid>((guidguidguidguidguidguidguid))</status_message_guid> - <height>120</height> - <width>120</width> - </photo> - <photo> - <guid>((guidguidguidguidguidguidguig))</guid> - <diaspora_handle>[email protected]</diaspora_handle> - <public>false</public> - <created_at>2011-07-20T01:36:07Z</created_at> - <remote_photo_path>https://alice.diaspora.example.org/uploads/images/</remote_photo_path> - <remote_photo_name>12345.jpg</remote_photo_name> - <text>foobar</text> - <status_message_guid>((guidguidguidguidguidguidguid))</status_message_guid> - <height>120</height> - <width>120</width> - </photo> - </status_message> - </post> - </XML> +DIASPORA_POST_LEGACY_TIMESTAMP = """ + <status_message> + <text>((status message))</text> + <guid>((guidguidguidguidguidguidguid))</guid> + <author>[email protected]</author> + <public>false</public> + <created_at>2011-07-20 01:36:07 UTC</created_at> + <provider_display_name>Socialhome</provider_display_name> + </status_message> """ -DIASPORA_POST_INVALID = """<XML> - <post> - <status_message> - <raw_message>((status message))</raw_message> - <diaspora_handle>[email protected]</diaspora_handle> - <public>false</public> - <created_at>2011-07-20T01:36:07Z</created_at> - <provider_display_name>Socialhome</provider_display_name> - </status_message> - </post> - </XML> +DIASPORA_POST_WITH_PHOTOS = """ + <status_message> + <text>((status message))</text> + <guid>((guidguidguidguidguidguidguid))</guid> + <author>[email protected]</author> + <public>false</public> + <created_at>2011-07-20T01:36:07Z</created_at> + <provider_display_name>Socialhome</provider_display_name> + <photo> + <guid>((guidguidguidguidguidguidguif))</guid> + <author>[email protected]</author> + <public>false</public> + <created_at>2011-07-20T01:36:07Z</created_at> + <remote_photo_path>https://alice.diaspora.example.org/uploads/images/</remote_photo_path> + <remote_photo_name>1234.jpg</remote_photo_name> + <text/> + <status_message_guid>((guidguidguidguidguidguidguid))</status_message_guid> + <height>120</height> + <width>120</width> + </photo> + </status_message> """ -DIASPORA_POST_COMMENT = """<XML> - <post> - <comment> - <guid>((guidguidguidguidguidguid))</guid> - <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid> - <author_signature>((base64-encoded data))</author_signature> - <text>((text))</text> - <diaspora_handle>[email protected]</diaspora_handle> - <author_signature>((signature))</author_signature> - </comment> - </post> - </XML> + +DIASPORA_POST_INVALID = """ + <status_message> + <text>((status message))</text> + <author>[email protected]</author> + <public>false</public> + <created_at>2011-07-20T01:36:07Z</created_at> + <provider_display_name>Socialhome</provider_display_name> + </status_message> """ -DIASPORA_POST_LIKE = """<XML> - <post> - <like> - <target_type>Post</target_type> - <guid>((guidguidguidguidguidguid))</guid> - <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid> - <author_signature>((base64-encoded data))</author_signature> - <positive>true</positive> - <diaspora_handle>[email protected]</diaspora_handle> - <author_signature>((signature))</author_signature> - </like> - </post> - </XML> +DIASPORA_POST_COMMENT = """ + <comment> + <guid>((guidguidguidguidguidguid))</guid> + <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid> + <author_signature>((base64-encoded data))</author_signature> + <text>((text))</text> + <author>[email protected]</author> + <author_signature>((signature))</author_signature> + </comment> """ -DIASPORA_REQUEST = """<XML> - <post> - <request> - <sender_handle>[email protected]</sender_handle> - <recipient_handle>[email protected]</recipient_handle> - </request> - </post> - </XML> +DIASPORA_POST_LIKE = """ + <like> + <parent_type>Post</parent_type> + <guid>((guidguidguidguidguidguid))</guid> + <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid> + <author_signature>((base64-encoded data))</author_signature> + <positive>true</positive> + <author>[email protected]</author> + <author_signature>((signature))</author_signature> + </like> +""" + +DIASPORA_REQUEST = """ + <request> + <author>[email protected]</author> + <recipient>[email protected]</recipient> + </request> """ -DIASPORA_PROFILE = """<XML> - <post> - <profile> - <diaspora_handle>[email protected]</diaspora_handle> - <first_name>Bob Bobertson</first_name> - <last_name></last_name> - <image_url>https://example.com/uploads/images/thumb_large_c833747578b5.jpg</image_url> - <image_url_small>https://example.com/uploads/images/thumb_small_c8b147578b5.jpg</image_url_small> - <image_url_medium>https://example.com/uploads/images/thumb_medium_c8b1aab04f3.jpg</image_url_medium> - <gender></gender> - <bio>A cool bio</bio> - <location>Helsinki</location> - <searchable>true</searchable> - <nsfw>false</nsfw> - <tag_string>#socialfederation #federation</tag_string> - </profile> - </post> -</XML> +DIASPORA_PROFILE = """ + <profile> + <author>[email protected]</author> + <first_name>Bob Bobertson</first_name> + <last_name></last_name> + <image_url>https://example.com/uploads/images/thumb_large_c833747578b5.jpg</image_url> + <image_url_small>https://example.com/uploads/images/thumb_small_c8b147578b5.jpg</image_url_small> + <image_url_medium>https://example.com/uploads/images/thumb_medium_c8b1aab04f3.jpg</image_url_medium> + <gender></gender> + <bio>A cool bio</bio> + <location>Helsinki</location> + <searchable>true</searchable> + <nsfw>false</nsfw> + <tag_string>#socialfederation #federation</tag_string> + </profile> """ -DIASPORA_RETRACTION = """<XML> - <post> - <retraction> - <author>[email protected]</author> - <target_guid>xxxxxxxxxxxxxxxx</target_guid> - <target_type>Post</target_type> - </retraction> - </post> -</XML> +DIASPORA_RETRACTION = """ + <retraction> + <author>[email protected]</author> + <target_guid>xxxxxxxxxxxxxxxx</target_guid> + <target_type>Post</target_type> + </retraction> """
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 0 }, "num_modified_files": 2 }
0.10
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-warnings" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libxml2-dev libxslt1-dev" ], "python": "3.6", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 arrow==1.2.3 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 codecov==2.1.13 colorama==0.4.5 commonmark==0.9.1 coverage==6.2 cssselect==1.1.0 dirty-validators==0.3.2 docutils==0.18.1 factory-boy==3.2.1 Faker==14.2.1 -e git+https://github.com/jaywink/federation.git@3a2910afc2329fc4f052bd01a1eae6927a0c1ac8#egg=federation idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 Jinja2==3.0.3 jsonschema==2.6.0 livereload==2.6.3 lxml==3.8.0 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycrypto==2.6.1 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 pytest-warnings==0.3.1 python-dateutil==2.9.0.post0 python-xrd==0.1 pytz==2025.2 recommonmark==0.7.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-autobuild==2021.3.14 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: federation channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - arrow==1.2.3 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - codecov==2.1.13 - colorama==0.4.5 - commonmark==0.9.1 - coverage==6.2 - cssselect==1.1.0 - dirty-validators==0.3.2 - docutils==0.18.1 - factory-boy==3.2.1 - faker==14.2.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - jinja2==3.0.3 - jsonschema==2.6.0 - livereload==2.6.3 - lxml==3.8.0 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycrypto==2.6.1 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-warnings==0.3.1 - python-dateutil==2.9.0.post0 - python-xrd==0.1 - pytz==2025.2 - recommonmark==0.7.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-autobuild==2021.3.14 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/federation
[ "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_simple_post", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_legact_timestamp", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_post_with_photos", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_comment", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_like", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_request", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_profile", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_retraction", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_invalid_entity_logs_an_error", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_adds_source_protocol_to_entity", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_element_to_objects_calls_sender_key_fetcher", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_element_to_objects_calls_retrieve_remote_profile" ]
[]
[ "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_post_legacy", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_already_fine_entities_are_returned_as_is", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_post_is_converted_to_diasporapost", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_comment_is_converted_to_diasporacomment", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_reaction_of_like_is_converted_to_diasporalike", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_relationship_of_sharing_or_following_is_converted_to_diasporarequest", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_profile_is_converted_to_diasporaprofile", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_other_reaction_raises", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_other_relation_raises", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_retraction_is_converted_to_diasporaretraction", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_signs_relayable_if_no_signature" ]
[]
BSD 3-Clause "New" or "Revised" License
1,234
[ "federation/entities/diaspora/mappers.py", "CHANGELOG.md" ]
[ "federation/entities/diaspora/mappers.py", "CHANGELOG.md" ]
hynek__structlog-112
5636314046792f1cc2510af27a379746bfe9dbf2
2017-05-07 09:36:19
ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52
codecov[bot]: # [Codecov](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=h1) Report > Merging [#112](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=desc) into [master](https://codecov.io/gh/hynek/structlog/commit/5636314046792f1cc2510af27a379746bfe9dbf2?src=pr&el=desc) will **not change** coverage. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/hynek/structlog/pull/112/graphs/tree.svg?width=650&height=150&src=pr&token=biZKjfuKn0)](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #112 +/- ## ===================================== Coverage 100% 100% ===================================== Files 13 13 Lines 774 777 +3 Branches 96 97 +1 ===================================== + Hits 774 777 +3 ``` | [Impacted Files](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/structlog/stdlib.py](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=tree#diff-c3JjL3N0cnVjdGxvZy9zdGRsaWIucHk=) | `100% <100%> (ø)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=footer). Last update [5636314...30777d0](https://codecov.io/gh/hynek/structlog/pull/112?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). hynek: I wonder if we should promote the `_record` field as an official API because I’m sure there’s a lot useful things that could be done with it. *ponder*
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 51e3966..0a95646 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,7 +24,8 @@ Deprecations: Changes: ^^^^^^^^ -*none* +- ``structlog.stdlib.add_logger_name()`` now works in ``structlog.stdlib.ProcessorFormatter``'s ``foreign_pre_chain``. + `#112 <https://github.com/hynek/structlog/issues/112>`_ ---- diff --git a/src/structlog/stdlib.py b/src/structlog/stdlib.py index 88c5735..4529e84 100644 --- a/src/structlog/stdlib.py +++ b/src/structlog/stdlib.py @@ -346,7 +346,11 @@ def add_logger_name(logger, method_name, event_dict): """ Add the logger name to the event dict. """ - event_dict['logger'] = logger.name + record = event_dict.get("_record") + if record is None: + event_dict["logger"] = logger.name + else: + event_dict["logger"] = record.name return event_dict @@ -415,13 +419,15 @@ class ProcessorFormatter(logging.Formatter): else: logger = None meth_name = record.levelname.lower() - ed = {"event": record.getMessage()} + ed = {"event": record.getMessage(), "_record": record} # Non-structlog allows to run through a chain to prepare it for the # final processor (e.g. adding timestamps and log levels). for proc in self.foreign_pre_chain or (): ed = proc(None, meth_name, ed) + del ed["_record"] + record.msg = self.processor(logger, meth_name, ed) return super(ProcessorFormatter, self).format(record)
add_logger_name processor does not work in ProcessorFormatter's pre_chain Hi, ### Steps to reproduce 1. Take [this](http://structlog.readthedocs.io/en/stable/standard-library.html?highlight=add_logger_name#rendering-using-structlog-based-formatters-within-logging) example from the doc. 2. Add `structlog.stdlib.add_logger_name` processor to pre_chain. 3. Run the example. ### Expected behaviour The logger name (`root` in the doc example) should be added to the event dict with the key `logger`. ### Actual behaviour Crashes as soon as you log anything using logging module. Here is the stacktrace: ``` >>> logging.getLogger('foo').warning('bar') --- Logging error --- Traceback (most recent call last): File "/usr/lib64/python3.6/logging/__init__.py", line 992, in emit msg = self.format(record)logging.getLogger('foo').warning("bar") File "/usr/lib64/python3.6/logging/__init__.py", line 838, in format return fmt.format(record) File "/home/gilbsgilbs/Projects/structlog/src/structlog/stdlib.py", line 423, in format ed = proc(None, meth_name, ed) File "/home/gilbsgilbs/Projects/structlog/src/structlog/stdlib.py", line 349, in add_logger_name event_dict['logger'] = logger.name AttributeError: 'NoneType' object has no attribute 'name' Call stack: File "test.py", line 66, in <module> logging.getLogger('foo').warning('bar') Message: 'bar' Arguments: () ``` ### Comments This is because `ProcessorFormatter` passes `None` as the logger to pre_chain processors. From inside the processor, we have lost track of the record, which was our only hope to get the logger name (`record.name`). How this should be fixed according to you? I can contribute to fix this faster. Probably won't use `ProcessorFormatter` for now because of this issue.
hynek/structlog
diff --git a/tests/test_stdlib.py b/tests/test_stdlib.py index 15aca38..423760e 100644 --- a/tests/test_stdlib.py +++ b/tests/test_stdlib.py @@ -294,6 +294,26 @@ class TestAddLogLevel(object): assert 'warning' == event_dict['level'] [email protected] +def log_record(): + """ + A LogRecord factory. + """ + def create_log_record(**kwargs): + defaults = { + "name": "sample-name", + "level": logging.INFO, + "pathname": None, + "lineno": None, + "msg": "sample-message", + "args": [], + "exc_info": None, + } + defaults.update(kwargs) + return logging.LogRecord(**defaults) + return create_log_record + + class TestAddLoggerName(object): def test_logger_name_added(self): """ @@ -304,6 +324,15 @@ class TestAddLoggerName(object): event_dict = add_logger_name(logger, None, {}) assert name == event_dict["logger"] + def test_logger_name_added_with_record(self, log_record): + """ + The logger name is deduced from the LogRecord if provided. + """ + name = "sample-name" + record = log_record(name=name) + event_dict = add_logger_name(None, None, {"_record": record}) + assert name == event_dict["logger"] + class TestRenderToLogKW(object): def test_default(self): @@ -424,6 +453,27 @@ class TestProcessorFormatter(object): "[warning ] foo [in test_foreign_pre_chain]\n", ) == capsys.readouterr() + def test_foreign_pre_chain_add_logger_name(self, configure_for_pf, capsys): + """ + foreign_pre_chain works with add_logger_name processor. + """ + configure_logging((add_logger_name,)) + configure( + processors=[ + ProcessorFormatter.wrap_for_formatter, + ], + logger_factory=LoggerFactory(), + wrapper_class=BoundLogger, + ) + + logging.getLogger("sample-name").warning("foo") + + assert ( + "", + "foo [sample-name] [in test_foreign_pr" + "e_chain_add_logger_name]\n", + ) == capsys.readouterr() + def test_native(self, configure_for_pf, capsys): """ If the log entry comes from structlog, it's unpackaged and processed.
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
17.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "greenlet", "colorama", "coverage", "freezegun", "pretend", "pytest", "simplejson" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 colorama==0.4.5 coverage==6.2 freezegun==1.2.2 greenlet==2.0.2 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 pretend==1.0.9 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 simplejson==3.20.1 six==1.17.0 -e git+https://github.com/hynek/structlog.git@5636314046792f1cc2510af27a379746bfe9dbf2#egg=structlog tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: structlog channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - colorama==0.4.5 - coverage==6.2 - freezegun==1.2.2 - greenlet==2.0.2 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - pretend==1.0.9 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - simplejson==3.20.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/structlog
[ "tests/test_stdlib.py::TestAddLoggerName::test_logger_name_added_with_record", "tests/test_stdlib.py::TestProcessorFormatter::test_foreign_pre_chain_add_logger_name" ]
[ "tests/test_stdlib.py::TestLoggerFactory::test_ignores_frames" ]
[ "tests/test_stdlib.py::TestLoggerFactory::test_deduces_correct_name", "tests/test_stdlib.py::TestLoggerFactory::test_deduces_correct_caller", "tests/test_stdlib.py::TestLoggerFactory::test_stack_info", "tests/test_stdlib.py::TestLoggerFactory::test_no_stack_info_by_default", "tests/test_stdlib.py::TestLoggerFactory::test_find_caller", "tests/test_stdlib.py::TestLoggerFactory::test_sets_correct_logger", "tests/test_stdlib.py::TestLoggerFactory::test_positional_argument_avoids_guessing", "tests/test_stdlib.py::TestFilterByLevel::test_filters_lower_levels", "tests/test_stdlib.py::TestFilterByLevel::test_passes_higher_levels", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[debug]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[info]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[warning]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[error]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[critical]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_exception", "tests/test_stdlib.py::TestBoundLogger::test_proxies_log", "tests/test_stdlib.py::TestBoundLogger::test_positional_args_proxied", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[addHandler-method_args0]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[removeHandler-method_args1]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[hasHandlers-None]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[callHandlers-method_args3]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[handle-method_args4]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[setLevel-method_args5]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[getEffectiveLevel-None]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[isEnabledFor-method_args7]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[findCaller-None]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[makeRecord-method_args9]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[getChild-method_args10]", "tests/test_stdlib.py::TestBoundLogger::test_exception_exc_info", "tests/test_stdlib.py::TestBoundLogger::test_exception_maps_to_error", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_formats_tuple", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_formats_dict", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_positional_args_retained", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_nop_no_args", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_args_removed_if_empty", "tests/test_stdlib.py::TestAddLogLevel::test_log_level_added", "tests/test_stdlib.py::TestAddLogLevel::test_log_level_alias_normalized", "tests/test_stdlib.py::TestAddLoggerName::test_logger_name_added", "tests/test_stdlib.py::TestRenderToLogKW::test_default", "tests/test_stdlib.py::TestRenderToLogKW::test_add_extra_event_dict", "tests/test_stdlib.py::TestProcessorFormatter::test_foreign_delegate", "tests/test_stdlib.py::TestProcessorFormatter::test_foreign_pre_chain", "tests/test_stdlib.py::TestProcessorFormatter::test_native" ]
[]
Apache License 2.0 or MIT License
1,235
[ "CHANGELOG.rst", "src/structlog/stdlib.py" ]
[ "CHANGELOG.rst", "src/structlog/stdlib.py" ]
fronzbot__blinkpy-24
b0cb3dda37ba51cf268112f7732ed38bd21fd9eb
2017-05-09 19:36:29
b0cb3dda37ba51cf268112f7732ed38bd21fd9eb
diff --git a/CHANGES.rst b/CHANGES.rst index cf9e38f..2a95b40 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,10 @@ Changelog A list of changes between each release +0.6.0.dev1 (unreleased) +^^^^^^^^^^^^^^^^^^ +- Added auto-reauthorization (token refresh) when a request fails due to an expired token + 0.6.0.dev0 (unreleased) ^^^^^^^^^^^^^^^^^^ - Removed redundent properties that only called hidden variables diff --git a/blinkpy.py b/blinkpy.py index 4ec5a75..cae947c 100644 --- a/blinkpy.py +++ b/blinkpy.py @@ -22,8 +22,15 @@ from helpers.constants import (BLINK_URL, LOGIN_URL, DEFAULT_URL, ONLINE) -def _request(url, data=None, headers=None, reqtype='get', - stream=False, json_resp=True): +def _attempt_reauthorization(blink): + """Attempt to refresh auth token and links.""" + headers = blink.get_auth_token() + blink.set_links() + return headers + + +def _request(blink, url='http://google.com', data=None, headers=None, + reqtype='get', stream=False, json_resp=True, is_retry=False): """Wrapper function for request.""" if reqtype == 'post': response = requests.post(url, headers=headers, @@ -35,8 +42,14 @@ def _request(url, data=None, headers=None, reqtype='get', raise BlinkException(ERROR.REQUEST) if json_resp and 'code' in response.json(): - raise BlinkAuthenticationException( - (response.json()['code'], response.json()['message'])) + if is_retry: + raise BlinkAuthenticationException( + (response.json()['code'], response.json()['message'])) + else: + headers = _attempt_reauthorization(blink) + return _request(blink, url=url, data=data, headers=headers, + reqtype=reqtype, stream=stream, + json_resp=json_resp, is_retry=True) if json_resp: return response.json() @@ -75,9 +88,10 @@ class BlinkURLHandler(object): class BlinkCamera(object): """Class to initialize individual camera.""" - def __init__(self, config, urls): + def __init__(self, config, blink): """Initiailize BlinkCamera.""" - self.urls = urls + self.blink = blink + self.urls = self.blink.urls self.id = str(config['device_id']) # pylint: disable=invalid-name self.name = config['name'] self._status = config['armed'] @@ -99,15 +113,18 @@ class BlinkCamera(object): def snap_picture(self): """Take a picture with camera to create a new thumbnail.""" - _request(self.image_link, headers=self.header, reqtype='post') + _request(self.blink, url=self.image_link, + headers=self.header, reqtype='post') def set_motion_detect(self, enable): """Set motion detection.""" url = self.arm_link if enable: - _request(url + 'enable', headers=self.header, reqtype='post') + _request(self.blink, url=url + 'enable', + headers=self.header, reqtype='post') else: - _request(url + 'disable', headers=self.header, reqtype='post') + _request(self.blink, url=url + 'disable', + headers=self.header, reqtype='post') def update(self, values): """Update camera information.""" @@ -122,7 +139,7 @@ class BlinkCamera(object): def image_refresh(self): """Refresh current thumbnail.""" url = self.urls.home_url - response = _request(url, headers=self.header, + response = _request(self.blink, url=url, headers=self.header, reqtype='get')['devices'] for element in response: try: @@ -137,7 +154,7 @@ class BlinkCamera(object): def image_to_file(self, path): """Write image to file.""" thumb = self.image_refresh() - response = _request(thumb, headers=self.header, + response = _request(self.blink, url=thumb, headers=self.header, reqtype='get', stream=True, json_resp=False) if response.status_code == 200: with open(path, 'wb') as imgfile: @@ -183,7 +200,7 @@ class Blink(object): """Get all events on server.""" url = self.urls.event_url + self.network_id headers = self._auth_header - self._events = _request(url, headers=headers, + self._events = _request(self, url=url, headers=headers, reqtype='get')['event'] return self._events @@ -192,7 +209,7 @@ class Blink(object): """Return boolean system online status.""" url = self.urls.network_url + self.network_id + '/syncmodules' headers = self._auth_header - return ONLINE[_request(url, headers=headers, + return ONLINE[_request(self, url=url, headers=headers, reqtype='get')['syncmodule']['status']] def last_motion(self): @@ -224,7 +241,7 @@ class Blink(object): else: value_to_append = 'disarm' url = self.urls.network_url + self.network_id + '/' + value_to_append - _request(url, headers=self._auth_header, reqtype='post') + _request(self, url=url, headers=self._auth_header, reqtype='post') def refresh(self): """Get all blink cameras and pulls their most recent status.""" @@ -248,7 +265,7 @@ class Blink(object): if self._auth_header is None: raise BlinkException(ERROR.AUTH_TOKEN) - return _request(url, headers=headers, reqtype='get') + return _request(self, url=url, headers=headers, reqtype='get') def get_cameras(self): """Find and creates cameras.""" @@ -258,7 +275,7 @@ class Blink(object): element['device_type'] == 'camera'): # Add region to config element['region_id'] = self.region_id - device = BlinkCamera(element, self.urls) + device = BlinkCamera(element, self) self.cameras[device.name] = device self._idlookup[device.id] = device.name @@ -306,13 +323,13 @@ class Blink(object): "password": self._password, "client_specifier": "iPhone 9.2 | 2.2 | 222" }) - response = _request(LOGIN_URL, headers=headers, + response = _request(self, url=LOGIN_URL, headers=headers, data=data, json_resp=False, reqtype='post') if response.status_code is 200: response = response.json() (self.region_id, self.region), = response['region'].items() else: - response = _request(LOGIN_BACKUP_URL, headers=headers, + response = _request(self, url=LOGIN_BACKUP_URL, headers=headers, data=data, reqtype='post') self.region_id = 'rest.piri' self.region = "UNKNOWN" @@ -325,6 +342,8 @@ class Blink(object): self.urls = BlinkURLHandler(self.region_id) + return self._auth_header + def get_ids(self): """Set the network ID and Account ID.""" url = self.urls.networks_url @@ -333,6 +352,6 @@ class Blink(object): if self._auth_header is None: raise BlinkException(ERROR.AUTH_TOKEN) - response = _request(url, headers=headers, reqtype='get') + response = _request(self, url=url, headers=headers, reqtype='get') self.network_id = str(response['networks'][0]['id']) self.account_id = str(response['networks'][0]['account_id']) diff --git a/helpers/constants.py b/helpers/constants.py index b323e12..193d50b 100644 --- a/helpers/constants.py +++ b/helpers/constants.py @@ -6,7 +6,7 @@ import os MAJOR_VERSION = 0 MINOR_VERSION = 6 -PATCH_VERSION = '0.dev0' +PATCH_VERSION = '0.dev1' __version__ = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
Token Checking/Reauthorization Token expires after 24hrs. Would like to add in a feature where the token are handled behind the scenes in order to be backwards compatible with existing module that rely on blinkpy (such as the home assistant Blink module). Perhaps when blinkpy calls the _request function we do a token check and grab a new one if the existing token has expired?
fronzbot/blinkpy
diff --git a/tests/test_blink_functions.py b/tests/test_blink_functions.py index a4685e5..cb2ba8b 100644 --- a/tests/test_blink_functions.py +++ b/tests/test_blink_functions.py @@ -18,6 +18,7 @@ class TestBlinkFunctions(unittest.TestCase): password=PASSWORD) (self.region_id, self.region), = mresp.LOGIN_RESPONSE['region'].items() self.test_urls = blinkpy.BlinkURLHandler(self.region_id) + self.urls = self.test_urls def tearDown(self): """Clean up after test.""" @@ -25,6 +26,7 @@ class TestBlinkFunctions(unittest.TestCase): self.region = None self.region_id = None self.test_urls = None + self.urls = None @mock.patch('blinkpy.blinkpy.requests.post', side_effect=mresp.mocked_requests_post) @@ -122,7 +124,8 @@ class TestBlinkFunctions(unittest.TestCase): """Checks that the update function is doing the right thing.""" self.test_urls = blinkpy.BlinkURLHandler('test') test_config = mresp.FIRST_CAMERA - test_camera = blinkpy.blinkpy.BlinkCamera(test_config, self.test_urls) + self.urls = self.test_urls + test_camera = blinkpy.blinkpy.BlinkCamera(test_config, self) test_update = mresp.SECOND_CAMERA test_camera.update(test_update) test_image_url = self.test_urls.base_url + test_update['thumbnail'] diff --git a/tests/test_blink_system.py b/tests/test_blink_system.py index a67f362..cde365a 100644 --- a/tests/test_blink_system.py +++ b/tests/test_blink_system.py @@ -47,7 +47,7 @@ class TestBlinkSetup(unittest.TestCase): self.blink_no_cred.get_auth_token() def test_no_auth_header(self): - """Check that we throw an excpetion when no auth header given.""" + """Check that we throw an exception when no auth header given.""" # pylint: disable=unused-variable (region_id, region), = mresp.LOGIN_RESPONSE['region'].items() self.blink.urls = blinkpy.BlinkURLHandler(region_id) @@ -79,7 +79,7 @@ class TestBlinkSetup(unittest.TestCase): with self.assertRaises(blinkpy.BlinkAuthenticationException): # pylint: disable=protected-access - blinkpy.blinkpy._request(None, reqtype='post') + blinkpy.blinkpy._request(None, reqtype='post', is_retry=True) @mock.patch('blinkpy.blinkpy.requests.post', side_effect=mresp.mocked_requests_post)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 3 }
0.5
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "tox", "pytest", "pytest-cov", "pytest-timeout" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 -e git+https://github.com/fronzbot/blinkpy.git@b0cb3dda37ba51cf268112f7732ed38bd21fd9eb#egg=blinkpy certifi==2021.5.30 charset-normalizer==2.0.12 coverage==6.2 distlib==0.3.9 filelock==3.4.1 fixtures==4.0.1 idna==3.10 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 packaging==21.3 pbr==6.1.1 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 pytest-timeout==2.1.0 requests==2.27.1 six==1.17.0 testtools==2.6.0 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 urllib3==1.26.20 virtualenv==20.17.1 zipp==3.6.0
name: blinkpy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - coverage==6.2 - distlib==0.3.9 - filelock==3.4.1 - fixtures==4.0.1 - idna==3.10 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - packaging==21.3 - pbr==6.1.1 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-timeout==2.1.0 - requests==2.27.1 - six==1.17.0 - testtools==2.6.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - urllib3==1.26.20 - virtualenv==20.17.1 - zipp==3.6.0 prefix: /opt/conda/envs/blinkpy
[ "tests/test_blink_functions.py::TestBlinkFunctions::test_camera_update", "tests/test_blink_system.py::TestBlinkSetup::test_bad_request" ]
[]
[ "tests/test_blink_functions.py::TestBlinkFunctions::test_camera_thumbs", "tests/test_blink_functions.py::TestBlinkFunctions::test_image_to_file", "tests/test_blink_functions.py::TestBlinkFunctions::test_image_with_bad_data", "tests/test_blink_functions.py::TestBlinkFunctions::test_last_motion", "tests/test_blink_functions.py::TestBlinkFunctions::test_set_motion_detect", "tests/test_blink_functions.py::TestBlinkFunctions::test_take_new_picture", "tests/test_blink_system.py::TestBlinkSetup::test_arm_disarm_system", "tests/test_blink_system.py::TestBlinkSetup::test_check_online_status", "tests/test_blink_system.py::TestBlinkSetup::test_full_setup", "tests/test_blink_system.py::TestBlinkSetup::test_initialization", "tests/test_blink_system.py::TestBlinkSetup::test_manual_login", "tests/test_blink_system.py::TestBlinkSetup::test_no_auth_header", "tests/test_blink_system.py::TestBlinkSetup::test_no_credentials", "tests/test_blink_system.py::TestBlinkSetup::test_setup_backup_subdomain", "tests/test_blink_system.py::TestBlinkSetup::test_system_bad_refresh" ]
[]
MIT License
1,236
[ "blinkpy.py", "helpers/constants.py", "CHANGES.rst" ]
[ "blinkpy.py", "helpers/constants.py", "CHANGES.rst" ]
borgbackup__borg-2500
781a41de50849b5c96c83a0f8fff91306ee52eb7
2017-05-10 16:46:37
a439fa3e720c8bb2a82496768ffcce282fb7f7b7
codecov-io: # [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=h1) Report > Merging [#2500](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=desc) into [master](https://codecov.io/gh/borgbackup/borg/commit/6cd7d415ca501284a12bbb1462b562f453b3205d?src=pr&el=desc) will **increase** coverage by `0.08%`. > The diff coverage is `91.04%`. [![Impacted file tree graph](https://codecov.io/gh/borgbackup/borg/pull/2500/graphs/tree.svg?token=LssEpmW3o4&src=pr&height=150&width=650)](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2500 +/- ## ========================================== + Coverage 83.24% 83.32% +0.08% ========================================== Files 21 21 Lines 7573 7628 +55 Branches 1288 1297 +9 ========================================== + Hits 6304 6356 +52 - Misses 914 915 +1 - Partials 355 357 +2 ``` | [Impacted Files](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/borg/archiver.py](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree#diff-c3JjL2JvcmcvYXJjaGl2ZXIucHk=) | `82.32% <75%> (-0.05%)` | :arrow_down: | | [src/borg/cache.py](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree#diff-c3JjL2JvcmcvY2FjaGUucHk=) | `86.69% <91.53%> (+0.46%)` | :arrow_up: | | [src/borg/archive.py](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree#diff-c3JjL2JvcmcvYXJjaGl2ZS5weQ==) | `81.58% <0%> (-0.16%)` | :arrow_down: | | [src/borg/helpers.py](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree#diff-c3JjL2JvcmcvaGVscGVycy5weQ==) | `87.44% <0%> (+0.08%)` | :arrow_up: | | [src/borg/remote.py](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree#diff-c3JjL2JvcmcvcmVtb3RlLnB5) | `77.34% <0%> (+0.2%)` | :arrow_up: | | [src/borg/locking.py](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=tree#diff-c3JjL2JvcmcvbG9ja2luZy5weQ==) | `88.46% <0%> (+1.28%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=footer). Last update [6cd7d41...6c93c41](https://codecov.io/gh/borgbackup/borg/pull/2500?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 9946dd47..601c9848 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -36,7 +36,7 @@ from .algorithms.crc32 import crc32 from .archive import Archive, ArchiveChecker, ArchiveRecreater, Statistics, is_special from .archive import BackupOSError, backup_io -from .cache import Cache +from .cache import Cache, assert_secure from .constants import * # NOQA from .compress import CompressionSpec from .crypto.key import key_creator, tam_required_file, tam_required, RepoKey, PassphraseKey @@ -86,7 +86,8 @@ def argument(args, str_or_bool): return str_or_bool -def with_repository(fake=False, invert_fake=False, create=False, lock=True, exclusive=False, manifest=True, cache=False): +def with_repository(fake=False, invert_fake=False, create=False, lock=True, exclusive=False, manifest=True, cache=False, + secure=True): """ Method decorator for subcommand-handling methods: do_XYZ(self, args, repository, …) @@ -97,6 +98,7 @@ def with_repository(fake=False, invert_fake=False, create=False, lock=True, excl :param exclusive: (str or bool) lock repository exclusively (for writing) :param manifest: load manifest and key, pass them as keyword arguments :param cache: open cache, pass it as keyword argument (implies manifest) + :param secure: do assert_secure after loading manifest """ def decorator(method): @functools.wraps(method) @@ -117,6 +119,8 @@ def wrapper(self, args, **kwargs): kwargs['manifest'], kwargs['key'] = Manifest.load(repository) if 'compression' in args: kwargs['key'].compressor = args.compression.compressor + if secure: + assert_secure(repository, kwargs['manifest']) if cache: with Cache(repository, kwargs['key'], kwargs['manifest'], do_files=getattr(args, 'cache_files', False), @@ -3815,15 +3819,15 @@ def _setup_implied_logging(self, args): """ turn on INFO level logging for args that imply that they will produce output """ # map of option name to name of logger for that option option_logger = { - 'output_list': 'borg.output.list', - 'show_version': 'borg.output.show-version', - 'show_rc': 'borg.output.show-rc', - 'stats': 'borg.output.stats', - 'progress': 'borg.output.progress', - } + 'output_list': 'borg.output.list', + 'show_version': 'borg.output.show-version', + 'show_rc': 'borg.output.show-rc', + 'stats': 'borg.output.stats', + 'progress': 'borg.output.progress', + } for option, logger_name in option_logger.items(): - option_set = args.get(option, False) - logging.getLogger(logger_name).setLevel('INFO' if option_set else 'WARN') + if args.get(option, False): + logging.getLogger(logger_name).setLevel('INFO') def _setup_topic_debugging(self, args): """Turn on DEBUG level logging for specified --debug-topics.""" @@ -3839,10 +3843,8 @@ def run(self, args): # This works around http://bugs.python.org/issue9351 func = getattr(args, 'func', None) or getattr(args, 'fallback_func') # do not use loggers before this! - is_serve = func == self.do_serve - setup_logging(level=args.log_level, is_serve=is_serve, json=args.log_json) + setup_logging(level=args.log_level, is_serve=func == self.do_serve, json=args.log_json) self.log_json = args.log_json - args.progress |= is_serve self._setup_implied_logging(vars(args)) self._setup_topic_debugging(args) if args.show_version: diff --git a/src/borg/cache.py b/src/borg/cache.py index 40ed925a..882d9863 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -32,9 +32,29 @@ class SecurityManager: + """ + Tracks repositories. Ensures that nothing bad happens (repository swaps, + replay attacks, unknown repositories etc.). + + This is complicated by the Cache being initially used for this, while + only some commands actually use the Cache, which meant that other commands + did not perform these checks. + + Further complications were created by the Cache being a cache, so it + could be legitimately deleted, which is annoying because Borg didn't + recognize repositories after that. + + Therefore a second location, the security database (see get_security_dir), + was introduced which stores this information. However, this means that + the code has to deal with a cache existing but no security DB entry, + or inconsistencies between the security DB and the cache which have to + be reconciled, and also with no cache existing but a security DB entry. + """ + def __init__(self, repository): self.repository = repository self.dir = get_security_dir(repository.id_str) + self.cache_dir = cache_dir(repository) self.key_type_file = os.path.join(self.dir, 'key-type') self.location_file = os.path.join(self.dir, 'location') self.manifest_ts_file = os.path.join(self.dir, 'manifest-timestamp') @@ -52,9 +72,9 @@ def key_matches(self, key): except OSError as exc: logger.warning('Could not read/parse key type file: %s', exc) - def save(self, manifest, key, cache): + def save(self, manifest, key): logger.debug('security: saving state for %s to %s', self.repository.id_str, self.dir) - current_location = cache.repository._location.canonical_path() + current_location = self.repository._location.canonical_path() logger.debug('security: current location %s', current_location) logger.debug('security: key type %s', str(key.TYPE)) logger.debug('security: manifest timestamp %s', manifest.timestamp) @@ -65,25 +85,27 @@ def save(self, manifest, key, cache): with open(self.manifest_ts_file, 'w') as fd: fd.write(manifest.timestamp) - def assert_location_matches(self, cache): + def assert_location_matches(self, cache_config=None): # Warn user before sending data to a relocated repository try: with open(self.location_file) as fd: previous_location = fd.read() - logger.debug('security: read previous_location %r', previous_location) + logger.debug('security: read previous location %r', previous_location) except FileNotFoundError: - logger.debug('security: previous_location file %s not found', self.location_file) + logger.debug('security: previous location file %s not found', self.location_file) previous_location = None except OSError as exc: logger.warning('Could not read previous location file: %s', exc) previous_location = None - if cache.previous_location and previous_location != cache.previous_location: + if cache_config and cache_config.previous_location and previous_location != cache_config.previous_location: # Reconcile cache and security dir; we take the cache location. - previous_location = cache.previous_location + previous_location = cache_config.previous_location logger.debug('security: using previous_location of cache: %r', previous_location) - if previous_location and previous_location != self.repository._location.canonical_path(): + + repository_location = self.repository._location.canonical_path() + if previous_location and previous_location != repository_location: msg = ("Warning: The repository at location {} was previously located at {}\n".format( - self.repository._location.canonical_path(), previous_location) + + repository_location, previous_location) + "Do you want to continue? [yN] ") if not yes(msg, false_msg="Aborting.", invalid_msg="Invalid answer, aborting.", retry=False, env_var_override='BORG_RELOCATED_REPO_ACCESS_IS_OK'): @@ -91,11 +113,11 @@ def assert_location_matches(self, cache): # adapt on-disk config immediately if the new location was accepted logger.debug('security: updating location stored in cache and security dir') with open(self.location_file, 'w') as fd: - fd.write(cache.repository._location.canonical_path()) - cache.begin_txn() - cache.commit() + fd.write(repository_location) + if cache_config: + cache_config.save() - def assert_no_manifest_replay(self, manifest, key, cache): + def assert_no_manifest_replay(self, manifest, key, cache_config=None): try: with open(self.manifest_ts_file) as fd: timestamp = fd.read() @@ -106,7 +128,8 @@ def assert_no_manifest_replay(self, manifest, key, cache): except OSError as exc: logger.warning('Could not read previous location file: %s', exc) timestamp = '' - timestamp = max(timestamp, cache.timestamp or '') + if cache_config: + timestamp = max(timestamp, cache_config.timestamp or '') logger.debug('security: determined newest manifest timestamp as %s', timestamp) # If repository is older than the cache or security dir something fishy is going on if timestamp and timestamp > manifest.timestamp: @@ -115,29 +138,155 @@ def assert_no_manifest_replay(self, manifest, key, cache): else: raise Cache.RepositoryReplay() - def assert_key_type(self, key, cache): + def assert_key_type(self, key, cache_config=None): # Make sure an encrypted repository has not been swapped for an unencrypted repository - if cache.key_type is not None and cache.key_type != str(key.TYPE): + if cache_config and cache_config.key_type is not None and cache_config.key_type != str(key.TYPE): raise Cache.EncryptionMethodMismatch() if self.known() and not self.key_matches(key): raise Cache.EncryptionMethodMismatch() - def assert_secure(self, manifest, key, cache): - self.assert_location_matches(cache) - self.assert_key_type(key, cache) - self.assert_no_manifest_replay(manifest, key, cache) + def assert_secure(self, manifest, key, *, cache_config=None, warn_if_unencrypted=True): + # warn_if_unencrypted=False is only used for initializing a new repository. + # Thus, avoiding asking about a repository that's currently initializing. + self.assert_access_unknown(warn_if_unencrypted, manifest, key) + if cache_config: + self._assert_secure(manifest, key, cache_config) + else: + cache_config = CacheConfig(self.repository) + if cache_config.exists(): + with cache_config: + self._assert_secure(manifest, key, cache_config) + else: + self._assert_secure(manifest, key) + logger.debug('security: repository checks ok, allowing access') + + def _assert_secure(self, manifest, key, cache_config=None): + self.assert_location_matches(cache_config) + self.assert_key_type(key, cache_config) + self.assert_no_manifest_replay(manifest, key, cache_config) if not self.known(): - self.save(manifest, key, cache) + logger.debug('security: remembering previously unknown repository') + self.save(manifest, key) - def assert_access_unknown(self, warn_if_unencrypted, key): - if warn_if_unencrypted and not key.logically_encrypted and not self.known(): + def assert_access_unknown(self, warn_if_unencrypted, manifest, key): + # warn_if_unencrypted=False is only used for initializing a new repository. + # Thus, avoiding asking about a repository that's currently initializing. + if not key.logically_encrypted and not self.known(): msg = ("Warning: Attempting to access a previously unknown unencrypted repository!\n" + "Do you want to continue? [yN] ") - if not yes(msg, false_msg="Aborting.", invalid_msg="Invalid answer, aborting.", - retry=False, env_var_override='BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK'): + allow_access = not warn_if_unencrypted or yes(msg, false_msg="Aborting.", + invalid_msg="Invalid answer, aborting.", + retry=False, env_var_override='BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK') + if allow_access: + if warn_if_unencrypted: + logger.debug('security: remembering unknown unencrypted repository (explicitly allowed)') + else: + logger.debug('security: initializing unencrypted repository') + self.save(manifest, key) + else: raise Cache.CacheInitAbortedError() +def assert_secure(repository, manifest): + sm = SecurityManager(repository) + sm.assert_secure(manifest, manifest.key) + + +def recanonicalize_relative_location(cache_location, repository): + # borg < 1.0.8rc1 had different canonicalization for the repo location (see #1655 and #1741). + repo_location = repository._location.canonical_path() + rl = Location(repo_location) + cl = Location(cache_location) + if cl.proto == rl.proto and cl.user == rl.user and cl.host == rl.host and cl.port == rl.port \ + and \ + cl.path and rl.path and \ + cl.path.startswith('/~/') and rl.path.startswith('/./') and cl.path[3:] == rl.path[3:]: + # everything is same except the expected change in relative path canonicalization, + # update previous_location to avoid warning / user query about changed location: + return repo_location + else: + return cache_location + + +def cache_dir(repository, path=None): + return path or os.path.join(get_cache_dir(), repository.id_str) + + +class CacheConfig: + def __init__(self, repository, path=None, lock_wait=None): + self.repository = repository + self.path = cache_dir(repository, path) + self.config_path = os.path.join(self.path, 'config') + self.lock = None + self.lock_wait = lock_wait + + def __enter__(self): + self.open() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def exists(self): + return os.path.exists(self.config_path) + + def create(self): + assert not self.exists() + config = configparser.ConfigParser(interpolation=None) + config.add_section('cache') + config.set('cache', 'version', '1') + config.set('cache', 'repository', self.repository.id_str) + config.set('cache', 'manifest', '') + with SaveFile(self.config_path) as fd: + config.write(fd) + + def open(self): + self.lock = Lock(os.path.join(self.path, 'lock'), exclusive=True, timeout=self.lock_wait, + kill_stale_locks=hostname_is_unique()).acquire() + self.load() + + def load(self): + self._config = configparser.ConfigParser(interpolation=None) + self._config.read(self.config_path) + self._check_upgrade(self.config_path) + self.id = self._config.get('cache', 'repository') + self.manifest_id = unhexlify(self._config.get('cache', 'manifest')) + self.timestamp = self._config.get('cache', 'timestamp', fallback=None) + self.key_type = self._config.get('cache', 'key_type', fallback=None) + previous_location = self._config.get('cache', 'previous_location', fallback=None) + if previous_location: + self.previous_location = recanonicalize_relative_location(previous_location, self.repository) + else: + self.previous_location = None + + def save(self, manifest=None, key=None): + if manifest: + self._config.set('cache', 'manifest', manifest.id_str) + self._config.set('cache', 'timestamp', manifest.timestamp) + if key: + self._config.set('cache', 'key_type', str(key.TYPE)) + self._config.set('cache', 'previous_location', self.repository._location.canonical_path()) + with SaveFile(self.config_path) as fd: + self._config.write(fd) + + def close(self): + if self.lock is not None: + self.lock.release() + self.lock = None + + def _check_upgrade(self, config_path): + try: + cache_version = self._config.getint('cache', 'version') + wanted_version = 1 + if cache_version != wanted_version: + self.close() + raise Exception('%s has unexpected cache version %d (wanted: %d).' % + (config_path, cache_version, wanted_version)) + except configparser.NoSectionError: + self.close() + raise Exception('%s does not look like a Borg cache.' % config_path) from None + + class Cache: """Client Side cache """ @@ -158,7 +307,7 @@ class EncryptionMethodMismatch(Error): @staticmethod def break_lock(repository, path=None): - path = path or os.path.join(get_cache_dir(), repository.id_str) + path = cache_dir(repository, path) Lock(os.path.join(path, 'lock'), exclusive=True).break_lock() @staticmethod @@ -178,25 +327,27 @@ def __init__(self, repository, key, manifest, path=None, sync=True, do_files=Fal :param lock_wait: timeout for lock acquisition (None: return immediately if lock unavailable) :param sync: do :meth:`.sync` """ - self.lock = None - self.timestamp = None - self.lock = None - self.txn_active = False self.repository = repository self.key = key self.manifest = manifest self.progress = progress - self.path = path or os.path.join(get_cache_dir(), repository.id_str) - self.security_manager = SecurityManager(repository) self.do_files = do_files + self.timestamp = None + self.txn_active = False + + self.path = cache_dir(repository, path) + self.security_manager = SecurityManager(repository) + self.cache_config = CacheConfig(self.repository, self.path, lock_wait) + # Warn user before sending data to a never seen before unencrypted repository if not os.path.exists(self.path): - self.security_manager.assert_access_unknown(warn_if_unencrypted, key) + self.security_manager.assert_access_unknown(warn_if_unencrypted, manifest, key) self.create() - self.open(lock_wait=lock_wait) + + self.open() try: - self.security_manager.assert_secure(manifest, key, self) - if sync and self.manifest.id != self.manifest_id: + self.security_manager.assert_secure(manifest, key, cache_config=self.cache_config) + if sync and self.manifest.id != self.cache_config.manifest_id: self.sync() self.commit() except: @@ -240,66 +391,27 @@ def create(self): os.makedirs(self.path) with open(os.path.join(self.path, 'README'), 'w') as fd: fd.write(CACHE_README) - config = configparser.ConfigParser(interpolation=None) - config.add_section('cache') - config.set('cache', 'version', '1') - config.set('cache', 'repository', self.repository.id_str) - config.set('cache', 'manifest', '') - with SaveFile(os.path.join(self.path, 'config')) as fd: - config.write(fd) + self.cache_config.create() ChunkIndex().write(os.path.join(self.path, 'chunks').encode('utf-8')) os.makedirs(os.path.join(self.path, 'chunks.archive.d')) with SaveFile(os.path.join(self.path, 'files'), binary=True) as fd: pass # empty file - def _check_upgrade(self, config_path): - try: - cache_version = self.config.getint('cache', 'version') - wanted_version = 1 - if cache_version != wanted_version: - self.close() - raise Exception('%s has unexpected cache version %d (wanted: %d).' % ( - config_path, cache_version, wanted_version)) - except configparser.NoSectionError: - self.close() - raise Exception('%s does not look like a Borg cache.' % config_path) from None - # borg < 1.0.8rc1 had different canonicalization for the repo location (see #1655 and #1741). - cache_loc = self.config.get('cache', 'previous_location', fallback=None) - if cache_loc: - repo_loc = self.repository._location.canonical_path() - rl = Location(repo_loc) - cl = Location(cache_loc) - if cl.proto == rl.proto and cl.user == rl.user and cl.host == rl.host and cl.port == rl.port \ - and \ - cl.path and rl.path and \ - cl.path.startswith('/~/') and rl.path.startswith('/./') and cl.path[3:] == rl.path[3:]: - # everything is same except the expected change in relative path canonicalization, - # update previous_location to avoid warning / user query about changed location: - self.config.set('cache', 'previous_location', repo_loc) - def _do_open(self): - self.config = configparser.ConfigParser(interpolation=None) - config_path = os.path.join(self.path, 'config') - self.config.read(config_path) - self._check_upgrade(config_path) - self.id = self.config.get('cache', 'repository') - self.manifest_id = unhexlify(self.config.get('cache', 'manifest')) - self.timestamp = self.config.get('cache', 'timestamp', fallback=None) - self.key_type = self.config.get('cache', 'key_type', fallback=None) - self.previous_location = self.config.get('cache', 'previous_location', fallback=None) + self.cache_config.load() self.chunks = ChunkIndex.read(os.path.join(self.path, 'chunks').encode('utf-8')) self.files = None - def open(self, lock_wait=None): + def open(self): if not os.path.isdir(self.path): raise Exception('%s Does not look like a Borg cache' % self.path) - self.lock = Lock(os.path.join(self.path, 'lock'), exclusive=True, timeout=lock_wait, kill_stale_locks=hostname_is_unique()).acquire() + self.cache_config.open() self.rollback() def close(self): - if self.lock is not None: - self.lock.release() - self.lock = None + if self.cache_config is not None: + self.cache_config.close() + self.cache_config = None def _read_files(self): self.files = {} @@ -338,7 +450,7 @@ def commit(self): """ if not self.txn_active: return - self.security_manager.save(self.manifest, self.key, self) + self.security_manager.save(self.manifest, self.key) pi = ProgressIndicatorMessage(msgid='cache.commit') if self.files is not None: if self._newest_mtime is None: @@ -356,12 +468,7 @@ def commit(self): entry.age > 0 and entry.age < ttl: msgpack.pack((path_hash, entry), fd) pi.output('Saving cache config') - self.config.set('cache', 'manifest', self.manifest.id_str) - self.config.set('cache', 'timestamp', self.manifest.timestamp) - self.config.set('cache', 'key_type', str(self.key.TYPE)) - self.config.set('cache', 'previous_location', self.repository._location.canonical_path()) - with SaveFile(os.path.join(self.path, 'config')) as fd: - self.config.write(fd) + self.cache_config.save(self.manifest, self.key) pi.output('Saving chunks cache') self.chunks.write(os.path.join(self.path, 'chunks').encode('utf-8')) os.rename(os.path.join(self.path, 'txn.active'), diff --git a/src/borg/helpers.py b/src/borg/helpers.py index a93ba710..ec06946e 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -1226,14 +1226,6 @@ def __init__(self, msgid=None): if self.logger.level == logging.NOTSET: self.logger.setLevel(logging.WARN) self.logger.propagate = False - - # If --progress is not set then the progress logger level will be WARN - # due to setup_implied_logging (it may be NOTSET with a logging config file, - # but the interactions there are generally unclear), so self.emit becomes - # False, which is correct. - # If --progress is set then the level will be INFO as per setup_implied_logging; - # note that this is always the case for serve processes due to a "args.progress |= is_serve". - # In this case self.emit is True. self.emit = self.logger.getEffectiveLevel() == logging.INFO def __del__(self): diff --git a/src/borg/logger.py b/src/borg/logger.py index 69cb86f1..6300776d 100644 --- a/src/borg/logger.py +++ b/src/borg/logger.py @@ -88,21 +88,15 @@ def setup_logging(stream=None, conf_fname=None, env_var='BORG_LOGGING_CONF', lev # if we did not / not successfully load a logging configuration, fallback to this: logger = logging.getLogger('') handler = logging.StreamHandler(stream) - if is_serve and not json: + if is_serve: fmt = '$LOG %(levelname)s %(name)s Remote: %(message)s' else: fmt = '%(message)s' - formatter = JsonFormatter(fmt) if json else logging.Formatter(fmt) + formatter = JsonFormatter(fmt) if json and not is_serve else logging.Formatter(fmt) handler.setFormatter(formatter) borg_logger = logging.getLogger('borg') borg_logger.formatter = formatter borg_logger.json = json - if configured and logger.handlers: - # The RepositoryServer can call setup_logging a second time to adjust the output - # mode from text-ish is_serve to json is_serve. - # Thus, remove the previously installed handler, if any. - logger.handlers[0].close() - logger.handlers.clear() logger.addHandler(handler) logger.setLevel(level.upper()) configured = True @@ -230,8 +224,6 @@ def format(self, record): data = { 'type': 'log_message', 'time': record.created, - 'message': '', - 'levelname': 'CRITICAL', } for attr in self.RECORD_ATTRIBUTES: value = getattr(record, attr, None) diff --git a/src/borg/remote.py b/src/borg/remote.py index 1a67930e..c32ba9e6 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -2,30 +2,29 @@ import fcntl import functools import inspect -import json import logging import os import select import shlex import sys import tempfile +import traceback import textwrap import time -import traceback from subprocess import Popen, PIPE import msgpack from . import __version__ from .helpers import Error, IntegrityError -from .helpers import bin_to_hex from .helpers import get_home_dir -from .helpers import hostname_is_unique -from .helpers import replace_placeholders from .helpers import sysinfo -from .logger import create_logger, setup_logging +from .helpers import bin_to_hex +from .helpers import replace_placeholders +from .helpers import hostname_is_unique from .repository import Repository, MAX_OBJECT_SIZE, LIST_SCAN_LIMIT from .version import parse_version, format_version +from .logger import create_logger logger = create_logger(__name__) @@ -313,10 +312,6 @@ def negotiate(self, client_data): # clients since 1.1.0b3 use a dict as client_data if isinstance(client_data, dict): self.client_version = client_data[b'client_version'] - if client_data.get(b'client_supports_log_v3', False): - level = logging.getLevelName(logging.getLogger('').level) - setup_logging(is_serve=True, json=True, level=level) - logger.debug('Initialized logging system for new (v3) protocol') else: self.client_version = BORG_VERSION # seems to be newer than current version (no known old format) @@ -560,10 +555,7 @@ def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock try: try: - version = self.call('negotiate', {'client_data': { - b'client_version': BORG_VERSION, - b'client_supports_log_v3': True, - }}) + version = self.call('negotiate', {'client_data': {b'client_version': BORG_VERSION}}) except ConnectionClosed: raise ConnectionClosedWithHint('Is borg working on the server?') from None if version == RPC_PROTOCOL_VERSION: @@ -654,23 +646,12 @@ def borg_cmd(self, args, testing): opts.append('--critical') else: raise ValueError('log level missing, fix this code') - - # Tell the remote server about debug topics it may need to consider. - # Note that debug topics are usable for "spew" or "trace" logs which would - # be too plentiful to transfer for normal use, so the server doesn't send - # them unless explicitly enabled. - # - # Needless to say, if you do --debug-topic=repository.compaction, for example, - # with a 1.0.x server it won't work, because the server does not recognize the - # option. - # - # This is not considered a problem, since this is a debugging feature that - # should not be used for regular use. - for topic in args.debug_topics: - if '.' not in topic: - topic = 'borg.debug.' + topic - if 'repository' in topic: - opts.append('--debug-topic=%s' % topic) + try: + borg_logger = logging.getLogger('borg') + if borg_logger.json: + opts.append('--log-json') + except AttributeError: + pass env_vars = [] if not hostname_is_unique(): env_vars.append('BORG_HOSTNAME_IS_UNIQUE=no') @@ -949,63 +930,7 @@ def preload(self, ids): def handle_remote_line(line): - """ - Handle a remote log line. - - This function is remarkably complex because it handles multiple wire formats. - """ - if line.startswith('{'): - # This format is used by Borg since 1.1.0b6 for new-protocol clients. - # It is the same format that is exposed by --log-json. - msg = json.loads(line) - - if msg['type'] not in ('progress_message', 'progress_percent', 'log_message'): - logger.warning('Dropped remote log message with unknown type %r: %s', msg['type'], line) - return - - if msg['type'] == 'log_message': - # Re-emit log messages on the same level as the remote to get correct log suppression and verbosity. - level = getattr(logging, msg['levelname'], logging.CRITICAL) - assert isinstance(level, int) - target_logger = logging.getLogger(msg['name']) - msg['message'] = 'Remote: ' + msg['message'] - # In JSON mode, we manually check whether the log message should be propagated. - if logging.getLogger('borg').json and level >= target_logger.getEffectiveLevel(): - sys.stderr.write(json.dumps(msg) + '\n') - else: - target_logger.log(level, '%s', msg['message']) - elif msg['type'].startswith('progress_'): - # Progress messages are a bit more complex. - # First of all, we check whether progress output is enabled. This is signalled - # through the effective level of the borg.output.progress logger - # (also see ProgressIndicatorBase in borg.helpers). - progress_logger = logging.getLogger('borg.output.progress') - if progress_logger.getEffectiveLevel() == logging.INFO: - # When progress output is enabled, we check whether the client is in - # --log-json mode, as signalled by the "json" attribute on the "borg" logger. - if logging.getLogger('borg').json: - # In --log-json mode we re-emit the progress JSON line as sent by the server, - # with the message, if any, prefixed with "Remote: ". - if 'message' in msg: - msg['message'] = 'Remote: ' + msg['message'] - sys.stderr.write(json.dumps(msg) + '\n') - elif 'message' in msg: - # In text log mode we write only the message to stderr and terminate with \r - # (carriage return, i.e. move the write cursor back to the beginning of the line) - # so that the next message, progress or not, overwrites it. This mirrors the behaviour - # of local progress displays. - sys.stderr.write('Remote: ' + msg['message'] + '\r') - elif line.startswith('$LOG '): - # This format is used by Borg since 1.1.0b1. - # It prefixed log lines with $LOG as a marker, followed by the log level - # and optionally a logger name, then "Remote:" as a separator followed by the original - # message. - # - # It is the oldest format supported by these servers, so it was important to make - # it readable with older (1.0.x) clients. - # - # TODO: Remove this block (so it'll be handled by the "else:" below) with a Borg 1.1 RC. - # Also check whether client_supports_log_v3 should be removed. + if line.startswith('$LOG '): _, level, msg = line.split(' ', 2) level = getattr(logging, level, logging.CRITICAL) # str -> int if msg.startswith('Remote:'): @@ -1016,15 +941,7 @@ def handle_remote_line(line): logname, msg = msg.split(' ', 1) logging.getLogger(logname).log(level, msg.rstrip()) else: - # Plain 1.0.x and older format - re-emit to stderr (mirroring what the 1.0.x - # client did) or as a generic log message. - # We don't know what priority the line had. - if logging.getLogger('borg').json: - logging.getLogger('').warning('Remote: ' + line.strip()) - else: - # In non-JSON mode we circumvent logging to preserve carriage returns (\r) - # which are generated by remote progress displays. - sys.stderr.write('Remote: ' + line) + sys.stderr.write('Remote: ' + line) class RepositoryNoCache:
Decouple SecurityManager and Cache and always check with SecurityManager Currently SecurityManager is only queried if the Cache is used, which elides checks for various commands, e.g. list, key management, extract, mount, ... The debug commands may be excluded.
borgbackup/borg
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 29460189..8f47b0b9 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1709,7 +1709,7 @@ def test_common_options(self): self.create_test_files() self.cmd('init', '--encryption=repokey', self.repository_location) log = self.cmd('--debug', 'create', self.repository_location + '::test', 'input') - assert 'security: read previous_location' in log + assert 'security: read previous location' in log def _get_sizes(self, compression, compressible, size=10000): if compressible: diff --git a/src/borg/testsuite/repository.py b/src/borg/testsuite/repository.py index 16f47b91..2819c64c 100644 --- a/src/borg/testsuite/repository.py +++ b/src/borg/testsuite/repository.py @@ -714,7 +714,6 @@ def test_borg_cmd(self): class MockArgs: remote_path = 'borg' umask = 0o077 - debug_topics = [] assert self.repository.borg_cmd(None, testing=True) == [sys.executable, '-m', 'borg.archiver', 'serve'] args = MockArgs() @@ -724,9 +723,6 @@ class MockArgs: assert self.repository.borg_cmd(args, testing=False) == ['borg', 'serve', '--umask=077', '--info'] args.remote_path = 'borg-0.28.2' assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info'] - args.debug_topics = ['something_client_side', 'repository_compaction'] - assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info', - '--debug-topic=borg.debug.repository_compaction'] class RemoteLegacyFree(RepositoryTestCaseBase):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 5 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-xdist pytest-cov pytest-benchmark" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libacl1-dev liblz4-dev libfuse-dev" ], "python": "3.9", "reqs_path": [ "requirements.d/development.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/borgbackup/borg.git@781a41de50849b5c96c83a0f8fff91306ee52eb7#egg=borgbackup cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 coverage==7.8.0 Cython==3.0.12 distlib==0.3.9 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 iniconfig==2.1.0 msgpack-python==0.5.6 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 py-cpuinfo==9.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-xdist==3.6.1 setuptools-scm==8.2.0 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: borg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - coverage==7.8.0 - cython==3.0.12 - distlib==0.3.9 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - iniconfig==2.1.0 - msgpack-python==0.5.6 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-xdist==3.6.1 - setuptools-scm==8.2.0 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/borg
[ "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_borg_cmd", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_segment", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_stderr_messages" ]
[ "src/borg/testsuite/archiver.py::test_return_codes[python]", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_common_options", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_exclude_folder_but_recurse", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_exclude_folder_no_recurse", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_profile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_put_get_delete_obj", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_force", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_export_tar", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_export_tar_gz", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_export_tar_strip_components", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_export_tar_strip_components_links", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_info_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_json_args", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_log_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection_repokey_blank_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_attic013_acl_bug", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_check_usage", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_corrupted_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_empty_repository", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_extra_chunks", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_corrupted_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_duplicate_archive", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_item_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_metadata", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_file_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data_unencrypted", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable2", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_fresh_init_tam_required", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_not_required", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_common_options", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_exclude_folder_but_recurse", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_exclude_folder_no_recurse", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_profile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_force", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_export_tar", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_export_tar_gz", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_export_tar_strip_components", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_export_tar_strip_components_links", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_info_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_json_args", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_log_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_remote_repo_restrict_to_path", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection_repokey_blank_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_doesnt_leak", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_sort_option", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test1", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_consistency", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_invalid_rpc", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_max_data_size", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_rpc_exception_transport", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_corrupted_commit_segment", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_corrupted_segment", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_commit_segment", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_no_commits" ]
[ "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_double_force", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_double_force", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::test_get_args", "src/borg/testsuite/archiver.py::test_compare_chunk_contents", "src/borg/testsuite/archiver.py::TestBuildFilter::test_basic", "src/borg/testsuite/archiver.py::TestBuildFilter::test_empty", "src/borg/testsuite/archiver.py::TestBuildFilter::test_strip_components", "src/borg/testsuite/archiver.py::TestCommonOptions::test_simple", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[-p-progress-True-before]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[-p-progress-True-after]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[-p-progress-True-both]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--lock-wait=3-lock_wait-3-before]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--lock-wait=3-lock_wait-3-after]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--lock-wait=3-lock_wait-3-both]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--no-files-cache-no_files_cache-False-before]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--no-files-cache-no_files_cache-False-after]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--no-files-cache-no_files_cache-False-both]", "src/borg/testsuite/repository.py::RepositoryTestCase::test1", "src/borg/testsuite/repository.py::RepositoryTestCase::test2", "src/borg/testsuite/repository.py::RepositoryTestCase::test_consistency", "src/borg/testsuite/repository.py::RepositoryTestCase::test_consistency2", "src/borg/testsuite/repository.py::RepositoryTestCase::test_list", "src/borg/testsuite/repository.py::RepositoryTestCase::test_max_data_size", "src/borg/testsuite/repository.py::RepositoryTestCase::test_overwrite_in_same_transaction", "src/borg/testsuite/repository.py::RepositoryTestCase::test_scan", "src/borg/testsuite/repository.py::RepositoryTestCase::test_single_kind_transactions", "src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse1", "src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse2", "src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse_delete", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_compact_segments", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_deleting_compacted_segments", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_write_index", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_ignores_commit_tag_in_data", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_moved_deletes_are_tracked", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_lock_upgrade", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_lock_upgrade_old", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_of_missing_index", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_shadow_index_rollback", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_shadowed_entries_are_preserved", "src/borg/testsuite/repository.py::RepositoryAppendOnlyTestCase::test_append_only", "src/borg/testsuite/repository.py::RepositoryAppendOnlyTestCase::test_destroy_append_only", "src/borg/testsuite/repository.py::RepositoryFreeSpaceTestCase::test_additional_free_space", "src/borg/testsuite/repository.py::RepositoryFreeSpaceTestCase::test_create_free_space", "src/borg/testsuite/repository.py::NonceReservation::test_commit_nonce_reservation", "src/borg/testsuite/repository.py::NonceReservation::test_commit_nonce_reservation_asserts", "src/borg/testsuite/repository.py::NonceReservation::test_get_free_nonce", "src/borg/testsuite/repository.py::NonceReservation::test_get_free_nonce_asserts", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_corrupted_hints", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_deleted_hints", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_deleted_index", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_index", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_index_outside_transaction", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_unreadable_hints", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_unreadable_index", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_crash_before_compact", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_corrupted_commit_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_corrupted_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_index_too_new", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_commit_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_index", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_no_commits", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test2", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_consistency2", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_list", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_overwrite_in_same_transaction", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_scan", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_single_kind_transactions", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_ssh_cmd", "src/borg/testsuite/repository.py::RemoteLegacyFree::test_legacy_free", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_crash_before_compact", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_index_too_new", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_index", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_info_to_correct_local_child", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_post11_format_messages", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_pre11_format_messages", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_remote_messages_screened" ]
[]
BSD License
1,237
[ "src/borg/helpers.py", "src/borg/logger.py", "src/borg/archiver.py", "src/borg/remote.py", "src/borg/cache.py" ]
[ "src/borg/helpers.py", "src/borg/logger.py", "src/borg/archiver.py", "src/borg/remote.py", "src/borg/cache.py" ]
pre-commit__pre-commit-537
e3b14c35f782ed464e3f96b44e8509048187689f
2017-05-10 19:53:23
e3b14c35f782ed464e3f96b44e8509048187689f
diff --git a/pre_commit/git.py b/pre_commit/git.py index d4277e7..2ed0299 100644 --- a/pre_commit/git.py +++ b/pre_commit/git.py @@ -48,10 +48,10 @@ def is_in_merge_conflict(): def parse_merge_msg_for_conflicts(merge_msg): # Conflicted files start with tabs return [ - line.lstrip('#').strip() + line.lstrip(b'#').strip().decode('UTF-8') for line in merge_msg.splitlines() # '#\t' for git 2.4.1 - if line.startswith(('\t', '#\t')) + if line.startswith((b'\t', b'#\t')) ] @@ -60,7 +60,7 @@ def get_conflicted_files(): logger.info('Checking merge-conflict files only.') # Need to get the conflicted files from the MERGE_MSG because they could # have resolved the conflict by choosing one side or the other - merge_msg = open(os.path.join(get_git_dir('.'), 'MERGE_MSG')).read() + merge_msg = open(os.path.join(get_git_dir('.'), 'MERGE_MSG'), 'rb').read() merge_conflict_filenames = parse_merge_msg_for_conflicts(merge_msg) # This will get the rest of the changes made after the merge.
Unicode error: python 2 + merge conflict + non-ascii commit message The important part of the stack: ``` File "...python2.7/site-packages/pre_commit/commands/run.py", line 52, in get_filenames return getter(include_expr, exclude_expr) File "...python2.7/site-packages/pre_commit/util.py", line 46, in wrapper ret = wrapper._cache[key] = func(*args) File "...python2.7/site-packages/pre_commit/git.py", line 98, in wrapper for filename in all_file_list_strategy() File "...python2.7/site-packages/pre_commit/util.py", line 46, in wrapper ret = wrapper._cache[key] = func(*args) File "...python2.7/site-packages/pre_commit/git.py", line 64, in get_conflicted_files merge_conflict_filenames = parse_merge_msg_for_conflicts(merge_msg) File "...python2.7/site-packages/pre_commit/git.py", line 54, in parse_merge_msg_for_conflicts if line.startswith(('\t', '#\t')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 37: ordinal not in range(128) ``` An easy fix: https://github.com/pre-commit/pre-commit/blob/e3b14c35f782ed464e3f96b44e8509048187689f/pre_commit/git.py#L63
pre-commit/pre-commit
diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py index cd4c685..ad8d245 100644 --- a/tests/commands/install_uninstall_test.py +++ b/tests/commands/install_uninstall_test.py @@ -1,3 +1,4 @@ +# -*- coding: UTF-8 -*- from __future__ import absolute_import from __future__ import unicode_literals @@ -190,6 +191,18 @@ def test_commit_am(tempdir_factory): assert ret == 0 +def test_unicode_merge_commit_message(tempdir_factory): + path = make_consuming_repo(tempdir_factory, 'script_hooks_repo') + with cwd(path): + assert install(Runner(path, C.CONFIG_FILE)) == 0 + cmd_output('git', 'checkout', 'master', '-b', 'foo') + cmd_output('git', 'commit', '--allow-empty', '-m', 'branch2') + cmd_output('git', 'checkout', 'master') + cmd_output('git', 'merge', 'foo', '--no-ff', '--no-commit', '-m', '☃') + # Used to crash + cmd_output('git', 'commit', '--no-edit') + + def test_install_idempotent(tempdir_factory): path = make_consuming_repo(tempdir_factory, 'script_hooks_repo') with cwd(path): diff --git a/tests/git_test.py b/tests/git_test.py index c18dcd8..ffe1c1a 100644 --- a/tests/git_test.py +++ b/tests/git_test.py @@ -142,8 +142,8 @@ def test_get_conflicted_files_unstaged_files(in_merge_conflict): assert ret == {'conflict_file'} -MERGE_MSG = "Merge branch 'foo' into bar\n\nConflicts:\n\tconflict_file\n" -OTHER_MERGE_MSG = MERGE_MSG + '\tother_conflict_file\n' +MERGE_MSG = b"Merge branch 'foo' into bar\n\nConflicts:\n\tconflict_file\n" +OTHER_MERGE_MSG = MERGE_MSG + b'\tother_conflict_file\n' @pytest.mark.parametrize(
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 1, "test_score": 1 }, "num_modified_files": 1 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "numpy>=1.16.0", "pandas>=1.0.0", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements-dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aspy.yaml==1.3.0 cached-property==2.0.1 coverage==7.8.0 distlib==0.3.9 exceptiongroup==1.2.2 filelock==3.18.0 flake8==7.2.0 iniconfig==2.1.0 mccabe==0.7.0 mock==5.2.0 nodeenv==1.9.1 numpy==2.0.2 packaging==24.2 pandas==2.2.3 platformdirs==4.3.7 pluggy==1.5.0 -e git+https://github.com/pre-commit/pre-commit.git@e3b14c35f782ed464e3f96b44e8509048187689f#egg=pre_commit pycodestyle==2.13.0 pyflakes==3.3.1 pytest==8.3.5 pytest-env==1.1.5 python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==6.0.2 six==1.17.0 tomli==2.2.1 tzdata==2025.2 virtualenv==20.29.3
name: pre-commit channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aspy-yaml==1.3.0 - cached-property==2.0.1 - coverage==7.8.0 - distlib==0.3.9 - exceptiongroup==1.2.2 - filelock==3.18.0 - flake8==7.2.0 - iniconfig==2.1.0 - mccabe==0.7.0 - mock==5.2.0 - nodeenv==1.9.1 - numpy==2.0.2 - packaging==24.2 - pandas==2.2.3 - platformdirs==4.3.7 - pluggy==1.5.0 - pycodestyle==2.13.0 - pyflakes==3.3.1 - pytest==8.3.5 - pytest-env==1.1.5 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyyaml==6.0.2 - setuptools==18.4 - six==1.17.0 - tomli==2.2.1 - tzdata==2025.2 - virtualenv==20.29.3 prefix: /opt/conda/envs/pre-commit
[ "tests/git_test.py::test_parse_merge_msg_for_conflicts[Merge" ]
[ "tests/commands/install_uninstall_test.py::test_install_pre_commit_and_run", "tests/commands/install_uninstall_test.py::test_install_in_submodule_and_run", "tests/commands/install_uninstall_test.py::test_install_idempotent", "tests/commands/install_uninstall_test.py::test_failing_hooks_returns_nonzero", "tests/commands/install_uninstall_test.py::test_install_existing_hooks_no_overwrite", "tests/commands/install_uninstall_test.py::test_install_existing_hook_no_overwrite_idempotent", "tests/commands/install_uninstall_test.py::test_failing_existing_hook_returns_1", "tests/commands/install_uninstall_test.py::test_install_overwrite_no_existing_hooks", "tests/commands/install_uninstall_test.py::test_install_overwrite", "tests/commands/install_uninstall_test.py::test_replace_old_commit_script", "tests/commands/install_uninstall_test.py::test_installs_hooks_with_hooks_True", "tests/commands/install_uninstall_test.py::test_install_hooks_command", "tests/commands/install_uninstall_test.py::test_installed_from_venv" ]
[ "tests/commands/install_uninstall_test.py::test_is_not_script", "tests/commands/install_uninstall_test.py::test_is_script", "tests/commands/install_uninstall_test.py::test_is_previous_pre_commit", "tests/commands/install_uninstall_test.py::test_install_pre_commit", "tests/commands/install_uninstall_test.py::test_install_hooks_directory_not_present", "tests/commands/install_uninstall_test.py::test_install_hooks_dead_symlink", "tests/commands/install_uninstall_test.py::test_uninstall_does_not_blow_up_when_not_there", "tests/commands/install_uninstall_test.py::test_uninstall", "tests/commands/install_uninstall_test.py::test_commit_am", "tests/commands/install_uninstall_test.py::test_unicode_merge_commit_message", "tests/commands/install_uninstall_test.py::test_environment_not_sourced", "tests/commands/install_uninstall_test.py::test_uninstall_restores_legacy_hooks", "tests/commands/install_uninstall_test.py::test_uninstall_doesnt_remove_not_our_hooks", "tests/commands/install_uninstall_test.py::test_pre_push_integration_failing", "tests/commands/install_uninstall_test.py::test_pre_push_integration_accepted", "tests/commands/install_uninstall_test.py::test_pre_push_integration_empty_push", "tests/commands/install_uninstall_test.py::test_install_disallow_mising_config", "tests/commands/install_uninstall_test.py::test_install_allow_mising_config", "tests/commands/install_uninstall_test.py::test_install_temporarily_allow_mising_config", "tests/git_test.py::test_get_root_at_root", "tests/git_test.py::test_get_root_deeper", "tests/git_test.py::test_get_root_not_git_dir", "tests/git_test.py::test_get_staged_files_deleted", "tests/git_test.py::test_is_not_in_merge_conflict", "tests/git_test.py::test_is_in_merge_conflict", "tests/git_test.py::test_cherry_pick_conflict", "tests/git_test.py::test_get_files_matching_base", "tests/git_test.py::test_get_files_matching_total_match", "tests/git_test.py::test_does_search_instead_of_match", "tests/git_test.py::test_does_not_include_deleted_fileS", "tests/git_test.py::test_exclude_removes_files", "tests/git_test.py::test_get_conflicted_files", "tests/git_test.py::test_get_conflicted_files_unstaged_files" ]
[]
MIT License
1,238
[ "pre_commit/git.py" ]
[ "pre_commit/git.py" ]
erikrose__parsimonious-113
30b94f1be71a7be640f3f4285a34cc495e18b87a
2017-05-11 00:15:58
30b94f1be71a7be640f3f4285a34cc495e18b87a
diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py index 5e2d2b9..dda8fd9 100644 --- a/parsimonious/expressions.py +++ b/parsimonious/expressions.py @@ -78,7 +78,7 @@ def expression(callable, rule_name, grammar): else: # Node or None return result - return Node(self.name, text, pos, end, children=children) + return Node(self, text, pos, end, children=children) def _as_rhs(self): return '{custom function "%s"}' % callable.__name__ @@ -94,10 +94,20 @@ class Expression(StrAndRepr): # http://stackoverflow.com/questions/1336791/dictionary-vs-object-which-is-more-efficient-and-why # Top-level expressions--rules--have names. Subexpressions are named ''. - __slots__ = ['name'] + __slots__ = ['name', 'identity_tuple'] def __init__(self, name=''): self.name = name + self.identity_tuple = (self.name, ) + + def __hash__(self): + return hash(self.identity_tuple) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.identity_tuple == other.identity_tuple + + def __ne__(self, other): + return not (self == other) def parse(self, text, pos=0): """Return a parse tree of ``text``. @@ -180,10 +190,9 @@ class Expression(StrAndRepr): return node def __str__(self): - return u'<%s %s at 0x%s>' % ( + return u'<%s %s>' % ( self.__class__.__name__, - self.as_rule(), - id(self)) + self.as_rule()) def as_rule(self): """Return the left- and right-hand sides of a rule that represents me. @@ -223,10 +232,11 @@ class Literal(Expression): def __init__(self, literal, name=''): super(Literal, self).__init__(name) self.literal = literal + self.identity_tuple = (name, literal) def _uncached_match(self, text, pos, cache, error): if text.startswith(self.literal, pos): - return Node(self.name, text, pos, pos + len(self.literal)) + return Node(self, text, pos, pos + len(self.literal)) def _as_rhs(self): # TODO: Get backslash escaping right. @@ -241,7 +251,7 @@ class TokenMatcher(Literal): """ def _uncached_match(self, token_list, pos, cache, error): if token_list[pos].type == self.literal: - return Node(self.name, token_list, pos, pos + 1) + return Node(self, token_list, pos, pos + 1) class Regex(Expression): @@ -262,13 +272,14 @@ class Regex(Expression): (dot_all and re.S) | (unicode and re.U) | (verbose and re.X)) + self.identity_tuple = (self.name, self.re) def _uncached_match(self, text, pos, cache, error): """Return length of match, ``None`` if no match.""" m = self.re.match(text, pos) if m is not None: span = m.span() - node = RegexNode(self.name, text, pos, pos + span[1] - span[0]) + node = RegexNode(self, text, pos, pos + span[1] - span[0]) node.match = m # TODO: A terrible idea for cache size? return node @@ -293,6 +304,18 @@ class Compound(Expression): super(Compound, self).__init__(kwargs.get('name', '')) self.members = members + def __hash__(self): + # Note we leave members out of the hash computation, since compounds can get added to + # sets, then have their members mutated. See RuleVisitor._resolve_refs. + # Equality should still work, but we want the rules to go into the correct hash bucket. + return hash((self.__class__, self.name)) + + def __eq__(self, other): + return ( + isinstance(other, self.__class__) and + self.name == other.name and + self.members == other.members) + class Sequence(Compound): """A series of expressions that must match contiguous, ordered pieces of @@ -315,7 +338,7 @@ class Sequence(Compound): new_pos += length length_of_sequence += length # Hooray! We got through all the members! - return Node(self.name, text, pos, pos + length_of_sequence, children) + return Node(self, text, pos, pos + length_of_sequence, children) def _as_rhs(self): return u'({0})'.format(u' '.join(self._unicode_members())) @@ -333,7 +356,7 @@ class OneOf(Compound): node = m.match_core(text, pos, cache, error) if node is not None: # Wrap the succeeding child in a node representing the OneOf: - return Node(self.name, text, pos, node.end, children=[node]) + return Node(self, text, pos, node.end, children=[node]) def _as_rhs(self): return u'({0})'.format(u' / '.join(self._unicode_members())) @@ -350,7 +373,7 @@ class Lookahead(Compound): def _uncached_match(self, text, pos, cache, error): node = self.members[0].match_core(text, pos, cache, error) if node is not None: - return Node(self.name, text, pos, pos) + return Node(self, text, pos, pos) def _as_rhs(self): return u'&%s' % self._unicode_members()[0] @@ -367,7 +390,7 @@ class Not(Compound): # not bother to cache NOTs directly. node = self.members[0].match_core(text, pos, cache, error) if node is None: - return Node(self.name, text, pos, pos) + return Node(self, text, pos, pos) def _as_rhs(self): # TODO: Make sure this parenthesizes the member properly if it's an OR @@ -386,8 +409,8 @@ class Optional(Compound): """ def _uncached_match(self, text, pos, cache, error): node = self.members[0].match_core(text, pos, cache, error) - return (Node(self.name, text, pos, pos) if node is None else - Node(self.name, text, pos, node.end, children=[node])) + return (Node(self, text, pos, pos) if node is None else + Node(self, text, pos, node.end, children=[node])) def _as_rhs(self): return u'%s?' % self._unicode_members()[0] @@ -404,7 +427,7 @@ class ZeroOrMore(Compound): node = self.members[0].match_core(text, new_pos, cache, error) if node is None or not (node.end - node.start): # Node was None or 0 length. 0 would otherwise loop infinitely. - return Node(self.name, text, pos, new_pos, children) + return Node(self, text, pos, new_pos, children) children.append(node) new_pos += node.end - node.start @@ -441,7 +464,7 @@ class OneOrMore(Compound): break new_pos += length if len(children) >= self.min: - return Node(self.name, text, pos, new_pos, children) + return Node(self, text, pos, new_pos, children) def _as_rhs(self): return u'%s+' % self._unicode_members()[0] diff --git a/parsimonious/grammar.py b/parsimonious/grammar.py index b6386d0..b7b1c29 100644 --- a/parsimonious/grammar.py +++ b/parsimonious/grammar.py @@ -420,8 +420,8 @@ class RuleVisitor(NodeVisitor): # of `expr.members` can refer back to `expr`, but it can't go # any farther. done.add(expr) - expr.members = [self._resolve_refs(rule_map, member, done) - for member in expr.members] + expr.members = tuple(self._resolve_refs(rule_map, member, done) + for member in expr.members) return expr def visit_rules(self, node, rules_list): diff --git a/parsimonious/nodes.py b/parsimonious/nodes.py index 77ad1f9..8c8d1af 100644 --- a/parsimonious/nodes.py +++ b/parsimonious/nodes.py @@ -34,20 +34,25 @@ class Node(object): """ # I tried making this subclass list, but it got ugly. I had to construct # invalid ones and patch them up later, and there were other problems. - __slots__ = ['expr_name', # The name of the expression that generated me + __slots__ = ['expr', # The expression that generated me 'full_text', # The full text fed to the parser 'start', # The position in the text where that expr started matching 'end', # The position after start where the expr first didn't # match. [start:end] follow Python slice conventions. 'children'] # List of child parse tree nodes - def __init__(self, expr_name, full_text, start, end, children=None): - self.expr_name = expr_name + def __init__(self, expr, full_text, start, end, children=None): + self.expr = expr self.full_text = full_text self.start = start self.end = end self.children = children or [] + @property + def expr_name(self): + # backwards compatibility + return self.expr.name + def __iter__(self): """Support looping over my children and doing tuple unpacks on me. @@ -92,7 +97,7 @@ class Node(object): if not isinstance(other, Node): return NotImplemented - return (self.expr_name == other.expr_name and + return (self.expr == other.expr and self.full_text == other.full_text and self.start == other.start and self.end == other.end and @@ -109,7 +114,7 @@ class Node(object): ret = ["s = %r" % self.full_text] if top_level else [] ret.append("%s(%r, s, %s, %s%s)" % ( self.__class__.__name__, - self.expr_name, + self.expr, self.start, self.end, (', children=[%s]' % @@ -233,8 +238,8 @@ class NodeVisitor(with_metaclass(RuleDecoratorMeta, object)): for now. """ - raise NotImplementedError('No visitor method was defined for "%s".' % - node.expr_name) + raise NotImplementedError('No visitor method was defined for this expression: %s' % + node.expr.as_rule()) # Convenience methods: diff --git a/tox.ini b/tox.ini index f1fa5e6..9a8519a 100644 --- a/tox.ini +++ b/tox.ini @@ -11,4 +11,6 @@ envlist = py27, py33, py34, py35, py36 [testenv] usedevelop = True commands = nosetests parsimonious -deps = nose +deps = + nose + six>=1.9.0
Unnamed nodes should make up useful names for themselves When you print a node, you get something like this: ``` <Node called "char_range" matching "c-a"> <Node called "class_char" matching "c"> <RegexNode matching "c"> <Node matching "-"> <Node called "class_char" matching "a"> <RegexNode matching "a"> ``` Named nodes get names, but unnamed ones (like the one matching "-") don't. Especially when debugging—for instance, ending up in visit_generic and not knowing what node triggered that dispatch—it would be helpful if nodes would identify themselves by their rule expression: `<Node "class_item*" matching "abc">`. Then we take the "called" out of the named nodes, and everything is frighteningly consistent.
erikrose/parsimonious
diff --git a/parsimonious/tests/test_expressions.py b/parsimonious/tests/test_expressions.py index 2d0360b..58734b9 100644 --- a/parsimonious/tests/test_expressions.py +++ b/parsimonious/tests/test_expressions.py @@ -82,49 +82,49 @@ class TreeTests(TestCase): def test_simple_node(self): """Test that leaf expressions like ``Literal`` make the right nodes.""" h = Literal('hello', name='greeting') - eq_(h.match('hello'), Node('greeting', 'hello', 0, 5)) + eq_(h.match('hello'), Node(h, 'hello', 0, 5)) def test_sequence_nodes(self): """Assert that ``Sequence`` produces nodes with the right children.""" s = Sequence(Literal('heigh', name='greeting1'), Literal('ho', name='greeting2'), name='dwarf') text = 'heighho' - eq_(s.match(text), Node('dwarf', text, 0, 7, children= - [Node('greeting1', text, 0, 5), - Node('greeting2', text, 5, 7)])) + eq_(s.match(text), Node(s, text, 0, 7, children= + [Node(s.members[0], text, 0, 5), + Node(s.members[1], text, 5, 7)])) def test_one_of(self): """``OneOf`` should return its own node, wrapping the child that succeeds.""" o = OneOf(Literal('a', name='lit'), name='one_of') text = 'aa' - eq_(o.match(text), Node('one_of', text, 0, 1, children=[ - Node('lit', text, 0, 1)])) + eq_(o.match(text), Node(o, text, 0, 1, children=[ + Node(o.members[0], text, 0, 1)])) def test_optional(self): """``Optional`` should return its own node wrapping the succeeded child.""" expr = Optional(Literal('a', name='lit'), name='opt') text = 'a' - eq_(expr.match(text), Node('opt', text, 0, 1, children=[ - Node('lit', text, 0, 1)])) + eq_(expr.match(text), Node(expr, text, 0, 1, children=[ + Node(expr.members[0], text, 0, 1)])) # Test failure of the Literal inside the Optional; the # LengthTests.test_optional is ambiguous for that. text = '' - eq_(expr.match(text), Node('opt', text, 0, 0)) + eq_(expr.match(text), Node(expr, text, 0, 0)) def test_zero_or_more_zero(self): """Test the 0 case of ``ZeroOrMore``; it should still return a node.""" expr = ZeroOrMore(Literal('a'), name='zero') text = '' - eq_(expr.match(text), Node('zero', text, 0, 0)) + eq_(expr.match(text), Node(expr, text, 0, 0)) def test_one_or_more_one(self): """Test the 1 case of ``OneOrMore``; it should return a node with a child.""" expr = OneOrMore(Literal('a', name='lit'), name='one') text = 'a' - eq_(expr.match(text), Node('one', text, 0, 1, children=[ - Node('lit', text, 0, 1)])) + eq_(expr.match(text), Node(expr, text, 0, 1, children=[ + Node(expr.members[0], text, 0, 1)])) # Things added since Grammar got implemented are covered in integration # tests in test_grammar. @@ -142,9 +142,9 @@ class ParseTests(TestCase): """ expr = OneOrMore(Literal('a', name='lit'), name='more') text = 'aa' - eq_(expr.parse(text), Node('more', text, 0, 2, children=[ - Node('lit', text, 0, 1), - Node('lit', text, 1, 2)])) + eq_(expr.parse(text), Node(expr, text, 0, 2, children=[ + Node(expr.members[0], text, 0, 1), + Node(expr.members[0], text, 1, 2)])) class ErrorReportingTests(TestCase): diff --git a/parsimonious/tests/test_grammar.py b/parsimonious/tests/test_grammar.py index 6051c3e..f9af0e8 100644 --- a/parsimonious/tests/test_grammar.py +++ b/parsimonious/tests/test_grammar.py @@ -9,7 +9,7 @@ from nose.tools import eq_, assert_raises, ok_ from six import text_type from parsimonious.exceptions import UndefinedLabel, ParseError -from parsimonious.expressions import Sequence +from parsimonious.expressions import Literal, Lookahead, Regex, Sequence, TokenMatcher from parsimonious.grammar import rule_grammar, RuleVisitor, Grammar, TokenGrammar, LazyReference from parsimonious.nodes import Node from parsimonious.utils import Token @@ -21,37 +21,40 @@ class BootstrappingGrammarTests(TestCase): def test_quantifier(self): text = '*' - eq_(rule_grammar['quantifier'].parse(text), - Node('quantifier', text, 0, 1, children=[ - Node('', text, 0, 1), Node('_', text, 1, 1)])) + quantifier = rule_grammar['quantifier'] + eq_(quantifier.parse(text), + Node(quantifier, text, 0, 1, children=[ + Node(quantifier.members[0], text, 0, 1), Node(rule_grammar['_'], text, 1, 1)])) text = '?' - eq_(rule_grammar['quantifier'].parse(text), - Node('quantifier', text, 0, 1, children=[ - Node('', text, 0, 1), Node('_', text, 1, 1)])) + eq_(quantifier.parse(text), + Node(quantifier, text, 0, 1, children=[ + Node(quantifier.members[0], text, 0, 1), Node(rule_grammar['_'], text, 1, 1)])) text = '+' - eq_(rule_grammar['quantifier'].parse(text), - Node('quantifier', text, 0, 1, children=[ - Node('', text, 0, 1), Node('_', text, 1, 1)])) + eq_(quantifier.parse(text), + Node(quantifier, text, 0, 1, children=[ + Node(quantifier.members[0], text, 0, 1), Node(rule_grammar['_'], text, 1, 1)])) def test_spaceless_literal(self): text = '"anything but quotes#$*&^"' - eq_(rule_grammar['spaceless_literal'].parse(text), - Node('spaceless_literal', text, 0, len(text), children=[ - Node('', text, 0, len(text))])) + spaceless_literal = rule_grammar['spaceless_literal'] + eq_(spaceless_literal.parse(text), + Node(spaceless_literal, text, 0, len(text), children=[ + Node(spaceless_literal.members[0], text, 0, len(text))])) text = r'''r"\""''' - eq_(rule_grammar['spaceless_literal'].parse(text), - Node('spaceless_literal', text, 0, 5, children=[ - Node('', text, 0, 5)])) + eq_(spaceless_literal.parse(text), + Node(spaceless_literal, text, 0, 5, children=[ + Node(spaceless_literal.members[0], text, 0, 5)])) def test_regex(self): text = '~"[a-zA-Z_][a-zA-Z_0-9]*"LI' + regex = rule_grammar['regex'] eq_(rule_grammar['regex'].parse(text), - Node('regex', text, 0, len(text), children=[ - Node('', text, 0, 1), - Node('spaceless_literal', text, 1, 25, children=[ - Node('', text, 1, 25)]), - Node('', text, 25, 27), - Node('_', text, 27, 27)])) + Node(regex, text, 0, len(text), children=[ + Node(Literal('~'), text, 0, 1), + Node(rule_grammar['spaceless_literal'], text, 1, 25, children=[ + Node(rule_grammar['spaceless_literal'].members[0], text, 1, 25)]), + Node(regex.members[2], text, 25, 27), + Node(rule_grammar['_'], text, 27, 27)])) def test_successes(self): """Make sure the PEG recognition grammar succeeds on various inputs.""" @@ -117,7 +120,7 @@ class RuleVisitorTests(TestCase): rules, default_rule = RuleVisitor().visit(tree) text = '98' - eq_(default_rule.parse(text), Node('number', text, 0, 2)) + eq_(default_rule.parse(text), Node(default_rule, text, 0, 2)) def test_undefined_rule(self): """Make sure we throw the right exception on undefined rules.""" @@ -132,8 +135,8 @@ class RuleVisitorTests(TestCase): # It should turn into a Node from the Optional and another from the # Literal within. - eq_(default_rule.parse(howdy), Node('boy', howdy, 0, 5, children=[ - Node('', howdy, 0, 5)])) + eq_(default_rule.parse(howdy), Node(default_rule, howdy, 0, 5, children=[ + Node(Literal("howdy"), howdy, 0, 5)])) class GrammarTests(TestCase): @@ -150,8 +153,8 @@ class GrammarTests(TestCase): """ greeting_grammar = Grammar('greeting = "hi" / "howdy"') tree = greeting_grammar.parse('hi') - eq_(tree, Node('greeting', 'hi', 0, 2, children=[ - Node('', 'hi', 0, 2)])) + eq_(tree, Node(greeting_grammar['greeting'], 'hi', 0, 2, children=[ + Node(Literal('hi'), 'hi', 0, 2)])) def test_unicode(self): """Assert that a ``Grammar`` can convert into a string-formatted series @@ -179,10 +182,10 @@ class GrammarTests(TestCase): bold_close = "))" """) s = ' ((boo))yah' - eq_(grammar.match(s, pos=1), Node('bold_text', s, 1, 8, children=[ - Node('bold_open', s, 1, 3), - Node('text', s, 3, 6), - Node('bold_close', s, 6, 8)])) + eq_(grammar.match(s, pos=1), Node(grammar['bold_text'], s, 1, 8, children=[ + Node(grammar['bold_open'], s, 1, 3), + Node(grammar['text'], s, 3, 6), + Node(grammar['bold_close'], s, 6, 8)])) def test_bad_grammar(self): """Constructing a Grammar with bad rules should raise ParseError.""" @@ -232,9 +235,9 @@ class GrammarTests(TestCase): assert_raises(ParseError, grammar.parse, 'burp') s = 'arp' - eq_(grammar.parse('arp'), Node('starts_with_a', s, 0, 3, children=[ - Node('', s, 0, 0), - Node('', s, 0, 3)])) + eq_(grammar.parse('arp'), Node(grammar['starts_with_a'], s, 0, 3, children=[ + Node(Lookahead(Literal('a')), s, 0, 0), + Node(Regex(r'[a-z]+'), s, 0, 3)])) def test_parens(self): grammar = Grammar(r'''sequence = "chitty" (" " "bang")+''') @@ -313,10 +316,10 @@ class GrammarTests(TestCase): (pos + 1) if text[pos].isdigit() else None) s = '[6]' eq_(grammar.parse(s), - Node('bracketed_digit', s, 0, 3, children=[ - Node('start', s, 0, 1), - Node('digit', s, 1, 2), - Node('end', s, 2, 3)])) + Node(grammar['bracketed_digit'], s, 0, 3, children=[ + Node(grammar['start'], s, 0, 1), + Node(grammar['digit'], s, 1, 2), + Node(grammar['end'], s, 2, 3)])) def test_complex_custom_rules(self): """Run 5-arg custom rules through their paces. @@ -337,10 +340,10 @@ class GrammarTests(TestCase): grammar['real_digit'].match_core(text, pos, cache, error)) s = '[6]' eq_(grammar.parse(s), - Node('bracketed_digit', s, 0, 3, children=[ - Node('start', s, 0, 1), - Node('real_digit', s, 1, 2), - Node('end', s, 2, 3)])) + Node(grammar['bracketed_digit'], s, 0, 3, children=[ + Node(grammar['start'], s, 0, 1), + Node(grammar['real_digit'], s, 1, 2), + Node(grammar['end'], s, 2, 3)])) def test_lazy_custom_rules(self): """Make sure LazyReferences manually shoved into custom rules are @@ -358,9 +361,9 @@ class GrammarTests(TestCase): name='forty_five')).default('forty_five') s = '45' eq_(grammar.parse(s), - Node('forty_five', s, 0, 2, children=[ - Node('four', s, 0, 1), - Node('five', s, 1, 2)])) + Node(grammar['forty_five'], s, 0, 2, children=[ + Node(grammar['four'], s, 0, 1), + Node(grammar['five'], s, 1, 2)])) def test_unconnected_custom_rules(self): """Make sure custom rules that aren't hooked to any other rules still @@ -373,7 +376,7 @@ class GrammarTests(TestCase): grammar = Grammar(one_char=lambda text, pos: pos + 1).default('one_char') s = '4' eq_(grammar.parse(s), - Node('one_char', s, 0, 1)) + Node(grammar['one_char'], s, 0, 1)) def test_lazy_default_rule(self): """Make sure we get an actual rule set as our default rule, even when @@ -385,7 +388,7 @@ class GrammarTests(TestCase): styled_text = text text = "hi" """) - eq_(grammar.parse('hi'), Node('text', 'hi', 0, 2)) + eq_(grammar.parse('hi'), Node(grammar['text'], 'hi', 0, 2)) def test_immutable_grammar(self): """Make sure that a Grammar is immutable after being created.""" @@ -431,9 +434,9 @@ class TokenGrammarTests(TestCase): token1 = "token1" """) eq_(grammar.parse(s), - Node('foo', s, 0, 2, children=[ - Node('token1', s, 0, 1), - Node('', s, 1, 2)])) + Node(grammar['foo'], s, 0, 2, children=[ + Node(grammar['token1'], s, 0, 1), + Node(TokenMatcher('token2'), s, 1, 2)])) def test_parse_failure(self): """Parse failures should work normally with token literals.""" diff --git a/parsimonious/tests/test_nodes.py b/parsimonious/tests/test_nodes.py index caf9f68..20f1a53 100644 --- a/parsimonious/tests/test_nodes.py +++ b/parsimonious/tests/test_nodes.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- from nose import SkipTest -from nose.tools import eq_, ok_, assert_raises +from nose.tools import eq_, ok_, assert_raises, assert_in from parsimonious import Grammar, NodeVisitor, VisitationError, rule +from parsimonious.expressions import Literal from parsimonious.nodes import Node @@ -33,25 +34,19 @@ class ExplosiveFormatter(NodeVisitor): def test_visitor(): - """Assert a tree gets visited correctly. - - We start with a tree from applying this grammar... :: - + """Assert a tree gets visited correctly.""" + grammar = Grammar(r''' bold_text = bold_open text bold_close text = ~'[a-zA-Z 0-9]*' bold_open = '((' bold_close = '))' - - ...to this text:: - - ((o hai)) - - """ + ''') text = '((o hai))' - tree = Node('bold_text', text, 0, 9, - [Node('bold_open', text, 0, 2), - Node('text', text, 2, 7), - Node('bold_close', text, 7, 9)]) + tree = Node(grammar['bold_text'], text, 0, 9, + [Node(grammar['bold_open'], text, 0, 2), + Node(grammar['text'], text, 2, 7), + Node(grammar['bold_close'], text, 7, 9)]) + eq_(grammar.parse(text), tree) result = HtmlFormatter().visit(tree) eq_(result, '<b>o hai</b>') @@ -59,12 +54,12 @@ def test_visitor(): def test_visitation_exception(): assert_raises(VisitationError, ExplosiveFormatter().visit, - Node('boom', '', 0, 0)) + Node(Literal(''), '', 0, 0)) def test_str(): """Test str and unicode of ``Node``.""" - n = Node('text', 'o hai', 0, 5) + n = Node(Literal('something', name='text'), 'o hai', 0, 5) good = '<Node called "text" matching "o hai">' eq_(str(n), good) @@ -73,9 +68,16 @@ def test_repr(): """Test repr of ``Node``.""" s = u'hai ö' boogie = u'böogie' - n = Node(boogie, s, 0, 3, children=[ - Node('', s, 3, 4), Node('', s, 4, 5)]) - eq_(repr(n), """s = {hai_o}\nNode({boogie}, s, 0, 3, children=[Node('', s, 3, 4), Node('', s, 4, 5)])""".format(hai_o=repr(s), boogie=repr(boogie))) + n = Node(Literal(boogie), s, 0, 3, children=[ + Node(Literal(' '), s, 3, 4), Node(Literal(u'ö'), s, 4, 5)]) + eq_(repr(n), + str("""s = {hai_o}\nNode({boogie}, s, 0, 3, children=[Node({space}, s, 3, 4), Node({o}, s, 4, 5)])""").format( + hai_o=repr(s), + boogie=repr(Literal(boogie)), + space=repr(Literal(" ")), + o=repr(Literal(u"ö")), + ) + ) def test_parse_shortcut(): @@ -145,6 +147,43 @@ def test_unwrapped_exceptions(): def test_node_inequality(): - node = Node('text', 'o hai', 0, 5) + node = Node(Literal('12345'), 'o hai', 0, 5) ok_(node != 5) ok_(node != None) + ok_(node != Node(Literal('23456'), 'o hai', 0, 5)) + ok_(not (node != Node(Literal('12345'), 'o hai', 0, 5))) + + +def test_generic_visit_NotImplementedError_unnamed_node(): + """ + Test that generic_visit provides informative error messages + when visitors are not defined. + + Regression test for https://github.com/erikrose/parsimonious/issues/110 + """ + class MyVisitor(NodeVisitor): + grammar = Grammar(r''' + bar = "b" "a" "r" + ''') + unwrapped_exceptions = (NotImplementedError, ) + + with assert_raises(NotImplementedError) as e: + MyVisitor().parse('bar') + assert_in('No visitor method was defined for this expression: "b"', str(e.exception)) + + +def test_generic_visit_NotImplementedError_named_node(): + """ + Test that generic_visit provides informative error messages + when visitors are not defined. + """ + class MyVisitor(NodeVisitor): + grammar = Grammar(r''' + bar = myrule myrule myrule + myrule = ~"[bar]" + ''') + unwrapped_exceptions = (NotImplementedError, ) + + with assert_raises(NotImplementedError) as e: + MyVisitor().parse('bar') + assert_in('No visitor method was defined for this expression: myrule = ~"[bar]"', str(e.exception))
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 4 }
0.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "nose", "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work nose==1.3.7 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work -e git+https://github.com/erikrose/parsimonious.git@30b94f1be71a7be640f3f4285a34cc495e18b87a#egg=parsimonious pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 six==1.17.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: parsimonious channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - nose==1.3.7 - six==1.17.0 prefix: /opt/conda/envs/parsimonious
[ "parsimonious/tests/test_expressions.py::TreeTests::test_one_of", "parsimonious/tests/test_expressions.py::TreeTests::test_one_or_more_one", "parsimonious/tests/test_expressions.py::TreeTests::test_optional", "parsimonious/tests/test_expressions.py::TreeTests::test_sequence_nodes", "parsimonious/tests/test_expressions.py::TreeTests::test_simple_node", "parsimonious/tests/test_expressions.py::TreeTests::test_zero_or_more_zero", "parsimonious/tests/test_expressions.py::ParseTests::test_parse_success", "parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_quantifier", "parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_regex", "parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_spaceless_literal", "parsimonious/tests/test_grammar.py::RuleVisitorTests::test_optional", "parsimonious/tests/test_grammar.py::RuleVisitorTests::test_round_trip", "parsimonious/tests/test_grammar.py::GrammarTests::test_complex_custom_rules", "parsimonious/tests/test_grammar.py::GrammarTests::test_expressions_from_rules", "parsimonious/tests/test_grammar.py::GrammarTests::test_lazy_custom_rules", "parsimonious/tests/test_grammar.py::GrammarTests::test_lazy_default_rule", "parsimonious/tests/test_grammar.py::GrammarTests::test_lookahead", "parsimonious/tests/test_grammar.py::GrammarTests::test_match", "parsimonious/tests/test_grammar.py::GrammarTests::test_simple_custom_rules", "parsimonious/tests/test_grammar.py::GrammarTests::test_unconnected_custom_rules", "parsimonious/tests/test_grammar.py::TokenGrammarTests::test_parse_success", "parsimonious/tests/test_nodes.py::test_visitor", "parsimonious/tests/test_nodes.py::test_visitation_exception", "parsimonious/tests/test_nodes.py::test_str", "parsimonious/tests/test_nodes.py::test_repr", "parsimonious/tests/test_nodes.py::test_node_inequality", "parsimonious/tests/test_nodes.py::test_generic_visit_NotImplementedError_unnamed_node", "parsimonious/tests/test_nodes.py::test_generic_visit_NotImplementedError_named_node" ]
[]
[ "parsimonious/tests/test_expressions.py::LengthTests::test_not", "parsimonious/tests/test_expressions.py::LengthTests::test_one_of", "parsimonious/tests/test_expressions.py::LengthTests::test_one_or_more", "parsimonious/tests/test_expressions.py::LengthTests::test_optional", "parsimonious/tests/test_expressions.py::LengthTests::test_regex", "parsimonious/tests/test_expressions.py::LengthTests::test_sequence", "parsimonious/tests/test_expressions.py::LengthTests::test_zero_or_more", "parsimonious/tests/test_expressions.py::ErrorReportingTests::test_favoring_named_rules", "parsimonious/tests/test_expressions.py::ErrorReportingTests::test_inner_rule_succeeding", "parsimonious/tests/test_expressions.py::ErrorReportingTests::test_line_and_column", "parsimonious/tests/test_expressions.py::ErrorReportingTests::test_no_named_rule_succeeding", "parsimonious/tests/test_expressions.py::ErrorReportingTests::test_parse_with_leftovers", "parsimonious/tests/test_expressions.py::ErrorReportingTests::test_rewinding", "parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode", "parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode_crash", "parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode_keep_parens", "parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode_surrounding_parens", "parsimonious/tests/test_expressions.py::SlotsTests::test_subclassing", "parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_successes", "parsimonious/tests/test_grammar.py::RuleVisitorTests::test_undefined_rule", "parsimonious/tests/test_grammar.py::GrammarTests::test_bad_grammar", "parsimonious/tests/test_grammar.py::GrammarTests::test_comments", "parsimonious/tests/test_grammar.py::GrammarTests::test_immutable_grammar", "parsimonious/tests/test_grammar.py::GrammarTests::test_infinite_loop", "parsimonious/tests/test_grammar.py::GrammarTests::test_multi_line", "parsimonious/tests/test_grammar.py::GrammarTests::test_not", "parsimonious/tests/test_grammar.py::GrammarTests::test_parens", "parsimonious/tests/test_grammar.py::GrammarTests::test_parens_with_leading_whitespace", "parsimonious/tests/test_grammar.py::GrammarTests::test_repr", "parsimonious/tests/test_grammar.py::GrammarTests::test_resolve_refs_order", "parsimonious/tests/test_grammar.py::GrammarTests::test_right_recursive", "parsimonious/tests/test_grammar.py::GrammarTests::test_rule_ordering_is_preserved", "parsimonious/tests/test_grammar.py::GrammarTests::test_rule_ordering_is_preserved_on_shallow_copies", "parsimonious/tests/test_grammar.py::GrammarTests::test_single_quoted_literals", "parsimonious/tests/test_grammar.py::GrammarTests::test_unicode", "parsimonious/tests/test_grammar.py::TokenGrammarTests::test_parse_failure", "parsimonious/tests/test_grammar.py::TokenGrammarTests::test_token_repr", "parsimonious/tests/test_nodes.py::test_parse_shortcut", "parsimonious/tests/test_nodes.py::test_match_shortcut", "parsimonious/tests/test_nodes.py::test_rule_decorator", "parsimonious/tests/test_nodes.py::test_unwrapped_exceptions" ]
[]
MIT License
1,239
[ "parsimonious/expressions.py", "tox.ini", "parsimonious/grammar.py", "parsimonious/nodes.py" ]
[ "parsimonious/expressions.py", "tox.ini", "parsimonious/grammar.py", "parsimonious/nodes.py" ]
jbasko__configmanager-34
b63b5e6c97f694392d3b01a7f2b8345c56ddf7f6
2017-05-11 07:04:46
b63b5e6c97f694392d3b01a7f2b8345c56ddf7f6
diff --git a/configmanager/__init__.py b/configmanager/__init__.py index b0b47c1..e912d5f 100644 --- a/configmanager/__init__.py +++ b/configmanager/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.0.15' +__version__ = '0.0.16' from .base import not_set, ConfigItem, ConfigManager from .exceptions import UnknownConfigItem, ConfigValueNotSet, UnsupportedOperation diff --git a/configmanager/base.py b/configmanager/base.py index 27b2a3a..fbe389e 100644 --- a/configmanager/base.py +++ b/configmanager/base.py @@ -115,6 +115,7 @@ class ConfigItem(object): """ The first segment of :attr:`.path`. """ + # TODO Deprecated return self.path[0] @property @@ -122,6 +123,7 @@ class ConfigItem(object): """ The second segment of :attr:`.path`. """ + # TODO Deprecated return self.path[-1] @property @@ -129,6 +131,7 @@ class ConfigItem(object): """ A string, :attr:`.path` joined by dots. """ + # TODO Deprecated return '.'.join(self.path) @property @@ -384,26 +387,6 @@ class ConfigManager(object): """ return self._resolve_config_path(*path) in self._configs - def items(self, *prefix): - """ - Returns: - list: list of :class:`.ConfigItem` instances managed by this manager. - - If ``prefix`` is specified, only items with matching path prefix are included. - - Note: - This is different from ``ConfigParser.items()`` which returns what we would call - here resolved values of items. - - See Also: - :meth:`.ConfigManager.export()` - """ - prefix = resolve_config_prefix(*prefix) - if not prefix: - return list(self._configs.values()) - else: - return [c for c in self._configs.values() if c.path[:len(prefix)] == prefix[:]] - def find_items(self, *prefix): prefix = resolve_config_prefix(*prefix) if not prefix: @@ -433,7 +416,7 @@ class ConfigManager(object): """ pairs = [] - for item in self.items(*prefix): + for item in self.find_items(*prefix): if item.has_value or item.has_default: item_name_without_prefix = '.'.join(item.path[len(prefix):]) pairs.append((item_name_without_prefix, item.value)) diff --git a/configmanager/proxies.py b/configmanager/proxies.py index 1e2a07b..3fbdf00 100644 --- a/configmanager/proxies.py +++ b/configmanager/proxies.py @@ -60,6 +60,9 @@ class PathProxy(object): def __eq__(self, other): return isinstance(other, self.__class__) and (self._path_ == other._path_) and (self._config_ is other._config_) + def items(self): + return ((k, self[k]) for k in self) + class ConfigItemProxy(PathProxy): diff --git a/docs/guide.rst b/docs/guide.rst index beaa2b1..e76a5ce 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -109,13 +109,13 @@ Copying Config Items Between Managers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The easiest way to copy all config items from one :ref:`config-manager` to another is -to use :meth:`.ConfigManager.items()`:: +to use :meth:`.ConfigManager.find_items()`:: config1 = ConfigManager( ConfigItem('upload', 'threads', default=1, value=3) ) - config2 = ConfigManager(*config1.items()) + config2 = ConfigManager(*config1.find_items()) If you don't want to keep the values (just the defaults), you can call :meth:`.ConfigManager.reset`: @@ -128,4 +128,4 @@ If you don't want to keep the values (just the defaults), you can call :meth:`.C If the second config manager already exists, you can add config items to it with :meth:`.ConfigManager.add`:: - map(config2.add, config1.items()) + map(config2.add, config1.find_items())
Get rid of current ConfigManager.items() implementation
jbasko/configmanager
diff --git a/tests/test_configmanager.py b/tests/test_configmanager.py index b0bbe4d..d93ec92 100644 --- a/tests/test_configmanager.py +++ b/tests/test_configmanager.py @@ -164,52 +164,6 @@ def test_reset(): assert m.get('forgettable', 'y') == 'YES' -def test_items_returns_all_config_items(): - m = ConfigManager( - ConfigItem('a', 'aa', 'aaa'), - ConfigItem('b', 'bb'), - ConfigItem('a', 'aa', 'AAA'), - ConfigItem('b', 'BB'), - ) - - assert len(m.items()) == 4 - assert m.items()[0].path == ('a', 'aa', 'aaa') - assert m.items()[-1].path == ('b', 'BB') - - -def test_items_with_prefix_returns_matching_config_items(): - m = ConfigManager( - ConfigItem('a', 'aa', 'aaa'), - ConfigItem('a.aa', 'haha'), - ConfigItem('b', 'bb'), - ConfigItem('a', 'aa', 'AAA'), - ConfigItem('b', 'BB'), - ) - - a_items = m.items('a') - assert len(a_items) == 2 - assert a_items[0].path == ('a', 'aa', 'aaa') - assert a_items[1].path == ('a', 'aa', 'AAA') - - a_aa_items1 = m.items('a', 'aa') - a_aa_items2 = m.items('a.aa') - assert a_aa_items1 != a_aa_items2 - - assert len(a_aa_items1) == 2 - assert a_aa_items1[0].path == ('a', 'aa', 'aaa') - assert a_aa_items1[1].path == ('a', 'aa', 'AAA') - - assert len(a_aa_items2) == 1 - assert a_aa_items2[0].path == ('a.aa', 'haha') - - assert len(m.items('b')) == 2 - assert len(m.items('b', 'bb')) == 1 - assert len(m.items('b.bb')) == 0 - - no_items = m.items('haha.haha') - assert len(no_items) == 0 - - def test_can_add_items_to_default_section_and_set_their_value_without_naming_section(): m = ConfigManager() @@ -302,7 +256,7 @@ def test_copying_items_between_managers(): ConfigItem('b', 'bbbb', 'q'), ) - n = ConfigManager(*m.items()) + n = ConfigManager(*m.find_items()) assert m.export() == n.export() m.set('a', 'x', 'xaxa') diff --git a/tests/test_proxies.py b/tests/test_proxies.py index 6b94e11..7035e8f 100644 --- a/tests/test_proxies.py +++ b/tests/test_proxies.py @@ -51,8 +51,8 @@ def test_value_proxy_does_not_provide_section_and_item_access(config): with pytest.raises(AttributeError): config.v.uploads.get('enabled', True) - with pytest.raises(AttributeError): - config.v.items() + # This is different, "items" don't refer to config items here, it's part of Python's dictionary interface. + assert config.v.items() def test_value_proxy_is_iterable(config): @@ -151,8 +151,8 @@ def test_section_proxy_raises_attribute_error_if_section_not_specified(config): with pytest.raises(AttributeError): config.s.set('enabled', True) - with pytest.raises(AttributeError): - config.s.items() + # This is different now, items() is part of Python's dictionary interface, nothing to do with config items. + assert config.s.items() with pytest.raises(AttributeError): config.s.has('uploads') @@ -194,3 +194,17 @@ def test_item_proxy_is_iterable(config): assert ('auth', 'server', 'port') in paths assert ('uploads', 'something_else') not in paths + +def test_proxies_support_items_transparently(config): + items = dict(config.t.items()) + assert len(items) == 7 + assert isinstance(items[('uploads', 'enabled')], ConfigItem) + + sections = dict(config.s.items()) + assert len(sections) == 5 + assert isinstance(sections[('auth', 'server')], ConfigSectionProxy) + + values = dict(config.v.items()) + assert len(values) == 2 + assert values[('uploads', 'enabled')] is False + assert values[('downloads', 'threads')] == 0
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 4 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 -e git+https://github.com/jbasko/configmanager.git@b63b5e6c97f694392d3b01a7f2b8345c56ddf7f6#egg=configmanager configparser==7.2.0 coverage==7.8.0 distlib==0.3.9 exceptiongroup==1.2.2 filelock==3.18.0 iniconfig==2.1.0 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 pyproject-api==1.9.0 pytest==8.3.5 six==1.17.0 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: configmanager channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - configparser==7.2.0 - coverage==7.8.0 - distlib==0.3.9 - exceptiongroup==1.2.2 - filelock==3.18.0 - iniconfig==2.1.0 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - pyproject-api==1.9.0 - pytest==8.3.5 - six==1.17.0 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/configmanager
[ "tests/test_proxies.py::test_value_proxy_does_not_provide_section_and_item_access", "tests/test_proxies.py::test_section_proxy_raises_attribute_error_if_section_not_specified", "tests/test_proxies.py::test_proxies_support_items_transparently" ]
[]
[ "tests/test_configmanager.py::test_get_item_returns_config_item", "tests/test_configmanager.py::test_get_returns_value_not_item", "tests/test_configmanager.py::test_basic_accessors_with_no_path_raise_value_error[get]", "tests/test_configmanager.py::test_basic_accessors_with_no_path_raise_value_error[has]", "tests/test_configmanager.py::test_basic_accessors_with_no_path_raise_value_error[get_item]", "tests/test_configmanager.py::test_basic_accessors_with_no_path_raise_value_error[set]", "tests/test_configmanager.py::test_duplicate_config_raises_value_error", "tests/test_configmanager.py::test_sets_config", "tests/test_configmanager.py::test_config_manager_configs_are_safe_copies", "tests/test_configmanager.py::test_has", "tests/test_configmanager.py::test_cannot_retrieve_non_existent_config", "tests/test_configmanager.py::test_reset", "tests/test_configmanager.py::test_can_add_items_to_default_section_and_set_their_value_without_naming_section", "tests/test_configmanager.py::test_export_empty_config_manager", "tests/test_configmanager.py::test_export_config_manager_with_no_values", "tests/test_configmanager.py::test_export_config_manager_with_default_section_item", "tests/test_configmanager.py::test_export_config_manager_with_multiple_sections_and_defaults", "tests/test_configmanager.py::test_exports_configs_with_prefix", "tests/test_configmanager.py::test_exports_configs_with_deep_paths", "tests/test_configmanager.py::test_copying_items_between_managers", "tests/test_configmanager.py::test_read_as_defaults_treats_all_values_as_declarations", "tests/test_proxies.py::test_value_proxy_exposes_values_for_reading_and_writing", "tests/test_proxies.py::test_value_proxy_is_iterable", "tests/test_proxies.py::test_section_proxy_forbids_access_to_config_items_via_attributes", "tests/test_proxies.py::test_section_proxy_exposes_sections_and_basic_manager_interface", "tests/test_proxies.py::test_section_proxy_exposes_has_values_and_reset", "tests/test_proxies.py::test_section_proxy_is_iterable", "tests/test_proxies.py::test_item_proxy_provides_access_to_items", "tests/test_proxies.py::test_item_proxy_is_iterable" ]
[]
MIT License
1,240
[ "configmanager/base.py", "configmanager/__init__.py", "configmanager/proxies.py", "docs/guide.rst" ]
[ "configmanager/base.py", "configmanager/__init__.py", "configmanager/proxies.py", "docs/guide.rst" ]
jaywink__federation-79
273b7ba47a08d4fe8f85db9620c19ce7c79f83be
2017-05-12 21:13:44
e0dd39d518136eef5d36fa3c2cb36dc4b32d4a63
diff --git a/federation/protocols/diaspora/protocol.py b/federation/protocols/diaspora/protocol.py index 83c7045..8113b90 100644 --- a/federation/protocols/diaspora/protocol.py +++ b/federation/protocols/diaspora/protocol.py @@ -1,7 +1,7 @@ +import json import logging import warnings from base64 import b64decode, urlsafe_b64decode, b64encode, urlsafe_b64encode -from json import loads, dumps from urllib.parse import unquote_plus from Crypto.Cipher import AES, PKCS1_v1_5 @@ -20,14 +20,35 @@ logger = logging.getLogger("federation") PROTOCOL_NAME = "diaspora" PROTOCOL_NS = "https://joindiaspora.com/protocol" +MAGIC_ENV_TAG = "{http://salmon-protocol.org/ns/magic-env}env" def identify_payload(payload): + """Try to identify whether this is a Diaspora payload. + + Try first public message. Then private message. The check if this is a legacy payload. + """ + # Private encrypted JSON payload + try: + data = json.loads(payload) + if "encrypted_magic_envelope" in data: + return True + except Exception: + pass + # Public XML payload + try: + xml = etree.fromstring(bytes(payload, encoding="utf-8")) + if xml.tag == MAGIC_ENV_TAG: + return True + except Exception: + pass + # Legacy XML payload try: xml = unquote_plus(payload) return xml.find('xmlns="%s"' % PROTOCOL_NS) > -1 except Exception: - return False + pass + return False class Protocol(BaseProtocol): @@ -151,7 +172,7 @@ class Protocol(BaseProtocol): key and hence the passphrase for the key. """ decoded_json = b64decode(b64data.encode("ascii")) - rep = loads(decoded_json.decode("ascii")) + rep = json.loads(decoded_json.decode("ascii")) outer_key_details = self.decrypt_outer_aes_key_bundle( rep["aes_key"], key) header = self.get_decrypted_header( @@ -173,7 +194,7 @@ class Protocol(BaseProtocol): b64decode(data.encode("ascii")), sentinel=None ) - return loads(decoded_json.decode("ascii")) + return json.loads(decoded_json.decode("ascii")) def get_decrypted_header(self, ciphertext, key, iv): """ @@ -273,7 +294,7 @@ class Protocol(BaseProtocol): """ Record the information on the key used to encrypt the header. """ - d = dumps({ + d = json.dumps({ "iv": b64encode(self.outer_iv).decode("ascii"), "key": b64encode(self.outer_key).decode("ascii") }) @@ -297,7 +318,7 @@ class Protocol(BaseProtocol): public_key)).decode("ascii") ciphertext = b64encode(self.create_ciphertext()).decode("ascii") - d = dumps({ + d = json.dumps({ "aes_key": aes_key, "ciphertext": ciphertext })
Don't try to identify Diaspora protocol Diaspora will drop the whole XML wrapper and just deliver a Magic Envelope (for public posts). Private posts will be delivered wrapped in a JSON structure. Diaspora 0.6 understands this new message, 0.7 will maybe send it out. For public posts, this: ``` <?xml version="1.0" encoding="UTF-8"?> <diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env"> <header> <author_id>[email protected]</author_id> </header> <me:env> .... </me:env> </diaspora> ``` becomes this: ``` <me:env> .... </me:env> ``` Check for `me:env` tags, then just try and open it - if it doesn't open it's something else. Same for public messages but looking at the JSON. Old structures should be supported.
jaywink/federation
diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py index 97f88e6..b58c95e 100644 --- a/federation/tests/fixtures/payloads.py +++ b/federation/tests/fixtures/payloads.py @@ -1,4 +1,4 @@ -ENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?> +ENCRYPTED_LEGACY_DIASPORA_PAYLOAD = """<?xml version='1.0'?> <diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env"> <encrypted_header>{encrypted_header}</encrypted_header> <me:env> @@ -11,7 +11,7 @@ ENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?> """ -UNENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?> +UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD = """<?xml version='1.0'?> <diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env"> <header> <author_id>[email protected]</author_id> @@ -26,6 +26,26 @@ UNENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?> """ +DIASPORA_PUBLIC_PAYLOAD = """<?xml version='1.0' encoding='UTF-8'?> +<me:env xmlns:me="http://salmon-protocol.org/ns/magic-env"> + <me:encoding>base64url</me:encoding> + <me:alg>RSA-SHA256</me:alg> + <me:data type="application/xml">PHN0YXR1c19tZXNzYWdlPjxmb28-YmFyPC9mb28-PC9zdGF0dXNfbWVzc2FnZT4=</me:data> + <me:sig key_id="Zm9vYmFyQGV4YW1wbGUuY29t">Cmk08MR4Tp8r9eVybD1hORcR_8NLRVxAu0biOfJbkI1xLx1c480zJ720cpVyKaF9""" \ + """CxVjW3lvlvRz5YbswMv0izPzfHpXoWTXH-4UPrXaGYyJnrNvqEB2UWn4iHKJ2Rerto8sJY2b95qbXD6Nq75EoBNub5P7DYc16ENhp3""" \ + """8YwBRnrBEvNOewddpOpEBVobyNB7no_QR8c_xkXie-hUDFNwI0z7vax9HkaBFbvEmzFPMZAAdWyjxeGiWiqY0t2ZdZRCPTezy66X6Q0""" \ + """qc4I8kfT-Mt1ctjGmNMoJ4Lgu-PrO5hSRT4QBAVyxaog5w-B0PIPuC-mUW5SZLsnX3_ZuwJww==</me:sig> +</me:env> +""" + + +DIASPORA_ENCRYPTED_PAYLOAD = """{ + "aes_key": "...", + "encrypted_magic_envelope": "..." +} +""" + + DIASPORA_POST_LEGACY = """<XML> <post> <status_message> diff --git a/federation/tests/protocols/diaspora/test_diaspora.py b/federation/tests/protocols/diaspora/test_protocol.py similarity index 81% rename from federation/tests/protocols/diaspora/test_diaspora.py rename to federation/tests/protocols/diaspora/test_protocol.py index 3226e19..fa4359e 100644 --- a/federation/tests/protocols/diaspora/test_diaspora.py +++ b/federation/tests/protocols/diaspora/test_protocol.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from base64 import urlsafe_b64decode from unittest.mock import Mock, patch from xml.etree.ElementTree import ElementTree @@ -8,10 +7,14 @@ import pytest from federation.exceptions import EncryptedMessageError, NoSenderKeyFoundError, NoHeaderInMessageError from federation.protocols.diaspora.protocol import Protocol, identify_payload -from federation.tests.fixtures.payloads import ENCRYPTED_DIASPORA_PAYLOAD, UNENCRYPTED_DIASPORA_PAYLOAD +from federation.tests.fixtures.payloads import ( + ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, + DIASPORA_PUBLIC_PAYLOAD, + DIASPORA_ENCRYPTED_PAYLOAD, +) -class MockUser(object): +class MockUser(): private_key = "foobar" def __init__(self, nokey=False): @@ -27,15 +30,15 @@ def mock_not_found_get_contact_key(contact): return None -class DiasporaTestBase(object): +class DiasporaTestBase(): def init_protocol(self): return Protocol() def get_unencrypted_doc(self): - return etree.fromstring(UNENCRYPTED_DIASPORA_PAYLOAD) + return etree.fromstring(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD) def get_encrypted_doc(self): - return etree.fromstring(ENCRYPTED_DIASPORA_PAYLOAD) + return etree.fromstring(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD) def get_mock_user(self, nokey=False): return MockUser(nokey) @@ -68,7 +71,7 @@ class TestDiasporaProtocol(DiasporaTestBase): protocol = self.init_protocol() user = self.get_mock_user() protocol.get_message_content = self.mock_get_message_content - sender, content = protocol.receive(UNENCRYPTED_DIASPORA_PAYLOAD, user, mock_get_contact_key, + sender, content = protocol.receive(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_get_contact_key, skip_author_verification=True) assert sender == "[email protected]" assert content == "<content />" @@ -80,7 +83,7 @@ class TestDiasporaProtocol(DiasporaTestBase): return_value="<content><diaspora_handle>[email protected]</diaspora_handle></content>" ) protocol.parse_header = Mock(return_value="foobar") - sender, content = protocol.receive(ENCRYPTED_DIASPORA_PAYLOAD, user, mock_get_contact_key, + sender, content = protocol.receive(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_get_contact_key, skip_author_verification=True) assert sender == "[email protected]" assert content == "<content><diaspora_handle>[email protected]</diaspora_handle></content>" @@ -88,19 +91,19 @@ class TestDiasporaProtocol(DiasporaTestBase): def test_receive_raises_on_encrypted_message_and_no_user(self): protocol = self.init_protocol() with pytest.raises(EncryptedMessageError): - protocol.receive(ENCRYPTED_DIASPORA_PAYLOAD) + protocol.receive(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD) def test_receive_raises_on_encrypted_message_and_no_user_key(self): protocol = self.init_protocol() user = self.get_mock_user(nokey=True) with pytest.raises(EncryptedMessageError): - protocol.receive(ENCRYPTED_DIASPORA_PAYLOAD, user) + protocol.receive(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user) def test_receive_raises_if_sender_key_cannot_be_found(self): protocol = self.init_protocol() user = self.get_mock_user() with pytest.raises(NoSenderKeyFoundError): - protocol.receive(UNENCRYPTED_DIASPORA_PAYLOAD, user, mock_not_found_get_contact_key) + protocol.receive(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_not_found_get_contact_key) def test_find_header_raises_if_header_cannot_be_found(self): protocol = self.init_protocol() @@ -115,8 +118,14 @@ class TestDiasporaProtocol(DiasporaTestBase): body = protocol.get_message_content() assert body == urlsafe_b64decode("{data}".encode("ascii")) - def test_identify_payload_with_diaspora_payload(self): - assert identify_payload(UNENCRYPTED_DIASPORA_PAYLOAD) == True + def test_identify_payload_with_legacy_diaspora_payload(self): + assert identify_payload(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD) == True + + def test_identify_payload_with_diaspora_public_payload(self): + assert identify_payload(DIASPORA_PUBLIC_PAYLOAD) == True + + def test_identify_payload_with_diaspora_encrypted_payload(self): + assert identify_payload(DIASPORA_ENCRYPTED_PAYLOAD) == True def test_identify_payload_with_other_payload(self): assert identify_payload("foobar not a diaspora protocol") == False diff --git a/federation/tests/test_inbound.py b/federation/tests/test_inbound.py index 879e7d1..0975808 100644 --- a/federation/tests/test_inbound.py +++ b/federation/tests/test_inbound.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from unittest.mock import patch import pytest @@ -6,12 +5,12 @@ import pytest from federation.exceptions import NoSuitableProtocolFoundError from federation.inbound import handle_receive from federation.protocols.diaspora.protocol import Protocol -from federation.tests.fixtures.payloads import UNENCRYPTED_DIASPORA_PAYLOAD +from federation.tests.fixtures.payloads import UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD -class TestHandleReceiveProtocolIdentification(object): +class TestHandleReceiveProtocolIdentification(): def test_handle_receive_routes_to_identified_protocol(self): - payload = UNENCRYPTED_DIASPORA_PAYLOAD + payload = UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD with patch.object( Protocol, 'receive',
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 1 }, "num_modified_files": 1 }
0.11
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libxml2-dev libxslt1-dev" ], "python": "3.6", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 arrow==1.2.3 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 codecov==2.1.13 colorama==0.4.5 commonmark==0.9.1 coverage==6.2 cssselect==1.1.0 dirty-validators==0.5.4 docutils==0.18.1 factory-boy==3.2.1 Faker==14.2.1 -e git+https://github.com/jaywink/federation.git@273b7ba47a08d4fe8f85db9620c19ce7c79f83be#egg=federation idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 Jinja2==3.0.3 jsonschema==3.2.0 livereload==2.6.3 lxml==5.3.1 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycrypto==2.6.1 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 pytest-cov==4.0.0 pytest-warnings==0.3.1 python-dateutil==2.9.0.post0 python-xrd==0.1 pytz==2025.2 recommonmark==0.7.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-autobuild==2021.3.14 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: federation channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - arrow==1.2.3 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - codecov==2.1.13 - colorama==0.4.5 - commonmark==0.9.1 - coverage==6.2 - cssselect==1.1.0 - dirty-validators==0.5.4 - docutils==0.18.1 - factory-boy==3.2.1 - faker==14.2.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - jinja2==3.0.3 - jsonschema==3.2.0 - livereload==2.6.3 - lxml==5.3.1 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycrypto==2.6.1 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-warnings==0.3.1 - python-dateutil==2.9.0.post0 - python-xrd==0.1 - pytz==2025.2 - recommonmark==0.7.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-autobuild==2021.3.14 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/federation
[ "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_diaspora_public_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_diaspora_encrypted_payload" ]
[]
[ "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_unencrypted_header", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_encrypted_header", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_unencrypted_returns_sender_and_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_encrypted_returns_sender_and_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_on_encrypted_message_and_no_user", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_on_encrypted_message_and_no_user_key", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_if_sender_key_cannot_be_found", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_header_raises_if_header_cannot_be_found", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_message_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_legacy_diaspora_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_other_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_returns_sender_in_header", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_returns_sender_in_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_returns_none_if_no_sender_found", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_build_send", "federation/tests/test_inbound.py::TestHandleReceiveProtocolIdentification::test_handle_receive_routes_to_identified_protocol", "federation/tests/test_inbound.py::TestHandleReceiveProtocolIdentification::test_handle_receive_raises_on_unidentified_protocol" ]
[]
BSD 3-Clause "New" or "Revised" License
1,241
[ "federation/protocols/diaspora/protocol.py" ]
[ "federation/protocols/diaspora/protocol.py" ]
hynek__structlog-117
ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52
2017-05-13 05:52:50
ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52
codecov[bot]: # [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=h1) Report > Merging [#117](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=desc) into [master](https://codecov.io/gh/hynek/structlog/commit/5636314046792f1cc2510af27a379746bfe9dbf2?src=pr&el=desc) will **not change** coverage. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/hynek/structlog/pull/117/graphs/tree.svg?width=650&height=150&src=pr&token=biZKjfuKn0)](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #117 +/- ## ===================================== Coverage 100% 100% ===================================== Files 13 13 Lines 774 775 +1 Branches 96 96 ===================================== + Hits 774 775 +1 ``` | [Impacted Files](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/structlog/stdlib.py](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree#diff-c3JjL3N0cnVjdGxvZy9zdGRsaWIucHk=) | `100% <100%> (ø)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=footer). Last update [5636314...161ede8](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). codecov[bot]: # [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=h1) Report > Merging [#117](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=desc) into [master](https://codecov.io/gh/hynek/structlog/commit/5636314046792f1cc2510af27a379746bfe9dbf2?src=pr&el=desc) will **not change** coverage. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/hynek/structlog/pull/117/graphs/tree.svg?height=150&width=650&token=biZKjfuKn0&src=pr)](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #117 +/- ## ===================================== Coverage 100% 100% ===================================== Files 13 13 Lines 774 775 +1 Branches 96 96 ===================================== + Hits 774 775 +1 ``` | [Impacted Files](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/structlog/stdlib.py](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree#diff-c3JjL3N0cnVjdGxvZy9zdGRsaWIucHk=) | `100% <100%> (ø)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=footer). Last update [5636314...161ede8](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). if-fi: Hi @hynek I just found the same problem on Thursday, and I was looking for a non-hackish solution to send as a pull request. Yours is pretty smooth. I just tried it locally and it works fine in all scenarios I came up with. P.S. I also found a problem when using `ProcessorFormatter` with `RotatingFileHandler`. I will send you a pull request that I hope will be included in the same bugfix release as this one gilbsgilbs: Hi @if-fi, hi @hynek. As far as I can see, this won't break anything and will fix the issue. Still, I have some remarks: - You're clearing `record.args` too often. Clearing after calling `record.getMessage()` (which is the one actually consuming the args) should be sufficient I guess (untested), - Not really fund of mutating `record.msg` and now `record.args`. You really shouldn't ever have to mutate any `record` attribute, appart from `record.message` (≠ from `record.msg`, yeah, ik, logging module is real crap, but `record.msg` should be the unformatted message and `record.message` the formatted one -_-"), - You're actually formatting the message twice. First time in `record.getMessage()`, and another time calling super function, which puts the formatted message into `record.message` . The second time should be near-free since `record.args` is empty (provided that format operator is a bit smart, haven't checked that out). Yet, it still requires two format when one is most likely possible (calling super function sooner, and getting the formatted message in `record.message`). Don't have much time to dig into this. I think the fix is ok. hynek: 1. Good catch, I’ll move it up. 2. I sadly don’t know enough about this part. But I guess I’d be hoping for too much if I thought I could format into `record.message` and it solves #119 too, right? :) 3. The reason is https://github.com/hynek/structlog/pull/105#discussion_r107939889
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0a95646..b9dbfab 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -26,6 +26,10 @@ Changes: - ``structlog.stdlib.add_logger_name()`` now works in ``structlog.stdlib.ProcessorFormatter``'s ``foreign_pre_chain``. `#112 <https://github.com/hynek/structlog/issues/112>`_ +- Clear log record args in ``structlog.stdlib.ProcessorFormatter`` after rendering. + This fix is for you if you tried to use it and got ``TypeError: not all arguments converted during string formatting`` exceptions. + `#116 <https://github.com/hynek/structlog/issues/116>`_ + `#117 <https://github.com/hynek/structlog/issues/117>`_ ---- diff --git a/src/structlog/stdlib.py b/src/structlog/stdlib.py index 4529e84..fb7ad04 100644 --- a/src/structlog/stdlib.py +++ b/src/structlog/stdlib.py @@ -420,6 +420,7 @@ class ProcessorFormatter(logging.Formatter): logger = None meth_name = record.levelname.lower() ed = {"event": record.getMessage(), "_record": record} + record.args = () # Non-structlog allows to run through a chain to prepare it for the # final processor (e.g. adding timestamps and log levels).
Suggested configurations leads to exceptions for third party libs. Hi, Python 2.7.5 CentOS Linux release 7.2.1511 (Core) I tried the suggestion named: > Rendering Using structlog-based Formatters Within logging From: [http://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging](http://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging) The only thing I added was: ``` import boto3 ec2 = boto3.client('ec2') response = ec2.describe_regions() print('Regions:', response['Regions']) response = ec2.describe_availability_zones() print('Availability Zones:', response['AvailabilityZones']) ``` (This issue is not related to the third party lib used, I got the same thing with other third party libs, just needed one as a minimal repro case.) This leads to a ton of exception that ends with: > File "/usr/lib64/python2.7/logging/__init__.py", line 328, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting My goal is to use structlog to get all my logs and those from imported third party libs to be formatted in JSON with a basic set of common keys. But I started with using the documentation as is first to understand how it works. I was expecting boto3 logs to be formatted and it worked, somewhere in the console output (and the log file) there is: > 2017-05-12 19:57:08 [info ] Starting new HTTP connection (1): 169.254.169.254 What I don't understand are all the Exception thrown from inside the logging library that are in visible in the std err output. Should the suggested config work in this scenario? Attached are the source code file used, the log file from the WatchedFileHandler and console output file where the exceptions are visible. It was generated with: `python issue.py &> console_output.txt` [console_output.txt](https://github.com/hynek/structlog/files/997889/console_output.txt) [filehandler_output.txt](https://github.com/hynek/structlog/files/997891/filehandler_output.txt) [source_code.txt](https://github.com/hynek/structlog/files/997890/source_code.txt) Martin
hynek/structlog
diff --git a/tests/test_stdlib.py b/tests/test_stdlib.py index 423760e..548ccfa 100644 --- a/tests/test_stdlib.py +++ b/tests/test_stdlib.py @@ -432,6 +432,22 @@ class TestProcessorFormatter(object): "foo [in test_foreign_delegate]\n", ) == capsys.readouterr() + def test_clears_args(self, capsys, configure_for_pf): + """ + We render our log records before sending it back to logging. Therefore + we must clear `LogRecord.args` otherwise the user gets an + `TypeError: not all arguments converted during string formatting.` if + they use positional formatting in stdlib logging. + """ + configure_logging(None) + + logging.getLogger().warning("hello %s.", "world") + + assert ( + "", + "hello world. [in test_clears_args]\n", + ) == capsys.readouterr() + def test_foreign_pre_chain(self, configure_for_pf, capsys): """ If foreign_pre_chain is an iterable, it's used to pre-process
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 0 }, "num_modified_files": 2 }
17.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "greenlet", "colorama", "coverage", "freezegun", "pretend", "pytest", "simplejson" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 colorama==0.4.5 coverage==6.2 freezegun==1.2.2 greenlet==2.0.2 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pluggy==1.0.0 pretend==1.0.9 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 simplejson==3.20.1 six==1.17.0 -e git+https://github.com/hynek/structlog.git@ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52#egg=structlog tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: structlog channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - colorama==0.4.5 - coverage==6.2 - freezegun==1.2.2 - greenlet==2.0.2 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - pretend==1.0.9 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - simplejson==3.20.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/structlog
[ "tests/test_stdlib.py::TestProcessorFormatter::test_clears_args" ]
[ "tests/test_stdlib.py::TestLoggerFactory::test_ignores_frames" ]
[ "tests/test_stdlib.py::TestLoggerFactory::test_deduces_correct_name", "tests/test_stdlib.py::TestLoggerFactory::test_deduces_correct_caller", "tests/test_stdlib.py::TestLoggerFactory::test_stack_info", "tests/test_stdlib.py::TestLoggerFactory::test_no_stack_info_by_default", "tests/test_stdlib.py::TestLoggerFactory::test_find_caller", "tests/test_stdlib.py::TestLoggerFactory::test_sets_correct_logger", "tests/test_stdlib.py::TestLoggerFactory::test_positional_argument_avoids_guessing", "tests/test_stdlib.py::TestFilterByLevel::test_filters_lower_levels", "tests/test_stdlib.py::TestFilterByLevel::test_passes_higher_levels", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[debug]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[info]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[warning]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[error]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[critical]", "tests/test_stdlib.py::TestBoundLogger::test_proxies_exception", "tests/test_stdlib.py::TestBoundLogger::test_proxies_log", "tests/test_stdlib.py::TestBoundLogger::test_positional_args_proxied", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[addHandler-method_args0]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[removeHandler-method_args1]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[hasHandlers-None]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[callHandlers-method_args3]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[handle-method_args4]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[setLevel-method_args5]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[getEffectiveLevel-None]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[isEnabledFor-method_args7]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[findCaller-None]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[makeRecord-method_args9]", "tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[getChild-method_args10]", "tests/test_stdlib.py::TestBoundLogger::test_exception_exc_info", "tests/test_stdlib.py::TestBoundLogger::test_exception_maps_to_error", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_formats_tuple", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_formats_dict", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_positional_args_retained", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_nop_no_args", "tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_args_removed_if_empty", "tests/test_stdlib.py::TestAddLogLevel::test_log_level_added", "tests/test_stdlib.py::TestAddLogLevel::test_log_level_alias_normalized", "tests/test_stdlib.py::TestAddLoggerName::test_logger_name_added", "tests/test_stdlib.py::TestAddLoggerName::test_logger_name_added_with_record", "tests/test_stdlib.py::TestRenderToLogKW::test_default", "tests/test_stdlib.py::TestRenderToLogKW::test_add_extra_event_dict", "tests/test_stdlib.py::TestProcessorFormatter::test_foreign_delegate", "tests/test_stdlib.py::TestProcessorFormatter::test_foreign_pre_chain", "tests/test_stdlib.py::TestProcessorFormatter::test_foreign_pre_chain_add_logger_name", "tests/test_stdlib.py::TestProcessorFormatter::test_native" ]
[]
Apache License 2.0 or MIT License
1,242
[ "CHANGELOG.rst", "src/structlog/stdlib.py" ]
[ "CHANGELOG.rst", "src/structlog/stdlib.py" ]
nipy__nipype-2019
4358fe5d10b22c036b4c2f3d7cf99d20d88d76ec
2017-05-14 02:57:50
14161a590a3166b5a9c0f4afd42ff1acf843a960
satra: lgtm - seems like a simple fix to incorporate in `0.13.1` effigies: Actually, I should probably copy the memory estimate, too. For a test, I can do something like: ```Python mapnode = pe.MapNode(...) nodes = list(mapnode._make_nodes()) for node in nodes: for attr in attrs_we_care_about: assert getattr(node, attr) == getattr(mapnode, attr) ``` Any other candidates for `attrs_we_care_about`? codecov-io: # [Codecov](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=h1) Report > Merging [#2019](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=desc) into [master](https://codecov.io/gh/nipy/nipype/commit/4358fe5d10b22c036b4c2f3d7cf99d20d88d76ec?src=pr&el=desc) will **increase** coverage by `<.01%`. > The diff coverage is `93.75%`. [![Impacted file tree graph](https://codecov.io/gh/nipy/nipype/pull/2019/graphs/tree.svg?height=150&width=650&src=pr&token=Tu0EnSSGVZ)](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2019 +/- ## ========================================= + Coverage 72.19% 72.2% +<.01% ========================================= Files 1132 1132 Lines 57012 57028 +16 Branches 8162 8165 +3 ========================================= + Hits 41161 41176 +15 - Misses 14567 14568 +1 Partials 1284 1284 ``` | Flag | Coverage Δ | | |---|---|---| | #smoketests | `72.2% <93.75%> (ø)` | :arrow_up: | | #unittests | `69.79% <93.75%> (ø)` | :arrow_up: | | [Impacted Files](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [nipype/pipeline/engine/nodes.py](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=tree#diff-bmlweXBlL3BpcGVsaW5lL2VuZ2luZS9ub2Rlcy5weQ==) | `84.71% <100%> (+0.04%)` | :arrow_up: | | [nipype/pipeline/engine/tests/test\_engine.py](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=tree#diff-bmlweXBlL3BpcGVsaW5lL2VuZ2luZS90ZXN0cy90ZXN0X2VuZ2luZS5weQ==) | `93.52% <92.85%> (-0.03%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=footer). Last update [4358fe5...6dd54b2](https://codecov.io/gh/nipy/nipype/pull/2019?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). effigies: @satra I moved all the parameters that could be moved into the `Node()`. Seem reasonable?
diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index cbfa70ceb..d52e589a0 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -1112,9 +1112,14 @@ class MapNode(Node): nitems = len(filename_to_list(getattr(self.inputs, self.iterfield[0]))) for i in range(nitems): nodename = '_' + self.name + str(i) - node = Node(deepcopy(self._interface), name=nodename) - node.overwrite = self.overwrite - node.run_without_submitting = self.run_without_submitting + node = Node(deepcopy(self._interface), + n_procs=self._interface.num_threads, + mem_gb=self._interface.estimated_memory_gb, + overwrite=self.overwrite, + needed_outputs=self.needed_outputs, + run_without_submitting=self.run_without_submitting, + base_dir=op.join(cwd, 'mapflow'), + name=nodename) node.plugin_args = self.plugin_args node._interface.inputs.set( **deepcopy(self._interface.inputs.get())) @@ -1126,7 +1131,6 @@ class MapNode(Node): logger.debug('setting input %d %s %s', i, field, fieldvals[i]) setattr(node.inputs, field, fieldvals[i]) node.config = self.config - node.base_dir = op.join(cwd, 'mapflow') yield i, node def _node_runner(self, nodes, updatehash=False):
Processes in MapNodes do not respect thread limits ### Summary If a `MapNode`'s interface is assigned a `num_threads` greater than half of the available threads, the jobs may nonetheless run in parallel. ### Expected behavior Such jobs ought to run one at a time. ### How to replicate the behavior The following script creates two workflows, each one contains two processes that sleep for 3 seconds and are assigned a thread count of 5. The workflow is run with 6 processes. ```Python #!/usr/bin/env python from nipype.pipeline import engine as pe import nipype.interfaces.utility as niu from functools import partial import time def timeit(func): tic = time.time() func() toc = time.time() return toc - tic def sleeper(arg): import time time.sleep(3) wf1 = pe.Workflow(base_dir='/tmp/nipype', name='wf1') node1 = pe.Node(niu.Function(function=sleeper), name='node1') node2 = pe.Node(niu.Function(function=sleeper), name='node2') node1.inputs.arg = 1 node2.inputs.arg = 2 node1.interface.num_threads = 5 node2.interface.num_threads = 5 wf1.add_nodes([node1, node2]) wf2 = pe.Workflow(base_dir='/tmp/nipype', name='wf2') mapnode = pe.MapNode(niu.Function(function=sleeper), iterfield='arg', name='mapnode') mapnode.inputs.arg = [3, 4] mapnode.interface.num_threads = 5 wf2.add_nodes([mapnode]) time1 = timeit(partial(wf1.run, plugin='MultiProc', plugin_args={'n_procs': 6})) time2 = timeit(partial(wf2.run, plugin='MultiProc', plugin_args={'n_procs': 6})) print("Two Nodes: {:.1f}s".format(time1)) print("MapNode: {:.1f}s".format(time2)) ``` Output: ``` 170512-16:03:43,295 workflow INFO: Workflow wf1 settings: ['check', 'execution', 'logging'] 170512-16:03:43,298 workflow INFO: Running in parallel. 170512-16:03:43,301 workflow INFO: Executing: node2 ID: 0 170512-16:03:43,305 workflow INFO: Executing node node2 in dir: /tmp/nipype/wf1/node2 170512-16:03:46,369 workflow INFO: [Job finished] jobname: node2 jobid: 0 170512-16:03:46,371 workflow INFO: Executing: node1 ID: 1 170512-16:03:46,375 workflow INFO: Executing node node1 in dir: /tmp/nipype/wf1/node1 170512-16:03:49,439 workflow INFO: [Job finished] jobname: node1 jobid: 1 170512-16:03:49,455 workflow INFO: Workflow wf2 settings: ['check', 'execution', 'logging'] 170512-16:03:49,458 workflow INFO: Running in parallel. 170512-16:03:49,460 workflow INFO: Executing: mapnode ID: 0 170512-16:03:49,463 workflow INFO: Adding 2 jobs for mapnode mapnode 170512-16:03:49,468 workflow INFO: Executing: _mapnode0 ID: 1 170512-16:03:49,469 workflow INFO: Executing: _mapnode1 ID: 2 170512-16:03:49,473 workflow INFO: Executing node _mapnode0 in dir: /tmp/nipype/wf2/mapnode/mapflow/_mapnode0 170512-16:03:49,473 workflow INFO: Executing node _mapnode1 in dir: /tmp/nipype/wf2/mapnode/mapflow/_mapnode1 170512-16:03:52,537 workflow INFO: [Job finished] jobname: _mapnode0 jobid: 1 170512-16:03:52,538 workflow INFO: [Job finished] jobname: _mapnode1 jobid: 2 170512-16:03:52,540 workflow INFO: Executing: mapnode ID: 0 170512-16:03:52,544 workflow INFO: Executing node mapnode in dir: /tmp/nipype/wf2/mapnode 170512-16:03:52,555 workflow INFO: Executing node _mapnode0 in dir: /tmp/nipype/wf2/mapnode/mapflow/_mapnode0 170512-16:03:52,556 workflow INFO: Collecting precomputed outputs 170512-16:03:52,561 workflow INFO: Executing node _mapnode1 in dir: /tmp/nipype/wf2/mapnode/mapflow/_mapnode1 170512-16:03:52,563 workflow INFO: Collecting precomputed outputs 170512-16:03:52,606 workflow INFO: [Job finished] jobname: mapnode jobid: 0 Two Nodes: 6.3s MapNode: 3.2s ``` ### Script/Workflow details See https://github.com/poldracklab/fmriprep/pull/506#discussion_r116107213 ### Platform details: ``` {'pkg_path': '/usr/local/miniconda/lib/python3.6/site-packages/nipype', 'commit_source': 'installation', 'commit_hash': 'd82a18f', 'nipype_version': '0.13.0-dev', 'sys_version': '3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]', 'sys_executable': '/usr/local/miniconda/bin/python', 'sys_platform': 'linux', 'numpy_version': '1.12.0', 'scipy_version': '0.18.1', 'networkx_version': '1.11', 'nibabel_version': '2.1.0', 'traits_version': '4.6.0'} 0.13.0-dev ``` ### Execution environment - Container [Tag: poldracklab/fmriprep:latest]
nipy/nipype
diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index 5cd107bc6..e2624d03c 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -486,6 +486,28 @@ def test_mapnode_nested(tmpdir): assert "can only concatenate list" in str(excinfo.value) +def test_mapnode_expansion(tmpdir): + os.chdir(str(tmpdir)) + from nipype import MapNode, Function + + def func1(in1): + return in1 + 1 + + mapnode = MapNode(Function(function=func1), + iterfield='in1', + name='mapnode') + mapnode.inputs.in1 = [1, 2] + mapnode.interface.num_threads = 2 + mapnode.interface.estimated_memory_gb = 2 + + for idx, node in mapnode._make_nodes(): + for attr in ('overwrite', 'run_without_submitting', 'plugin_args'): + assert getattr(node, attr) == getattr(mapnode, attr) + for attr in ('num_threads', 'estimated_memory_gb'): + assert (getattr(node._interface, attr) == + getattr(mapnode._interface, attr)) + + def test_node_hash(tmpdir): wd = str(tmpdir) os.chdir(wd)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 click==8.0.4 configparser==5.2.0 decorator==4.4.2 funcsigs==1.0.2 future==1.0.0 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 lxml==5.3.1 mock==5.2.0 networkx==2.5.1 nibabel==3.2.2 -e git+https://github.com/nipy/nipype.git@4358fe5d10b22c036b4c2f3d7cf99d20d88d76ec#egg=nipype numpy==1.19.5 packaging==21.3 pluggy==1.0.0 prov==2.0.1 py==1.11.0 pydotplus==2.0.2 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 rdflib==5.0.0 scipy==1.5.4 simplejson==3.20.1 six==1.17.0 tomli==1.2.3 traits==6.4.1 typing_extensions==4.1.1 zipp==3.6.0
name: nipype channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - click==8.0.4 - configparser==5.2.0 - decorator==4.4.2 - funcsigs==1.0.2 - future==1.0.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - lxml==5.3.1 - mock==5.2.0 - networkx==2.5.1 - nibabel==3.2.2 - numpy==1.19.5 - packaging==21.3 - pluggy==1.0.0 - prov==2.0.1 - py==1.11.0 - pydotplus==2.0.2 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - rdflib==5.0.0 - scipy==1.5.4 - simplejson==3.20.1 - six==1.17.0 - tomli==1.2.3 - traits==6.4.1 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/nipype
[ "nipype/pipeline/engine/tests/test_engine.py::test_mapnode_expansion" ]
[ "nipype/pipeline/engine/tests/test_engine.py::test_1mod[iterables0-expected0]", "nipype/pipeline/engine/tests/test_engine.py::test_1mod[iterables1-expected1]", "nipype/pipeline/engine/tests/test_engine.py::test_2mods[iterables0-expected0]", "nipype/pipeline/engine/tests/test_engine.py::test_2mods[iterables1-expected1]", "nipype/pipeline/engine/tests/test_engine.py::test_2mods[iterables2-expected2]", "nipype/pipeline/engine/tests/test_engine.py::test_3mods[iterables0-expected0-connect0]", "nipype/pipeline/engine/tests/test_engine.py::test_3mods[iterables1-expected1-connect1]", "nipype/pipeline/engine/tests/test_engine.py::test_3mods[iterables2-expected2-connect2]", "nipype/pipeline/engine/tests/test_engine.py::test_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_iterable_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_synchronize_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_synchronize_tuples_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_itersource_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_itersource_synchronize1_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_itersource_synchronize2_expansion", "nipype/pipeline/engine/tests/test_engine.py::test_disconnect", "nipype/pipeline/engine/tests/test_engine.py::test_doubleconnect", "nipype/pipeline/engine/tests/test_engine.py::test_node_hash", "nipype/pipeline/engine/tests/test_engine.py::test_old_config", "nipype/pipeline/engine/tests/test_engine.py::test_mapnode_json", "nipype/pipeline/engine/tests/test_engine.py::test_parameterize_dirs_false", "nipype/pipeline/engine/tests/test_engine.py::test_serial_input", "nipype/pipeline/engine/tests/test_engine.py::test_write_graph_runs", "nipype/pipeline/engine/tests/test_engine.py::test_deep_nested_write_graph_runs" ]
[ "nipype/pipeline/engine/tests/test_engine.py::test_init", "nipype/pipeline/engine/tests/test_engine.py::test_connect", "nipype/pipeline/engine/tests/test_engine.py::test_add_nodes", "nipype/pipeline/engine/tests/test_engine.py::test_node_init", "nipype/pipeline/engine/tests/test_engine.py::test_workflow_add", "nipype/pipeline/engine/tests/test_engine.py::test_node_get_output", "nipype/pipeline/engine/tests/test_engine.py::test_mapnode_iterfield_check", "nipype/pipeline/engine/tests/test_engine.py::test_mapnode_nested", "nipype/pipeline/engine/tests/test_engine.py::test_io_subclass" ]
[]
Apache License 2.0
1,243
[ "nipype/pipeline/engine/nodes.py" ]
[ "nipype/pipeline/engine/nodes.py" ]
borgbackup__borg-2508
00e76f77fc742b3297a407f2924b24ba497693c7
2017-05-14 16:44:35
a439fa3e720c8bb2a82496768ffcce282fb7f7b7
diff --git a/docs/man_intro.rst b/docs/man_intro.rst index b726e331..85ba9bd3 100644 --- a/docs/man_intro.rst +++ b/docs/man_intro.rst @@ -14,7 +14,7 @@ deduplicating and encrypting backup tool SYNOPSIS -------- -borg <command> [options] [arguments] +borg [common options] <command> [options] [arguments] DESCRIPTION ----------- diff --git a/docs/usage.rst b/docs/usage.rst index 6ba7682e..d2b0904a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -19,7 +19,7 @@ In case you are interested in more details (like formulas), please see :ref:`json_output`. Common options -++++++++++++++ +~~~~~~~~~~~~~~ All |project_name| commands share these options: diff --git a/setup.py b/setup.py index 274e740d..5e2d309d 100644 --- a/setup.py +++ b/setup.py @@ -259,7 +259,7 @@ def generate_level(self, prefix, parser, Archiver): "command_": command.replace(' ', '_'), "underline": '-' * len('borg ' + command)} doc.write(".. _borg_{command_}:\n\n".format(**params)) - doc.write("borg {command}\n{underline}\n::\n\n borg {command}".format(**params)) + doc.write("borg {command}\n{underline}\n::\n\n borg [common options] {command}".format(**params)) self.write_usage(parser, doc) epilog = parser.epilog parser.epilog = None @@ -402,10 +402,10 @@ def generate_level(self, prefix, parser, Archiver): if is_intermediary: subparsers = [action for action in parser._actions if 'SubParsersAction' in str(action.__class__)][0] for subcommand in subparsers.choices: - write('| borg', command, subcommand, '...') + write('| borg', '[common options]', command, subcommand, '...') self.see_also.setdefault(command, []).append('%s-%s' % (command, subcommand)) else: - write('borg', command, end='') + write('borg', '[common options]', command, end='') self.write_usage(write, parser) write('\n') diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 1be2b901..ecde3f7d 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -1870,6 +1870,132 @@ def preprocess_args(self, args): print(warning, file=sys.stderr) return args + class CommonOptions: + """ + Support class to allow specifying common options directly after the top-level command. + + Normally options can only be specified on the parser defining them, which means + that generally speaking *all* options go after all sub-commands. This is annoying + for common options in scripts, e.g. --remote-path or logging options. + + This class allows adding the same set of options to both the top-level parser + and the final sub-command parsers (but not intermediary sub-commands, at least for now). + + It does so by giving every option's target name ("dest") a suffix indicating its level + -- no two options in the parser hierarchy can have the same target -- + then, after parsing the command line, multiple definitions are resolved. + + Defaults are handled by only setting them on the top-level parser and setting + a sentinel object in all sub-parsers, which then allows to discern which parser + supplied the option. + """ + + def __init__(self, define_common_options, suffix_precedence): + """ + *define_common_options* should be a callable taking one argument, which + will be a argparse.Parser.add_argument-like function. + + *define_common_options* will be called multiple times, and should call + the passed function to define common options exactly the same way each time. + + *suffix_precedence* should be a tuple of the suffixes that will be used. + It is ordered from lowest precedence to highest precedence: + An option specified on the parser belonging to index 0 is overridden if the + same option is specified on any parser with a higher index. + """ + self.define_common_options = define_common_options + self.suffix_precedence = suffix_precedence + + # Maps suffixes to sets of target names. + # E.g. common_options["_subcommand"] = {..., "log_level", ...} + self.common_options = dict() + # Set of options with the 'append' action. + self.append_options = set() + # This is the sentinel object that replaces all default values in parsers + # below the top-level parser. + self.default_sentinel = object() + + def add_common_group(self, parser, suffix, provide_defaults=False): + """ + Add common options to *parser*. + + *provide_defaults* must only be True exactly once in a parser hierarchy, + at the top level, and False on all lower levels. The default is chosen + accordingly. + + *suffix* indicates the suffix to use internally. It also indicates + which precedence the *parser* has for common options. See *suffix_precedence* + of __init__. + """ + assert suffix in self.suffix_precedence + + def add_argument(*args, **kwargs): + if 'dest' in kwargs: + kwargs.setdefault('action', 'store') + assert kwargs['action'] in ('help', 'store_const', 'store_true', 'store_false', 'store', 'append') + is_append = kwargs['action'] == 'append' + if is_append: + self.append_options.add(kwargs['dest']) + assert kwargs['default'] == [], 'The default is explicitly constructed as an empty list in resolve()' + else: + self.common_options.setdefault(suffix, set()).add(kwargs['dest']) + kwargs['dest'] += suffix + if not provide_defaults: + # Interpolate help now, in case the %(default)d (or so) is mentioned, + # to avoid producing incorrect help output. + # Assumption: Interpolated output can safely be interpolated again, + # which should always be the case. + # Note: We control all inputs. + kwargs['help'] = kwargs['help'] % kwargs + if not is_append: + kwargs['default'] = self.default_sentinel + + common_group.add_argument(*args, **kwargs) + + common_group = parser.add_argument_group('Common options') + self.define_common_options(add_argument) + + def resolve(self, args: argparse.Namespace): # Namespace has "in" but otherwise is not like a dict. + """ + Resolve the multiple definitions of each common option to the final value. + """ + for suffix in self.suffix_precedence: + # From highest level to lowest level, so the "most-specific" option wins, e.g. + # "borg --debug create --info" shall result in --info being effective. + for dest in self.common_options.get(suffix, []): + # map_from is this suffix' option name, e.g. log_level_subcommand + # map_to is the target name, e.g. log_level + map_from = dest + suffix + map_to = dest + # Retrieve value; depending on the action it may not exist, but usually does + # (store_const/store_true/store_false), either because the action implied a default + # or a default is explicitly supplied. + # Note that defaults on lower levels are replaced with default_sentinel. + # Only the top level has defaults. + value = getattr(args, map_from, self.default_sentinel) + if value is not self.default_sentinel: + # value was indeed specified on this level. Transfer value to target, + # and un-clobber the args (for tidiness - you *cannot* use the suffixed + # names for other purposes, obviously). + setattr(args, map_to, value) + try: + delattr(args, map_from) + except AttributeError: + pass + + # Options with an "append" action need some special treatment. Instead of + # overriding values, all specified values are merged together. + for dest in self.append_options: + option_value = [] + for suffix in self.suffix_precedence: + # Find values of this suffix, if any, and add them to the final list + extend_from = dest + suffix + if extend_from in args: + values = getattr(args, extend_from) + delattr(args, extend_from) + option_value.extend(values) + setattr(args, dest, option_value) + def build_parser(self): def process_epilog(epilog): epilog = textwrap.dedent(epilog).splitlines() @@ -1881,58 +2007,67 @@ def process_epilog(epilog): epilog = [line for line in epilog if not line.startswith('.. man')] return '\n'.join(epilog) - common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog) + def define_common_options(add_common_option): + add_common_option('-h', '--help', action='help', help='show this help message and exit') + add_common_option('--critical', dest='log_level', + action='store_const', const='critical', default='warning', + help='work on log level CRITICAL') + add_common_option('--error', dest='log_level', + action='store_const', const='error', default='warning', + help='work on log level ERROR') + add_common_option('--warning', dest='log_level', + action='store_const', const='warning', default='warning', + help='work on log level WARNING (default)') + add_common_option('--info', '-v', '--verbose', dest='log_level', + action='store_const', const='info', default='warning', + help='work on log level INFO') + add_common_option('--debug', dest='log_level', + action='store_const', const='debug', default='warning', + help='enable debug output, work on log level DEBUG') + add_common_option('--debug-topic', dest='debug_topics', + action='append', metavar='TOPIC', default=[], + help='enable TOPIC debugging (can be specified multiple times). ' + 'The logger path is borg.debug.<TOPIC> if TOPIC is not fully qualified.') + add_common_option('-p', '--progress', dest='progress', action='store_true', + help='show progress information') + add_common_option('--log-json', dest='log_json', action='store_true', + help='Output one JSON object per log line instead of formatted text.') + add_common_option('--lock-wait', dest='lock_wait', type=int, metavar='N', default=1, + help='wait for the lock, but max. N seconds (default: %(default)d).') + add_common_option('--show-version', dest='show_version', action='store_true', default=False, + help='show/log the borg version') + add_common_option('--show-rc', dest='show_rc', action='store_true', default=False, + help='show/log the return code (rc)') + add_common_option('--no-files-cache', dest='cache_files', action='store_false', + help='do not load/update the file metadata cache used to detect unchanged files') + add_common_option('--umask', dest='umask', type=lambda s: int(s, 8), default=UMASK_DEFAULT, metavar='M', + help='set umask to M (local and remote, default: %(default)04o)') + add_common_option('--remote-path', dest='remote_path', metavar='PATH', + help='use PATH as borg executable on the remote (default: "borg")') + add_common_option('--remote-ratelimit', dest='remote_ratelimit', type=int, metavar='rate', + help='set remote network upload rate limit in kiByte/s (default: 0=unlimited)') + add_common_option('--consider-part-files', dest='consider_part_files', + action='store_true', default=False, + help='treat part files like normal files (e.g. to list/extract them)') - common_group = common_parser.add_argument_group('Common options') - common_group.add_argument('-h', '--help', action='help', help='show this help message and exit') - common_group.add_argument('--critical', dest='log_level', - action='store_const', const='critical', default='warning', - help='work on log level CRITICAL') - common_group.add_argument('--error', dest='log_level', - action='store_const', const='error', default='warning', - help='work on log level ERROR') - common_group.add_argument('--warning', dest='log_level', - action='store_const', const='warning', default='warning', - help='work on log level WARNING (default)') - common_group.add_argument('--info', '-v', '--verbose', dest='log_level', - action='store_const', const='info', default='warning', - help='work on log level INFO') - common_group.add_argument('--debug', dest='log_level', - action='store_const', const='debug', default='warning', - help='enable debug output, work on log level DEBUG') - common_group.add_argument('--debug-topic', dest='debug_topics', - action='append', metavar='TOPIC', default=[], - help='enable TOPIC debugging (can be specified multiple times). ' - 'The logger path is borg.debug.<TOPIC> if TOPIC is not fully qualified.') - common_group.add_argument('-p', '--progress', dest='progress', action='store_true', - help='show progress information') - common_group.add_argument('--log-json', dest='log_json', action='store_true', - help='Output one JSON object per log line instead of formatted text.') - common_group.add_argument('--lock-wait', dest='lock_wait', type=int, metavar='N', default=1, - help='wait for the lock, but max. N seconds (default: %(default)d).') - common_group.add_argument('--show-version', dest='show_version', action='store_true', default=False, - help='show/log the borg version') - common_group.add_argument('--show-rc', dest='show_rc', action='store_true', default=False, - help='show/log the return code (rc)') - common_group.add_argument('--no-files-cache', dest='cache_files', action='store_false', - help='do not load/update the file metadata cache used to detect unchanged files') - common_group.add_argument('--umask', dest='umask', type=lambda s: int(s, 8), default=UMASK_DEFAULT, metavar='M', - help='set umask to M (local and remote, default: %(default)04o)') - common_group.add_argument('--remote-path', dest='remote_path', metavar='PATH', - help='use PATH as borg executable on the remote (default: "borg")') - common_group.add_argument('--remote-ratelimit', dest='remote_ratelimit', type=int, metavar='rate', - help='set remote network upload rate limit in kiByte/s (default: 0=unlimited)') - common_group.add_argument('--consider-part-files', dest='consider_part_files', - action='store_true', default=False, - help='treat part files like normal files (e.g. to list/extract them)') - - parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups') + parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups', + add_help=False) + parser.common_options = self.CommonOptions(define_common_options, + suffix_precedence=('_maincommand', '_midcommand', '_subcommand')) parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__, help='show version number and exit') - subparsers = parser.add_subparsers(title='required arguments', metavar='<command>') + parser.common_options.add_common_group(parser, '_maincommand', provide_defaults=True) + common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog) # some empty defaults for all subparsers common_parser.set_defaults(paths=[], patterns=[]) + parser.common_options.add_common_group(common_parser, '_subcommand') + + mid_common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog) + mid_common_parser.set_defaults(paths=[], patterns=[]) + parser.common_options.add_common_group(mid_common_parser, '_midcommand') + + subparsers = parser.add_subparsers(title='required arguments', metavar='<command>') serve_epilog = process_epilog(""" This command starts a repository server process. This command is usually not used manually. @@ -1953,7 +2088,7 @@ def process_epilog(epilog): This command initializes an empty repository. A repository is a filesystem directory containing the deduplicated data from zero or more archives. - Encryption can be enabled at repository init time. + Encryption can be enabled at repository init time. It cannot be changed later. It is not recommended to work without encryption. Repository encryption protects you e.g. against the case that an attacker has access to your backup repository. @@ -2008,8 +2143,8 @@ def process_epilog(epilog): `authenticated` mode uses no encryption, but authenticates repository contents through the same keyed BLAKE2b-256 hash as the other blake2 modes (it uses it - as chunk ID hash). The key is stored like repokey. - This mode is new and not compatible with borg 1.0.x. + as the chunk ID hash). The key is stored like repokey. + This mode is new and *not* compatible with borg 1.0.x. `none` mode uses no encryption and no authentication. It uses sha256 as chunk ID hash. Not recommended, rather consider using an authenticated or @@ -2035,7 +2170,7 @@ def process_epilog(epilog): help='repository to create') subparser.add_argument('-e', '--encryption', dest='encryption', required=True, choices=('none', 'keyfile', 'repokey', 'keyfile-blake2', 'repokey-blake2', 'authenticated'), - help='select encryption key mode') + help='select encryption key mode **(required)**') subparser.add_argument('-a', '--append-only', dest='append_only', action='store_true', help='create an append-only mode repository') @@ -2113,7 +2248,7 @@ def process_epilog(epilog): help='work slower, but using less space') self.add_archives_filters_args(subparser) - subparser = subparsers.add_parser('key', parents=[common_parser], add_help=False, + subparser = subparsers.add_parser('key', parents=[mid_common_parser], add_help=False, description="Manage a keyfile or repokey of a repository", epilog="", formatter_class=argparse.RawDescriptionHelpFormatter, @@ -3113,7 +3248,7 @@ def process_epilog(epilog): in case you ever run into some severe malfunction. Use them only if you know what you are doing or if a trusted developer tells you what to do.""") - subparser = subparsers.add_parser('debug', parents=[common_parser], add_help=False, + subparser = subparsers.add_parser('debug', parents=[mid_common_parser], add_help=False, description='debugging command (not intended for normal use)', epilog=debug_epilog, formatter_class=argparse.RawDescriptionHelpFormatter, @@ -3254,7 +3389,7 @@ def process_epilog(epilog): benchmark_epilog = process_epilog("These commands do various benchmarks.") - subparser = subparsers.add_parser('benchmark', parents=[common_parser], add_help=False, + subparser = subparsers.add_parser('benchmark', parents=[mid_common_parser], add_help=False, description='benchmark command', epilog=benchmark_epilog, formatter_class=argparse.RawDescriptionHelpFormatter, @@ -3358,6 +3493,7 @@ def parse_args(self, args=None): args = self.preprocess_args(args) parser = self.build_parser() args = parser.parse_args(args or ['-h']) + parser.common_options.resolve(args) # This works around http://bugs.python.org/issue9351 func = getattr(args, 'func', None) or getattr(args, 'fallback_func') if func == self.do_create and not args.paths:
main command options? stuff like --remote-path should be an option of main command, not subcommand, so it can be used like: ``` borg --remote-path=... create ``` Currently, it only works like this: ``` borg create --remote-path=... ``` Thus, it is a bit impractical if one wants to define a abbreviation like: ``` BORG="borg --remote-path=x" ```
borgbackup/borg
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 14b22ed0..842b8f0a 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1,3 +1,4 @@ +import argparse import errno import json import logging @@ -1680,6 +1681,12 @@ def test_log_json(self): assert log_message['name'].startswith('borg.') assert isinstance(log_message['message'], str) + def test_common_options(self): + self.create_test_files() + self.cmd('init', '--encryption=repokey', self.repository_location) + log = self.cmd('--debug', 'create', self.repository_location + '::test', 'input') + assert 'security: read previous_location' in log + def _get_sizes(self, compression, compressible, size=10000): if compressible: contents = b'X' * size @@ -2989,3 +2996,116 @@ def test_strip_components(self): assert not filter(Item(path='shallow/')) # can this even happen? paths are normalized... assert filter(Item(path='deep enough/file')) assert filter(Item(path='something/dir/file')) + + +class TestCommonOptions: + @staticmethod + def define_common_options(add_common_option): + add_common_option('-h', '--help', action='help', help='show this help message and exit') + add_common_option('--critical', dest='log_level', help='foo', + action='store_const', const='critical', default='warning') + add_common_option('--error', dest='log_level', help='foo', + action='store_const', const='error', default='warning') + add_common_option('--append', dest='append', help='foo', + action='append', metavar='TOPIC', default=[]) + add_common_option('-p', '--progress', dest='progress', action='store_true', help='foo') + add_common_option('--lock-wait', dest='lock_wait', type=int, metavar='N', default=1, + help='(default: %(default)d).') + add_common_option('--no-files-cache', dest='no_files_cache', action='store_false', help='foo') + + @pytest.fixture + def basic_parser(self): + parser = argparse.ArgumentParser(prog='test', description='test parser', add_help=False) + parser.common_options = Archiver.CommonOptions(self.define_common_options, + suffix_precedence=('_level0', '_level1')) + return parser + + @pytest.fixture + def subparsers(self, basic_parser): + return basic_parser.add_subparsers(title='required arguments', metavar='<command>') + + @pytest.fixture + def parser(self, basic_parser): + basic_parser.common_options.add_common_group(basic_parser, '_level0', provide_defaults=True) + return basic_parser + + @pytest.fixture + def common_parser(self, parser): + common_parser = argparse.ArgumentParser(add_help=False, prog='test') + parser.common_options.add_common_group(common_parser, '_level1') + return common_parser + + @pytest.fixture + def parse_vars_from_line(self, parser, subparsers, common_parser): + subparser = subparsers.add_parser('subcommand', parents=[common_parser], add_help=False, + description='foo', epilog='bar', help='baz', + formatter_class=argparse.RawDescriptionHelpFormatter) + subparser.set_defaults(func=1234) + subparser.add_argument('--append-only', dest='append_only', action='store_true') + + def parse_vars_from_line(*line): + print(line) + args = parser.parse_args(line) + parser.common_options.resolve(args) + return vars(args) + + return parse_vars_from_line + + def test_simple(self, parse_vars_from_line): + assert parse_vars_from_line('--error') == { + 'no_files_cache': True, + 'append': [], + 'lock_wait': 1, + 'log_level': 'error', + 'progress': False + } + + assert parse_vars_from_line('--error', 'subcommand', '--critical') == { + 'no_files_cache': True, + 'append': [], + 'lock_wait': 1, + 'log_level': 'critical', + 'progress': False, + 'append_only': False, + 'func': 1234, + } + + with pytest.raises(SystemExit): + parse_vars_from_line('--append-only', 'subcommand') + + assert parse_vars_from_line('--append=foo', '--append', 'bar', 'subcommand', '--append', 'baz') == { + 'no_files_cache': True, + 'append': ['foo', 'bar', 'baz'], + 'lock_wait': 1, + 'log_level': 'warning', + 'progress': False, + 'append_only': False, + 'func': 1234, + } + + @pytest.mark.parametrize('position', ('before', 'after', 'both')) + @pytest.mark.parametrize('flag,args_key,args_value', ( + ('-p', 'progress', True), + ('--lock-wait=3', 'lock_wait', 3), + ('--no-files-cache', 'no_files_cache', False), + )) + def test_flag_position_independence(self, parse_vars_from_line, position, flag, args_key, args_value): + line = [] + if position in ('before', 'both'): + line.append(flag) + line.append('subcommand') + if position in ('after', 'both'): + line.append(flag) + + result = { + 'no_files_cache': True, + 'append': [], + 'lock_wait': 1, + 'log_level': 'warning', + 'progress': False, + 'append_only': False, + 'func': 1234, + } + result[args_key] = args_value + + assert parse_vars_from_line(*line) == result
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 4 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libacl1-dev liblz4-dev libzstd-dev pkg-config build-essential" ], "python": "3.9", "reqs_path": [ "requirements.d/development.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/borgbackup/borg.git@00e76f77fc742b3297a407f2924b24ba497693c7#egg=borgbackup cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 coverage==7.8.0 Cython==3.0.12 distlib==0.3.9 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 iniconfig==2.1.0 msgpack-python==0.5.6 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 py-cpuinfo==9.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-asyncio==0.26.0 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 setuptools-scm==8.2.0 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: borg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - coverage==7.8.0 - cython==3.0.12 - distlib==0.3.9 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - iniconfig==2.1.0 - msgpack-python==0.5.6 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - setuptools-scm==8.2.0 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/borg
[ "src/borg/testsuite/archiver.py::TestCommonOptions::test_simple", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[-p-progress-True-before]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[-p-progress-True-after]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[-p-progress-True-both]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--lock-wait=3-lock_wait-3-before]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--lock-wait=3-lock_wait-3-after]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--lock-wait=3-lock_wait-3-both]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--no-files-cache-no_files_cache-False-before]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--no-files-cache-no_files_cache-False-after]", "src/borg/testsuite/archiver.py::TestCommonOptions::test_flag_position_independence[--no-files-cache-no_files_cache-False-both]" ]
[ "src/borg/testsuite/archiver.py::test_return_codes[python]", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_common_options", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_exclude_folder_but_recurse", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_exclude_folder_no_recurse", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_debug_put_get_delete_obj", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_force", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_info_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_json_args", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_log_json", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_repository_swap_detection_repokey_blank_passphrase", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_attic013_acl_bug", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_check_usage", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_corrupted_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_empty_repository", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_extra_chunks", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_corrupted_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_manifest_rebuild_duplicate_archive", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_item_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_archive_metadata", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_file_chunk", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_missing_manifest", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data", "src/borg/testsuite/archiver.py::ArchiverCheckTestCase::test_verify_data_unencrypted", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_disable2", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_fresh_init_tam_required", "src/borg/testsuite/archiver.py::ManifestAuthenticationTest::test_not_required", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_aes_counter_uniqueness_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_atime", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_bad_filters", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_break_lock", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_change_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_check_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_comment", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_common_options", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_auto_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_none_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_compressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_corrupted_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_exclude_folder_but_recurse", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_exclude_folder_no_recurse", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_pattern_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_read_special_broken_symlink", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_topical", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_create_without_root", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_archive_items", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_manifest", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_debug_dump_repo_objs", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_force", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_repo", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_keep_tagged_deprecation", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_include_exclude_regex_from_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_pattern_opt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_progress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_with_pattern", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_file_status_excluded", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_info", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_info_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_keyfile", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_paperkey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_qr", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_export_repokey", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_key_import_errors", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_chunk_counts", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_hash", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_json_args", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_repository_format", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_list_size", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_log_json", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_overwrite", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_path_normalization", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_off", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_on", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_prefix", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_prune_repository_save_space", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_basic", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_dry_run", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_caches", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_keep_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_exclude_tagged", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_list_output", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_rechunkify", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_recompress", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_skips_nothing_to_do", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_subtree_hardlinks", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_recreate_target_rc", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_remote_repo_restrict_to_path", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_rename", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repeated_files", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_move", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection2_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection_no_cache", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_repository_swap_detection_repokey_blank_passphrase", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_security_dir_compat", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_sparse_file", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_doesnt_leak", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_strip_components_links", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_symlink_extract", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_umask", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unix_socket", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unusual_filenames", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_with_lock", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_basic_functionality", "src/borg/testsuite/archiver.py::DiffArchiverTestCase::test_sort_option" ]
[ "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lz4_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_lzma_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_compression_zlib_uncompressible", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_delete_double_force", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::ArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_delete_double_force", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_help", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_interrupt", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_init_requires_encryption_option", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_unknown_unencrypted", "src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_usage", "src/borg/testsuite/archiver.py::test_get_args", "src/borg/testsuite/archiver.py::test_compare_chunk_contents", "src/borg/testsuite/archiver.py::TestBuildFilter::test_basic", "src/borg/testsuite/archiver.py::TestBuildFilter::test_empty", "src/borg/testsuite/archiver.py::TestBuildFilter::test_strip_components" ]
[]
BSD License
1,244
[ "setup.py", "docs/man_intro.rst", "docs/usage.rst", "src/borg/archiver.py" ]
[ "setup.py", "docs/man_intro.rst", "docs/usage.rst", "src/borg/archiver.py" ]
BernardoSilva__simplyhosting-api-client-python-16
1c93603325f43b7c7e02939a449555e65e0a6822
2017-05-14 16:45:01
554dfb5229703b505e32732031b91e2815b6440e
diff --git a/simplyhosting/user.py b/simplyhosting/user.py index cd6261f..6a65e1e 100644 --- a/simplyhosting/user.py +++ b/simplyhosting/user.py @@ -25,28 +25,14 @@ class User: def generate_secret_key(self, key_name, access): request = Request('post', '/user/generateSecretKey') - request.data = {} - key_name = kwargs.get('key_name', '') - access = kwargs.get('access', '') - if key_name: - request.data['keyName'] = key_name - - if access: - request.data['access'] = access + request.data = {'keyName': key_name, 'access': access} self.apiClient.request = request return self.apiClient - def update_secret_key(self, key_id, **kwargs): + def update_secret_key(self, key_id, optional_data={}): request = Request('post', '/user/updateSecretKey') request.data = {'keyId': key_id} - key_name = kwargs.get('key_name', '') - access = kwargs.get('access', '') - if key_name: - request.data['keyName'] = key_name - - if access: - request.data['access'] = access - + request.data.update(optional_data) self.apiClient.request = request return self.apiClient
Implement user resource API https://api.simplyhosting.com/v2/doc/#!/user.json
BernardoSilva/simplyhosting-api-client-python
diff --git a/test/test_user.py b/test/test_user.py new file mode 100644 index 0000000..6ce9c4c --- /dev/null +++ b/test/test_user.py @@ -0,0 +1,51 @@ +from simplyhosting.client import Client +import unittest + +class Test_user(unittest.TestCase): + def setUp(self): + self.client = Client(api_key='a', api_secret='b') + self.optional_data={'optionalParam': 'value'} + + def test_auth_set_data_successfully(self): + self.client.user().auth('benny', 'my-secret-password') + request = self.client.request + self.assertEqual('benny', request.data['login']) + self.assertEqual('my-secret-password', request.data['password']) + + def test_ping_path_is_correct(self): + self.client.user().ping() + request = self.client.request + self.assertEqual('/user/ping', request.path) + + def test_get_payment_method_path_is_correct(self): + self.client.user().get_payment_methods() + request = self.client.request + self.assertEqual('/user/getPaymentMethods', request.path) + + def test_generate_secret_key_set_data_successfully(self): + self.client.user().generate_secret_key('dev-key', 'rw') + request = self.client.request + self.assertEqual('dev-key', request.data['keyName']) + self.assertEqual('rw', request.data['access']) + + def test_update_secret_key_set_data_successfully(self): + self.client.user().update_secret_key(1, self.optional_data) + request = self.client.request + self.assertEqual(1, request.data['keyId']) + self.assertEqual('value', request.data['optionalParam']) + + def test_delete_secret_key_set_data_successfully(self): + self.client.user().delete_secret_key(1) + request = self.client.request + self.assertEqual(1, request.data['keyId']) + + def test_get_secret_keys_set_path_successfully(self): + self.client.user().get_secret_keys() + request = self.client.request + self.assertEqual('/user/getSecretKeys', request.path) + + def test_regenerate_secret_key_set_data_successfully(self): + self.client.user().regenerate_secret_key(1, 'r') + request = self.client.request + self.assertEqual(1, request.data['keyId']) + self.assertEqual('r', request.data['access'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 3, "test_score": 0 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 python-http-client==2.2.1 requests==2.13.0 -e git+https://github.com/BernardoSilva/simplyhosting-api-client-python.git@1c93603325f43b7c7e02939a449555e65e0a6822#egg=simplyhosting_api_client tomli==2.2.1
name: simplyhosting-api-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - python-http-client==2.2.1 - requests==2.13.0 - tomli==2.2.1 prefix: /opt/conda/envs/simplyhosting-api-client-python
[ "test/test_user.py::Test_user::test_generate_secret_key_set_data_successfully", "test/test_user.py::Test_user::test_update_secret_key_set_data_successfully" ]
[]
[ "test/test_user.py::Test_user::test_auth_set_data_successfully", "test/test_user.py::Test_user::test_delete_secret_key_set_data_successfully", "test/test_user.py::Test_user::test_get_payment_method_path_is_correct", "test/test_user.py::Test_user::test_get_secret_keys_set_path_successfully", "test/test_user.py::Test_user::test_ping_path_is_correct", "test/test_user.py::Test_user::test_regenerate_secret_key_set_data_successfully" ]
[]
null
1,245
[ "simplyhosting/user.py" ]
[ "simplyhosting/user.py" ]
BernardoSilva__simplyhosting-api-client-python-17
5c5e2edb50db13085b2bc01bc9f707514b6d9d05
2017-05-14 17:13:22
554dfb5229703b505e32732031b91e2815b6440e
diff --git a/simplyhosting/ip.py b/simplyhosting/ip.py index b7a0ecf..ee79a64 100644 --- a/simplyhosting/ip.py +++ b/simplyhosting/ip.py @@ -1,3 +1,50 @@ +from .request import Request + + class IP(object): def __init__(self, apiClient): self.apiClient = apiClient + + def set_ptr(self, ip, optional_data={}): + request = Request('post', '/ip/setPtr') + request.data = {'ip': ip} + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def get_ptr(self, ip): + request = Request('post', '/ip/getPtr') + request.data = {'ip': ip} + self.apiClient.request = request + return self.apiClient + + def null_route(self, ip, optional_data={}): + request = Request('post', '/ip/nullRoute') + request.data = {'ip': ip} + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def un_null_route(self, ip): + request = Request('post', '/ip/unNullRoute') + request.data = {'ip': ip} + self.apiClient.request = request + return self.apiClient + + def route(self, ip, server_id): + request = Request('post', '/ip/route') + request.data = {'ip': ip, 'serverId': server_id} + self.apiClient.request = request + return self.apiClient + + def get_list(self, optional_data={}): + request = Request('post', '/ip/getList') + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def get_list6(self, optional_data={}): + request = Request('post', '/ip/getList6') + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient
Implement IP resource API @see https://api.simplyhosting.com/v2/doc/#!/ip.json
BernardoSilva/simplyhosting-api-client-python
diff --git a/test/test_ip.py b/test/test_ip.py new file mode 100644 index 0000000..c64ee6b --- /dev/null +++ b/test/test_ip.py @@ -0,0 +1,45 @@ +from simplyhosting.client import Client +import unittest + +class Test_ip(unittest.TestCase): + def setUp(self): + self.client = Client(api_key='a', api_secret='b') + self.optional_data={'optionalParam': 'value'} + + def test_set_ptr_set_data_successfully(self): + self.client.ip().set_ptr('192.168.0.1', self.optional_data) + request = self.client.request + self.assertEqual('192.168.0.1', request.data['ip']) + self.assertEqual('value', request.data['optionalParam']) + + def test_get_ptr_set_data_successfully(self): + self.client.ip().get_ptr('192.168.0.1') + request = self.client.request + self.assertEqual('192.168.0.1', request.data['ip']) + + def test_null_route_set_data_successfully(self): + self.client.ip().null_route('192.168.0.1', self.optional_data) + request = self.client.request + self.assertEqual('192.168.0.1', request.data['ip']) + self.assertEqual('value', request.data['optionalParam']) + + def test_un_null_route_set_data_successfully(self): + self.client.ip().un_null_route('192.168.0.1') + request = self.client.request + self.assertEqual('192.168.0.1', request.data['ip']) + + def test_route_set_data_successfully(self): + self.client.ip().route('192.168.0.1', 1) + request = self.client.request + self.assertEqual('192.168.0.1', request.data['ip']) + self.assertEqual(1, request.data['serverId']) + + def test_get_list_set_data_successfully(self): + self.client.ip().get_list(self.optional_data) + request = self.client.request + self.assertEqual('value', request.data['optionalParam']) + + def test_get_list6_set_data_successfully(self): + self.client.ip().get_list6(self.optional_data) + request = self.client.request + self.assertEqual('value', request.data['optionalParam'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pycodestyle" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pycodestyle==2.13.0 pytest==8.3.5 python-http-client==2.2.1 requests==2.13.0 -e git+https://github.com/BernardoSilva/simplyhosting-api-client-python.git@5c5e2edb50db13085b2bc01bc9f707514b6d9d05#egg=simplyhosting_api_client tomli==2.2.1
name: simplyhosting-api-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pycodestyle==2.13.0 - pytest==8.3.5 - python-http-client==2.2.1 - requests==2.13.0 - tomli==2.2.1 prefix: /opt/conda/envs/simplyhosting-api-client-python
[ "test/test_ip.py::Test_ip::test_get_list6_set_data_successfully", "test/test_ip.py::Test_ip::test_get_list_set_data_successfully", "test/test_ip.py::Test_ip::test_get_ptr_set_data_successfully", "test/test_ip.py::Test_ip::test_null_route_set_data_successfully", "test/test_ip.py::Test_ip::test_route_set_data_successfully", "test/test_ip.py::Test_ip::test_set_ptr_set_data_successfully", "test/test_ip.py::Test_ip::test_un_null_route_set_data_successfully" ]
[]
[]
[]
null
1,246
[ "simplyhosting/ip.py" ]
[ "simplyhosting/ip.py" ]
BernardoSilva__simplyhosting-api-client-python-18
21692f359a619855f717c8129d9890248d5c0c19
2017-05-14 17:44:22
554dfb5229703b505e32732031b91e2815b6440e
diff --git a/simplyhosting/os.py b/simplyhosting/os.py index 8fd8cff..81fa06f 100644 --- a/simplyhosting/os.py +++ b/simplyhosting/os.py @@ -1,3 +1,18 @@ +from .request import Request + + class OS(object): def __init__(self, apiClient): self.apiClient = apiClient + + def get_params(self, server_id): + request = Request('post', '/os/getParams') + request.data = {'serverId': server_id} + self.apiClient.request = request + return self.apiClient + + def get_available_os_versions(self, server_id): + request = Request('post', '/os/getAvailableOsVersions') + request.data = {'serverId': server_id} + self.apiClient.request = request + return self.apiClient
Implement OS resource API @see https://api.simplyhosting.com/v2/doc/#!/os.json
BernardoSilva/simplyhosting-api-client-python
diff --git a/test/test_os.py b/test/test_os.py new file mode 100644 index 0000000..f8ba1fa --- /dev/null +++ b/test/test_os.py @@ -0,0 +1,17 @@ +from simplyhosting.client import Client +import unittest + +class Test_os(unittest.TestCase): + def setUp(self): + self.client = Client(api_key='a', api_secret='b') + self.optional_data={'optionalParam': 'value'} + + def test_get_params_set_data_successfully(self): + self.client.os().get_params(1) + request = self.client.request + self.assertEqual(1, request.data['serverId']) + + def test_get_available_os_versions_set_data_successfully(self): + self.client.os().get_available_os_versions(1) + request = self.client.request + self.assertEqual(1, request.data['serverId'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 0, "test_score": 1 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "coverage", "coveralls", "pytest" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 coveralls==4.0.1 docopt==0.6.2 exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 python-http-client==2.2.1 requests==2.13.0 -e git+https://github.com/BernardoSilva/simplyhosting-api-client-python.git@21692f359a619855f717c8129d9890248d5c0c19#egg=simplyhosting_api_client tomli==2.2.1
name: simplyhosting-api-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - coveralls==4.0.1 - docopt==0.6.2 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pytest==8.3.5 - python-http-client==2.2.1 - requests==2.13.0 - tomli==2.2.1 prefix: /opt/conda/envs/simplyhosting-api-client-python
[ "test/test_os.py::Test_os::test_get_available_os_versions_set_data_successfully", "test/test_os.py::Test_os::test_get_params_set_data_successfully" ]
[]
[]
[]
null
1,247
[ "simplyhosting/os.py" ]
[ "simplyhosting/os.py" ]
BernardoSilva__simplyhosting-api-client-python-19
c743f1656dbe82302c3996f6a73417f416b86091
2017-05-14 19:01:39
554dfb5229703b505e32732031b91e2815b6440e
diff --git a/simplyhosting/product.py b/simplyhosting/product.py index 923f375..9e216b4 100644 --- a/simplyhosting/product.py +++ b/simplyhosting/product.py @@ -1,3 +1,69 @@ +from .request import Request + + class Product(object): def __init__(self, apiClient): self.apiClient = apiClient + + def get_product_list(self, optional_data={}): + request = Request('post', '/product/getProductList') + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def get_config_options(self, product_id): + request = Request('post', '/product/getConfigOptions') + request.data = {'productId': product_id} + self.apiClient.request = request + return self.apiClient + + def get_addons(self, product_id): + request = Request('post', '/product/getAddons') + request.data = {'productId': product_id} + self.apiClient.request = request + return self.apiClient + + def order_product(self, product_id, optional_data={}): + request = Request('post', '/product/orderProduct') + request.data = {'productId': product_id} + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def order_products(self, product_id, payment_method, optional_data={}): + request = Request('post', '/product/orderProducts') + request.data = { + 'productId': product_id, + 'paymentMethod': payment_method + } + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def order_history(self, order_id): + request = Request('post', '/product/orderHistory') + request.data = {'orderId': order_id} + self.apiClient.request = request + return self.apiClient + + def cancel_service(self, service_id, reason, optional_data={}): + request = Request('post', '/product/cancelService') + request.data = {'serviceId': service_id, 'reason': reason} + request.data.update(optional_data) + self.apiClient.request = request + return self.apiClient + + def cancel_pending_order(self, order_id): + request = Request('post', '/product/cancelPendingOrder') + request.data = {'orderId': order_id} + self.apiClient.request = request + return self.apiClient + + def upgrade_service(self, service_id, config_options): + request = Request('post', '/product/upgradeService') + request.data = { + 'serviceId': service_id, + 'configOptions': config_options + } + self.apiClient.request = request + return self.apiClient
Implement Product resource API @see https://api.simplyhosting.com/v2/doc/#!/product.json
BernardoSilva/simplyhosting-api-client-python
diff --git a/test/test_product.py b/test/test_product.py new file mode 100644 index 0000000..1602504 --- /dev/null +++ b/test/test_product.py @@ -0,0 +1,53 @@ +from simplyhosting.client import Client +import unittest + + +class Test_product(unittest.TestCase): + def setUp(self): + self.client = Client(api_key='a', api_secret='b') + self.optional_data={'optionalParam': 'value'} + + def test_get_product_list_set_data_successfully(self): + self.client.product().get_product_list(self.optional_data) + request = self.client.request + self.assertEqual('value', request.data['optionalParam']) + + def test_get_config_options_set_data_successfully(self): + self.client.product().get_config_options(1) + request = self.client.request + self.assertEqual(1, request.data['productId']) + + def test_get_addons_set_data_successfully(self): + self.client.product().get_addons(1) + request = self.client.request + self.assertEqual(1, request.data['productId']) + + def test_order_products_set_data_successfully(self): + self.client.product().order_products(1, 'card', self.optional_data) + request = self.client.request + self.assertEqual(1, request.data['productId']) + self.assertEqual('card', request.data['paymentMethod']) + self.assertEqual('value', request.data['optionalParam']) + + def test_order_history_set_data_successfully(self): + self.client.product().order_history(1) + request = self.client.request + self.assertEqual(1, request.data['orderId']) + + def test_cancel_service_set_data_successfully(self): + self.client.product().cancel_service(1, 'My reason', self.optional_data) + request = self.client.request + self.assertEqual(1, request.data['serviceId']) + self.assertEqual('My reason', request.data['reason']) + self.assertEqual('value', request.data['optionalParam']) + + def test_cancel_pending_order_set_data_successfully(self): + self.client.product().cancel_pending_order(1) + request = self.client.request + self.assertEqual(1, request.data['orderId']) + + def test_upgrade_service_set_data_successfully(self): + self.client.product().upgrade_service(1, '22,69') + request = self.client.request + self.assertEqual(1, request.data['serviceId']) + self.assertEqual('22,69', request.data['configOptions'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "coverage", "coveralls", "pytest", "pycodestyle" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 coveralls==4.0.1 docopt==0.6.2 exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pycodestyle==2.13.0 pytest==8.3.5 python-http-client==2.2.1 requests==2.13.0 -e git+https://github.com/BernardoSilva/simplyhosting-api-client-python.git@c743f1656dbe82302c3996f6a73417f416b86091#egg=simplyhosting_api_client tomli==2.2.1
name: simplyhosting-api-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - coveralls==4.0.1 - docopt==0.6.2 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pycodestyle==2.13.0 - pytest==8.3.5 - python-http-client==2.2.1 - requests==2.13.0 - tomli==2.2.1 prefix: /opt/conda/envs/simplyhosting-api-client-python
[ "test/test_product.py::Test_product::test_cancel_pending_order_set_data_successfully", "test/test_product.py::Test_product::test_cancel_service_set_data_successfully", "test/test_product.py::Test_product::test_get_addons_set_data_successfully", "test/test_product.py::Test_product::test_get_config_options_set_data_successfully", "test/test_product.py::Test_product::test_get_product_list_set_data_successfully", "test/test_product.py::Test_product::test_order_history_set_data_successfully", "test/test_product.py::Test_product::test_order_products_set_data_successfully", "test/test_product.py::Test_product::test_upgrade_service_set_data_successfully" ]
[]
[]
[]
null
1,248
[ "simplyhosting/product.py" ]
[ "simplyhosting/product.py" ]
BernardoSilva__simplyhosting-api-client-python-20
554dfb5229703b505e32732031b91e2815b6440e
2017-05-14 22:41:46
554dfb5229703b505e32732031b91e2815b6440e
diff --git a/simplyhosting/vlan.py b/simplyhosting/vlan.py index 8ad1209..a51bbe3 100644 --- a/simplyhosting/vlan.py +++ b/simplyhosting/vlan.py @@ -1,3 +1,23 @@ +from .request import Request + + class Vlan(object): def __init__(self, apiClient): self.apiClient = apiClient + + def add_server(self, server_id, vlan_sid): + request = Request('post', '/vlan/addServer') + request.data = {'serverId': server_id, 'vlanSid': vlan_sid} + self.apiClient.request = request + return self.apiClient + + def remove_server(self, server_id, vlan_sid): + request = Request('post', '/vlan/removeServer') + request.data = {'serverId': server_id, 'vlanSid': vlan_sid} + self.apiClient.request = request + return self.apiClient + + def list(self): + request = Request('post', '/vlan/list') + self.apiClient.request = request + return self.apiClient
Implement vlan resource API @see https://api.simplyhosting.com/v2/doc/#!/vlan.json
BernardoSilva/simplyhosting-api-client-python
diff --git a/test/test_vlan.py b/test/test_vlan.py new file mode 100644 index 0000000..d34f3b8 --- /dev/null +++ b/test/test_vlan.py @@ -0,0 +1,24 @@ +from simplyhosting.client import Client +import unittest + +class Test_vlan(unittest.TestCase): + def setUp(self): + self.client = Client(api_key='a', api_secret='b') + self.optional_data={'optionalParam': 'value'} + + def test_add_server_set_data_successfully(self): + self.client.vlan().add_server(1, 3) + request = self.client.request + self.assertEqual(1, request.data['serverId']) + self.assertEqual(3, request.data['vlanSid']) + + def test_remove_server_set_data_successfully(self): + self.client.vlan().remove_server(1, 3) + request = self.client.request + self.assertEqual(1, request.data['serverId']) + self.assertEqual(3, request.data['vlanSid']) + + def test_list_set_correct_path(self): + self.client.vlan().list() + request = self.client.request + self.assertEqual('/vlan/list', request.path)
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "coverage", "coveralls" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 coveralls==4.0.1 docopt==0.6.2 python-http-client==2.2.1 requests==2.13.0 -e git+https://github.com/BernardoSilva/simplyhosting-api-client-python.git@554dfb5229703b505e32732031b91e2815b6440e#egg=simplyhosting_api_client tomli==2.2.1
name: simplyhosting-api-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - coveralls==4.0.1 - docopt==0.6.2 - python-http-client==2.2.1 - requests==2.13.0 - tomli==2.2.1 prefix: /opt/conda/envs/simplyhosting-api-client-python
[ "test/test_vlan.py::Test_vlan::test_add_server_set_data_successfully", "test/test_vlan.py::Test_vlan::test_list_set_correct_path", "test/test_vlan.py::Test_vlan::test_remove_server_set_data_successfully" ]
[]
[]
[]
null
1,249
[ "simplyhosting/vlan.py" ]
[ "simplyhosting/vlan.py" ]
BernardoSilva__simplyhosting-api-client-python-21
554dfb5229703b505e32732031b91e2815b6440e
2017-05-14 22:50:28
554dfb5229703b505e32732031b91e2815b6440e
diff --git a/simplyhosting/client.py b/simplyhosting/client.py index b62fc97..bed3e27 100644 --- a/simplyhosting/client.py +++ b/simplyhosting/client.py @@ -12,6 +12,7 @@ from .reseller_vlan import ResellerVlan from .server import Server from .service import Service from .support import Support +from .tool import Tool from .user import User from .vlan import Vlan from .response import Response @@ -100,6 +101,9 @@ class Client(object): def support(self): return Support(self) + def tool(self): + return Tool(self) + def user(self): return User(self) diff --git a/simplyhosting/tool.py b/simplyhosting/tool.py index 04102e1..94670df 100644 --- a/simplyhosting/tool.py +++ b/simplyhosting/tool.py @@ -1,3 +1,12 @@ +from .request import Request + + class Tool(object): def __init__(self, apiClient): self.apiClient = apiClient + + def queue(self, id): + request = Request('post', '/tool/queue') + request.data = {'id': id} + self.apiClient.request = request + return self.apiClient
Implement tool resource API https://api.simplyhosting.com/v2/doc/#!/tool.json
BernardoSilva/simplyhosting-api-client-python
diff --git a/test/test_tool.py b/test/test_tool.py new file mode 100644 index 0000000..000993e --- /dev/null +++ b/test/test_tool.py @@ -0,0 +1,12 @@ +from simplyhosting.client import Client +import unittest + + +class Test_tool(unittest.TestCase): + def setUp(self): + self.client = Client(api_key='a', api_secret='b') + + def test_queue_set_data_successfully(self): + self.client.tool().queue(1) + request = self.client.request + self.assertEqual(1, request.data['id'])
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 2 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "coverage", "coveralls", "pycodestyle" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
coverage==7.8.0 coveralls==4.0.1 docopt==0.6.2 exceptiongroup==1.2.2 iniconfig==2.1.0 packaging==24.2 pluggy==1.5.0 pycodestyle==2.13.0 pytest==8.3.5 python-http-client==2.2.1 requests==2.13.0 -e git+https://github.com/BernardoSilva/simplyhosting-api-client-python.git@554dfb5229703b505e32732031b91e2815b6440e#egg=simplyhosting_api_client tomli==2.2.1
name: simplyhosting-api-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - coveralls==4.0.1 - docopt==0.6.2 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - packaging==24.2 - pluggy==1.5.0 - pycodestyle==2.13.0 - pytest==8.3.5 - python-http-client==2.2.1 - requests==2.13.0 - tomli==2.2.1 prefix: /opt/conda/envs/simplyhosting-api-client-python
[ "test/test_tool.py::Test_tool::test_queue_set_data_successfully" ]
[]
[]
[]
null
1,250
[ "simplyhosting/tool.py", "simplyhosting/client.py" ]
[ "simplyhosting/tool.py", "simplyhosting/client.py" ]
oasis-open__cti-python-stix2-10
85b5a1971b0f36c3acaa0d3da734329bdd8ebe0b
2017-05-15 15:03:14
f937e2bb3f104e3cdf0578ed8323b2f7e39119a4
diff --git a/stix2/common.py b/stix2/common.py index 29cbf62..c8c243d 100644 --- a/stix2/common.py +++ b/stix2/common.py @@ -2,7 +2,7 @@ from .other import ExternalReference, GranularMarking from .properties import (BooleanProperty, ListProperty, ReferenceProperty, - TimestampProperty) + StringProperty, TimestampProperty) from .utils import NOW COMMON_PROPERTIES = { @@ -11,6 +11,7 @@ COMMON_PROPERTIES = { 'modified': TimestampProperty(default=lambda: NOW), 'external_references': ListProperty(ExternalReference), 'revoked': BooleanProperty(), + 'labels': ListProperty(StringProperty), 'created_by_ref': ReferenceProperty(type="identity"), 'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")), 'granular_markings': ListProperty(GranularMarking), diff --git a/stix2/sdo.py b/stix2/sdo.py index 693b750..a2f0062 100644 --- a/stix2/sdo.py +++ b/stix2/sdo.py @@ -57,7 +57,6 @@ class Identity(_STIXBase): _properties.update({ 'type': TypeProperty(_type), 'id': IDProperty(_type), - 'labels': ListProperty(StringProperty), 'name': StringProperty(required=True), 'description': StringProperty(), 'identity_class': StringProperty(required=True),
is labels optional Hi, As an exercise I'm starting a similar Scala library for STIX 2.1, at: [scalastix]( https://github.com/workingDog/scalastix) According to the specs and as part of the common properties, labels is optional. However, there are SDOs (e.g. Indicator) where it is required. Is this correct? labels are optional but not when required! I see that labels are not part of the python COMMON_PROPERTIES. Should I do the same?
oasis-open/cti-python-stix2
diff --git a/stix2/test/test_attack_pattern.py b/stix2/test/test_attack_pattern.py index c0891a5..618875e 100644 --- a/stix2/test/test_attack_pattern.py +++ b/stix2/test/test_attack_pattern.py @@ -67,4 +67,15 @@ def test_parse_attack_pattern(data): assert ap.external_references[0].source_name == 'capec' assert ap.name == "Spear Phishing" + +def test_attack_pattern_invalid_labels(): + with pytest.raises(stix2.exceptions.InvalidValueError): + stix2.AttackPattern( + id="attack-pattern--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061", + created="2016-05-12T08:17:27Z", + modified="2016-05-12T08:17:27Z", + name="Spear Phishing", + labels=1 + ) + # TODO: Add other examples
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 2 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.16 babel==2.17.0 bump2version==1.0.1 bumpversion==0.6.0 cachetools==5.5.2 certifi==2025.1.31 cfgv==3.4.0 chardet==5.2.0 charset-normalizer==3.4.1 colorama==0.4.6 coverage==7.8.0 distlib==0.3.9 docutils==0.21.2 exceptiongroup==1.2.2 filelock==3.18.0 identify==2.6.9 idna==3.10 imagesize==1.4.1 importlib_metadata==8.6.1 iniconfig==2.1.0 Jinja2==3.1.6 MarkupSafe==3.0.2 nodeenv==1.9.1 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 pre_commit==4.2.0 Pygments==2.19.1 pyproject-api==1.9.0 pytest==8.3.5 pytest-cov==6.0.0 python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==6.0.2 requests==2.32.3 six==1.17.0 snowballstemmer==2.2.0 Sphinx==7.4.7 sphinx-prompt==1.8.0 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 -e git+https://github.com/oasis-open/cti-python-stix2.git@85b5a1971b0f36c3acaa0d3da734329bdd8ebe0b#egg=stix2 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 urllib3==2.3.0 virtualenv==20.29.3 zipp==3.21.0
name: cti-python-stix2 channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.16 - babel==2.17.0 - bump2version==1.0.1 - bumpversion==0.6.0 - cachetools==5.5.2 - certifi==2025.1.31 - cfgv==3.4.0 - chardet==5.2.0 - charset-normalizer==3.4.1 - colorama==0.4.6 - coverage==7.8.0 - distlib==0.3.9 - docutils==0.21.2 - exceptiongroup==1.2.2 - filelock==3.18.0 - identify==2.6.9 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==8.6.1 - iniconfig==2.1.0 - jinja2==3.1.6 - markupsafe==3.0.2 - nodeenv==1.9.1 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - pre-commit==4.2.0 - pygments==2.19.1 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-cov==6.0.0 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyyaml==6.0.2 - requests==2.32.3 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==7.4.7 - sphinx-prompt==1.8.0 - sphinxcontrib-applehelp==2.0.0 - sphinxcontrib-devhelp==2.0.0 - sphinxcontrib-htmlhelp==2.1.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==2.0.0 - sphinxcontrib-serializinghtml==2.0.0 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - urllib3==2.3.0 - virtualenv==20.29.3 - zipp==3.21.0 prefix: /opt/conda/envs/cti-python-stix2
[ "stix2/test/test_attack_pattern.py::test_attack_pattern_invalid_labels" ]
[]
[ "stix2/test/test_attack_pattern.py::test_attack_pattern_example", "stix2/test/test_attack_pattern.py::test_parse_attack_pattern[{\\n", "stix2/test/test_attack_pattern.py::test_parse_attack_pattern[data1]" ]
[]
BSD 3-Clause "New" or "Revised" License
1,251
[ "stix2/common.py", "stix2/sdo.py" ]
[ "stix2/common.py", "stix2/sdo.py" ]
laterpay__laterpay-client-python-103
397afe02a9ddec00096da24febb8f37d60658f26
2017-05-15 15:09:08
87100aa64f880f61f9cdda81f1675c7650fc7c2e
coveralls: [![Coverage Status](https://coveralls.io/builds/11527944/badge)](https://coveralls.io/builds/11527944) Coverage remained the same at 100.0% when pulling **3014d0d6c526273f84c3f651559368adfdeea82a on bugfix/lptoken-muid** into **3daf25c7691ec60d7cb812c3c448b5c51843a771 on develop**.
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ba7c00..5ad4dde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 5.3.1 (under development) +* Only passed one of `lptoken` and `muid` to `/access` calls. Passing both is + not supported. + ## 5.3.0 * Added explicit support for the `muid` argument to `get_add_url()`, diff --git a/laterpay/__init__.py b/laterpay/__init__.py index 1a39bfc..af44ce6 100644 --- a/laterpay/__init__.py +++ b/laterpay/__init__.py @@ -360,16 +360,34 @@ class LaterPayClient(object): params = { 'cp': self.cp_key, 'ts': str(int(time.time())), - 'lptoken': str(lptoken or self.lptoken), 'article_id': article_ids, } - if muid: - # TODO: The behavior when lptoken and muid are given is not yet - # defined. Thus we'll allow both at the same time for now. It might - # be that in the end only one is allowed or one is prefered over - # the other. + """ + l = lptoken + s = self.lptoken + m = muid + x = error + + | L | not L | L | not L + -------+-------+-------+-------+------- + l | x | x | l | l + -------+-------+-------+-------+------- + not l | m | m | s | x + -------+-------+-------+-------+------- + | m | m | not m | not m + """ + if lptoken is None and muid is not None: params['muid'] = muid + elif lptoken is not None and muid is None: + params['lptoken'] = lptoken + elif lptoken is None and muid is None and self.lptoken is not None: + params['lptoken'] = self.lptoken + else: + raise AssertionError( + 'Either lptoken, self.lptoken or muid has to be passed. ' + 'Passing neither or both lptoken and muid is not allowed.', + ) params['hmac'] = signing.sign( secret=self.shared_secret,
We must only pass lptoken or muid to /access Only one of `lptoken` and `muid` is allowed to the API's `/access` calls. Not both.
laterpay/laterpay-client-python
diff --git a/tests/test_client.py b/tests/test_client.py index 7ffe43a..bc9e37f 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -326,7 +326,6 @@ class TestLaterPayClient(unittest.TestCase): data = client.get_access_data( ['article-1', 'article-2'], lptoken='fake-lptoken', - muid='some-user', ) self.assertEqual(data, { @@ -349,7 +348,7 @@ class TestLaterPayClient(unittest.TestCase): self.assertEqual(qd['cp'], ['fake-cp-key']) self.assertEqual(qd['article_id'], ['article-1', 'article-2']) self.assertEqual(qd['hmac'], ['fake-signature']) - self.assertEqual(qd['muid'], ['some-user']) + self.assertNotIn('muid', 'qd') sign_mock.assert_called_once_with( secret='fake-shared-secret', @@ -358,6 +357,70 @@ class TestLaterPayClient(unittest.TestCase): 'article_id': ['article-1', 'article-2'], 'ts': '123', 'lptoken': 'fake-lptoken', + }, + url='http://example.net/access', + method='GET', + ) + + @mock.patch('laterpay.signing.sign') + @mock.patch('time.time') + @responses.activate + def test_get_access_data_success_muid(self, time_time_mock, sign_mock): + time_time_mock.return_value = 123 + sign_mock.return_value = 'fake-signature' + responses.add( + responses.GET, + 'http://example.net/access', + body=json.dumps({ + "status": "ok", + "articles": { + "article-1": {"access": True}, + "article-2": {"access": False}, + }, + }), + status=200, + content_type='application/json', + ) + + client = LaterPayClient( + 'fake-cp-key', + 'fake-shared-secret', + api_root='http://example.net', + ) + + data = client.get_access_data( + ['article-1', 'article-2'], + muid='some-user', + ) + + self.assertEqual(data, { + "status": "ok", + "articles": { + "article-1": {"access": True}, + "article-2": {"access": False}, + }, + }) + self.assertEqual(len(responses.calls), 1) + + call = responses.calls[0] + + self.assertEqual(call.request.headers['X-LP-APIVersion'], '2') + + qd = parse_qs(urlparse(call.request.url).query) + + self.assertEqual(qd['ts'], ['123']) + self.assertEqual(qd['cp'], ['fake-cp-key']) + self.assertEqual(qd['article_id'], ['article-1', 'article-2']) + self.assertEqual(qd['hmac'], ['fake-signature']) + self.assertEqual(qd['muid'], ['some-user']) + self.assertNotIn('lptoken', 'qd') + + sign_mock.assert_called_once_with( + secret='fake-shared-secret', + params={ + 'cp': 'fake-cp-key', + 'article_id': ['article-1', 'article-2'], + 'ts': '123', 'muid': 'some-user', }, url='http://example.net/access', @@ -379,16 +442,31 @@ class TestLaterPayClient(unittest.TestCase): 'hmac': 'fake-signature', }) - params = self.lp.get_access_params('article-1', lptoken='fake-lptoken', muid='some-user') + params = self.lp.get_access_params('article-1', muid='some-user') self.assertEqual(params, { 'cp': '1', 'ts': '123', - 'lptoken': 'fake-lptoken', 'article_id': ['article-1'], 'hmac': 'fake-signature', 'muid': 'some-user', }) + lpclient = LaterPayClient('1', 'some-secret', lptoken='instance-lptoken') + params = lpclient.get_access_params('article-1') + self.assertEqual(params, { + 'cp': '1', + 'ts': '123', + 'lptoken': 'instance-lptoken', + 'article_id': ['article-1'], + 'hmac': 'fake-signature', + }) + + with self.assertRaises(AssertionError): + self.lp.get_access_params('article-1', lptoken='fake-lptoken', muid='some-user') + + with self.assertRaises(AssertionError): + self.lp.get_access_params('article-1') + @mock.patch('time.time') def test_get_gettoken_redirect(self, time_mock): time_mock.return_value = 12345678
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 2 }
5.3
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "flake8==2.6.0", "coverage==4.1", "pydocstyle==1.0.0", "furl==0.4.95", "mock==2.0.0", "responses==0.5.1", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "requirements-test.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
certifi==2025.1.31 charset-normalizer==3.4.1 cookies==2.2.1 coverage==4.1 exceptiongroup==1.2.2 flake8==2.6.0 furl==0.4.95 idna==3.10 iniconfig==2.1.0 -e git+https://github.com/laterpay/laterpay-client-python.git@397afe02a9ddec00096da24febb8f37d60658f26#egg=laterpay_client mccabe==0.5.3 mock==2.0.0 orderedmultidict==1.0.1 packaging==24.2 pbr==6.1.1 pluggy==1.5.0 pycodestyle==2.0.0 pydocstyle==1.0.0 pyflakes==1.2.3 PyJWT==2.10.1 pytest==8.3.5 requests==2.32.3 responses==0.5.1 six==1.17.0 tomli==2.2.1 urllib3==2.3.0
name: laterpay-client-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - certifi==2025.1.31 - charset-normalizer==3.4.1 - cookies==2.2.1 - coverage==4.1 - exceptiongroup==1.2.2 - flake8==2.6.0 - furl==0.4.95 - idna==3.10 - iniconfig==2.1.0 - mccabe==0.5.3 - mock==2.0.0 - orderedmultidict==1.0.1 - packaging==24.2 - pbr==6.1.1 - pluggy==1.5.0 - pycodestyle==2.0.0 - pydocstyle==1.0.0 - pyflakes==1.2.3 - pyjwt==2.10.1 - pytest==8.3.5 - requests==2.32.3 - responses==0.5.1 - six==1.17.0 - tomli==2.2.1 - urllib3==2.3.0 prefix: /opt/conda/envs/laterpay-client-python
[ "tests/test_client.py::TestLaterPayClient::test_get_access_data_success_muid", "tests/test_client.py::TestLaterPayClient::test_get_access_params" ]
[ "tests/test_client.py::TestLaterPayClient::test_get_manual_ident_token", "tests/test_client.py::TestLaterPayClient::test_get_manual_ident_token_muid", "tests/test_client.py::TestLaterPayClient::test_get_manual_ident_url" ]
[ "tests/test_client.py::TestItemDefinition::test_invalid_expiry", "tests/test_client.py::TestItemDefinition::test_invalid_period", "tests/test_client.py::TestItemDefinition::test_invalid_pricing", "tests/test_client.py::TestItemDefinition::test_invalid_sub_id", "tests/test_client.py::TestItemDefinition::test_item_definition", "tests/test_client.py::TestItemDefinition::test_sub_id", "tests/test_client.py::TestLaterPayClient::test_get_access_data_success", "tests/test_client.py::TestLaterPayClient::test_get_add_url", "tests/test_client.py::TestLaterPayClient::test_get_buy_url", "tests/test_client.py::TestLaterPayClient::test_get_controls_balance_url_all_defaults", "tests/test_client.py::TestLaterPayClient::test_get_controls_balance_url_all_set", "tests/test_client.py::TestLaterPayClient::test_get_controls_links_url_all_defaults", "tests/test_client.py::TestLaterPayClient::test_get_controls_links_url_all_set_long", "tests/test_client.py::TestLaterPayClient::test_get_controls_links_url_all_set_short", "tests/test_client.py::TestLaterPayClient::test_get_gettoken_redirect", "tests/test_client.py::TestLaterPayClient::test_get_login_dialog_url_with_use_dialog_api_false", "tests/test_client.py::TestLaterPayClient::test_get_logout_dialog_url_with_use_dialog_api_false", "tests/test_client.py::TestLaterPayClient::test_get_signup_dialog_url", "tests/test_client.py::TestLaterPayClient::test_get_subscribe_url", "tests/test_client.py::TestLaterPayClient::test_get_web_url_itemdefinition_value_none", "tests/test_client.py::TestLaterPayClient::test_has_token", "tests/test_client.py::TestLaterPayClient::test_web_url_consumable", "tests/test_client.py::TestLaterPayClient::test_web_url_dialog", "tests/test_client.py::TestLaterPayClient::test_web_url_failure_url", "tests/test_client.py::TestLaterPayClient::test_web_url_jsevents", "tests/test_client.py::TestLaterPayClient::test_web_url_muid", "tests/test_client.py::TestLaterPayClient::test_web_url_product_key", "tests/test_client.py::TestLaterPayClient::test_web_url_return_url", "tests/test_client.py::TestLaterPayClient::test_web_url_transaction_reference" ]
[]
MIT License
1,252
[ "laterpay/__init__.py", "CHANGELOG.md" ]
[ "laterpay/__init__.py", "CHANGELOG.md" ]
Azure__azure-cli-3354
4417fb03c91b0caa5f88a72ca0372d5931c072d9
2017-05-15 16:03:53
eb12ac454cbe1ddb59c86cdf2045e1912660e750
tjprescott: @yugangw-msft I agree. codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=h1) Report > Merging [#3354](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/4417fb03c91b0caa5f88a72ca0372d5931c072d9?src=pr&el=desc) will **decrease** coverage by `<.01%`. > The diff coverage is `71.42%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/3354/graphs/tree.svg?token=2pog0TKvF8&width=650&height=150&src=pr)](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #3354 +/- ## ========================================== - Coverage 70.66% 70.65% -0.01% ========================================== Files 391 391 Lines 25255 25259 +4 Branches 3835 3836 +1 ========================================== + Hits 17847 17848 +1 - Misses 6272 6274 +2 - Partials 1136 1137 +1 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...zure-cli-vm/azure/cli/command\_modules/vm/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktdm0vYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy92bS9jdXN0b20ucHk=) | `72.93% <71.42%> (-0.21%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=footer). Last update [4417fb0...ef65f19](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). tjprescott: @yugangw-msft I made the change you suggested.
diff --git a/appveyor.yml b/appveyor.yml index a3b8e2a82..23c0de8d3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ environment: install: - SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% - python scripts/dev_setup.py - - python -m pip install sphinx + - python -m pip install sphinx==1.5.6 build_script: - ps: | diff --git a/azure-cli.pyproj b/azure-cli.pyproj index a4caa6f17..5316ef474 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -946,7 +946,6 @@ <Folder Include="command_modules\azure-cli-vm\azure\cli\" /> <Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\" /> <Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\" /> - <Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\" /> <Folder Include="command_modules\azure-cli-vm\tests\" /> <Folder Include="command_modules\azure-cli-vm\tests\keyvault\" /> <Folder Include="command_modules\azure-cli-dls\" /> diff --git a/src/command_modules/azure-cli-vm/HISTORY.rst b/src/command_modules/azure-cli-vm/HISTORY.rst index 50d71c09c..d9a31bfac 100644 --- a/src/command_modules/azure-cli-vm/HISTORY.rst +++ b/src/command_modules/azure-cli-vm/HISTORY.rst @@ -6,6 +6,7 @@ unreleased * diagnostics: Fix incorrect Linux diagnostics default config with update for LAD v.3.0 extension * disk: support cross subscription blob import * vm: support license type on create +* BC: vm open-port: command always returns the NSG. Previously it returned the NIC or Subnet. 2.0.6 (2017-05-09) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py index 5c48d6656..3e07efc92 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py @@ -1177,6 +1177,7 @@ def vm_open_port(resource_group_name, vm_name, port, priority=900, network_secur raise CLIError("No NIC associated with VM '{}'".format(vm_name)) # get existing NSG or create a new one + created_nsg = False nic = network.network_interfaces.get(resource_group_name, os.path.split(nic_ids[0].id)[1]) if not apply_to_subnet: nsg = nic.network_security_group @@ -1197,6 +1198,7 @@ def vm_open_port(resource_group_name, vm_name, port, priority=900, network_secur parameters=NetworkSecurityGroup(location=location) ) ) + created_nsg = True # update the NSG with the new rule to allow inbound traffic SecurityRule = get_sdk(ResourceType.MGMT_NETWORK, 'SecurityRule', mod='models') @@ -1210,23 +1212,21 @@ def vm_open_port(resource_group_name, vm_name, port, priority=900, network_secur resource_group_name, nsg_name, rule_name, rule) ) - # update the NIC or subnet - if not apply_to_subnet: + # update the NIC or subnet if a new NSG was created + if created_nsg and not apply_to_subnet: nic.network_security_group = nsg - return LongRunningOperation('Updating NIC')( - network.network_interfaces.create_or_update( - resource_group_name, nic.name, nic) - ) - else: + LongRunningOperation('Updating NIC')(network.network_interfaces.create_or_update( + resource_group_name, nic.name, nic)) + elif created_nsg and apply_to_subnet: subnet.network_security_group = nsg - return LongRunningOperation('Updating subnet')( - network.subnets.create_or_update( - resource_group_name=resource_group_name, - virtual_network_name=subnet_id['name'], - subnet_name=subnet_id['child_name'], - subnet_parameters=subnet - ) - ) + LongRunningOperation('Updating subnet')(network.subnets.create_or_update( + resource_group_name=resource_group_name, + virtual_network_name=subnet_id['name'], + subnet_name=subnet_id['child_name'], + subnet_parameters=subnet + )) + + return network.network_security_groups.get(resource_group_name, nsg_name) def _build_nic_list(nic_ids):
az vm open-port returns error but executes successfully ### Description az vm open-port returns an error but executes successfully Example: PS C:\Users\larry> az vm open-port -g JUMPBOXRG -n jumpbox --port 80 --priority 500 Operation failed with status: 'Not Found'. Details: 404 Client Error: Not Found for url: https://management.azure.com/subscriptions/5ba80c27-8c76-[***]/providers/Microsoft.Network/locations/eastus/operations/5c5fa1c7-3e4a-4dd3-[***]?api-version=2017-03-01 Error occurs on Windows & Linux --- ### Environment summary **Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly) Windows: pip. Linux: apt-get **CLI Version:** What version of the CLI and modules are installed? (Use `az --version`) 2.0.6 **OS Version:** What OS and version are you using? Windows 10, Ubuntu 17.04 **Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows) Powershell, Bash
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml b/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml index 0aa74e003..df0308bf4 100644 --- a/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml +++ b/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml @@ -6,23 +6,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - computemanagementclient/0.33.1rc1 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [8b0d4f74-1697-11e7-9a38-f4b7e2e85440] + x-ms-client-request-id: [0fb8f1a8-3a91-11e7-b05a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"5075a256-2327-4846-b023-231e045604b5\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b8d1de5a-64b6-4f37-bdd3-0fd302008576\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_3bihPHQTJ0\",\r\n \"createOption\": \"FromImage\"\ + \ \"name\": \"osdisk_YXbKt2a4DE\",\r\n \"createOption\": \"FromImage\"\ ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_3bihPHQTJ0\"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_YXbKt2a4DE\"\ \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ ,\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -36,7 +37,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:56:18 GMT'] + Date: ['Tue, 16 May 2017 23:40:36 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -52,20 +53,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [8b345bb4-1697-11e7-9c1d-f4b7e2e85440] + x-ms-client-request-id: [0fdcf78a-3a91-11e7-b103-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"etag\": \"W/\\\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\",\r\n \ \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"acf9de26-2136-403a-8429-12c3eaa63554\"\ ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ - ,\r\n \"etag\": \"W/\\\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\\\"\"\ + ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -74,8 +76,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"dpfibvfzyeaejlgmx3vt4p22cc.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-30-5C-3C\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -85,8 +87,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:56:18 GMT'] - ETag: [W/"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b"] + Date: ['Tue, 16 May 2017 23:40:36 GMT'] + ETag: [W/"467e1f68-631a-4a50-9a85-7f0893f75459"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -96,41 +98,42 @@ interactions: content-length: ['2189'] status: {code: 200, message: OK} - request: - body: '{"properties": {"destinationPortRange": "*", "sourcePortRange": "*", "protocol": - "*", "access": "allow", "destinationAddressPrefix": "*", "priority": 900, "sourceAddressPrefix": - "*", "direction": "inbound"}, "name": "open-port-all"}' + body: '{"name": "open-port-all", "properties": {"sourceAddressPrefix": "*", "direction": + "inbound", "priority": 900, "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": + "*", "access": "allow", "sourcePortRange": "*"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['232'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [8b5bde98-1697-11e7-9144-f4b7e2e85440] + x-ms-client-request-id: [101557dc-3a91-11e7-af60-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\ - ,\r\n \"etag\": \"W/\\\"78ec4e59-badc-48a2-a4e8-9645691d75bb\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"4432927e-5f08-4b52-ab69-d46c6dfebee0\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\ protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ : \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 900,\r\n \"\ direction\": \"Inbound\"\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/a223ce3a-20ce-4309-9092-7cd0c0a84eaf?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/49f2734e-6fc7-4471-84c1-3f0de0678807?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Length: ['570'] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:56:18 GMT'] + Date: ['Tue, 16 May 2017 23:40:37 GMT'] Expires: ['-1'] Pragma: [no-cache] Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 201, message: Created} - request: body: null @@ -139,18 +142,19 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [8b5bde98-1697-11e7-9144-f4b7e2e85440] + x-ms-client-request-id: [101557dc-3a91-11e7-af60-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/a223ce3a-20ce-4309-9092-7cd0c0a84eaf?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/49f2734e-6fc7-4471-84c1-3f0de0678807?api-version=2017-03-01 response: body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:56:29 GMT'] + Date: ['Tue, 16 May 2017 23:40:47 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -166,15 +170,16 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [8b5bde98-1697-11e7-9144-f4b7e2e85440] + x-ms-client-request-id: [101557dc-3a91-11e7-af60-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ @@ -183,8 +188,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:56:29 GMT'] - ETag: [W/"35b90cac-1fef-48fd-901c-d0f80a58ba43"] + Date: ['Tue, 16 May 2017 23:40:48 GMT'] + ETag: [W/"b5a3dd59-d43b-4102-9161-9cf9edf79734"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -193,71 +198,6 @@ interactions: Vary: [Accept-Encoding] content-length: ['571'] status: {code: 200, message: OK} -- request: - body: '{"etag": "W/\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic", - "properties": {"macAddress": "00-0D-3A-36-F9-C9", "enableIPForwarding": false, - "virtualMachine": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1"}, - "ipConfigurations": [{"etag": "W/\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\"", - "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1", - "properties": {"subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet"}, - "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"}, - "privateIPAddress": "10.0.0.4", "privateIPAllocationMethod": "Dynamic", "primary": - true, "provisioningState": "Succeeded", "privateIPAddressVersion": "IPv4"}, - "name": "ipconfigvm1"}], "provisioningState": "Succeeded", "resourceGuid": "a841d97c-9eed-4000-bef6-05ba81198e68", - "primary": true, "networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}, - "enableAcceleratedNetworking": false, "dnsSettings": {"internalDomainNameSuffix": - "yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net", "dnsServers": [], "appliedDnsServers": - []}}, "tags": {}, "location": "westus"}' - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['1788'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] - accept-language: [en-US] - x-ms-client-request-id: [9283a5fa-1697-11e7-8767-f4b7e2e85440] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 - response: - body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\",\r\n \ - \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\ - ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ - ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ - ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ - ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ - : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ - \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ - \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ - : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ - \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\ - : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ - : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1\"\ - \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ - \n}"} - headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/bfe5fff4-9760-4e4d-876f-4281ec837b72?api-version=2017-03-01'] - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:56:31 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['2189'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] - status: {code: 200, message: OK} - request: body: null headers: @@ -265,75 +205,106 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [9283a5fa-1697-11e7-8767-f4b7e2e85440] + x-ms-client-request-id: [173d4736-3a91-11e7-8990-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/bfe5fff4-9760-4e4d-876f-4281ec837b72?api-version=2017-03-01 - response: - body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} - headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:01 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['29'] - status: {code: 200, message: OK} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] - accept-language: [en-US] - x-ms-client-request-id: [9283a5fa-1697-11e7-8767-f4b7e2e85440] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\",\r\n \ - \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\ - ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ - ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ - ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\"\ + body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\",\r\n \ + \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"06d0b2ae-cf07-4f71-9961-a6d1f2d0560d\"\ + ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ - ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ - : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ - \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ - \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ - : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ - \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\ - : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ - : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1\"\ - \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ - \n}"} + ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\ + *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Allow\",\r\n \"priority\": 1000,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ + open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Allow\",\r\n \"priority\": 900,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ + : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ + \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ + \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ + \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ + \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ + \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ + AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ + \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ + : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ + \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \ + \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ + \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ + \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ + \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ + \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ + : \"Outbound\"\r\n }\r\n }\r\n ],\r\n \"networkInterfaces\"\ + : [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + \r\n }\r\n ]\r\n }\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:01 GMT'] - ETag: [W/"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d"] + Date: ['Tue, 16 May 2017 23:40:48 GMT'] + ETag: [W/"b5a3dd59-d43b-4102-9161-9cf9edf79734"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2189'] + content-length: ['6735'] status: {code: 200, message: OK} - request: body: null @@ -342,21 +313,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a61e706e-1697-11e7-b60e-f4b7e2e85440] + x-ms-client-request-id: [177a9bbe-3a91-11e7-a894-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"e1a9a417-53a8-4b13-af8d-d5f60e85669a\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"06d0b2ae-cf07-4f71-9961-a6d1f2d0560d\"\ ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\ *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\ @@ -364,7 +336,7 @@ interactions: access\": \"Allow\",\r\n \"priority\": 1000,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ @@ -373,7 +345,7 @@ interactions: : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -383,7 +355,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -392,7 +364,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -401,7 +373,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -410,7 +382,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -419,7 +391,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -432,8 +404,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:03 GMT'] - ETag: [W/"35b90cac-1fef-48fd-901c-d0f80a58ba43"] + Date: ['Tue, 16 May 2017 23:40:49 GMT'] + ETag: [W/"b5a3dd59-d43b-4102-9161-9cf9edf79734"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -449,23 +421,24 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - computemanagementclient/0.33.1rc1 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a6dc6c08-1697-11e7-8dd1-f4b7e2e85440] + x-ms-client-request-id: [17a1289a-3a91-11e7-9813-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"5075a256-2327-4846-b023-231e045604b5\"\ + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b8d1de5a-64b6-4f37-bdd3-0fd302008576\"\ ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ ,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\ \n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_3bihPHQTJ0\",\r\n \"createOption\": \"FromImage\"\ + \ \"name\": \"osdisk_YXbKt2a4DE\",\r\n \"createOption\": \"FromImage\"\ ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_3bihPHQTJ0\"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_YXbKt2a4DE\"\ \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ ,\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\ @@ -479,7 +452,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:05 GMT'] + Date: ['Tue, 16 May 2017 23:40:49 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -495,20 +468,21 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a709bdd2-1697-11e7-b314-f4b7e2e85440] + x-ms-client-request-id: [17c33206-3a91-11e7-a030-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\",\r\n \ \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"acf9de26-2136-403a-8429-12c3eaa63554\"\ ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ - ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\"\ + ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ @@ -517,8 +491,8 @@ interactions: \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\ + internalDomainNameSuffix\": \"dpfibvfzyeaejlgmx3vt4p22cc.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-30-5C-3C\",\r\n \"enableAcceleratedNetworking\"\ : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ @@ -528,8 +502,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:05 GMT'] - ETag: [W/"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d"] + Date: ['Tue, 16 May 2017 23:40:49 GMT'] + ETag: [W/"467e1f68-631a-4a50-9a85-7f0893f75459"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -545,15 +519,16 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a72f21a8-1697-11e7-97c5-f4b7e2e85440] + x-ms-client-request-id: [17efc81a-3a91-11e7-87e9-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - ,\r\n \"etag\": \"W/\\\"3d59c338-7994-44e4-8d70-2fa4e0ecfdeb\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"f459dd81-724d-4c66-b439-6cfe004dd253\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ addressPrefix\": \"10.0.0.0/24\",\r\n \"ipConfigurations\": [\r\n \ \ {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ @@ -561,8 +536,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:05 GMT'] - ETag: [W/"3d59c338-7994-44e4-8d70-2fa4e0ecfdeb"] + Date: ['Tue, 16 May 2017 23:40:49 GMT'] + ETag: [W/"f459dd81-724d-4c66-b439-6cfe004dd253"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -579,21 +554,22 @@ interactions: Connection: [keep-alive] Content-Length: ['22'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a7573208-1697-11e7-bb17-f4b7e2e85440] + x-ms-client-request-id: [18173da4-3a91-11e7-bfea-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ - ,\r\n \"resourceGuid\": \"2b91219b-09b1-428a-b93c-49083df6ba8f\",\r\n \ + ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \ \ \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n {\r\ \n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -603,7 +579,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -612,7 +588,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -621,7 +597,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -630,7 +606,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -639,7 +615,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\ + ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -648,17 +624,17 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Outbound\"\r\n }\r\n }\r\n ]\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/360caa80-6fa6-42e9-9c90-8cba9d9e18e5?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/fe380d2b-71a6-4500-9f37-fb8df9299b7b?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Length: ['5138'] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:06 GMT'] + Date: ['Tue, 16 May 2017 23:40:50 GMT'] Expires: ['-1'] Pragma: [no-cache] Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 201, message: Created} - request: body: null @@ -667,18 +643,19 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a7573208-1697-11e7-bb17-f4b7e2e85440] + x-ms-client-request-id: [18173da4-3a91-11e7-bfea-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/360caa80-6fa6-42e9-9c90-8cba9d9e18e5?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/fe380d2b-71a6-4500-9f37-fb8df9299b7b?api-version=2017-03-01 response: body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:17 GMT'] + Date: ['Tue, 16 May 2017 23:41:00 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -694,21 +671,22 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a7573208-1697-11e7-bb17-f4b7e2e85440] + x-ms-client-request-id: [18173da4-3a91-11e7-bfea-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ - ,\r\n \"resourceGuid\": \"2b91219b-09b1-428a-b93c-49083df6ba8f\",\r\n \ + ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \ \ \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n {\r\ \n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -718,7 +696,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -727,7 +705,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -736,7 +714,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -745,7 +723,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -754,7 +732,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\ + ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -765,8 +743,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:17 GMT'] - ETag: [W/"a89b28c2-a57e-49e9-845d-3cdf498d5777"] + Date: ['Tue, 16 May 2017 23:41:01 GMT'] + ETag: [W/"d8504aba-c21f-422d-ab19-c595af79b03e"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -776,41 +754,42 @@ interactions: content-length: ['5145'] status: {code: 200, message: OK} - request: - body: '{"properties": {"destinationPortRange": "*", "sourcePortRange": "*", "protocol": - "*", "access": "allow", "destinationAddressPrefix": "*", "priority": 900, "sourceAddressPrefix": - "*", "direction": "inbound"}, "name": "open-port-all"}' + body: '{"name": "open-port-all", "properties": {"sourceAddressPrefix": "*", "direction": + "inbound", "priority": 900, "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": + "*", "access": "allow", "sourcePortRange": "*"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['232'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af17e3ba-1697-11e7-abf2-f4b7e2e85440] + x-ms-client-request-id: [1f3f0f50-3a91-11e7-8863-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\ - ,\r\n \"etag\": \"W/\\\"9b8c6e07-b5d1-4234-8c5e-d5c4f03a734b\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"0be30305-b192-4910-9c71-632a08861433\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\ protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ : \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 900,\r\n \"\ direction\": \"Inbound\"\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/364634b9-909f-4cd2-816a-dd5bec8bb6ae?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/f00ef70d-073b-448c-86c2-4422acef345e?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Length: ['570'] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:18 GMT'] + Date: ['Tue, 16 May 2017 23:41:02 GMT'] Expires: ['-1'] Pragma: [no-cache] Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 201, message: Created} - request: body: null @@ -819,18 +798,19 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af17e3ba-1697-11e7-abf2-f4b7e2e85440] + x-ms-client-request-id: [1f3f0f50-3a91-11e7-8863-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/364634b9-909f-4cd2-816a-dd5bec8bb6ae?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/f00ef70d-073b-448c-86c2-4422acef345e?api-version=2017-03-01 response: body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:29 GMT'] + Date: ['Tue, 16 May 2017 23:41:13 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -846,15 +826,16 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af17e3ba-1697-11e7-abf2-f4b7e2e85440] + x-ms-client-request-id: [1f3f0f50-3a91-11e7-8863-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\ - ,\r\n \"etag\": \"W/\\\"3180cf40-8b1d-454c-becc-3ae196aecae0\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"f26b729e-2bbc-4236-9d9c-dc34973b52e7\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ @@ -863,8 +844,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:29 GMT'] - ETag: [W/"3180cf40-8b1d-454c-becc-3ae196aecae0"] + Date: ['Tue, 16 May 2017 23:41:13 GMT'] + ETag: [W/"f26b729e-2bbc-4236-9d9c-dc34973b52e7"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -874,60 +855,63 @@ interactions: content-length: ['571'] status: {code: 200, message: OK} - request: - body: '{"etag": "W/\"3d59c338-7994-44e4-8d70-2fa4e0ecfdeb\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet", - "properties": {"addressPrefix": "10.0.0.0/24", "networkSecurityGroup": {"etag": - "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg", - "properties": {"resourceGuid": "2b91219b-09b1-428a-b93c-49083df6ba8f", "securityRules": - [], "defaultSecurityRules": [{"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", + body: '{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet", + "etag": "W/\"f459dd81-724d-4c66-b439-6cfe004dd253\"", "properties": {"provisioningState": + "Succeeded", "addressPrefix": "10.0.0.0/24", "networkSecurityGroup": {"id": + "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg", + "etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "properties": {"securityRules": + [], "provisioningState": "Succeeded", "defaultSecurityRules": [{"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound", - "properties": {"destinationPortRange": "*", "description": "Allow inbound traffic - from all VMs in VNET", "direction": "Inbound", "protocol": "*", "access": "Allow", - "destinationAddressPrefix": "VirtualNetwork", "priority": 65000, "sourceAddressPrefix": - "VirtualNetwork", "provisioningState": "Succeeded", "sourcePortRange": "*"}, - "name": "AllowVnetInBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", + "name": "AllowVnetInBound", "properties": {"sourceAddressPrefix": "VirtualNetwork", + "direction": "Inbound", "priority": 65000, "provisioningState": "Succeeded", + "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", "sourcePortRange": "*", "description": "Allow inbound traffic + from all VMs in VNET"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound", - "properties": {"destinationPortRange": "*", "description": "Allow inbound traffic - from azure load balancer", "direction": "Inbound", "protocol": "*", "access": - "Allow", "destinationAddressPrefix": "*", "priority": 65001, "sourceAddressPrefix": - "AzureLoadBalancer", "provisioningState": "Succeeded", "sourcePortRange": "*"}, - "name": "AllowAzureLoadBalancerInBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", + "name": "AllowAzureLoadBalancerInBound", "properties": {"sourceAddressPrefix": + "AzureLoadBalancer", "direction": "Inbound", "priority": 65001, "provisioningState": + "Succeeded", "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": + "*", "access": "Allow", "sourcePortRange": "*", "description": "Allow inbound + traffic from azure load balancer"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound", - "properties": {"destinationPortRange": "*", "description": "Deny all inbound - traffic", "direction": "Inbound", "protocol": "*", "access": "Deny", "destinationAddressPrefix": - "*", "priority": 65500, "sourceAddressPrefix": "*", "provisioningState": "Succeeded", - "sourcePortRange": "*"}, "name": "DenyAllInBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", + "name": "DenyAllInBound", "properties": {"sourceAddressPrefix": "*", "direction": + "Inbound", "priority": 65500, "provisioningState": "Succeeded", "destinationPortRange": + "*", "protocol": "*", "destinationAddressPrefix": "*", "access": "Deny", "sourcePortRange": + "*", "description": "Deny all inbound traffic"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound", - "properties": {"destinationPortRange": "*", "description": "Allow outbound traffic - from all VMs to all VMs in VNET", "direction": "Outbound", "protocol": "*", - "access": "Allow", "destinationAddressPrefix": "VirtualNetwork", "priority": - 65000, "sourceAddressPrefix": "VirtualNetwork", "provisioningState": "Succeeded", - "sourcePortRange": "*"}, "name": "AllowVnetOutBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", + "name": "AllowVnetOutBound", "properties": {"sourceAddressPrefix": "VirtualNetwork", + "direction": "Outbound", "priority": 65000, "provisioningState": "Succeeded", + "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", "sourcePortRange": "*", "description": "Allow outbound traffic + from all VMs to all VMs in VNET"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound", - "properties": {"destinationPortRange": "*", "description": "Allow outbound traffic - from all VMs to Internet", "direction": "Outbound", "protocol": "*", "access": - "Allow", "destinationAddressPrefix": "Internet", "priority": 65001, "sourceAddressPrefix": - "*", "provisioningState": "Succeeded", "sourcePortRange": "*"}, "name": "AllowInternetOutBound"}, - {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound", - "properties": {"destinationPortRange": "*", "description": "Deny all outbound - traffic", "direction": "Outbound", "protocol": "*", "access": "Deny", "destinationAddressPrefix": - "*", "priority": 65500, "sourceAddressPrefix": "*", "provisioningState": "Succeeded", - "sourcePortRange": "*"}, "name": "DenyAllOutBound"}], "provisioningState": "Succeeded"}, - "location": "westus"}, "provisioningState": "Succeeded"}, "name": "vm1Subnet"}' + "name": "AllowInternetOutBound", "properties": {"sourceAddressPrefix": "*", + "direction": "Outbound", "priority": 65001, "provisioningState": "Succeeded", + "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": "Internet", + "access": "Allow", "sourcePortRange": "*", "description": "Allow outbound traffic + from all VMs to Internet"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", + "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound", + "name": "DenyAllOutBound", "properties": {"sourceAddressPrefix": "*", "direction": + "Outbound", "priority": 65500, "provisioningState": "Succeeded", "destinationPortRange": + "*", "protocol": "*", "destinationAddressPrefix": "*", "access": "Deny", "sourcePortRange": + "*", "description": "Deny all outbound traffic"}}], "resourceGuid": "83ba7695-815c-4917-815e-234b1c1ea744"}, + "location": "westus"}}, "name": "vm1Subnet"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['4339'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b63ffeec-1697-11e7-8f60-f4b7e2e85440] + x-ms-client-request-id: [26673678-3a91-11e7-afe4-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - ,\r\n \"etag\": \"W/\\\"32c1cb2b-991e-4536-8e5b-53c411b9c1e3\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"4b1faf1a-281a-4eb0-8225-5c85f49f8ed9\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\ addressPrefix\": \"10.0.0.0/24\",\r\n \"networkSecurityGroup\": {\r\n \ \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\ @@ -935,10 +919,10 @@ interactions: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ \r\n }\r\n ]\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/c401ae58-d935-4c57-88fb-9d74e801f0d4?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/7780cb3c-66c8-45b8-9076-1b7ec01060c7?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:31 GMT'] + Date: ['Tue, 16 May 2017 23:41:14 GMT'] Expires: ['-1'] Pragma: [no-cache] Retry-After: ['3'] @@ -947,7 +931,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['806'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -956,18 +940,19 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b63ffeec-1697-11e7-8f60-f4b7e2e85440] + x-ms-client-request-id: [26673678-3a91-11e7-afe4-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/c401ae58-d935-4c57-88fb-9d74e801f0d4?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/7780cb3c-66c8-45b8-9076-1b7ec01060c7?api-version=2017-03-01 response: body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:34 GMT'] + Date: ['Tue, 16 May 2017 23:41:18 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -983,15 +968,16 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b63ffeec-1697-11e7-8f60-f4b7e2e85440] + x-ms-client-request-id: [26673678-3a91-11e7-afe4-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - ,\r\n \"etag\": \"W/\\\"63ff1aae-705e-4b66-a59d-6360a593c7ef\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"fd8c47c9-4595-4936-876b-68369f62ed80\\\"\",\r\n \ \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ addressPrefix\": \"10.0.0.0/24\",\r\n \"networkSecurityGroup\": {\r\n \ \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\ @@ -1001,8 +987,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:35 GMT'] - ETag: [W/"63ff1aae-705e-4b66-a59d-6360a593c7ef"] + Date: ['Tue, 16 May 2017 23:41:18 GMT'] + ETag: [W/"fd8c47c9-4595-4936-876b-68369f62ed80"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -1018,21 +1004,122 @@ interactions: Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7 - networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [29636d2e-3a91-11e7-b928-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01 + response: + body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\",\r\n \ + \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \ + \ \"securityRules\": [\r\n {\r\n \"name\": \"open-port-all\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Allow\",\r\n \"priority\": 900,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ + : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ + \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ + \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ + \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ + \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ + \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ + AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ + \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ + : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ + \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ + ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \ + \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ + \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ + \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ + \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ + \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ + : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\ + access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ + : \"Outbound\"\r\n }\r\n }\r\n ],\r\n \"subnets\": [\r\n\ + \ {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ + \r\n }\r\n ]\r\n }\r\n}"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Tue, 16 May 2017 23:41:18 GMT'] + ETag: [W/"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['6043'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b9ddd81e-1697-11e7-a9bc-f4b7e2e85440] + x-ms-client-request-id: [298021f4-3a91-11e7-9cf2-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ - ,\r\n \"resourceGuid\": \"2b91219b-09b1-428a-b93c-49083df6ba8f\",\r\n \ + ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \ \ \"securityRules\": [\r\n {\r\n \"name\": \"open-port-all\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\ @@ -1041,7 +1128,7 @@ interactions: : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1051,7 +1138,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1060,7 +1147,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1069,7 +1156,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -1078,7 +1165,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -1087,7 +1174,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\ + ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -1100,8 +1187,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Sat, 01 Apr 2017 04:57:37 GMT'] - ETag: [W/"caf86478-953e-48b0-a2db-a0548c82b687"] + Date: ['Tue, 16 May 2017 23:41:19 GMT'] + ETag: [W/"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] diff --git a/src/command_modules/azure-cli-vm/tests/test_vm_commands.py b/src/command_modules/azure-cli-vm/tests/test_vm_commands.py index 04b61dfbe..0040ba3f0 100644 --- a/src/command_modules/azure-cli-vm/tests/test_vm_commands.py +++ b/src/command_modules/azure-cli-vm/tests/test_vm_commands.py @@ -95,7 +95,7 @@ class VMOpenPortTest(ResourceGroupVCRTestBase): vm = self.vm_name # min params - apply to existing NIC (updates existing NSG) - nsg_id = self.cmd('vm open-port -g {} -n {} --port * --priority 900'.format(rg, vm))['networkSecurityGroup']['id'] + nsg_id = self.cmd('vm open-port -g {} -n {} --port * --priority 900'.format(rg, vm))['id'] nsg_name = os.path.split(nsg_id)[1] self.cmd('network nsg show -g {} -n {}'.format(rg, nsg_name), checks=JMESPathCheck("length(securityRules[?name == 'open-port-all'])", 1))
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 4 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.1 -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cdn&subdirectory=src/command_modules/azure-cli-cdn -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cosmosdb&subdirectory=src/command_modules/azure-cli-cosmosdb -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_interactive&subdirectory=src/command_modules/azure-cli-interactive -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_rdbms&subdirectory=src/command_modules/azure-cli-rdbms -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_sf&subdirectory=src/command_modules/azure-cli-sf -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.9 azure-graphrbac==0.30.0rc6 azure-keyvault==0.3.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.1 azure-mgmt-cdn==0.30.2 azure-mgmt-cognitiveservices==1.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-containerregistry==0.2.1 azure-mgmt-datalake-analytics==0.1.4 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.4 azure-mgmt-devtestlabs==2.0.0 azure-mgmt-dns==1.0.1 azure-mgmt-documentdb==0.1.3 azure-mgmt-iothub==0.2.2 azure-mgmt-keyvault==0.31.0 azure-mgmt-monitor==0.2.1 azure-mgmt-network==1.0.0rc3 azure-mgmt-nspkg==1.0.0 azure-mgmt-rdbms==0.1.0 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.1.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0 azure-mgmt-web==0.32.0 azure-monitor==0.3.0 azure-multiapi-storage==0.1.0 azure-nspkg==1.0.0 azure-servicefabric==5.6.130 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 prompt-toolkit==3.0.36 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pydocumentdb==2.3.5 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.7 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 vsts-cd-manager==1.0.2 wcwidth==0.2.13 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.1 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.9 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.3.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.1 - azure-mgmt-cdn==0.30.2 - azure-mgmt-cognitiveservices==1.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-containerregistry==0.2.1 - azure-mgmt-datalake-analytics==0.1.4 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.4 - azure-mgmt-devtestlabs==2.0.0 - azure-mgmt-dns==1.0.1 - azure-mgmt-documentdb==0.1.3 - azure-mgmt-iothub==0.2.2 - azure-mgmt-keyvault==0.31.0 - azure-mgmt-monitor==0.2.1 - azure-mgmt-network==1.0.0rc3 - azure-mgmt-nspkg==1.0.0 - azure-mgmt-rdbms==0.1.0 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.1.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0 - azure-mgmt-web==0.32.0 - azure-monitor==0.3.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==1.0.0 - azure-servicefabric==5.6.130 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pydocumentdb==2.3.5 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.7 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - vsts-cd-manager==1.0.2 - wcwidth==0.2.13 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMOpenPortTest::test_vm_open_port" ]
[ "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateLinuxSecretsScenarioTest::test_vm_create_linux_secrets", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateWindowsSecretsScenarioTest::test_vm_create_windows_secrets", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateLinuxSecretsScenarioTest::test_vmss_create_linux_secrets" ]
[ "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMUsageScenarioTest::test_vm_usage", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListThruServiceScenarioTest::test_vm_images_list_thru_services", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMShowListSizesListIPAddressesScenarioTest::test_vm_show_list_sizes_list_ip_addresses", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSizeListScenarioTest::test_vm_size_list", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListOffersScenarioTest::test_vm_image_list_offers", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListPublishersScenarioTest::test_vm_image_list_publishers", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListSkusScenarioTest::test_vm_image_list_skus", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageShowScenarioTest::test_vm_image_show", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMGeneralizeScenarioTest::test_vm_generalize", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMWindowsLicenseTest::test_windows_vm_license_type", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateFromUnmanagedDiskTest::test_vm_create_from_unmanaged_disk", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateWithSpecializedUnmanagedDiskTest::test_vm_create_with_specialized_unmanaged_disk", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMManagedDiskScenarioTest::test_managed_disk", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateAndStateModificationsScenarioTest::test_vm_create_state_modifications", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMNoWaitScenarioTest::test_vm_create_no_wait", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMAvailSetScenarioTest::test_vm_availset", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMExtensionScenarioTest::test_vm_extension", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMMachineExtensionImageScenarioTest::test_vm_machine_extension_image", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMExtensionImageSearchScenarioTest::test_vm_extension_image_search", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateUbuntuScenarioTest::test_vm_create_ubuntu", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMMultiNicScenarioTest::test_vm_create_multi_nics", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateNoneOptionsTest::test_vm_create_none_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMBootDiagnostics::test_vm_boot_diagnostics", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSExtensionInstallTest::test_vmss_extension", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::DiagnosticsExtensionInstallTest::test_diagnostics_extension_install", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateExistingOptions::test_vm_create_existing_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateExistingIdsOptions::test_vm_create_existing_ids_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateCustomIP::test_vm_create_custom_ip", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMDiskAttachDetachTest::test_vm_disk_attach_detach", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMUnmanagedDataDiskTest::test_vm_data_unmanaged_disk", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateCustomDataScenarioTest::test_vm_create_custom_data", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateAndModify::test_vmss_create_and_modify", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateOptions::test_vmss_create_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateNoneOptionsTest::test_vmss_create_none_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateExistingOptions::test_vmss_create_existing_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateExistingIdsOptions::test_vmss_create_existing_ids_options", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSVMsScenarioTest::test_vmss_vms", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCustomDataScenarioTest::test_vmss_create_custom_data", "src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSNicScenarioTest::test_vmss_nics" ]
[]
MIT License
1,253
[ "azure-cli.pyproj", "appveyor.yml", "src/command_modules/azure-cli-vm/HISTORY.rst", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py" ]
[ "azure-cli.pyproj", "appveyor.yml", "src/command_modules/azure-cli-vm/HISTORY.rst", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py" ]
GoogleCloudPlatform__httplib2shim-9
128d229807577809a437cd20161c3c496080991f
2017-05-16 16:17:57
ee8afd6b27bd80701465a03c072b01adb1b7437a
googlebot: Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). :memo: **Please visit <https://cla.developers.google.com/> to sign.** Once you've signed, please reply here (e.g. `I signed it!`) and we'll verify. Thanks. --- - If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/). - If you signed the CLA as a corporation, please let us know the company's name. <!-- need_sender_cla --> xmedeko: I signed it! googlebot: CLAs look good, thanks! <!-- ok --> coveralls: [![Coverage Status](https://coveralls.io/builds/11551076/badge)](https://coveralls.io/builds/11551076) Coverage increased (+0.08%) to 52.904% when pulling **ab4448b6168073bc916a0c0464c85dc42af72521 on xmedeko:master** into **128d229807577809a437cd20161c3c496080991f on GoogleCloudPlatform:master**. xmedeko: @jonparrott thanks for the review. For the `proxy_info` see the Http doc: ``` `proxy_info` may be: - a callable that takes the http scheme ('http' or 'https') and returns a ProxyInfo instance per request. - a ProxyInfo instance (static proxy config). - None (proxy disabled). ``` I just add that the callable returns `None` when no proxy is configured (the usual case). To be perfect compatible with the `httplib2` the `_default_make_pool` should check if it's callable or not. But I assume this is a temporary transition library so we do not be perfect - a user may simply do a lambda expression. In regards of doc, I would rather step back and remove the doc if you do not like it. It may be added in the separate commit. Because: - I do not use Google docstring style -> mistakes. - I am not a native speaker ->mistakes. - IMO doc for the private `_default_make_pool` is not necessary, better to make doc for the public `Http.__init__` - but do we have to copy the super class doc? I do not know. - It's not documented know and this commit is not commit to fix the doc. cwt: @xmedeko It was my false that I didn't test all possible cases of the variable `proxy_info`. There should be a scenario that the proxy environment already set, but we want to disable it manually in the code (`proxy_info=None`). jonparrott: It seems to me that we want is: ```python import collections if isinstance(proxy_info, collections.Callable): proxy_info = proxy_info() if proxy_info: ... ``` > In regards of doc, I would rather step back and remove the doc if you do not like it. It may be added in the separate commit. I'm happy to write the docstring for you. :) I just need to understand the change first. xmedeko: Great! Now the `proxy_info` param is backward compatible, so the doc is not necessary :-) I've amended the commit and added a simple unit test, too. coveralls: [![Coverage Status](https://coveralls.io/builds/11578406/badge)](https://coveralls.io/builds/11578406) Coverage increased (+1.02%) to 53.839% when pulling **0933c31513effb84194f7ff56cd923bac38189ce on xmedeko:master** into **128d229807577809a437cd20161c3c496080991f on GoogleCloudPlatform:master**.
diff --git a/httplib2shim/__init__.py b/httplib2shim/__init__.py index bdc9a8c..42b3aa6 100644 --- a/httplib2shim/__init__.py +++ b/httplib2shim/__init__.py @@ -20,6 +20,7 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import collections import errno import socket import ssl @@ -41,6 +42,8 @@ def _default_make_pool(http, proxy_info): cert_reqs = 'CERT_REQUIRED' if http.ca_certs and not ssl_disabled else None + if isinstance(proxy_info, collections.Callable): + proxy_info = proxy_info() if proxy_info: if proxy_info.proxy_user and proxy_info.proxy_pass: proxy_url = 'http://{}:{}@{}:{}/'.format( @@ -111,7 +114,7 @@ class Http(httplib2.Http): disable_ssl_certificate_validation=disable_ssl) if not pool: - pool = self._make_pool(proxy_info=proxy_info()) + pool = self._make_pool(proxy_info=proxy_info) self.pool = pool
proxy_info cannot be None for the ver. 0.0.2 After upgrade to ver. 0.0.2 I cannot call `httplib2shim.Http(proxy_info=None)`, it results in: ``` File "/usr/local/lib/python3.5/dist-packages/httplib2shim/__init__.py", line 114, in __init__ pool = self._make_pool(proxy_info=proxy_info()) TypeError: 'NoneType' object is not callable ``` Also, the `proxy_info` for the httplib2 may not be callable. While it's easy to make a lambda to change variable to callable, it's nice to allow `None` as proxy_info (and backward compatible, too.)
GoogleCloudPlatform/httplib2shim
diff --git a/httplib2shim/test/httplib2_test.py b/httplib2shim/test/httplib2_test.py index 5bfbd02..abb234f 100644 --- a/httplib2shim/test/httplib2_test.py +++ b/httplib2shim/test/httplib2_test.py @@ -39,6 +39,7 @@ import httplib2 import httplib2shim import six from six.moves.urllib import parse as urllib_parse +import urllib3 __author__ = "Joe Gregorio ([email protected])" @@ -1880,3 +1881,19 @@ class TestProxyInfo(unittest.TestCase): os.environ.clear() pi = httplib2.proxy_info_from_environment() self.assertEqual(pi, None) + + +class HttpShimProxyPoolTest(unittest.TestCase): + + def test_none(self): + http = httplib2.Http(proxy_info=None) + self.assertIsInstance(http.pool, urllib3.PoolManager) + http = httplib2.Http(proxy_info=lambda: None) + self.assertIsInstance(http.pool, urllib3.PoolManager) + + def test_instance_and_callable(self): + proxy_info = httplib2.proxy_info_from_url('http://myproxy.example.com') + http = httplib2.Http(proxy_info=proxy_info) + self.assertIsInstance(http.pool, urllib3.ProxyManager) + http = httplib2.Http(proxy_info=lambda: proxy_info) + self.assertIsInstance(http.pool, urllib3.ProxyManager)
{ "commit_name": "merge_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 1 }
0.0
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": [ "requirements-dev.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 cffi==1.15.1 coverage==6.2 cryptography==40.0.2 httplib2==0.22.0 -e git+https://github.com/GoogleCloudPlatform/httplib2shim.git@128d229807577809a437cd20161c3c496080991f#egg=httplib2shim idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 nose==1.3.7 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycparser==2.21 pyOpenSSL==23.2.0 pyparsing==3.1.4 pytest==7.0.1 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 urllib3-secure-extra==0.1.0 zipp==3.6.0
name: httplib2shim channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - cffi==1.15.1 - coverage==6.2 - cryptography==40.0.2 - httplib2==0.22.0 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - nose==1.3.7 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycparser==2.21 - pyopenssl==23.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - urllib3-secure-extra==0.1.0 - zipp==3.6.0 prefix: /opt/conda/envs/httplib2shim
[ "httplib2shim/test/httplib2_test.py::HttpShimProxyPoolTest::test_instance_and_callable", "httplib2shim/test/httplib2_test.py::HttpShimProxyPoolTest::test_none" ]
[ "httplib2shim/test/httplib2_test.py::UrlSafenameTest::test", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticate", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateBasic", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateBasic2", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateBasic3", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateDigest", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateEmpty", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMalformed", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMoreQuoteCombos", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple2", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple3", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple4", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateStrict", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testWsseAlgorithm" ]
[ "httplib2shim/test/httplib2_test.py::CredentialsTest::test", "httplib2shim/test/httplib2_test.py::ParserTest::testFromStd66", "httplib2shim/test/httplib2_test.py::UrlNormTest::test", "httplib2shim/test/httplib2_test.py::HttpTest::testGet301ViaHttps", "httplib2shim/test/httplib2_test.py::HttpTest::testGetConnectionRefused", "httplib2shim/test/httplib2_test.py::HttpTest::testGetUnknownServer", "httplib2shim/test/httplib2_test.py::HttpTest::testGetViaHttps", "httplib2shim/test/httplib2_test.py::HttpTest::testGetViaHttpsKeyCert", "httplib2shim/test/httplib2_test.py::HttpTest::testGetViaHttpsSpecViolationOnLocation", "httplib2shim/test/httplib2_test.py::HttpTest::testHeadRead", "httplib2shim/test/httplib2_test.py::HttpTest::testIPv6NoSSL", "httplib2shim/test/httplib2_test.py::HttpTest::testIPv6SSL", "httplib2shim/test/httplib2_test.py::HttpTest::testPickleHttp", "httplib2shim/test/httplib2_test.py::HttpTest::testSniHostnameValidation", "httplib2shim/test/httplib2_test.py::HttpTest::testSslCertValidation", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testConvertByteStr", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObject", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObjectAuthInfo", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObjectStale", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObjectWithOpaque", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testEnd2End", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationMaxAge0", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateAndExpires", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateAndExpiresMinFresh1", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateAndExpiresMinFresh2", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateOnly", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelFresh", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelMaxAgeBoth", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelNoCacheResponse", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelOnlyIfCached", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelStaleRequestMustReval", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelStaleResponseMustReval", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelTransparent", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpiresZero", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testMaxAgeNonNumeric", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testNormalizeHeaders", "httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseCacheControl", "httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_env", "httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_env_no_proxy", "httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_env_none", "httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_url", "httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_url_ident" ]
[]
MIT License
1,254
[ "httplib2shim/__init__.py" ]
[ "httplib2shim/__init__.py" ]
jaywink__federation-81
064d0fa366f6e61327237677567fb3626024bc71
2017-05-16 19:52:44
e0dd39d518136eef5d36fa3c2cb36dc4b32d4a63
pep8speaks: Hello @jaywink! Thanks for submitting the PR. - In the file [`federation/protocols/diaspora/magic_envelope.py`](https://github.com/jaywink/federation/blob/54dc84293126a9c0330ce7b0efb08bada5ed22bf/federation/protocols/diaspora/magic_envelope.py), following are the PEP8 issues : > [Line 37:1](https://github.com/jaywink/federation/blob/54dc84293126a9c0330ce7b0efb08bada5ed22bf/federation/protocols/diaspora/magic_envelope.py#L37): [W293](https://duckduckgo.com/?q=pep8%20W293) blank line contains whitespace - In the file [`federation/tests/protocols/diaspora/test_protocol.py`](https://github.com/jaywink/federation/blob/54dc84293126a9c0330ce7b0efb08bada5ed22bf/federation/tests/protocols/diaspora/test_protocol.py), following are the PEP8 issues : > [Line 145:45](https://github.com/jaywink/federation/blob/54dc84293126a9c0330ce7b0efb08bada5ed22bf/federation/tests/protocols/diaspora/test_protocol.py#L145): [E711](https://duckduckgo.com/?q=pep8%20E711) comparison to None should be 'if cond is None:'
diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f576a..2d5de32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [unreleased] + +### Backwards incompatible changes +* Removed exception class `NoHeaderInMessageError`. New style Diaspora protocol does not have a custom header in the Salmon magic envelope and thus there is no need to raise this anywhere. + +### Added +* New style Diaspora public payloads are now supported (see [here](https://github.com/diaspora/diaspora_federation/issues/30)). Old style payloads are still supported. Payloads are also still sent out old style. + ## [0.11.0] - 2017-05-08 ### Backwards incompatible changes diff --git a/federation/exceptions.py b/federation/exceptions.py index f94dd49..243111b 100644 --- a/federation/exceptions.py +++ b/federation/exceptions.py @@ -3,11 +3,6 @@ class EncryptedMessageError(Exception): pass -class NoHeaderInMessageError(Exception): - """Message payload is missing required header.""" - pass - - class NoSenderKeyFoundError(Exception): """Sender private key was not available to sign a payload message.""" pass diff --git a/federation/protocols/diaspora/magic_envelope.py b/federation/protocols/diaspora/magic_envelope.py index e3f6fff..ff9cc13 100644 --- a/federation/protocols/diaspora/magic_envelope.py +++ b/federation/protocols/diaspora/magic_envelope.py @@ -1,18 +1,21 @@ -from base64 import urlsafe_b64encode, b64encode +from base64 import urlsafe_b64encode, b64encode, urlsafe_b64decode from Crypto.Hash import SHA256 from Crypto.Signature import PKCS1_v1_5 as PKCSSign from lxml import etree -class MagicEnvelope(object): +NAMESPACE = "http://salmon-protocol.org/ns/magic-env" + + +class MagicEnvelope(): """Diaspora protocol magic envelope. See: http://diaspora.github.io/diaspora_federation/federation/magicsig.html """ nsmap = { - 'me': 'http://salmon-protocol.org/ns/magic-env' + "me": NAMESPACE, } def __init__(self, message, private_key, author_handle, wrap_payload=False): @@ -28,6 +31,16 @@ class MagicEnvelope(object): self.doc = None self.payload = None + @staticmethod + def get_sender(doc): + """Get the key_id from the `sig` element which contains urlsafe_b64encoded Diaspora handle. + + :param doc: ElementTree document + :returns: Diaspora handle + """ + key_id = doc.find(".//{%s}sig" % NAMESPACE).get("key_id") + return urlsafe_b64decode(key_id).decode("utf-8") + def create_payload(self): """Create the payload doc. @@ -58,14 +71,13 @@ class MagicEnvelope(object): return sig, key_id def build(self): - self.doc = etree.Element("{%s}env" % self.nsmap["me"], nsmap=self.nsmap) - etree.SubElement(self.doc, "{%s}encoding" % self.nsmap["me"]).text = 'base64url' - etree.SubElement(self.doc, "{%s}alg" % self.nsmap["me"]).text = 'RSA-SHA256' + self.doc = etree.Element("{%s}env" % NAMESPACE, nsmap=self.nsmap) + etree.SubElement(self.doc, "{%s}encoding" % NAMESPACE).text = 'base64url' + etree.SubElement(self.doc, "{%s}alg" % NAMESPACE).text = 'RSA-SHA256' self.create_payload() - etree.SubElement(self.doc, "{%s}data" % self.nsmap["me"], - {"type": "application/xml"}).text = self.payload + etree.SubElement(self.doc, "{%s}data" % NAMESPACE, {"type": "application/xml"}).text = self.payload signature, key_id = self._build_signature() - etree.SubElement(self.doc, "{%s}sig" % self.nsmap["me"], key_id=key_id).text = signature + etree.SubElement(self.doc, "{%s}sig" % NAMESPACE, key_id=key_id).text = signature return self.doc def render(self): diff --git a/federation/protocols/diaspora/protocol.py b/federation/protocols/diaspora/protocol.py index 8113b90..c6bce54 100644 --- a/federation/protocols/diaspora/protocol.py +++ b/federation/protocols/diaspora/protocol.py @@ -11,10 +11,9 @@ from Crypto.Random import get_random_bytes from Crypto.Signature import PKCS1_v1_5 as PKCSSign from lxml import etree -from federation.exceptions import ( - EncryptedMessageError, NoHeaderInMessageError, NoSenderKeyFoundError, SignatureVerificationError, -) +from federation.exceptions import EncryptedMessageError, NoSenderKeyFoundError, SignatureVerificationError from federation.protocols.base import BaseProtocol +from federation.protocols.diaspora.magic_envelope import MagicEnvelope logger = logging.getLogger("federation") @@ -67,6 +66,7 @@ class Protocol(BaseProtocol): xml = xml.lstrip().encode("utf-8") logger.debug("diaspora.protocol.receive: xml content: %s", xml) self.doc = etree.fromstring(xml) + # Check for a legacy header self.find_header() # Open payload and get actual message self.content = self.get_message_content() @@ -88,12 +88,16 @@ class Protocol(BaseProtocol): return self.user.private_key def find_header(self): + self.encrypted = self.legacy = False self.header = self.doc.find(".//{"+PROTOCOL_NS+"}header") if self.header != None: - self.encrypted = False + # Legacy public header found + self.legacy = True return if self.doc.find(".//{" + PROTOCOL_NS + "}encrypted_header") == None: - raise NoHeaderInMessageError("Could not find header in message") + # No legacy encrypted header found + return + self.legacy = True if not self.user: raise EncryptedMessageError("Cannot decrypt private message without user object") user_private_key = self._get_user_key(self.user) @@ -104,6 +108,11 @@ class Protocol(BaseProtocol): ) def get_sender(self): + if self.legacy: + return self.get_sender_legacy() + return MagicEnvelope.get_sender(self.doc) + + def get_sender_legacy(self): try: return self.header.find(".//{"+PROTOCOL_NS+"}author_id").text except AttributeError:
Add support for Diaspora Salmon refactoring See diaspora/diaspora_federation#30
jaywink/federation
diff --git a/federation/tests/protocols/diaspora/test_magic_envelope.py b/federation/tests/protocols/diaspora/test_magic_envelope.py index f9bd925..952ec2e 100644 --- a/federation/tests/protocols/diaspora/test_magic_envelope.py +++ b/federation/tests/protocols/diaspora/test_magic_envelope.py @@ -1,12 +1,15 @@ +from lxml import etree + from Crypto import Random from Crypto.PublicKey import RSA from lxml.etree import _Element from federation.protocols.diaspora.magic_envelope import MagicEnvelope from federation.tests.fixtures.keys import get_dummy_private_key +from federation.tests.fixtures.payloads import DIASPORA_PUBLIC_PAYLOAD -class TestMagicEnvelope(object): +class TestMagicEnvelope(): @staticmethod def generate_rsa_private_key(): """Generate a new RSA private key.""" @@ -80,3 +83,7 @@ class TestMagicEnvelope(object): ) output2 = env2.render() assert output2 == output + + def test_get_sender(self): + doc = etree.fromstring(bytes(DIASPORA_PUBLIC_PAYLOAD, encoding="utf-8")) + assert MagicEnvelope.get_sender(doc) == "[email protected]" diff --git a/federation/tests/protocols/diaspora/test_protocol.py b/federation/tests/protocols/diaspora/test_protocol.py index fa4359e..3fd5a37 100644 --- a/federation/tests/protocols/diaspora/test_protocol.py +++ b/federation/tests/protocols/diaspora/test_protocol.py @@ -5,7 +5,7 @@ from xml.etree.ElementTree import ElementTree from lxml import etree import pytest -from federation.exceptions import EncryptedMessageError, NoSenderKeyFoundError, NoHeaderInMessageError +from federation.exceptions import EncryptedMessageError, NoSenderKeyFoundError from federation.protocols.diaspora.protocol import Protocol, identify_payload from federation.tests.fixtures.payloads import ( ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, @@ -105,12 +105,6 @@ class TestDiasporaProtocol(DiasporaTestBase): with pytest.raises(NoSenderKeyFoundError): protocol.receive(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_not_found_get_contact_key) - def test_find_header_raises_if_header_cannot_be_found(self): - protocol = self.init_protocol() - protocol.doc = etree.fromstring("<foo>bar</foo>") - with pytest.raises(NoHeaderInMessageError): - protocol.find_header() - def test_get_message_content(self): protocol = self.init_protocol() protocol.doc = self.get_unencrypted_doc() @@ -130,25 +124,25 @@ class TestDiasporaProtocol(DiasporaTestBase): def test_identify_payload_with_other_payload(self): assert identify_payload("foobar not a diaspora protocol") == False - def test_get_sender_returns_sender_in_header(self): + def test_get_sender_legacy_returns_sender_in_header(self): protocol = self.init_protocol() protocol.doc = self.get_unencrypted_doc() protocol.find_header() - assert protocol.get_sender() == "[email protected]" + assert protocol.get_sender_legacy() == "[email protected]" - def test_get_sender_returns_sender_in_content(self): + def test_get_sender_legacy_returns_sender_in_content(self): protocol = self.init_protocol() protocol.header = ElementTree() protocol.content = "<content><diaspora_handle>[email protected]</diaspora_handle></content>" - assert protocol.get_sender() == "[email protected]" + assert protocol.get_sender_legacy() == "[email protected]" protocol.content = "<content><sender_handle>[email protected]</sender_handle></content>" - assert protocol.get_sender() == "[email protected]" + assert protocol.get_sender_legacy() == "[email protected]" - def test_get_sender_returns_none_if_no_sender_found(self): + def test_get_sender_legacy_returns_none_if_no_sender_found(self): protocol = self.init_protocol() protocol.header = ElementTree() protocol.content = "<content><handle>[email protected]</handle></content>" - assert protocol.get_sender() == None + assert protocol.get_sender_legacy() is None @patch.object(Protocol, "init_message") @patch.object(Protocol, "create_salmon_envelope")
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 3, "test_score": 3 }, "num_modified_files": 4 }
0.11
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": null, "pre_install": [ "apt-get update", "apt-get install -y libxml2-dev libxslt1-dev" ], "python": "3.6", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "py.test --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 arrow==1.2.3 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 codecov==2.1.13 colorama==0.4.5 commonmark==0.9.1 coverage==6.2 cssselect==1.1.0 dirty-validators==0.5.4 docutils==0.18.1 factory-boy==3.2.1 Faker==14.2.1 -e git+https://github.com/jaywink/federation.git@064d0fa366f6e61327237677567fb3626024bc71#egg=federation idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 Jinja2==3.0.3 jsonschema==3.2.0 livereload==2.6.3 lxml==5.3.1 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycrypto==2.6.1 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 pytest-cov==4.0.0 pytest-warnings==0.3.1 python-dateutil==2.9.0.post0 python-xrd==0.1 pytz==2025.2 recommonmark==0.7.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-autobuild==2021.3.14 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: federation channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - arrow==1.2.3 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - codecov==2.1.13 - colorama==0.4.5 - commonmark==0.9.1 - coverage==6.2 - cssselect==1.1.0 - dirty-validators==0.5.4 - docutils==0.18.1 - factory-boy==3.2.1 - faker==14.2.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - jinja2==3.0.3 - jsonschema==3.2.0 - livereload==2.6.3 - lxml==5.3.1 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycrypto==2.6.1 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-warnings==0.3.1 - python-dateutil==2.9.0.post0 - python-xrd==0.1 - pytz==2025.2 - recommonmark==0.7.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-autobuild==2021.3.14 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/federation
[ "federation/tests/protocols/diaspora/test_magic_envelope.py::TestMagicEnvelope::test_get_sender", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_legacy_returns_sender_in_header", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_legacy_returns_sender_in_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_legacy_returns_none_if_no_sender_found" ]
[]
[ "federation/tests/protocols/diaspora/test_magic_envelope.py::TestMagicEnvelope::test_build", "federation/tests/protocols/diaspora/test_magic_envelope.py::TestMagicEnvelope::test_create_payload_wrapped", "federation/tests/protocols/diaspora/test_magic_envelope.py::TestMagicEnvelope::test_create_payload", "federation/tests/protocols/diaspora/test_magic_envelope.py::TestMagicEnvelope::test_build_signature", "federation/tests/protocols/diaspora/test_magic_envelope.py::TestMagicEnvelope::test_render", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_unencrypted_header", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_encrypted_header", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_unencrypted_returns_sender_and_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_encrypted_returns_sender_and_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_on_encrypted_message_and_no_user", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_on_encrypted_message_and_no_user_key", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_if_sender_key_cannot_be_found", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_message_content", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_legacy_diaspora_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_diaspora_public_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_diaspora_encrypted_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_other_payload", "federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_build_send" ]
[]
BSD 3-Clause "New" or "Revised" License
1,255
[ "federation/exceptions.py", "federation/protocols/diaspora/magic_envelope.py", "CHANGELOG.md", "federation/protocols/diaspora/protocol.py" ]
[ "federation/exceptions.py", "federation/protocols/diaspora/magic_envelope.py", "CHANGELOG.md", "federation/protocols/diaspora/protocol.py" ]
Azure__azure-cli-3373
5bb6b7bb83f5396ee9b6a8c5f458eeb629215703
2017-05-16 22:24:34
eb12ac454cbe1ddb59c86cdf2045e1912660e750
tjprescott: **monitor alert create** ``` Command az monitor alert create: Create a metric-based alert rule. Arguments --condition [Required]: The condition expression upon which to trigger the rule. Usage: --condition "METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} PERIOD" Example: --condition "Percentage CPU > 60 avg 1h30m". --name -n [Required]: Name of the alert rule. --resource-group -g [Required]: Name of resource group. You can configure the default group using `az configure --defaults group=<name>`. --description : Free-text description of the rule. Defaults to the condition expression. --disabled : Create the rule in a disabled state. Allowed values: false, true. --location -l : Location. You can configure the default location using `az configure --defaults location=<location>`. --tags : Space separated tags in 'key[=value]' format. Use "" to clear existing tags. Action Arguments --action -a : Add an action to fire when the alert is triggered. Usage: --add-action TYPE KEY [ARG ...] Email: --add-action email [email protected] [email protected] Webhook: --add-action webhook https://www.contoso.com/alert apiKey=value Webhook: --add-action webhook https://www.contoso.com/alert?apiKey=value To specify multiple actions, add multiple --add-action ARGS entries. --email-service-owners : Email the service owners if an alert is triggered. Allowed values: false, true. Target Resource Arguments --target [Required]: Name or ID of the target resource. --target-namespace : Target resource provider namespace. --target-parent : Target resource parent path, if applicable. --target-type : Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines)'). Examples Create a High CPU-based alert on a VM with no actions. az vm alert rule create -n rule1 -g <RG> --target <VM ID> --condition "Percentage CPU > 90 avg 5m" Create a High CPU-based alert on a VM with email and webhook actions. az vm alert rule create -n rule1 -g <RG> --target <VM ID> \ --condition "Percentage CPU > 90 avg 5m" \ --action email [email protected] [email protected] --email-service-owners \ --action webhook https://www.contoso.com/alerts?type=HighCPU \ --action webhook https://alerts.contoso.com apiKey=<KEY> type=HighCPU ``` tjprescott: **monitor alert update** ``` Command az monitor alert update: Update a metric-based alert rule. To specify the condition: --condition METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} PERIOD. Arguments --description : Free-text description of the rule. --enabled --tags : Space separated tags in 'key[=value]' format. Use "" to clear existing tags. Resource Id Arguments --ids : One or more resource IDs (space delimited). If provided, no other 'Resource Id' arguments should be specified. --name -n : Name of the alert rule. --resource-group -g : Name of resource group. You can configure the default group using `az configure --defaults group=<name>`. Action Arguments --add-action -a : Add an action to fire when the alert is triggered. Usage: --add-action TYPE KEY [ARG ...] Email: --add-action email [email protected] [email protected] Webhook: --add-action webhook https://www.contoso.com/alert apiKey=value Webhook: --add-action webhook https://www.contoso.com/alert?apiKey=value To specify multiple actions, add multiple --add-action ARGS entries. --email-service-owners: Email the service owners if an alert is triggered. Allowed values: false, true. --remove-action -r : Remove one or more actions. Usage: --remove-action TYPE KEY [KEY ...] Email: --remove-action email [email protected] [email protected] Webhook: --remove-action webhook https://contoso.com/alert https://alerts.contoso.com. Condition Arguments --aggregation : Type of aggregation to apply based on --period. Allowed values: avg, last, max, min, total. --condition : The condition expression upon which to trigger the rule. Usage: --condition "METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} PERIOD" Example: --condition "Percentage CPU > 60 avg 1h30m". --metric : Name of the metric to base the rule on. Values from: az monitor metrics list-definitions. --operator : How to compare the metric against the threshold. Allowed values: <, <=, >, >=. --period : Time span over which to apply --aggregation, in nDnHnMnS shorthand or full ISO8601 format. --threshold : Numeric threshold at which to trigger the alert. Target Resource Arguments --target : ID of the resource to target for the alert rule. --target-namespace : Target resource provider namespace. --target-parent : Target resource parent path, if applicable. --target-type : Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines)'). ``` codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=h1) Report > Merging [#3373](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/4417fb03c91b0caa5f88a72ca0372d5931c072d9?src=pr&el=desc) will **increase** coverage by `0.14%`. > The diff coverage is `85.43%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/3373/graphs/tree.svg?token=2pog0TKvF8&width=650&height=150&src=pr)](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #3373 +/- ## ========================================= + Coverage 70.66% 70.8% +0.14% ========================================= Files 391 392 +1 Lines 25255 25442 +187 Branches 3835 3875 +40 ========================================= + Hits 17847 18015 +168 - Misses 6272 6276 +4 - Partials 1136 1151 +15 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...ure-cli-core/azure/cli/core/commands/parameters.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL2NvbW1hbmRzL3BhcmFtZXRlcnMucHk=) | `72.47% <100%> (ø)` | :arrow_up: | | [...onitor/azure/cli/command\_modules/monitor/params.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvcGFyYW1zLnB5) | `100% <100%> (ø)` | :arrow_up: | | [...itor/azure/cli/command\_modules/monitor/commands.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvY29tbWFuZHMucHk=) | `100% <100%> (ø)` | :arrow_up: | | [...or/azure/cli/command\_modules/monitor/validators.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvdmFsaWRhdG9ycy5weQ==) | `48.38% <100%> (+34.87%)` | :arrow_up: | | [...-monitor/azure/cli/command\_modules/monitor/help.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvaGVscC5weQ==) | `100% <100%> (ø)` | :arrow_up: | | [...ure/cli/command\_modules/monitor/\_client\_factory.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvX2NsaWVudF9mYWN0b3J5LnB5) | `77.27% <66.66%> (+35.6%)` | :arrow_up: | | [...onitor/azure/cli/command\_modules/monitor/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvY3VzdG9tLnB5) | `71.91% <75%> (+4.63%)` | :arrow_up: | | [...nitor/azure/cli/command\_modules/monitor/actions.py](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbW9uaXRvci9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL21vbml0b3IvYWN0aW9ucy5weQ==) | `79.1% <79.1%> (ø)` | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=footer). Last update [4417fb0...0e9a686](https://codecov.io/gh/Azure/azure-cli/pull/3373?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/azure-cli.pyproj b/azure-cli.pyproj index 5316ef474..720fd0f7d 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -503,16 +503,25 @@ <Compile Include="command_modules\azure-cli-lab\azure\cli\command_modules\lab\__init__.py" /> <Compile Include="command_modules\azure-cli-lab\azure_bdist_wheel.py" /> <Compile Include="command_modules\azure-cli-lab\setup.py" /> + <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\actions.py"> + <SubType>Code</SubType> + </Compile> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\commands.py" /> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\custom.py" /> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\help.py" /> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\params.py" /> - <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\test_custom.py" /> + <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_exception_handler.py"> + <SubType>Code</SubType> + </Compile> + <Compile Include="command_modules\azure-cli-monitor\tests\test_custom.py" /> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\validators.py" /> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\_client_factory.py" /> <Compile Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\__init__.py" /> <Compile Include="command_modules\azure-cli-monitor\azure_bdist_wheel.py" /> <Compile Include="command_modules\azure-cli-monitor\setup.py" /> + <Compile Include="command_modules\azure-cli-monitor\tests\test_monitor.py"> + <SubType>Code</SubType> + </Compile> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\zone_file\configs.py" /> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\zone_file\exceptions.py" /> <Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\zone_file\make_zone_file.py" /> @@ -874,8 +883,7 @@ <Folder Include="command_modules\azure-cli-monitor\azure\cli\" /> <Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\" /> <Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\" /> - <Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\" /> - <Folder Include="command_modules\azure-cli-monitor\azure\cli\command_modules\monitor\tests\__pycache__\" /> + <Folder Include="command_modules\azure-cli-monitor\tests\" /> <Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\zone_file\" /> <Folder Include="command_modules\azure-cli-network\tests\" /> <Folder Include="command_modules\azure-cli-network\tests\zone_files\" /> diff --git a/src/azure-cli-core/HISTORY.rst b/src/azure-cli-core/HISTORY.rst index b66c03554..103f25a5c 100644 --- a/src/azure-cli-core/HISTORY.rst +++ b/src/azure-cli-core/HISTORY.rst @@ -6,6 +6,7 @@ Release History unreleased ^^^^^^^^^^^^^^^^^^ * Command paths are no longer case sensitive. +* Certain boolean-type parameters are no longer case sensitive. 2.0.6 (2017-05-09) ^^^^^^^^^^^^^^^^^^ diff --git a/src/azure-cli-core/azure/cli/core/commands/parameters.py b/src/azure-cli-core/azure/cli/core/commands/parameters.py index f33c9509c..71a80e0e3 100644 --- a/src/azure-cli-core/azure/cli/core/commands/parameters.py +++ b/src/azure-cli-core/azure/cli/core/commands/parameters.py @@ -148,12 +148,12 @@ def three_state_flag(positive_label='true', negative_label='false', invert=False def __call__(self, parser, namespace, values, option_string=None): if invert: if values: - values = positive_label if values == negative_label else negative_label + values = positive_label if values.lower() == negative_label else negative_label else: values = values or negative_label else: values = values or positive_label - setattr(namespace, self.dest, values == positive_label) + setattr(namespace, self.dest, values.lower() == positive_label) params = { 'choices': CaseInsensitiveList(choices), diff --git a/src/command_modules/azure-cli-monitor/HISTORY.rst b/src/command_modules/azure-cli-monitor/HISTORY.rst index e488c756b..d71675a7b 100644 --- a/src/command_modules/azure-cli-monitor/HISTORY.rst +++ b/src/command_modules/azure-cli-monitor/HISTORY.rst @@ -7,6 +7,19 @@ unreleased +++++++++++++++++++++ * Include autoscale template file to fix `az monitor autoscale-settings get-parameters-template` command (#3349) +* BC: `monitor alert-rule-incidents list` renamed `monitor alert list-incidents` +* BC: `monitor alert-rule-incidents show` renamed `monitor alert show-incident` +* BC: `monitor metric-defintions list` renamed `monitor metrics list-definitions` +* BC: `monitor alert-rules` renamed `monitor alert` +* BC: `monitor alert create` completely revamped. `condition` and `action` no longer accepts JSON. + Adds numerous parameters to simplify the rule creation process. `location` no longer required. + Added name or ID support for target. + `--alert-rule-resource-name` removed. `is-enabled` renamed `enabled` and no longer required. + `description` defaults based on the supplied condition. Added examples to help clarifiy the + new format. +* BC: Support names or IDs for `monitor metric` commands. +* `monitor alert rule update` - Added numerous convenience arguments to improve usability. Added + examples to explain usage of the new arguments. 0.0.4 (2017-05-09) +++++++++++++++++++++ diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_client_factory.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_client_factory.py index 4664711f2..62c0c5062 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_client_factory.py +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_client_factory.py @@ -5,46 +5,46 @@ # MANAGEMENT CLIENT FACTORIES -def get_monitor_management_client(_): +def cf_monitor(_): from azure.mgmt.monitor import MonitorManagementClient from azure.cli.core.commands.client_factory import get_mgmt_service_client return get_mgmt_service_client(MonitorManagementClient) -def get_monitor_autoscale_settings_operation(kwargs): - return get_monitor_management_client(kwargs).autoscale_settings +def cf_alert_rules(kwargs): + return cf_monitor(kwargs).alert_rules -def get_monitor_diagnostic_settings_operation(kwargs): - return get_monitor_management_client(kwargs).service_diagnostic_settings +def cf_alert_rule_incidents(kwargs): + return cf_monitor(kwargs).alert_rule_incidents -def get_monitor_alert_rules_operation(kwargs): - return get_monitor_management_client(kwargs).alert_rules +def cf_autoscale(kwargs): + return cf_monitor(kwargs).autoscale_settings -def get_monitor_alert_rule_incidents_operation(kwargs): - return get_monitor_management_client(kwargs).alert_rule_incidents +def cf_diagnostics(kwargs): + return cf_monitor(kwargs).service_diagnostic_settings -def get_monitor_log_profiles_operation(kwargs): - return get_monitor_management_client(kwargs).log_profiles +def cf_log_profiles(kwargs): + return cf_monitor(kwargs).log_profiles # DATA CLIENT FACTORIES -def get_monitor_client(_): +def cf_monitor_data(_): from azure.monitor import MonitorClient from azure.cli.core.commands.client_factory import get_mgmt_service_client return get_mgmt_service_client(MonitorClient) -def get_monitor_activity_log_operation(kwargs): - return get_monitor_client(kwargs).activity_logs +def cf_metrics(kwargs): + return cf_monitor_data(kwargs).metrics -def get_monitor_metric_definitions_operation(kwargs): - return get_monitor_client(kwargs).metric_definitions +def cf_metric_def(kwargs): + return cf_monitor_data(kwargs).metric_definitions -def get_monitor_metrics_operation(kwargs): - return get_monitor_client(kwargs).metrics +def cf_activity_log(kwargs): + return cf_monitor_data(kwargs).activity_logs diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_exception_handler.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_exception_handler.py new file mode 100644 index 000000000..f4915d921 --- /dev/null +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_exception_handler.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core.util import CLIError + + +def monitor_exception_handler(ex): + from azure.mgmt.monitor.models import ErrorResponseException + if hasattr(ex, 'inner_exception') and 'MonitoringService' in ex.inner_exception.message: + raise CLIError(ex.inner_exception.code) + elif isinstance(ex, ErrorResponseException): + raise CLIError(ex) + else: + import sys + from six import reraise + reraise(*sys.exc_info()) diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py index df03bc6dd..90df287da 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py @@ -11,19 +11,143 @@ helps['monitor'] = """ type: group short-summary: Commands to manage Azure Monitor service. """ -# MANAGEMENT COMMANDS HELPS -helps['monitor alert-rules'] = """ - type: group - short-summary: Commands to manage alerts assigned to Azure resources. - """ -helps['monitor alert-rules update'] = """ - type: command - short-summary: Updates an alert rule. - """ -helps['monitor alert-rule-incidents'] = """ - type: group - short-summary: Commands to manage alert rule incidents. - """ + +# region Alerts + +helps['monitor alert'] = """ + type: group + short-summary: Commands to manage metric-based alert rules. + """ + +helps['monitor alert create'] = """ + type: command + short-summary: Create a metric-based alert rule. + parameters: + - name: --action -a + short-summary: Add an action to fire when the alert is triggered. + long-summary: | + Usage: --action TYPE KEY [ARG ...] + Email: --action email [email protected] [email protected] + Webhook: --action webhook https://www.contoso.com/alert apiKey=value + Webhook: --action webhook https://www.contoso.com/alert?apiKey=value + To specify multiple actions, add multiple --add-action ARGS entries. + - name: --description + short-summary: Free-text description of the rule. Defaults to the condition expression. + - name: --disabled + short-summary: Create the rule in a disabled state. + - name: --condition + short-summary: The condition expression upon which to trigger the rule. + long-summary: | + Usage: --condition "METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} PERIOD" + Example: --condition "Percentage CPU > 60 avg 1h30m" + - name: --email-service-owners + short-summary: Email the service owners if an alert is triggered. + examples: + - name: Create a High CPU-based alert on a VM with no actions. + text: > + az vm alert rule create -n rule1 -g <RG> --target <VM ID> --condition "Percentage CPU > 90 avg 5m" + - name: Create a High CPU-based alert on a VM with email and webhook actions. + text: | + az vm alert rule create -n rule1 -g <RG> --target <VM ID> \\ + --condition "Percentage CPU > 90 avg 5m" \\ + --action email [email protected] [email protected] --email-service-owners \\ + --action webhook https://www.contoso.com/alerts?type=HighCPU \\ + --action webhook https://alerts.contoso.com apiKey=<KEY> type=HighCPU +""" + +helps['monitor alert update'] = """ + type: command + short-summary: Update a metric-based alert rule. + long-summary: | + To specify the condition: + --condition METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} PERIOD + parameters: + - name: --target + short-summary: ID of the resource to target for the alert rule. + - name: --description + short-summary: Free-text description of the rule. + - name: --condition + short-summary: The condition expression upon which to trigger the rule. + long-summary: | + Usage: --condition "METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} PERIOD" + Example: --condition "Percentage CPU > 60 avg 1h30m" + - name: --add-action -a + short-summary: Add an action to fire when the alert is triggered. + long-summary: | + Usage: --add-action TYPE KEY [ARG ...] + Email: --add-action email [email protected] [email protected] + Webhook: --add-action webhook https://www.contoso.com/alert apiKey=value + Webhook: --add-action webhook https://www.contoso.com/alert?apiKey=value + To specify multiple actions, add multiple --add-action ARGS entries. + - name: --remove-action -r + short-summary: Remove one or more actions. + long-summary: | + Usage: --remove-action TYPE KEY [KEY ...] + Email: --remove-action email [email protected] [email protected] + Webhook: --remove-action webhook https://contoso.com/alert https://alerts.contoso.com + - name: --email-service-owners + short-summary: Email the service owners if an alert is triggered. + - name: --metric + short-summary: Name of the metric to base the rule on. + populator-commands: + - az monitor metrics list-definitions + - name: --operator + short-summary: How to compare the metric against the threshold. + - name: --threshold + short-summary: Numeric threshold at which to trigger the alert. + - name: --aggregation + short-summary: Type of aggregation to apply based on --period. + - name: --period + short-summary: > + Time span over which to apply --aggregation, in nDnHnMnS shorthand or full ISO8601 format. +""" + +helps['monitor alert delete'] = """ + type: command + short-summary: Delete an alert rule. + """ + +helps['monitor alert list'] = """ + type: command + short-summary: List alert rules in a resource group. + """ + +helps['monitor alert show'] = """ + type: command + short-summary: Show an alert rule. + """ + +helps['monitor alert show-incident'] = """ + type: command + short-summary: Show details of an alert rule incident. + """ + +helps['monitor alert list-incidents'] = """ + type: command + short-summary: List all incidents for an alert rule. + """ + +# endregion + +# region Metrics + +helps['monitor metrics'] = """ + type: group + short-summary: Commands to view Azure resource metrics. +""" + +helps['monitor metrics list'] = """ + type: command + short-summary: List metric values for a resource. +""" + +helps['monitor metrics list-definitions'] = """ + type: command + short-summary: List metric definitions for a resource. +""" + +# endregion + helps['monitor log-profiles'] = """ type: group short-summary: Commands to manage the log profiles assigned to Azure subscription. @@ -79,16 +203,8 @@ helps['monitor autoscale-settings update'] = """ type: command short-summary: Updates an autoscale setting. """ -# DATA COMMANDS HELPS + helps['monitor activity-log'] = """ - type: group - short-summary: Commands to manage activity log. - """ -helps['monitor metrics'] = """ - type: group - short-summary: Commands to manage metrics. - """ -helps['monitor metric-definitions'] = """ - type: group - short-summary: Commands to manage metric definitions. - """ + type: group + short-summary: Commands to manage activity log. +""" diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/actions.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/actions.py new file mode 100644 index 000000000..f3f748db1 --- /dev/null +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/actions.py @@ -0,0 +1,99 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import argparse +import re + +from azure.cli.core.util import CLIError +from azure.cli.command_modules.monitor.custom import operator_map, aggregation_map + + +def period_type(value): + + def _get_substring(indices): + if indices == tuple([-1, -1]): + return '' + else: + return value[indices[0]: indices[1]] + + regex = r'(p)?(\d+y)?(\d+m)?(\d+d)?(t)?(\d+h)?(\d+m)?(\d+s)?' + match = re.match(regex, value.lower()) + match_len = match.regs[0] + if match_len != tuple([0, len(value)]): + raise ValueError + # simply return value if a valid ISO8601 string is supplied + if match.regs[1] != tuple([-1, -1]) and match.regs[5] != tuple([-1, -1]): + return value + else: + # if shorthand is used, only support days, minutes, hours, seconds + # ensure M is interpretted as minutes + days = _get_substring(match.regs[4]) + minutes = _get_substring(match.regs[6]) or _get_substring(match.regs[3]) + hours = _get_substring(match.regs[7]) + seconds = _get_substring(match.regs[8]) + return 'P{}T{}{}{}'.format(days, minutes, hours, seconds).upper() + + +# pylint: disable=too-few-public-methods +class ConditionAction(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + from azure.mgmt.monitor.models import ThresholdRuleCondition, RuleMetricDataSource + # get default description if not specified + if namespace.description is None: + namespace.description = ' '.join(values) + if len(values) == 1: + # workaround because CMD.exe eats > character... Allows condition to be + # specified as a quoted expression + values = values[0].split(' ') + if len(values) < 5: + raise CLIError('usage error: --condition METRIC {>,>=,<,<=} THRESHOLD {avg,min,max,total,last} DURATION') + metric_name = ' '.join(values[:-4]) + operator = operator_map[values[-4]] + threshold = int(values[-3]) + aggregation = aggregation_map[values[-2].lower()] + window = period_type(values[-1]) + metric = RuleMetricDataSource(None, metric_name) # target URI will be filled in later + condition = ThresholdRuleCondition(operator, threshold, metric, window, aggregation) + namespace.condition = condition + + +# pylint: disable=protected-access +class AlertAddAction(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AlertAddAction, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + _type = values[0].lower() + action = None + if _type == 'email': + from azure.mgmt.monitor.models import RuleEmailAction + action = RuleEmailAction(custom_emails=values[1:]) + elif _type == 'webhook': + from azure.mgmt.monitor.models import RuleWebhookAction + uri = values[1] + try: + properties = dict(x.split('=', 1) for x in values[2:]) + except ValueError: + raise CLIError('usage error: {} webhook URI [KEY=VALUE ...]'.format(option_string)) + action = RuleWebhookAction(uri, properties) # pylint: disable=redefined-variable-type + else: + raise CLIError('usage error: {} TYPE KEY [ARGS]'.format(option_string)) + + return action + + +class AlertRemoveAction(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AlertRemoveAction, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + # TYPE is artificially enforced to create consistency with the --add-action argument + # but it could be enhanced to do additional validation in the future. + _type = values[0].lower() + if _type not in ['email', 'webhook']: + raise CLIError('usage error: {} TYPE KEY [KEY ...]'.format(option_string)) + return values[1:] diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/commands.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/commands.py index 620c42ba1..2abc7c7f4 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/commands.py +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/commands.py @@ -3,99 +3,92 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from ._client_factory import (get_monitor_alert_rules_operation, - get_monitor_alert_rule_incidents_operation, - get_monitor_log_profiles_operation, - get_monitor_autoscale_settings_operation, - get_monitor_diagnostic_settings_operation, - get_monitor_activity_log_operation, - get_monitor_metric_definitions_operation, - get_monitor_metrics_operation) -from azure.cli.core.sdk.util import (ServiceGroup, create_service_adapter) +# pylint: disable=line-too-long + +from ._client_factory import \ + (cf_alert_rules, cf_metrics, cf_metric_def, cf_alert_rule_incidents, cf_log_profiles, + cf_autoscale, cf_diagnostics, cf_activity_log) +from ._exception_handler import monitor_exception_handler +from azure.cli.core.commands import cli_command +from azure.cli.core.commands.arm import cli_generic_update_command + + +def monitor_command(*args, **kwargs): + cli_command(*args, exception_handler=monitor_exception_handler, **kwargs) # MANAGEMENT COMMANDS -custom_operations = create_service_adapter('azure.cli.command_modules.monitor.custom') - -alert_rules_operations = create_service_adapter( - 'azure.mgmt.monitor.operations.alert_rules_operations', - 'AlertRulesOperations') - -with ServiceGroup(__name__, get_monitor_alert_rules_operation, alert_rules_operations) as s: - with s.group('monitor alert-rules') as c: - c.command('create', 'create_or_update') - c.command('delete', 'delete') - c.command('show', 'get') - c.command('list', 'list_by_resource_group') - c.generic_update_command('update', 'get', 'create_or_update') - -alert_rule_incidents_operations = create_service_adapter( - 'azure.mgmt.monitor.operations.alert_rule_incidents_operations', - 'AlertRuleIncidentsOperations') - -with ServiceGroup(__name__, get_monitor_alert_rule_incidents_operation, - alert_rule_incidents_operations) as s: - with s.group('monitor alert-rule-incidents') as c: - c.command('show', 'get') - c.command('list', 'list_by_alert_rule') - -log_profiles_operations = create_service_adapter( - 'azure.mgmt.monitor.operations.log_profiles_operations', - 'LogProfilesOperations') - -with ServiceGroup(__name__, get_monitor_log_profiles_operation, - log_profiles_operations) as s: - with s.group('monitor log-profiles') as c: - c.command('create', 'create_or_update') - c.command('delete', 'delete') - c.command('show', 'get') - c.command('list', 'list') - c.generic_update_command('update', 'get', 'create_or_update') - -diagnostic_settings_operations = create_service_adapter( - 'azure.mgmt.monitor.operations.service_diagnostic_settings_operations', - 'ServiceDiagnosticSettingsOperations') - -with ServiceGroup(__name__, get_monitor_diagnostic_settings_operation, - diagnostic_settings_operations) as s: - with s.group('monitor diagnostic-settings') as c: - c.command('show', 'get') - c.generic_update_command('update', 'get', 'create_or_update') - -with ServiceGroup(__name__, get_monitor_diagnostic_settings_operation, custom_operations) as s: - with s.group('monitor diagnostic-settings') as c: - c.command('create', 'create_diagnostics_settings') - -autoscale_settings_operations = create_service_adapter( - 'azure.mgmt.monitor.operations.autoscale_settings_operations', - 'AutoscaleSettingsOperations') - -with ServiceGroup(__name__, get_monitor_autoscale_settings_operation, - autoscale_settings_operations) as s: - with s.group('monitor autoscale-settings') as c: - c.command('create', 'create_or_update') - c.command('delete', 'delete') - c.command('show', 'get') - c.command('list', 'list_by_resource_group') - c.generic_update_command('update', 'get', 'create_or_update') - -with ServiceGroup(__name__, get_monitor_autoscale_settings_operation, - custom_operations) as s: - with s.group('monitor autoscale-settings') as c: - c.command('get-parameters-template', 'scaffold_autoscale_settings_parameters') - - -# DATA COMMANDS -with ServiceGroup(__name__, get_monitor_activity_log_operation, - custom_operations) as s: - with s.group('monitor activity-log') as c: - c.command('list', 'list_activity_log') - -with ServiceGroup(__name__, get_monitor_metric_definitions_operation, - custom_operations) as s: - with s.group('monitor metric-definitions') as c: - c.command('list', 'list_metric_definitions') - -with ServiceGroup(__name__, get_monitor_metrics_operation, custom_operations) as s: - with s.group('monitor metrics') as c: - c.command('list', 'list_metrics') + +custom_path = 'azure.cli.command_modules.monitor.custom#' + +# region Alerts + +ar_path = 'azure.mgmt.monitor.operations.alert_rules_operations#AlertRulesOperations.' + +monitor_command(__name__, 'monitor alert create', custom_path + 'create_metric_rule', cf_alert_rules) +monitor_command(__name__, 'monitor alert delete', ar_path + 'delete', cf_alert_rules) +monitor_command(__name__, 'monitor alert show', ar_path + 'get', cf_alert_rules) +monitor_command(__name__, 'monitor alert list', ar_path + 'list_by_resource_group', cf_alert_rules) +cli_generic_update_command(__name__, 'monitor alert update', + ar_path + 'get', ar_path + 'create_or_update', cf_alert_rules, + custom_function_op=custom_path + 'update_metric_rule', + exception_handler=monitor_exception_handler) + +ari_path = 'azure.mgmt.monitor.operations.alert_rule_incidents_operations#AlertRuleIncidentsOperations.' +monitor_command(__name__, 'monitor alert show-incident', ari_path + 'get', cf_alert_rule_incidents) +monitor_command(__name__, 'monitor alert list-incidents', ari_path + 'list_by_alert_rule', cf_alert_rule_incidents) + +# endregion + +# region Metrics + +monitor_command(__name__, 'monitor metrics list', custom_path + 'list_metrics', cf_metrics) +monitor_command(__name__, 'monitor metrics list-definitions', custom_path + 'list_metric_definitions', cf_metric_def) + +# endregion + +# region Log Profiles + +lp_path = 'azure.mgmt.monitor.operations.log_profiles_operations#LogProfilesOperations.' +monitor_command(__name__, 'monitor log-profiles create', lp_path + 'create_or_update', cf_log_profiles) +monitor_command(__name__, 'monitor log-profiles delete', lp_path + 'delete', cf_log_profiles) +monitor_command(__name__, 'monitor log-profiles show', lp_path + 'get', cf_log_profiles) +monitor_command(__name__, 'monitor log-profiles list', lp_path + 'list', cf_log_profiles) +cli_generic_update_command(__name__, 'monitor log-profiles update', + lp_path + 'get', lp_path + 'create_or_update', cf_log_profiles, + exception_handler=monitor_exception_handler) + +# endregion + +# region Diagnostic Settings + +diag_path = 'azure.mgmt.monitor.operations.service_diagnostic_settings_operations#ServiceDiagnosticSettingsOperations.' +monitor_command(__name__, 'monitor diagnostic-settings create', custom_path + 'create_diagnostics_settings', cf_diagnostics) +monitor_command(__name__, 'monitor diagnostic-settings show', diag_path + 'get', cf_diagnostics) +cli_generic_update_command(__name__, 'monitor diagnostic-settings update', + diag_path + 'get', diag_path + 'create_or_update', cf_diagnostics, + exception_handler=monitor_exception_handler) + +# endregion + + +# region Autoscale + +autoscale_path = 'azure.mgmt.monitor.operations.autoscale_settings_operations#AutoscaleSettingsOperations.' + +monitor_command(__name__, 'monitor autoscale-settings create', autoscale_path + 'create_or_update', cf_autoscale) +monitor_command(__name__, 'monitor autoscale-settings delete', autoscale_path + 'delete', cf_autoscale) +monitor_command(__name__, 'monitor autoscale-settings show', autoscale_path + 'get', cf_autoscale) +monitor_command(__name__, 'monitor autoscale-settings list', autoscale_path + 'list_by_resource_group', cf_autoscale) +monitor_command(__name__, 'monitor autoscale-settings get-parameters-template', custom_path + 'scaffold_autoscale_settings_parameters', cf_autoscale) +cli_generic_update_command(__name__, 'monitor autoscale-settings update', + autoscale_path + 'get', autoscale_path + 'create_or_update', cf_autoscale, + exception_handler=monitor_exception_handler) + +# endregion + +# region Activity Log + +monitor_command(__name__, 'monitor activity-log list', custom_path + 'list_activity_log', cf_activity_log) + +# endregion diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/custom.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/custom.py index f838dcaf8..6f4d4a14d 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/custom.py +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/custom.py @@ -6,6 +6,7 @@ from __future__ import print_function import datetime import os from azure.cli.core.util import get_file_json, CLIError +from azure.mgmt.monitor.models import ConditionOperator, TimeAggregationOperator # 1 hour in milliseconds DEFAULT_QUERY_TIME_RANGE = 3600000 @@ -13,14 +14,135 @@ DEFAULT_QUERY_TIME_RANGE = 3600000 # ISO format with explicit indication of timezone DATE_TIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ' +# region Alerts + +operator_map = { + '>': ConditionOperator.greater_than.value, + '>=': ConditionOperator.greater_than_or_equal.value, + '<': ConditionOperator.less_than, + '<=': ConditionOperator.less_than_or_equal +} + + +aggregation_map = { + 'avg': TimeAggregationOperator.average.value, + 'min': TimeAggregationOperator.minimum.value, + 'max': TimeAggregationOperator.maximum.value, + 'total': TimeAggregationOperator.total.value, + 'last': TimeAggregationOperator.last.value +} + + +def _parse_actions(actions): + """ Actions come in as a combined list. This method separates the webhook actions into a + separate collection and combines any number of email actions into a single email collection + and a single value for `email_service_owners`. If any email action contains a True value + for `send_to_service_owners` then it is assumed the entire value should be True. """ + from azure.mgmt.monitor.models import RuleEmailAction, RuleWebhookAction + actions = actions or [] + email_service_owners = None + webhooks = [x for x in actions if isinstance(x, RuleWebhookAction)] + custom_emails = set() + for action in actions: + if isinstance(action, RuleEmailAction): + if action.send_to_service_owners: + email_service_owners = True + custom_emails = custom_emails | set(action.custom_emails) + return list(custom_emails), webhooks, email_service_owners + + +def _parse_action_removals(actions): + """ Separates the combined list of keys to remove into webhooks and emails. """ + flattened = list(set([x for sublist in actions for x in sublist])) + emails = [] + webhooks = [] + for item in flattened: + if item.startswith('http://') or item.startswith('https://'): + webhooks.append(item) + else: + emails.append(item) + return emails, webhooks + + +def create_metric_rule(client, resource_group_name, rule_name, target, condition, + description=None, disabled=False, location=None, tags=None, + email_service_owners=False, actions=None): + from azure.mgmt.monitor.models import AlertRuleResource, RuleEmailAction, RuleWebhookAction + condition.data_source.resource_uri = target + custom_emails, webhooks, _ = _parse_actions(actions) + actions = [RuleEmailAction(email_service_owners, custom_emails)] + (webhooks or []) + rule = AlertRuleResource(location, rule_name, not disabled, + condition, tags, description, actions) + return client.create_or_update(resource_group_name, rule_name, rule) + + +def update_metric_rule(instance, target=None, condition=None, description=None, enabled=None, + metric=None, operator=None, threshold=None, aggregation=None, period=None, + tags=None, email_service_owners=None, add_actions=None, remove_actions=None): + # Update general properties + if description is not None: + instance.description = description + if enabled is not None: + instance.is_enabled = enabled + if tags is not None: + instance.tags = tags + + # Update conditions + if condition is not None: + target = target or instance.condition.data_source.resource_uri + instance.condition = condition + + if metric is not None: + instance.condition.data_source.metric_name = metric + if operator is not None: + instance.condition.operator = operator_map[operator] + if threshold is not None: + instance.condition.threshold = threshold + if aggregation is not None: + instance.condition.time_aggregation = aggregation_map[aggregation] + if period is not None: + instance.condition.window_size = period + + if target is not None: + instance.condition.data_source.resource_uri = target + + # Update actions + emails, webhooks, curr_email_service_owners = _parse_actions(instance.actions) + + # process removals + if remove_actions is not None: + removed_emails, removed_webhooks = _parse_action_removals(remove_actions) + emails = [x for x in emails if x not in removed_emails] + webhooks = [x for x in webhooks if x.service_uri not in removed_webhooks] + + # process additions + if add_actions is not None: + added_emails, added_webhooks, _ = _parse_actions(add_actions) + emails = list(set(emails) | set(added_emails)) + webhooks = webhooks + added_webhooks + + # Replace the existing actions array. This potentially restructures rules that were created + # via other methods (Portal, ARM template). However, the functionality of these rules should + # be the same. + from azure.mgmt.monitor.models import RuleEmailAction + if email_service_owners is None: + email_service_owners = curr_email_service_owners + actions = [RuleEmailAction(email_service_owners, emails)] + webhooks + instance.actions = actions + + return instance + +# endregion + -def list_metric_definitions(client, resource_id, metric_names=None): +# pylint: disable=unused-argument +def list_metric_definitions(client, resource, resource_group_name=None, metric_names=None): '''Commands to manage metric definitions. :param str resource_id: The identifier of the resource :param str metric_names: The list of metric names ''' odata_filter = _metric_names_filter_builder(metric_names) - metric_definitions = client.list(resource_id, filter=odata_filter) + metric_definitions = client.list(resource, filter=odata_filter) return list(metric_definitions) @@ -34,7 +156,8 @@ def _metric_names_filter_builder(metric_names=None): return ' or '.join(filters) -def list_metrics(client, resource_id, time_grain, +# pylint: disable=unused-argument +def list_metrics(client, resource, time_grain, resource_group_name=None, start_time=None, end_time=None, metric_names=None): '''Lists the metric values for a resource. :param str resource_id: The identifier of the resource @@ -49,7 +172,7 @@ def list_metrics(client, resource_id, time_grain, :param str metric_names: The space separated list of metric names ''' odata_filter = _metrics_odata_filter_builder(time_grain, start_time, end_time, metric_names) - metrics = client.list(resource_id, filter=odata_filter) + metrics = client.list(resource, filter=odata_filter) return list(metrics) diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/params.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/params.py index 460194968..a42b1b0d5 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/params.py +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/params.py @@ -5,39 +5,84 @@ from azure.cli.core.sdk.util import ParametersContext from azure.cli.core.util import get_json_object -from azure.cli.command_modules.monitor.validators import (validate_diagnostic_settings) +from azure.cli.core.commands import \ + (CliArgumentType, register_cli_argument, register_extra_cli_argument) +from azure.cli.core.commands.parameters import \ + (location_type, enum_choice_list, tags_type, three_state_flag) +from azure.cli.core.commands.validators import get_default_location_from_resource_group -with ParametersContext(command='monitor alert-rules') as c: - c.register_alias('name', ('--azure-resource-name',)) - c.register_alias('rule_name', ('--name', '-n')) +from azure.cli.command_modules.monitor.actions import \ + (AlertAddAction, AlertRemoveAction, ConditionAction, period_type) +from azure.cli.command_modules.monitor.custom import operator_map, aggregation_map +from azure.cli.command_modules.monitor.validators import \ + (validate_diagnostic_settings, get_target_resource_validator) +from azure.mgmt.monitor.models.monitor_management_client_enums import \ + (ConditionOperator, TimeAggregationOperator) +from azure.mgmt.monitor.models import (LogProfileResource, RetentionPolicy) -with ParametersContext(command='monitor alert-rules create') as c: - from azure.mgmt.monitor.models.alert_rule_resource import AlertRuleResource +# pylint: disable=line-too-long - c.expand('parameters', AlertRuleResource) - c.register('condition', ('--condition',), - type=get_json_object, - help='JSON encoded condition configuration. Use @{file} to load from a file.') - c.register('actions', ('--actions',), - type=get_json_object, - help='JSON encoded array of actions that are performed when the alert ' - 'rule becomes active, and when an alert condition is resolved. ' - 'Use @{file} to load from a file.') -with ParametersContext(command='monitor alert-rules show') as c: - c.argument('rule_name', id_part='name') +def register_resource_parameter(command, dest, arg_group=None, required=True): + """ Helper method to add the extra parameters needed to support specifying name or ID + for target resources. """ + register_cli_argument(command, dest, options_list=['--{}'.format(dest)], arg_group=arg_group, required=required, validator=get_target_resource_validator(dest, required), help="Name or ID of the target resource.") + register_extra_cli_argument(command, 'namespace', options_list=['--{}-namespace'.format(dest)], arg_group=arg_group, help="Target resource provider namespace.") + register_extra_cli_argument(command, 'parent', options_list=['--{}-parent'.format(dest)], arg_group=arg_group, help="Target resource parent path, if applicable.") + register_extra_cli_argument(command, 'resource_type', options_list=['--{}-type'.format(dest)], arg_group=arg_group, help="Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines)')") -with ParametersContext(command='monitor alert-rules delete') as c: - c.argument('rule_name', id_part='name') -# https://github.com/Azure/azure-rest-api-specs/issues/1017 -with ParametersContext(command='monitor alert-rules list') as c: - c.ignore('filter') +name_arg_type = CliArgumentType(options_list=['--name', '-n'], metavar='NAME') + +register_cli_argument('monitor', 'location', location_type, validator=get_default_location_from_resource_group) +register_cli_argument('monitor', 'tags', tags_type) + +# region Alerts + +register_cli_argument('monitor alert', 'rule_name', name_arg_type, id_part='name', help='Name of the alert rule.') -with ParametersContext(command='monitor alert-rule-incidents') as c: - c.register_alias('incident_name', ('--name', '-n')) +register_cli_argument('monitor alert create', 'rule_name', name_arg_type, id_part='name', help='Name of the alert rule.') +register_cli_argument('monitor alert create', 'custom_emails', nargs='+', arg_group='Action') +register_cli_argument('monitor alert create', 'disabled', **three_state_flag()) +register_cli_argument('monitor alert create', 'email_service_owners', arg_group='Action', **three_state_flag()) +register_cli_argument('monitor alert create', 'actions', options_list=['--action', '-a'], action=AlertAddAction, nargs='+', arg_group='Action') +register_cli_argument('monitor alert create', 'condition', action=ConditionAction, nargs='+') +register_cli_argument('monitor alert create', 'metric_name', arg_group='Condition') +register_cli_argument('monitor alert create', 'operator', arg_group='Condition', **enum_choice_list(ConditionOperator)) +register_cli_argument('monitor alert create', 'threshold', arg_group='Condition') +register_cli_argument('monitor alert create', 'time_aggregation', arg_group='Condition', **enum_choice_list(TimeAggregationOperator)) +register_cli_argument('monitor alert create', 'window_size', arg_group='Condition') +register_resource_parameter('monitor alert create', 'target', 'Target Resource') + +register_cli_argument('monitor alert update', 'rule_name', name_arg_type, id_part='name', help='Name of the alert rule.') +register_cli_argument('monitor alert update', 'email_service_owners', arg_group='Action', **three_state_flag()) +register_cli_argument('monitor alert update', 'add_actions', options_list=['--add-action', '-a'], nargs='+', action=AlertAddAction, arg_group='Action') +register_cli_argument('monitor alert update', 'remove_actions', options_list=['--remove-action', '-r'], nargs='+', action=AlertRemoveAction, arg_group='Action') +register_cli_argument('monitor alert update', 'condition', action=ConditionAction, nargs='+', arg_group='Condition') +register_cli_argument('monitor alert update', 'metric', arg_group='Condition') +register_cli_argument('monitor alert update', 'operator', arg_group='Condition', **enum_choice_list(operator_map.keys())) +register_cli_argument('monitor alert update', 'threshold', arg_group='Condition') +register_cli_argument('monitor alert update', 'aggregation', arg_group='Condition', **enum_choice_list(aggregation_map.keys())) +register_cli_argument('monitor alert update', 'period', type=period_type, arg_group='Condition') +register_resource_parameter('monitor alert update', 'target', 'Target Resource', required=False) + +for item in ['show-incident', 'list-incidents']: + register_cli_argument('monitor alert {}'.format(item), 'rule_name', options_list=['--rule-name'], id_part='name') + register_cli_argument('monitor alert {}'.format(item), 'incident_name', name_arg_type, id_part='child_name') + +register_cli_argument('monitor alert list-incidents', 'rule_name', options_list=['--rule-name'], id_part=None) + +# endregion + +# region Metrics + +for item in ['list', 'list-definitions']: + register_resource_parameter('monitor metrics {}'.format(item), 'resource', 'Target Resource') + register_cli_argument('monitor metrics {}'.format(item), 'resource_group_name', arg_group='Target Resource') + +# endregion with ParametersContext(command='monitor autoscale-settings') as c: c.register_alias('name', ('--azure-resource-name',)) c.register_alias('autoscale_setting_name', ('--name', '-n')) @@ -78,9 +123,6 @@ with ParametersContext(command='monitor log-profiles') as c: c.register_alias('log_profile_name', ('--name', '-n')) with ParametersContext(command='monitor log-profiles create') as c: - from azure.mgmt.monitor.models.log_profile_resource import LogProfileResource - from azure.mgmt.monitor.models.retention_policy import RetentionPolicy - c.register_alias('name', ('--log-profile-name',)) c.expand('retention_policy', RetentionPolicy) c.expand('parameters', LogProfileResource) diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py index 1cd23eebb..292414d18 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py +++ b/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py @@ -7,6 +7,41 @@ from azure.cli.core.commands.arm import is_valid_resource_id, resource_id, parse from azure.cli.core.util import CLIError +def get_target_resource_validator(dest, required): + def _validator(namespace): + name_or_id = getattr(namespace, dest) + rg = namespace.resource_group_name + res_ns = namespace.namespace + parent = namespace.parent + res_type = namespace.resource_type + + usage_error = CLIError('usage error: --{0} ID | --{0} NAME --resource-group NAME ' + '--{0}-namespace NAMESPACE [--{0}-parent PARENT] ' + '[--{0}-type TYPE]'.format(dest)) + if not name_or_id and required: + raise usage_error + elif name_or_id: + if is_valid_resource_id(name_or_id) and any((res_ns, parent, res_type)): + raise usage_error + elif not is_valid_resource_id(name_or_id): + from azure.cli.core.commands.client_factory import get_subscription_id + if res_type and '/' in res_type: + res_ns = res_ns or res_type.rsplit('/', 1)[0] + res_type = res_type.rsplit('/', 1)[1] + if not all((rg, res_ns, res_type, name_or_id)): + raise usage_error + + setattr(namespace, dest, + '/subscriptions/{}/resourceGroups/{}/providers/{}/{}{}/{}'.format( + get_subscription_id(), rg, res_ns, parent + '/' if parent else '', + res_type, name_or_id)) + + del namespace.namespace + del namespace.parent + del namespace.resource_type + return _validator + + # pylint: disable=line-too-long def validate_diagnostic_settings(namespace): from azure.cli.core.commands.client_factory import get_subscription_id diff --git a/src/command_modules/azure-cli-network/HISTORY.rst b/src/command_modules/azure-cli-network/HISTORY.rst index 4546398cc..1c3d7867a 100644 --- a/src/command_modules/azure-cli-network/HISTORY.rst +++ b/src/command_modules/azure-cli-network/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +unreleased +++++++++++++++++++ + +* `network watcher show-topology`: Fix bug with location defaulting logic. + 2.0.6 (2017-05-09) ++++++++++++++++++ diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py index 9946f272c..30254e8be 100644 --- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py +++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py @@ -729,11 +729,10 @@ def process_nw_topology_namespace(namespace): location = namespace.location if not location: - resource_client = \ get_mgmt_service_client(ResourceType.MGMT_RESOURCE_RESOURCES).resource_groups resource_group = resource_client.get(namespace.target_resource_group_name) - location = resource_group.location # pylint: disable=no-member + namespace.location = resource_group.location # pylint: disable=no-member get_network_watcher_from_location( watcher_name='network_watcher_name', rg_name='resource_group_name')(namespace)
conditions JSON format required is not syntactically correct JSON ### Description **Outline the issue here:** The only JSON which the Azure cloud will accept for creating a Monitoring rule is as below: { "dataSource": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "resourceUri": "/subscriptions/your_subscription/resourceGroups/your_resource_group/providers/Microsoft.Compute/virtualMachines/hcm99mon01", "metricName": "Percentage CPU", }, "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "threshold" : 60, "operator": "GreaterThan", "windowSize" : "PT5M", "timeAggregation": "Average" } The comma after "metricName": "Percentage CPU", is not correct JSON as there are no items following the comma. Yet the Azure cloud will say "poorly formed request" when the comma is removed. The JSON code above will work in Azure cloud to create a metric based rule. But will fail JSON validation at the JSON validation LINT site: https://jsonlint.com/ --- ### Environment summary **Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly) Answer here: Nightly then installed public / bash **CLI Version:** What version of the CLI and modules are installed? (Use `az --version`) Answer here: 3.0.2 Monitor 0.0.3 **OS Version:** What OS and version are you using? Answer here: macOS Sierra **Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows) Answer here: csh
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-monitor/tests/recordings/test_monitor.yaml b/src/command_modules/azure-cli-monitor/tests/recordings/test_monitor.yaml new file mode 100644 index 000000000..8eac5a22c --- /dev/null +++ b/src/command_modules/azure-cli-monitor/tests/recordings/test_monitor.yaml @@ -0,0 +1,1241 @@ +interactions: +- request: + body: '{"tags": {"use": "az-test"}, "location": "westus"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001","name":"cli_test_monitor000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:27:20 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001","name":"cli_test_monitor000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:27:21 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Connection: [close] + Host: [raw.githubusercontent.com] + User-Agent: [Python-urllib/3.5] + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json + response: + body: {string: "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ + ,\n \"contentVersion\":\"1.0.0.0\",\n \"parameters\":{},\n \"variables\"\ + :{},\n \"resources\":[],\n\n \"outputs\":{\n \"aliases\":{\n \"\ + type\":\"object\",\n \"value\":{\n\n \"Linux\":{\n \"\ + CentOS\":{\n \"publisher\":\"OpenLogic\",\n \"offer\"\ + :\"CentOS\",\n \"sku\":\"7.3\",\n \"version\":\"latest\"\ + \n },\n \"CoreOS\":{\n \"publisher\":\"CoreOS\"\ + ,\n \"offer\":\"CoreOS\",\n \"sku\":\"Stable\",\n \ + \ \"version\":\"latest\"\n },\n \"Debian\":{\n\ + \ \"publisher\":\"credativ\",\n \"offer\":\"Debian\"\ + ,\n \"sku\":\"8\",\n \"version\":\"latest\"\n \ + \ },\n \"openSUSE-Leap\": {\n \"publisher\":\"SUSE\"\ + ,\n \"offer\":\"openSUSE-Leap\",\n \"sku\":\"42.2\"\ + ,\n \"version\": \"latest\"\n },\n \"RHEL\":{\n\ + \ \"publisher\":\"RedHat\",\n \"offer\":\"RHEL\",\n\ + \ \"sku\":\"7.3\",\n \"version\":\"latest\"\n \ + \ },\n \"SLES\":{\n \"publisher\":\"SUSE\",\n \ + \ \"offer\":\"SLES\",\n \"sku\":\"12-SP2\",\n \ + \ \"version\":\"latest\"\n },\n \"UbuntuLTS\":{\n \ + \ \"publisher\":\"Canonical\",\n \"offer\":\"UbuntuServer\"\ + ,\n \"sku\":\"16.04-LTS\",\n \"version\":\"latest\"\n\ + \ }\n },\n\n \"Windows\":{\n \"Win2016Datacenter\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2016-Datacenter\",\n \ + \ \"version\":\"latest\"\n },\n \"Win2012R2Datacenter\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2012-R2-Datacenter\",\n\ + \ \"version\":\"latest\"\n },\n \"Win2012Datacenter\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2012-Datacenter\",\n \ + \ \"version\":\"latest\"\n },\n \"Win2008R2SP1\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2008-R2-SP1\",\n \ + \ \"version\":\"latest\"\n }\n }\n }\n }\n }\n\ + }\n"} + headers: + accept-ranges: [bytes] + access-control-allow-origin: ['*'] + cache-control: [max-age=300] + connection: [close] + content-length: ['2235'] + content-security-policy: [default-src 'none'; style-src 'unsafe-inline'] + content-type: [text/plain; charset=utf-8] + date: ['Tue, 16 May 2017 21:27:21 GMT'] + etag: ['"d6824855d13e27c5258a680eb60f635d088fd05e"'] + expires: ['Tue, 16 May 2017 21:32:21 GMT'] + source-age: ['0'] + strict-transport-security: [max-age=31536000] + vary: ['Authorization,Accept-Encoding'] + via: [1.1 varnish] + x-cache: [MISS] + x-cache-hits: ['0'] + x-content-type-options: [nosniff] + x-fastly-request-id: [9c036cbbaaff7302979f64509adf7fb65e855b1b] + x-frame-options: [deny] + x-geo-block-list: [''] + x-github-request-id: ['647C:4019:466F47C:495454A:591B6EB9'] + x-served-by: [cache-sea1025-SEA] + x-timer: ['S1494970042.861616,VS0,VE78'] + x-xss-protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/virtualNetworks?api-version=2017-03-01 + response: + body: {string: '{"value":[]}'} + headers: + cache-control: [no-cache] + content-length: ['12'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:27:21 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"template": {"variables": {}, "outputs": {}, "parameters": + {}, "contentVersion": "1.0.0.0", "resources": [{"name": "vm1VNET", "tags": {}, + "type": "Microsoft.Network/virtualNetworks", "location": "westus", "properties": + {"subnets": [{"properties": {"addressPrefix": "10.0.0.0/24"}, "name": "vm1Subnet"}], + "addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}}, "apiVersion": "2015-06-15", + "dependsOn": []}, {"name": "vm1NSG", "tags": {}, "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2015-06-15", "properties": {"securityRules": [{"properties": + {"direction": "Inbound", "sourcePortRange": "*", "destinationAddressPrefix": + "*", "access": "Allow", "priority": 1000, "sourceAddressPrefix": "*", "protocol": + "Tcp", "destinationPortRange": "22"}, "name": "default-allow-ssh"}]}, "location": + "westus", "dependsOn": []}, {"name": "vm1PublicIP", "tags": {}, "type": "Microsoft.Network/publicIPAddresses", + "apiVersion": "2015-06-15", "properties": {"publicIPAllocationMethod": "dynamic"}, + "location": "westus", "dependsOn": []}, {"name": "vm1VMNic", "tags": {}, "type": + "Microsoft.Network/networkInterfaces", "apiVersion": "2015-06-15", "properties": + {"ipConfigurations": [{"properties": {"subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet"}, + "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"}}, + "name": "ipconfigvm1"}], "networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}}, + "location": "westus", "dependsOn": ["Microsoft.Network/virtualNetworks/vm1VNET", + "Microsoft.Network/networkSecurityGroups/vm1NSG", "Microsoft.Network/publicIpAddresses/vm1PublicIP"]}, + {"name": "vm1", "tags": {}, "type": "Microsoft.Compute/virtualMachines", "apiVersion": + "2016-04-30-preview", "properties": {"storageProfile": {"osDisk": {"createOption": + "fromImage", "caching": null, "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "osdisk_ccsFuak3AF"}, "imageReference": {"version": "latest", "offer": + "UbuntuServer", "sku": "16.04-LTS", "publisher": "Canonical"}}, "osProfile": + {"linuxConfiguration": {"disablePasswordAuthentication": true, "ssh": {"publicKeys": + [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N", + "path": "/home/trpresco/.ssh/authorized_keys"}]}}, "computerName": "vm1", "adminUsername": + "trpresco"}, "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"}]}, + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}}, "location": "westus", "dependsOn": + ["Microsoft.Network/networkInterfaces/vm1VMNic"]}], "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"}, + "parameters": {}, "mode": "Incremental"}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Length: ['3687'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/vm_deploy_lBbLTLjPfcn0397KjOapCc1k2BqtMVeQ","name":"vm_deploy_lBbLTLjPfcn0397KjOapCc1k2BqtMVeQ","properties":{"templateHash":"719195829845188578","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-05-16T21:27:23.4263869Z","duration":"PT0.57642S","correlationId":"deea0a51-5ef6-473d-9be8-c2b28815aa7a","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}]}}'} + headers: + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/vm_deploy_lBbLTLjPfcn0397KjOapCc1k2BqtMVeQ/operationStatuses/08587066368426276617?api-version=2017-05-10'] + cache-control: [no-cache] + content-length: ['2698'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:27:23 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587066368426276617?api-version=2017-05-10 + response: + body: {string: '{"status":"Running"}'} + headers: + cache-control: [no-cache] + content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:27:53 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587066368426276617?api-version=2017-05-10 + response: + body: {string: '{"status":"Running"}'} + headers: + cache-control: [no-cache] + content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:28:23 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587066368426276617?api-version=2017-05-10 + response: + body: {string: '{"status":"Running"}'} + headers: + cache-control: [no-cache] + content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:28:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587066368426276617?api-version=2017-05-10 + response: + body: {string: '{"status":"Running"}'} + headers: + cache-control: [no-cache] + content-length: ['20'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:24 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587066368426276617?api-version=2017-05-10 + response: + body: {string: '{"status":"Succeeded"}'} + headers: + cache-control: [no-cache] + content-length: ['22'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Resources/deployments/vm_deploy_lBbLTLjPfcn0397KjOapCc1k2BqtMVeQ","name":"vm_deploy_lBbLTLjPfcn0397KjOapCc1k2BqtMVeQ","properties":{"templateHash":"719195829845188578","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-05-16T21:29:39.3379001Z","duration":"PT2M16.4879332S","correlationId":"deea0a51-5ef6-473d-9be8-c2b28815aa7a","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/virtualNetworks/vm1VNET"}]}}'} + headers: + cache-control: [no-cache] + content-length: ['3767'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview&$expand=instanceView + response: + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"eaa22fed-0ce9-4ef4-95f7-4b2687ef5032\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_ccsFuak3AF\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/disks/osdisk_ccsFuak3AF\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ + : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ + : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ + ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ + \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ + : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ + :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ + : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.2.10\",\r\n\ + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ + Ready\",\r\n \"message\": \"Guest Agent is running\",\r\n \ + \ \"time\": \"2017-05-16T21:29:31+00:00\"\r\n }\r\n \ + \ ],\r\n \"extensionHandlers\": []\r\n },\r\n \"statuses\"\ + : [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\ + \n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning\ + \ succeeded\",\r\n \"time\": \"2017-05-16T21:29:27.2746488+00:00\"\ + \r\n },\r\n {\r\n \"code\": \"PowerState/running\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\ + \r\n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ + ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} + headers: + cache-control: [no-cache] + content-length: ['3022'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:55 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 + response: + body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"etag\": \"W/\\\"875c08df-09dc-45da-852a-65ce884c6447\\\"\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"0eaad880-5345-4ce7-9bd9-47d27b9e7ac8\"\ + ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ + ,\r\n \"etag\": \"W/\\\"875c08df-09dc-45da-852a-65ce884c6447\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ + : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ + \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ + \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ + : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ + \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ + internalDomainNameSuffix\": \"naijypgg2gjubdldespkkm5rqd.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-31-34-03\",\r\n \"enableAcceleratedNetworking\"\ + : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ + : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ + \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1\"\ + \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ + \n}"} + headers: + cache-control: [no-cache] + content-length: ['2495'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:55 GMT'] + etag: [W/"875c08df-09dc-45da-852a-65ce884c6447"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [vm create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP?api-version=2017-03-01 + response: + body: {string: "{\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ + ,\r\n \"etag\": \"W/\\\"913f9ae8-8ea2-430d-b2b5-54bfe7d7e9d5\\\"\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"16679c95-f20a-4fff-b220-bcbb80e8d9b1\"\ + ,\r\n \"ipAddress\": \"137.117.21.91\",\r\n \"publicIPAddressVersion\"\ + : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ + : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ + \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\"\r\ + \n}"} + headers: + cache-control: [no-cache] + content-length: ['939'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:55 GMT'] + etag: [W/"913f9ae8-8ea2-430d-b2b5-54bfe7d7e9d5"] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor metrics list-definitions] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricDefinitions?api-version=2016-03-01&$filter= + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions","value":[{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Percentage + CPU","localizedValue":"Percentage CPU"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"Percent","primaryAggregationType":"Average","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Percentage + CPU"},{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Network + In","localizedValue":"Network In"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"Bytes","primaryAggregationType":"Total","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Network + In"},{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Network + Out","localizedValue":"Network Out"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"Bytes","primaryAggregationType":"Total","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Network + Out"},{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Disk + Read Bytes","localizedValue":"Disk Read Bytes"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"Bytes","primaryAggregationType":"Total","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Disk + Read Bytes"},{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Disk + Write Bytes","localizedValue":"Disk Write Bytes"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"Bytes","primaryAggregationType":"Total","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Disk + Write Bytes"},{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Disk + Read Operations/Sec","localizedValue":"Disk Read Operations/Sec"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"CountPerSecond","primaryAggregationType":"Average","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Disk + Read Operations/Sec"},{"resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","name":{"value":"Disk + Write Operations/Sec","localizedValue":"Disk Write Operations/Sec"},"category":"AllMetrics","startTime":"0001-01-01T00:00:00Z","endTime":"0001-01-01T00:00:00Z","unit":"CountPerSecond","primaryAggregationType":"Average","ResourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","ResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricAvailabilities":[{"timeGrain":"PT1M","retention":"P30D"},{"timeGrain":"PT1H","retention":"P30D"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1/providers/microsoft.insights/metricdefinitions/Disk + Write Operations/Sec"}]}'} + headers: + cache-control: [no-cache] + content-length: ['10140'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:56 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001","name":"cli_test_monitor000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:56 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"location": "westus", "properties": {"isEnabled": true, "name": "rule1", + "description": "Percentage CPU > 90 avg 5m", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "sendToServiceOwners": false, "customEmails": []}], "condition": {"threshold": + 90.0, "windowSize": "PT5M", "operator": "GreaterThan", "dataSource": {"metricName": + "Percentage CPU", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert create] + Connection: [keep-alive] + Content-Length: ['794'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"threshold":90.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:29:58.549822Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":[]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['1585'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001","name":"cli_test_monitor000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:29:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"location": "westus", "properties": {"isEnabled": false, "name": "rule2", + "description": "Test Rule 2", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "sendToServiceOwners": false, "customEmails": ["[email protected]", "[email protected]", + "[email protected]"]}], "condition": {"threshold": 60.0, "windowSize": "PT1H", + "operator": "GreaterThanOrEqual", "dataSource": {"metricName": "Percentage CPU", + "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert create] + Connection: [keep-alive] + Content-Length: ['848'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule2?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule2","name":"rule2","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule2","description":"Test + Rule 2","condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":60.0,"windowSize":"PT1H","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:01.236707Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":["[email protected]","[email protected]","[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['1644'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:01 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001","name":"cli_test_monitor000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:02 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"location": "westus", "properties": {"isEnabled": true, "name": "rule3", + "description": "Percentage CPU >= 99 avg 5m", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "sendToServiceOwners": false, "customEmails": []}, {"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", + "properties": {}, "serviceUri": "https://alert.contoso.com?apiKey=value"}, {"odata.type": + "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", "properties": + {"apiKey": "value"}, "serviceUri": "https://contoso.com/alerts"}], "condition": + {"threshold": 99.0, "windowSize": "PT5M", "operator": "GreaterThanOrEqual", + "dataSource": {"metricName": "Percentage CPU", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert create] + Connection: [keep-alive] + Content-Length: ['1115'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule3?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule3","name":"rule3","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule3","description":"Percentage + CPU >= 99 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":99.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:03.2203596Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://contoso.com/alerts","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage","apiKey":"value"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":[]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2508'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:03 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"threshold":90.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:29:58.549822Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":[]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['1585'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:04 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule2?api-version=2016-03-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Tue, 16 May 2017 21:30:05 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule3?api-version=2016-03-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Tue, 16 May 2017 21:30:06 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules?api-version=2016-03-01 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"threshold":90.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:29:58.549822Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":[]}]}}]}'} + headers: + cache-control: [no-cache] + content-length: ['1597'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:07 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"threshold":90.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:29:58.549822Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":[]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['1585'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:07 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"tags": {"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"}, "location": "westus", "properties": + {"isEnabled": true, "name": "rule1", "description": "Percentage CPU > 90 avg + 5m", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "customEmails": ["[email protected]"]}, {"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", + "properties": {}, "serviceUri": "https://alert.contoso.com?apiKey=value"}], + "condition": {"threshold": 85.0, "windowSize": "PT5M", "operator": "GreaterThanOrEqual", + "dataSource": {"metricName": "Percentage CPU", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Length: ['1089'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:10.5609273Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":["[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2079'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:10 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:10.5609273Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":["[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2079'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:10 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"tags": {"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"}, "location": "westus", "properties": + {"isEnabled": true, "name": "rule1", "description": "Percentage CPU > 90 avg + 5m", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "customEmails": ["[email protected]", "[email protected]"]}, {"odata.type": + "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", "properties": + {"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}, "serviceUri": + "https://alert.contoso.com?apiKey=value"}], "condition": {"threshold": 85.0, + "windowSize": "PT5M", "operator": "GreaterThanOrEqual", "dataSource": {"metricName": + "Percentage CPU", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Length: ['1272'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:11.7383668Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":["[email protected]","[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2099'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:11 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:11.7383668Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":["[email protected]","[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2099'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:12 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"tags": {"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"}, "location": "westus", "properties": + {"isEnabled": true, "name": "rule1", "description": "Percentage CPU > 90 avg + 5m", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "sendToServiceOwners": true, "customEmails": ["[email protected]", "[email protected]"]}, + {"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", + "properties": {"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}, "serviceUri": + "https://alert.contoso.com?apiKey=value"}], "condition": {"threshold": 85.0, + "windowSize": "PT5M", "operator": "GreaterThanOrEqual", "dataSource": {"metricName": + "Percentage CPU", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Length: ['1301'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:16.0587829Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","sendToServiceOwners":true,"customEmails":["[email protected]","[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2126'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:16.0587829Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://alert.contoso.com?apiKey=value","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","sendToServiceOwners":true,"customEmails":["[email protected]","[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2126'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:15 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"tags": {"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"}, "location": "westus", "properties": + {"isEnabled": true, "name": "rule1", "description": "Percentage CPU > 90 avg + 5m", "actions": [{"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + "sendToServiceOwners": false, "customEmails": ["[email protected]", "[email protected]"]}, + {"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", + "properties": {"apiKey": "value"}, "serviceUri": "https://contoso.com/alerts"}], + "condition": {"threshold": 85.0, "windowSize": "PT5M", "operator": "GreaterThanOrEqual", + "dataSource": {"metricName": "Percentage CPU", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + "resourceUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1"}, + "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + "timeAggregation": "Average"}}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [monitor alert update] + Connection: [keep-alive] + Content-Length: ['1145'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 monitormanagementclient/0.2.1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1?api-version=2016-03-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/microsoft.insights/alertrules/rule1","name":"rule1","type":"Microsoft.Insights/alertRules","location":"westus","tags":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage"},"properties":{"name":"rule1","description":"Percentage + CPU > 90 avg 5m","isEnabled":true,"condition":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition","dataSource":{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource","resourceUri":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor000001/providers/Microsoft.Compute/virtualMachines/vm1","metricName":"Percentage + CPU"},"operator":"GreaterThanOrEqual","threshold":85.0,"windowSize":"PT5M","timeAggregation":"Average"},"lastUpdatedTime":"2017-05-16T21:30:17.7055681Z","provisioningState":"Succeeded","actions":[{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction","serviceUri":"https://contoso.com/alerts","properties":{"$type":"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, + mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage","apiKey":"value"}},{"$type":"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, + Microsoft.WindowsAzure.Management.Mon.Client","odata.type":"Microsoft.Azure.Management.Insights.Models.RuleEmailAction","customEmails":["[email protected]","[email protected]"]}]}}'} + headers: + cache-control: [no-cache] + content-length: ['2104'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 16 May 2017 21:30:17 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor000001?api-version=2017-05-10 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Tue, 16 May 2017 21:30:17 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGTU9OSVRPUk9PSUlTTjJVNktPRVJMNTZDTTNSTUJLUVBUSHwxM0ZEOTgyRjQxMDlGQUMzLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + retry-after: ['15'] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/tests/test_custom.py b/src/command_modules/azure-cli-monitor/tests/test_custom.py similarity index 66% rename from src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/tests/test_custom.py rename to src/command_modules/azure-cli-monitor/tests/test_custom.py index d4dba006a..ec3cd8fdb 100644 --- a/src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/tests/test_custom.py +++ b/src/command_modules/azure-cli-monitor/tests/test_custom.py @@ -4,6 +4,10 @@ # -------------------------------------------------------------------------------------------- import unittest +try: + import unittest.mock as mock +except ImportError: + import mock import re from azure.cli.core.util import CLIError from azure.cli.command_modules.monitor.custom import (_metric_names_filter_builder, @@ -14,7 +18,8 @@ from azure.cli.command_modules.monitor.custom import (_metric_names_filter_build scaffold_autoscale_settings_parameters) -class CustomCommandTest(unittest.TestCase): +class FilterBuilderTests(unittest.TestCase): + def test_metric_names_filter_builder(self): metric_names = None filter_output = _metric_names_filter_builder(metric_names) @@ -107,3 +112,64 @@ class CustomCommandTest(unittest.TestCase): template = scaffold_autoscale_settings_parameters(None) if not template or not isinstance(template, dict): assert False + + +def _mock_get_subscription_id(): + return '00000000-0000-0000-0000-000000000000' + + +class MonitorNameOrIdTest(unittest.TestCase): + + def _build_namespace(self, name_or_id=None, resource_group=None, provider_namespace=None, parent=None, resource_type=None): + from argparse import Namespace + ns = Namespace() + ns.name_or_id = name_or_id + ns.resource_group_name = resource_group + ns.namespace = provider_namespace + ns.parent = parent + ns.resource_type = resource_type + return ns + + @mock.patch('azure.cli.core.commands.client_factory.get_subscription_id', _mock_get_subscription_id) + def test_monitor_resource_id(self): + from azure.cli.command_modules.monitor.validators import get_target_resource_validator + validator = get_target_resource_validator('name_or_id', True) + + id = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Compute/virtualMachines/vm1' + + # must supply name or ID + ns = self._build_namespace() + with self.assertRaises(CLIError): + validator(ns) + + # must only supply ID or name parameters + ns = self._build_namespace(id, 'my-rg', 'blahblah', 'stuff') + with self.assertRaises(CLIError): + validator(ns) + + # error on invalid ID + ns = self._build_namespace('bad-id') + with self.assertRaises(CLIError): + validator(ns) + + # allow Provider/Type syntax (same as resource commands) + ns = self._build_namespace('vm1', 'my-rg', None, None, 'Microsoft.Compute/virtualMachines') + validator(ns) + self.assertEqual(ns.name_or_id, id) + + # allow Provider and Type separate + ns = self._build_namespace('vm1', 'my-rg', 'Microsoft.Compute', None, 'virtualMachines') + validator(ns) + self.assertEqual(ns.name_or_id, id) + + # verify works with parent + id = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Compute/fakeType/type1/anotherFakeType/type2/virtualMachines/vm1' + ns = self._build_namespace('vm1', 'my-rg', 'Microsoft.Compute', 'fakeType/type1/anotherFakeType/type2', 'virtualMachines') + validator(ns) + self.assertEqual(ns.name_or_id, id) + + # verify extra parameters are removed + self.assertFalse(hasattr(ns, 'resource_name')) + self.assertFalse(hasattr(ns, 'namespace')) + self.assertFalse(hasattr(ns, 'parent')) + self.assertFalse(hasattr(ns, 'resource_type')) diff --git a/src/command_modules/azure-cli-monitor/tests/test_monitor.py b/src/command_modules/azure-cli-monitor/tests/test_monitor.py new file mode 100644 index 000000000..a191b8558 --- /dev/null +++ b/src/command_modules/azure-cli-monitor/tests/test_monitor.py @@ -0,0 +1,105 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import unittest + +from azure.cli.testsdk import ScenarioTest, JMESPathCheck, ResourceGroupPreparer + + +class MonitorTests(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='cli_test_monitor') + def test_monitor(self, resource_group): + + vm = 'vm1' + + vm_json = self.cmd('vm create -g {} -n {} --image UbuntuLTS --admin-password TestPassword11!! --admin-username testadmin --authentication-type password'.format(resource_group, vm)).get_output_in_json() + vm_id = vm_json['id'] + + # catalog command--so just don't fail + self.cmd('monitor metrics list-definitions --resource {} -g {} --resource-type Microsoft.Compute/virtualMachines'.format(vm, resource_group)) + + # test alert commands + rule1 = 'rule1' + rule2 = 'rule2' + rule3 = 'rule3' + webhook1 = 'https://alert.contoso.com?apiKey=value' + webhook2 = 'https://contoso.com/alerts' + self.cmd('monitor alert create -g {} -n {} --target {} --condition "Percentage CPU > 90 avg 5m"'.format(resource_group, rule1, vm_id), checks=[ + JMESPathCheck('actions[0].customEmails', []), + JMESPathCheck('actions[0].sendToServiceOwners', None), + JMESPathCheck('alertRuleResourceName', rule1), + JMESPathCheck('condition.dataSource.metricName', 'Percentage CPU'), + JMESPathCheck('condition.dataSource.resourceUri', vm_id), + JMESPathCheck('condition.threshold', 90.0), + JMESPathCheck('condition.timeAggregation', 'Average'), + JMESPathCheck('condition.windowSize', '0:05:00'), + ]) + self.cmd('monitor alert create -g {} -n {} --target {} --target-namespace Microsoft.Compute --target-type virtualMachines --disabled --condition "Percentage CPU >= 60 avg 1h" --description "Test Rule 2" -a email [email protected] [email protected] [email protected]'.format(resource_group, rule2, vm), checks=[ + JMESPathCheck('length(actions[0].customEmails)', 3), + JMESPathCheck('actions[0].sendToServiceOwners', None), + JMESPathCheck('alertRuleResourceName', rule2), + JMESPathCheck('condition.dataSource.metricName', 'Percentage CPU'), + JMESPathCheck('condition.dataSource.resourceUri', vm_id), + JMESPathCheck('condition.threshold', 60.0), + JMESPathCheck('condition.timeAggregation', 'Average'), + JMESPathCheck('condition.windowSize', '1:00:00'), + JMESPathCheck('isEnabled', None), + JMESPathCheck('description', 'Test Rule 2') + ]) + self.cmd('monitor alert create -g {} -n {} --target {} --condition "Percentage CPU >= 99 avg 5m" --action webhook {} --action webhook {} apiKey=value'.format(resource_group, rule3, vm_id, webhook1, webhook2), checks=[ + JMESPathCheck('alertRuleResourceName', rule3), + JMESPathCheck('condition.dataSource.metricName', 'Percentage CPU'), + JMESPathCheck('condition.dataSource.resourceUri', vm_id), + JMESPathCheck('condition.operator', 'GreaterThanOrEqual'), + JMESPathCheck('condition.threshold', 99.0), + JMESPathCheck('condition.timeAggregation', 'Average'), + JMESPathCheck('condition.windowSize', '0:05:00'), + JMESPathCheck('isEnabled', True), + JMESPathCheck('description', 'Percentage CPU >= 99 avg 5m') + ]) + self.cmd('monitor alert show -g {} -n {}'.format(resource_group, rule1), checks=[ + JMESPathCheck('alertRuleResourceName', rule1) + ]) + + self.cmd('monitor alert delete -g {} -n {}'.format(resource_group, rule2)) + self.cmd('monitor alert delete -g {} -n {}'.format(resource_group, rule3)) + self.cmd('monitor alert list -g {}'.format(resource_group), checks=[ + JMESPathCheck('length(@)', 1) + ]) + + def _check_emails(actions, emails_to_verify, email_service_owners=None): + emails = next((x for x in actions if x['odatatype'].endswith('RuleEmailAction')), None) + custom_emails = emails['customEmails'] + if emails_to_verify is not None: + self.assertEqual(str(emails_to_verify.sort()), str(custom_emails.sort())) + if email_service_owners is not None: + self.assertEqual(emails['sendToServiceOwners'], email_service_owners) + + def _check_webhooks(actions, uris_to_check): + webhooks = [x['serviceUri'] for x in actions if x['odatatype'].endswith('RuleWebhookAction')] + if uris_to_check is not None: + self.assertEqual(webhooks.sort(), uris_to_check.sort()) + + # test updates + result = self.cmd('monitor alert update -g {} -n {} -a email [email protected] -a webhook {} --operator ">=" --threshold 85'.format(resource_group, rule1, webhook1), checks=[ + JMESPathCheck('condition.operator', 'GreaterThanOrEqual'), + JMESPathCheck('condition.threshold', 85.0), + ]).get_output_in_json() + _check_emails(result['actions'], ['[email protected]'], None) + _check_webhooks(result['actions'], [webhook1]) + + result = self.cmd('monitor alert update -g {} -n {} -r email [email protected] -a email [email protected] -a email [email protected]'.format(resource_group, rule1)).get_output_in_json() + _check_emails(result['actions'], ['[email protected]', '[email protected]', '[email protected]'], None) + + result = self.cmd('monitor alert update -g {} -n {} --email-service-owners'.format(resource_group, rule1)).get_output_in_json() + _check_emails(result['actions'], None, True) + + self.cmd('monitor alert update -g {} -n {} --email-service-owners False --remove-action webhook {} --add-action webhook {}'.format(resource_group, rule1, webhook1, webhook2)) + _check_webhooks(result['actions'], [webhook2]) + + +if __name__ == '__main__': + unittest.main() diff --git a/src/command_modules/azure-cli-network/tests/recordings/test_network_watcher.yaml b/src/command_modules/azure-cli-network/tests/recordings/test_network_watcher.yaml index 338a058af..307db7748 100644 --- a/src/command_modules/azure-cli-network/tests/recordings/test_network_watcher.yaml +++ b/src/command_modules/azure-cli-network/tests/recordings/test_network_watcher.yaml @@ -7,94 +7,99 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b5bab27e-245b-11e7-aaa0-a0b3ccf7272a] + x-ms-client-request-id: [289e7a62-3b29-11e7-b711-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"780f3380-5349-41a5-81ed-cd7a4e96ed49\"","type":"Microsoft.Network/networkWatchers","location":"westus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"220a932a-d62d-47f1-8b0d-26a20d23991a\"","type":"Microsoft.Network/networkWatchers","location":"westus2","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"670c995d-bb81-4cfb-bfeb-0f1d0d902b82\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:17 GMT'] + Date: ['Wed, 17 May 2017 17:49:27 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['1073'] - x-ms-original-request-ids: [a05b9d14-6893-4d9b-a257-c31d3855c278, c5bbed0f-ed4c-434f-8808-221f2585619e, - d687f68a-4036-4aa9-aa06-c4c6e16a9b33] + content-length: ['520'] status: {code: 200, message: OK} - request: - body: '{"location": "westus"}' + body: '{"location": "westus2"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['22'] + Content-Length: ['23'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b602a836-245b-11e7-b4b9-a0b3ccf7272a] + x-ms-client-request-id: [28c60290-3b29-11e7-b660-a0b3ccf7272a] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"westus-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ - ,\r\n \"etag\": \"W/\\\"780f3380-5349-41a5-81ed-cd7a4e96ed49\\\"\",\r\n \ - \ \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\": \"westus\"\ + body: {string: "{\r\n \"name\": \"westus2-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher\"\ + ,\r\n \"etag\": \"W/\\\"02ca7f3e-011c-4723-a6e3-ca5252774a5a\\\"\",\r\n \ + \ \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\": \"westus2\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n\ \ \"runningOperationIds\": []\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/05971129-028f-49a0-8123-f0ac8473e0c7?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operations/3a979408-c169-4ea8-8d36-eb6c874befb0?api-version=2017-03-01'] Cache-Control: [no-cache] + Content-Length: ['429'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:17 GMT'] + Date: ['Wed, 17 May 2017 17:49:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['402'] x-ms-ratelimit-remaining-subscription-writes: ['1199'] - status: {code: 200, message: OK} + status: {code: 201, message: Created} - request: - body: '{"location": "westus2"}' + body: '{"location": "westus", "tags": {"foo": "doo"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['23'] + Content-Length: ['46'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b6a62100-245b-11e7-a8fa-a0b3ccf7272a] + x-ms-client-request-id: [29431668-3b29-11e7-9e16-a0b3ccf7272a] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"westus2-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher\"\ - ,\r\n \"etag\": \"W/\\\"220a932a-d62d-47f1-8b0d-26a20d23991a\\\"\",\r\n \ - \ \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\": \"westus2\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n\ - \ \"runningOperationIds\": []\r\n }\r\n}"} + body: {string: "{\r\n \"name\": \"westus-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"64d50082-001f-41e2-9bd2-c57b90281e00\\\"\",\r\n \ + \ \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\": \"westus\"\ + ,\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\n \"properties\": {\r\ + \n \"provisioningState\": \"Succeeded\",\r\n \"runningOperationIds\"\ + : []\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operations/5d3322c0-b870-4e3f-987e-66b2863cd182?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/f141f428-4888-4f45-a405-62f844f1512c?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:17 GMT'] + Date: ['Wed, 17 May 2017 17:49:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['405'] + content-length: ['439'] x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: @@ -105,25 +110,24 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b6d786d4-245b-11e7-a6f3-a0b3ccf7272a] + x-ms-client-request-id: [2980eada-3b29-11e7-9a9a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"780f3380-5349-41a5-81ed-cd7a4e96ed49\"","type":"Microsoft.Network/networkWatchers","location":"westus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"220a932a-d62d-47f1-8b0d-26a20d23991a\"","type":"Microsoft.Network/networkWatchers","location":"westus2","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"64d50082-001f-41e2-9bd2-c57b90281e00\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"02ca7f3e-011c-4723-a6e3-ca5252774a5a\"","type":"Microsoft.Network/networkWatchers","location":"westus2","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:18 GMT'] + Date: ['Wed, 17 May 2017 17:49:28 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['1073'] - x-ms-original-request-ids: [12144127-00cc-46f3-acf6-8eee276b9801, 5988e9ad-537b-4b0b-b1ec-725987a34273, - 40591546-de51-4fb5-a1ef-bb827fd3fe4a] + content-length: ['765'] + x-ms-original-request-ids: [f7152f68-bacd-4bdc-87c8-6bebc4dabcc2, a14638e9-5d2d-4331-a326-c5e0bb7d0f2b] status: {code: 200, message: OK} - request: body: null @@ -133,28 +137,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b72ba8f6-245b-11e7-8c05-a0b3ccf7272a] + x-ms-client-request-id: [29b0b31c-3b29-11e7-8224-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"780f3380-5349-41a5-81ed-cd7a4e96ed49\"","type":"Microsoft.Network/networkWatchers","location":"westus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"220a932a-d62d-47f1-8b0d-26a20d23991a\"","type":"Microsoft.Network/networkWatchers","location":"westus2","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"64d50082-001f-41e2-9bd2-c57b90281e00\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"02ca7f3e-011c-4723-a6e3-ca5252774a5a\"","type":"Microsoft.Network/networkWatchers","location":"westus2","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:18 GMT'] + Date: ['Wed, 17 May 2017 17:49:29 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['1073'] - x-ms-original-request-ids: [b45f3e96-e19d-4f1f-b7e2-73d6f4212c02, 206581e3-0ef4-4f98-bf9e-8845482b28c1, - 06a88aa8-193c-44c4-8a4a-7a30d8a47c1d] + content-length: ['765'] + x-ms-original-request-ids: [cb2b4107-0140-46ad-9bf7-9f3ba4bc600d, 3ec116d8-6cef-4f42-a279-44642cced67e] status: {code: 200, message: OK} - request: - body: '{"tags": {"foo": "doo"}, "location": "westus"}' + body: '{"location": "westus", "tags": {"foo": "doo"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -162,24 +165,24 @@ interactions: Content-Length: ['46'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b771fce6-245b-11e7-8209-a0b3ccf7272a] + x-ms-client-request-id: [29e669e8-3b29-11e7-9ea0-a0b3ccf7272a] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"westus-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ - ,\r\n \"etag\": \"W/\\\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"westus-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"64d50082-001f-41e2-9bd2-c57b90281e00\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\": \"westus\"\ ,\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\n \"properties\": {\r\ \n \"provisioningState\": \"Succeeded\",\r\n \"runningOperationIds\"\ : []\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/594182f2-db8b-41c6-a1ab-10c25ea4c7b3?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/8feea2ee-dfab-442e-a9b1-fc28fedb9ea2?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:19 GMT'] + Date: ['Wed, 17 May 2017 17:49:30 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -187,10 +190,10 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['439'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: - body: '{"tags": {"foo": "doo"}, "location": "westus2"}' + body: '{"location": "westus2", "tags": {"foo": "doo"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -198,32 +201,32 @@ interactions: Content-Length: ['47'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b7ccb102-245b-11e7-a054-a0b3ccf7272a] + x-ms-client-request-id: [2a15d990-3b29-11e7-907c-a0b3ccf7272a] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"westus2-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher\"\ - ,\r\n \"etag\": \"W/\\\"ea4f9434-fdfb-4d7d-b9aa-cc22e999974e\\\"\",\r\n \ + body: {string: "{\r\n \"name\": \"westus2-watcher\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher\"\ + ,\r\n \"etag\": \"W/\\\"1dcbb925-967e-4415-a7ff-1ada8e9d87e2\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\": \"westus2\"\ ,\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\n \"properties\": {\r\ \n \"provisioningState\": \"Succeeded\",\r\n \"runningOperationIds\"\ : []\r\n }\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operations/35e03a6a-9839-41ed-9695-6eabcf642c12?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operations/2263ab1e-c011-4258-8b37-8e7b519e294a?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:20 GMT'] + Date: ['Wed, 17 May 2017 17:49:30 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['442'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + content-length: ['466'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -233,25 +236,24 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b83dc106-245b-11e7-8d26-a0b3ccf7272a] + x-ms-client-request-id: [2a99a028-3b29-11e7-a329-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"ea4f9434-fdfb-4d7d-b9aa-cc22e999974e\"","type":"Microsoft.Network/networkWatchers","location":"westus2","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"64d50082-001f-41e2-9bd2-c57b90281e00\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"1dcbb925-967e-4415-a7ff-1ada8e9d87e2\"","type":"Microsoft.Network/networkWatchers","location":"westus2","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:21 GMT'] + Date: ['Wed, 17 May 2017 17:49:30 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['1115'] - x-ms-original-request-ids: [d847eeab-e414-467f-bcb5-93444abc162c, a0c6b8cb-1045-4174-ab35-cda3f28254c5, - 7e702627-5132-4c82-baa6-7a86c423b3d8] + content-length: ['786'] + x-ms-original-request-ids: [ef7d2a7b-dc71-4327-9808-726e3eb302ad, 839bf2fc-f0eb-4099-ba6b-85196290c87c] status: {code: 200, message: OK} - request: body: null @@ -261,25 +263,24 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b899f0a4-245b-11e7-9bcd-a0b3ccf7272a] + x-ms-client-request-id: [2ad7718a-3b29-11e7-a1c4-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"ea4f9434-fdfb-4d7d-b9aa-cc22e999974e\"","type":"Microsoft.Network/networkWatchers","location":"westus2","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"64d50082-001f-41e2-9bd2-c57b90281e00\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"westus2-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher","etag":"W/\"1dcbb925-967e-4415-a7ff-1ada8e9d87e2\"","type":"Microsoft.Network/networkWatchers","location":"westus2","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:21 GMT'] + Date: ['Wed, 17 May 2017 17:49:31 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['1115'] - x-ms-original-request-ids: [6ef73889-df07-4611-af7d-e8567254e8f7, 5cd047f2-b306-4c71-b42b-b82e77de4898, - 4158d825-c7a8-430c-9830-204420e8e1bc] + content-length: ['786'] + x-ms-original-request-ids: [770eb39d-3081-4080-b4a7-b358897ec3ca, dc1f340a-acb9-47bc-9a2b-48feb9540b35] status: {code: 200, message: OK} - request: body: null @@ -290,21 +291,21 @@ interactions: Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b8e318ec-245b-11e7-bea5-a0b3ccf7272a] + x-ms-client-request-id: [2b05a66c-3b29-11e7-88b5-a0b3ccf7272a] method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus2-watcher?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkWatchers/westus2-watcher?api-version=2017-03-01 response: body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operations/1544fb32-0f04-4d5a-b9e7-1e4b86600e61?api-version=2017-03-01'] + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operations/e04b7f69-2149-4707-b9de-b1d9d332b9cf?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 18 Apr 2017 17:23:21 GMT'] + Date: ['Wed, 17 May 2017 17:49:31 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operationResults/1544fb32-0f04-4d5a-b9e7-1e4b86600e61?api-version=2017-03-01'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus2/operationResults/e04b7f69-2149-4707-b9de-b1d9d332b9cf?api-version=2017-03-01'] Pragma: [no-cache] Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -319,18 +320,18 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b8e318ec-245b-11e7-bea5-a0b3ccf7272a] + x-ms-client-request-id: [2b05a66c-3b29-11e7-88b5-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/1544fb32-0f04-4d5a-b9e7-1e4b86600e61?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/e04b7f69-2149-4707-b9de-b1d9d332b9cf?api-version=2017-03-01 response: body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:32 GMT'] + Date: ['Wed, 17 May 2017 17:49:42 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -347,25 +348,24 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [bf72dd12-245b-11e7-b76a-a0b3ccf7272a] + x-ms-client-request-id: [319481a6-3b29-11e7-8ccc-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"64d50082-001f-41e2-9bd2-c57b90281e00\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:32 GMT'] + Date: ['Wed, 17 May 2017 17:49:42 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [b0a0d4a6-a252-4593-83fb-85f532dd7943, ed803d0c-49f9-468a-a1a7-d4de99b03bbc, - 13b62d9a-9c60-4eec-a771-e63d81a87c28] + content-length: ['385'] + x-ms-original-request-ids: [01cb86b2-0e22-449a-a9ae-45e2502ffce0, 071c4239-852b-46e0-9b0c-b2186730d0ff] status: {code: 200, message: OK} - request: body: null @@ -375,27 +375,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [bfc7de5e-245b-11e7-bb7c-a0b3ccf7272a] + x-ms-client-request-id: [31b0ef3a-3b29-11e7-8aca-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"64d50082-001f-41e2-9bd2-c57b90281e00\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:33 GMT'] + Date: ['Wed, 17 May 2017 17:49:42 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [868d82e9-25e8-4161-a9d1-043808047510, ca0c9be5-eb7b-46f5-9bac-3417ca797730] + content-length: ['385'] + x-ms-original-request-ids: [0454fc69-8d77-4f7b-a16c-5cfb94265213, 4da4abca-1374-4a79-a326-f12c9968fa1e] status: {code: 200, message: OK} - request: - body: '{"kind": "Storage", "location": "westus", "sku": {"name": "Standard_LRS"}}' + body: '{"location": "westus", "kind": "Storage", "sku": {"name": "Standard_LRS"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -404,9 +404,9 @@ interactions: Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c079eb4a-245b-11e7-ac2e-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1?api-version=2016-12-01 response: @@ -414,9 +414,9 @@ interactions: headers: Cache-Control: [no-cache] Content-Length: ['0'] - Date: ['Tue, 18 Apr 2017 17:23:36 GMT'] + Date: ['Wed, 17 May 2017 17:49:43 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/e51e3930-d3c2-4c5f-bcdb-4ae6a7d0c459?monitor=true&api-version=2016-12-01'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] Retry-After: ['17'] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -432,27 +432,24 @@ interactions: Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c079eb4a-245b-11e7-ac2e-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/e51e3930-d3c2-4c5f-bcdb-4ae6a7d0c459?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1","kind":"Storage","location":"westus","name":"clitestnwstorage1","properties":{"creationTime":"2017-04-18T17:23:36.9566350Z","primaryEndpoints":{"blob":"https://clitestnwstorage1.blob.core.windows.net/","file":"https://clitestnwstorage1.file.core.windows.net/","queue":"https://clitestnwstorage1.queue.core.windows.net/","table":"https://clitestnwstorage1.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available","supportsHttpsTrafficOnly":false},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} - - '} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json] - Date: ['Tue, 18 Apr 2017 17:23:54 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:50:01 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['774'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -461,94 +458,52 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd0039dc-245b-11e7-b928-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher?api-version=2017-05-10 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher","name":"cli_test_network_watcher","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:55 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:50:19 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['238'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: - Connection: [close] - Host: [raw.githubusercontent.com] - User-Agent: [Python-urllib/3.5] + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ - ,\n \"contentVersion\":\"1.0.0.0\",\n \"parameters\":{},\n \"variables\"\ - :{},\n \"resources\":[],\n\n \"outputs\":{\n \"aliases\":{\n \"\ - type\":\"object\",\n \"value\":{\n\n \"Linux\":{\n \"\ - CentOS\":{\n \"publisher\":\"OpenLogic\",\n \"offer\"\ - :\"CentOS\",\n \"sku\":\"7.3\",\n \"version\":\"latest\"\ - \n },\n \"CoreOS\":{\n \"publisher\":\"CoreOS\"\ - ,\n \"offer\":\"CoreOS\",\n \"sku\":\"Stable\",\n \ - \ \"version\":\"latest\"\n },\n \"Debian\":{\n\ - \ \"publisher\":\"credativ\",\n \"offer\":\"Debian\"\ - ,\n \"sku\":\"8\",\n \"version\":\"latest\"\n \ - \ },\n \"openSUSE-Leap\": {\n \"publisher\":\"SUSE\"\ - ,\n \"offer\":\"openSUSE-Leap\",\n \"sku\":\"42.2\"\ - ,\n \"version\": \"latest\"\n },\n \"RHEL\":{\n\ - \ \"publisher\":\"RedHat\",\n \"offer\":\"RHEL\",\n\ - \ \"sku\":\"7.3\",\n \"version\":\"latest\"\n \ - \ },\n \"SLES\":{\n \"publisher\":\"SUSE\",\n \ - \ \"offer\":\"SLES\",\n \"sku\":\"12-SP2\",\n \ - \ \"version\":\"latest\"\n },\n \"UbuntuLTS\":{\n \ - \ \"publisher\":\"Canonical\",\n \"offer\":\"UbuntuServer\"\ - ,\n \"sku\":\"16.04-LTS\",\n \"version\":\"latest\"\n\ - \ }\n },\n\n \"Windows\":{\n \"Win2016Datacenter\"\ - :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ - offer\":\"WindowsServer\",\n \"sku\":\"2016-Datacenter\",\n \ - \ \"version\":\"latest\"\n },\n \"Win2012R2Datacenter\"\ - :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ - offer\":\"WindowsServer\",\n \"sku\":\"2012-R2-Datacenter\",\n\ - \ \"version\":\"latest\"\n },\n \"Win2012Datacenter\"\ - :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ - offer\":\"WindowsServer\",\n \"sku\":\"2012-Datacenter\",\n \ - \ \"version\":\"latest\"\n },\n \"Win2008R2SP1\"\ - :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ - offer\":\"WindowsServer\",\n \"sku\":\"2008-R2-SP1\",\n \ - \ \"version\":\"latest\"\n }\n }\n }\n }\n }\n\ - }\n"} + body: {string: ''} headers: - Accept-Ranges: [bytes] - Access-Control-Allow-Origin: ['*'] - Cache-Control: [max-age=300] - Connection: [close] - Content-Length: ['2235'] - Content-Security-Policy: [default-src 'none'; style-src 'unsafe-inline'] - Content-Type: [text/plain; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:56 GMT'] - ETag: ['"d6824855d13e27c5258a680eb60f635d088fd05e"'] - Expires: ['Tue, 18 Apr 2017 17:28:56 GMT'] - Source-Age: ['0'] - Strict-Transport-Security: [max-age=31536000] - Vary: ['Authorization,Accept-Encoding'] - Via: [1.1 varnish] - X-Cache: [MISS] - X-Cache-Hits: ['0'] - X-Content-Type-Options: [nosniff] - X-Fastly-Request-ID: [6fd506e90b0466d7e41f98f0d6d937b284cfbc50] - X-Frame-Options: [deny] - X-Geo-Block-List: [''] - X-GitHub-Request-Id: ['E7DE:04F5:51456B5:5481E9C:58F64BAB'] - X-Served-By: [cache-sea1050-SEA] - X-Timer: ['S1492536236.129848,VS0,VE109'] - X-XSS-Protection: [1; mode=block] - status: {code: 200, message: OK} + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:50:36 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} - request: body: null headers: @@ -557,81 +512,52 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd46a0a4-245b-11e7-9980-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"value":[]}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:56 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:50:54 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['12'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: - body: '{"properties": {"mode": "Incremental", "template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", "resources": [{"type": "Microsoft.Network/virtualNetworks", - "tags": {}, "location": "westus", "name": "vm1VNET", "properties": {"subnets": - [{"properties": {"addressPrefix": "10.0.0.0/24"}, "name": "vm1Subnet"}], "addressSpace": - {"addressPrefixes": ["10.0.0.0/16"]}}, "apiVersion": "2015-06-15", "dependsOn": - []}, {"type": "Microsoft.Network/networkSecurityGroups", "tags": {}, "location": - "westus", "name": "vm1NSG", "dependsOn": [], "properties": {"securityRules": - [{"properties": {"sourcePortRange": "*", "destinationPortRange": "22", "access": - "Allow", "destinationAddressPrefix": "*", "sourceAddressPrefix": "*", "protocol": - "Tcp", "priority": 1000, "direction": "Inbound"}, "name": "default-allow-ssh"}]}, - "apiVersion": "2015-06-15"}, {"type": "Microsoft.Network/publicIPAddresses", - "tags": {}, "location": "westus", "name": "vm1PublicIP", "dependsOn": [], "properties": - {"publicIPAllocationMethod": "dynamic"}, "apiVersion": "2015-06-15"}, {"type": - "Microsoft.Network/networkInterfaces", "tags": {}, "location": "westus", "name": - "vm1VMNic", "dependsOn": ["Microsoft.Network/virtualNetworks/vm1VNET", "Microsoft.Network/networkSecurityGroups/vm1NSG", - "Microsoft.Network/publicIpAddresses/vm1PublicIP"], "properties": {"networkSecurityGroup": - {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}, - "ipConfigurations": [{"properties": {"subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet"}, - "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"}}, - "name": "ipconfigvm1"}]}, "apiVersion": "2015-06-15"}, {"type": "Microsoft.Compute/virtualMachines", - "tags": {}, "location": "westus", "name": "vm1", "dependsOn": ["Microsoft.Network/networkInterfaces/vm1VMNic"], - "properties": {"networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic"}]}, - "storageProfile": {"osDisk": {"createOption": "fromImage", "caching": null, - "managedDisk": {"storageAccountType": "Premium_LRS"}, "name": "osdisk_EF1e9VAb72"}, - "imageReference": {"offer": "UbuntuServer", "version": "latest", "sku": "16.04-LTS", - "publisher": "Canonical"}}, "osProfile": {"linuxConfiguration": {"ssh": {"publicKeys": - [{"path": "/home/trpresco/.ssh/authorized_keys", "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N"}]}, - "disablePasswordAuthentication": true}, "adminUsername": "trpresco", "computerName": - "vm1"}, "hardwareProfile": {"vmSize": "Standard_DS1_v2"}}, "apiVersion": "2016-04-30-preview"}], - "outputs": {}, "variables": {}, "parameters": {}}, "parameters": {}}}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['3507'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd5b6080-245b-11e7-a6b8-a0b3ccf7272a] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10 + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/vm_deploy_BtQtA5NtaP93vKt6AOGfHuNwNZIITzAR","name":"vm_deploy_BtQtA5NtaP93vKt6AOGfHuNwNZIITzAR","properties":{"templateHash":"6887668168770991941","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-04-18T17:23:57.6063245Z","duration":"PT0.6204488S","correlationId":"bd69eddb-3cc0-4be5-993f-c862fb5024b7","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIpAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIpAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}]}}'} + body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/vm_deploy_BtQtA5NtaP93vKt6AOGfHuNwNZIITzAR/operationStatuses/08587090706484917545?api-version=2017-05-10'] Cache-Control: [no-cache] - Content-Length: ['2386'] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:23:56 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:51:11 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] - status: {code: 201, message: Created} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -640,24 +566,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd5b6080-245b-11e7-a6b8-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587090706484917545?api-version=2017-05-10 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"status":"Running"}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:24:27 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:51:29 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['20'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -666,24 +593,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd5b6080-245b-11e7-a6b8-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587090706484917545?api-version=2017-05-10 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"status":"Running"}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:24:57 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:51:46 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['20'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -692,24 +620,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd5b6080-245b-11e7-a6b8-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587090706484917545?api-version=2017-05-10 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"status":"Running"}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:27 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:52:04 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['20'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -718,24 +647,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd5b6080-245b-11e7-a6b8-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587090706484917545?api-version=2017-05-10 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"status":"Succeeded"}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:58 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:52:21 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['22'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -744,24 +674,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 resourcemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [cd5b6080-245b-11e7-a6b8-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/vm_deploy_BtQtA5NtaP93vKt6AOGfHuNwNZIITzAR","name":"vm_deploy_BtQtA5NtaP93vKt6AOGfHuNwNZIITzAR","properties":{"templateHash":"6887668168770991941","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-04-18T17:25:51.8593562Z","duration":"PT1M54.8734805S","correlationId":"bd69eddb-3cc0-4be5-993f-c862fb5024b7","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIpAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIpAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}],"outputs":{},"outputResources":[{"id":"Microsoft.Compute/virtualMachines/vm1"},{"id":"Microsoft.Network/networkInterfaces/vm1VMNic"},{"id":"Microsoft.Network/networkSecurityGroups/vm1NSG"},{"id":"Microsoft.Network/publicIPAddresses/vm1PublicIP"},{"id":"Microsoft.Network/virtualNetworks/vm1VNET"}]}}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:58 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:52:38 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['2688'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -770,60 +701,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [16b63146-245c-11e7-adbc-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?$expand=instanceView&api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ - : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"Unknown\",\r\n\ - \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/Unavailable\"\ - ,\r\n \"level\": \"Warning\",\r\n \"displayStatus\"\ - : \"Not Ready\",\r\n \"message\": \"VM status blob is found but\ - \ not yet populated.\",\r\n \"time\": \"2017-04-18T17:25:59+00:00\"\ - \r\n }\r\n ]\r\n },\r\n \"statuses\": [\r\n \ - \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-04-18T17:25:41.4063635+00:00\"\r\n \ - \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ - \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ - ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:59 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:52:55 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['2887'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -832,49 +728,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [16da07dc-245c-11e7-8242-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"etag\": \"W/\\\"f6aa9cf5-0cba-4ac2-a216-8ceae0e1afcf\\\"\",\r\n \ - \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"bcfed233-7a67-4590-a43c-f81471e3da46\"\ - ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ - ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ - ,\r\n \"etag\": \"W/\\\"f6aa9cf5-0cba-4ac2-a216-8ceae0e1afcf\\\"\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ - ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ - : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ - \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ - \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ - : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ - \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ - internalDomainNameSuffix\": \"yoerbdku5cpuppgm4azb304f0g.dx.internal.cloudapp.net\"\ - \r\n },\r\n \"macAddress\": \"00-0D-3A-36-82-6C\",\r\n \"enableAcceleratedNetworking\"\ - : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ - : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ - \n}"} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:58 GMT'] - ETag: [W/"f6aa9cf5-0cba-4ac2-a216-8ceae0e1afcf"] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:53:13 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['2225'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -883,35 +755,52 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [16fd9cd2-245c-11e7-a836-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ - ,\r\n \"etag\": \"W/\\\"8fe97487-b404-4a43-b601-f064a9bebfee\\\"\",\r\n \ - \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ - \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a8da445e-1b99-457b-b4ad-fa907caa1e2f\"\ - ,\r\n \"ipAddress\": \"13.64.70.192\",\r\n \"publicIPAddressVersion\"\ - : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ - : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ - \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\"\r\ - \n}"} + body: {string: ''} headers: Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:53:30 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:59 GMT'] - ETag: [W/"8fe97487-b404-4a43-b601-f064a9bebfee"] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:53:48 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['848'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -920,60 +809,52 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [172a47f8-245c-11e7-8d82-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?$expand=instanceView&api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ - : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"Unknown\",\r\n\ - \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/Unavailable\"\ - ,\r\n \"level\": \"Warning\",\r\n \"displayStatus\"\ - : \"Not Ready\",\r\n \"message\": \"VM status blob is found but\ - \ not yet populated.\",\r\n \"time\": \"2017-04-18T17:25:59+00:00\"\ - \r\n }\r\n ]\r\n },\r\n \"statuses\": [\r\n \ - \ {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\"\ - ,\r\n \"time\": \"2017-04-18T17:25:41.4063635+00:00\"\r\n \ - \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ - \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\ - \n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ - ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: ''} headers: Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:54:06 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:26:00 GMT'] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:54:23 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['2887'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -982,1358 +863,754 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [174f4412-245c-11e7-a671-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "[\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"\ - 4psa\",\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/4psa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"4ward365\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/4ward365\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"7isolutions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/7isolutions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"a10networks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/a10networks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"abiquo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/abiquo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"accellion\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/accellion\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Acronis\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Acronis\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Acronis.Backup\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Acronis.Backup\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"actian_matrix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/actian_matrix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"actifio\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/actifio\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"active-navigation\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/active-navigation\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"activeeon\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/activeeon\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adam-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adam-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adatao\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adatao\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adobe_test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adobe_test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adra-match\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adra-match\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"advantech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/advantech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"advantech-webaccess\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/advantech-webaccess\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"advellence\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/advellence\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aerospike\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aerospike\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aerospike-database\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aerospike-database\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aimsinnovation\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aimsinnovation\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AIP.Diagnostics.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AIP.Diagnostics.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aiscaler-cache-control-ddos-and-url-rewriting-\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aiscaler-cache-control-ddos-and-url-rewriting-\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"akeron\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/akeron\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"akumina\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/akumina\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alachisoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alachisoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alertlogic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alertlogic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AlertLogic.Extension\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AlertLogic.Extension\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"algebraix-data\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/algebraix-data\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alienvault\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alienvault\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alldigital-brevity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alldigital-brevity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alteryx\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alteryx\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"altiar\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/altiar\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alvao\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alvao\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"analitica\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/analitica\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"angoss\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/angoss\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"apigee\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/apigee\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appcelerator\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appcelerator\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appex-networks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appex-networks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appistry\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appistry\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appscale-marketplace\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appscale-marketplace\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appveyorci\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appveyorci\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appzero\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appzero\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aqua-security\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aqua-security\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"arangodb\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/arangodb\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aras\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aras\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"archive360\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/archive360\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"array_networks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/array_networks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"arvatosystems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/arvatosystems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"asigra\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/asigra\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aspex\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aspex\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aspex-managed-cloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aspex-managed-cloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"atlassian\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/atlassian\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"atmosera\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/atmosera\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"atomicorp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/atomicorp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"attunity_cloudbeam\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/attunity_cloudbeam\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"auraportal\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/auraportal\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"auriq-systems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/auriq-systems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"avds\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/avds\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"avepoint\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/avepoint\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"averesystems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/averesystems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aviatrix-systems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aviatrix-systems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"awingu\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/awingu\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"axinom\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/axinom\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"axway\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/axway\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azul\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azul\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AzureRT.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AzureRT.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azuresyncfusion\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azuresyncfusion\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azuretesting\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azuretesting\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AzureTools1type\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AzureTools1type\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"balabit\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/balabit\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"barracudanetworks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/barracudanetworks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"basho\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/basho\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"batch\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/batch\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bdy\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bdy\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"beyondtrust\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/beyondtrust\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Bitnami\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Bitnami\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bizagi\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bizagi\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"biztalk360\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/biztalk360\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blackberry\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blackberry\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blockapps\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blockapps\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blockchain-foundry\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blockchain-foundry\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blockstack\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blockstack\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bluetalon\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bluetalon\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bmc.ctm\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bmc.ctm\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bmcctm.test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bmcctm.test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"boundlessgeo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/boundlessgeo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"boxless\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/boxless\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"brainshare-it\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/brainshare-it\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"brocade_communications\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/brocade_communications\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bryte\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bryte\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bssw\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bssw\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"buddhalabs\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/buddhalabs\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bugrius\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bugrius\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bwappengine\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bwappengine\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Canonical\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Canonical\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"caringo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/caringo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"catechnologies\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/catechnologies\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cautelalabs\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cautelalabs\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cbrdashboard\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cbrdashboard\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cds\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cds\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"certivox\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/certivox\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cfd-direct\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cfd-direct\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"chain\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/chain\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"checkpoint\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/checkpoint\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"checkpointsystems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/checkpointsystems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"chef-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/chef-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Chef.Bootstrap.WindowsAzure\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Chef.Bootstrap.WindowsAzure\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cherwell\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cherwell\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cipherpoint\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cipherpoint\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"circleci\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/circleci\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cires21\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cires21\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cisco\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cisco\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"citrix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/citrix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clear-linux-project\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clear-linux-project\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"click2cloud-inc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/click2cloud-inc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clickberry\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clickberry\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clouber\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clouber\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloud-cruiser\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloud-cruiser\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudbees\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudbees\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudbees-enterprise-jenkins\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudbees-enterprise-jenkins\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudbolt-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudbolt-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudboost\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudboost\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudcoreo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudcoreo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudcruiser\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudcruiser\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudera\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudera\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudera1qaz2wsx\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudera1qaz2wsx\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudhouse\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudhouse\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudify\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudify\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudlink\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudlink\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CloudLinkEMC.SecureVM\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CloudLinkEMC.SecureVM\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CloudLinkEMC.SecureVM.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CloudLinkEMC.SecureVM.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CloudLinkEMC.SecureVM.Test2\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CloudLinkEMC.SecureVM.Test2\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudsecurity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudsecurity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudsoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudsoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clustrix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clustrix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"codelathe\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/codelathe\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"codenvy\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/codenvy\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"coffingdw\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/coffingdw\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cognosys\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cognosys\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cohesity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cohesity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cohesive\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cohesive\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"commvault\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/commvault\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"companyname-short\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/companyname-short\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"composable\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/composable\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"comunity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/comunity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Confer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Confer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"confluentinc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/confluentinc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"connecting-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/connecting-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"consensys\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/consensys\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"convertigo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/convertigo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"corda\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/corda\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cordis\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cordis\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"corent-technology-pvt\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/corent-technology-pvt\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CoreOS\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CoreOS\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"couchbase\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/couchbase\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"crate-io\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/crate-io\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"credativ\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/credativ\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cristie-software-clonemanager\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cristie-software-clonemanager\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cryptzone\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cryptzone\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"csstest\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/csstest\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ctm.bmc.com\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ctm.bmc.com\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dalet\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dalet\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"danielsol.AzureTools1\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/danielsol.AzureTools1\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Dans.Windows.App\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Dans.Windows.App\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Dans3.Windows.App\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Dans3.Windows.App\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataart\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataart\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datacastle\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datacastle\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datacore\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datacore\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Datadog.Agent\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Datadog.Agent\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataexpeditioninc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataexpeditioninc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataiku\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataiku\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datalayer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datalayer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataliberation\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataliberation\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datastax\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datastax\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datasunrise\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datasunrise\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datometry\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datometry\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"defacto_global_\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/defacto_global_\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dell-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dell-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dellemc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dellemc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dell_software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dell_software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"denyall\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/denyall\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"derdack\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/derdack\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dgsecure\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dgsecure\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"digitaloffice\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/digitaloffice\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"docker\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/docker\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"docscorp-us\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/docscorp-us\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dolbydeveloper\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dolbydeveloper\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dome9\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dome9\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"donovapub\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/donovapub\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"drone\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/drone\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dsi\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dsi\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dundas\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dundas\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dynatrace\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dynatrace\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dynatrace.ruxit\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dynatrace.ruxit\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eastbanctech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eastbanctech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"easyterritory\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/easyterritory\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"edevtech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/edevtech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"egnyte\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/egnyte\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"egress\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/egress\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eip\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eip\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eip-eipower\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eip-eipower\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elastacloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elastacloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elasticbox\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elasticbox\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elecard\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elecard\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"element-it\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/element-it\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elementrem\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elementrem\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elfiqnetworks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elfiqnetworks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eloquera\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eloquera\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"emercoin\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/emercoin\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"enforongo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/enforongo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"enterprise-ethereum-alliance\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/enterprise-ethereum-alliance\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eperi\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eperi\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"equalum\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/equalum\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"equilibrium\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/equilibrium\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ESET\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ESET\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"esri\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/esri\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ethcore\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ethcore\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ethereum\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ethereum\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eurotech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eurotech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eventtracker\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eventtracker\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"evostream-inc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/evostream-inc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"exasol\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/exasol\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"exit-games\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/exit-games\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"expertime\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/expertime\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"f5-networks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/f5-networks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"falconstorsoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/falconstorsoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fidesys\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fidesys\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"filebridge\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/filebridge\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"firehost\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/firehost\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"flexerasoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/flexerasoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"flowforma\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/flowforma\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fluid-mobility\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fluid-mobility\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"foghorn-systems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/foghorn-systems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"folio3-dynamics-services\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/folio3-dynamics-services\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"forscene\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/forscene\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fortinet\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fortinet\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fortycloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fortycloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fptjapan\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fptjapan\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fw\",\r\ - \n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fw\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"g-data-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/g-data-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gbs\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gbs\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gemalto-safenet\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gemalto-safenet\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Gemalto.SafeNet.ProtectV\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Gemalto.SafeNet.ProtectV\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"GitHub\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/GitHub\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gitlab\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gitlab\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"globalscape\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/globalscape\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gordic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gordic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"graphitegtc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/graphitegtc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"greathorn\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/greathorn\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"greensql\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/greensql\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gridgain\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gridgain\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"h2o-ai\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/h2o-ai\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"haivision\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/haivision\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"halobicloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/halobicloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hanu\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hanu\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"HDInsight\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/HDInsight\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hewlett-packard\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hewlett-packard\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hillstone-networks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hillstone-networks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hitachi-solutions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hitachi-solutions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hortonworks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hortonworks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hpe\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hpe\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"HPE.Security.ApplicationDefender\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/HPE.Security.ApplicationDefender\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"humanlogic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/humanlogic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hush-hush\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hush-hush\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hvr\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hvr\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hyperglance\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hyperglance\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hypergrid\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hypergrid\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hytrust\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hytrust\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"iaansys\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/iaansys\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"iamcloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/iamcloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ibabs-eu\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ibabs-eu\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"idcspa\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/idcspa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ikan\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ikan\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"imaginecommunications\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/imaginecommunications\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"imc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/imc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"imperva\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/imperva\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"incredibuild\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/incredibuild\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"infoblox\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/infoblox\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"infolibrarian\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/infolibrarian\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"informatica\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/informatica\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"informatica-cloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/informatica-cloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"informationbuilders\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/informationbuilders\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"infostrat\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/infostrat\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"inriver\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/inriver\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"insitesoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/insitesoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"intel\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/intel\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"intelligent-plant-ltd\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/intelligent-plant-ltd\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"intigua\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/intigua\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"iquest\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/iquest\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ishlangu-load-balancer-adc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ishlangu-load-balancer-adc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"itelios\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/itelios\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jedox\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jedox\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jelastic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jelastic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jetnexus\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jetnexus\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jfrog\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jfrog\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jitterbit_integration\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jitterbit_integration\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kaazing\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kaazing\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kali-linux\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kali-linux\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Kasperskylab.ksa\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Kasperskylab.ksa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kaspersky_lab\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kaspersky_lab\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kelverion\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kelverion\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kemptech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kemptech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kepion\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kepion\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"knime\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/knime\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kollective\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kollective\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"lakesidesoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/lakesidesoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"lansa\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/lansa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"le\",\r\ - \n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/le\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"learningtechnolgy\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/learningtechnolgy\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"lieberlieber\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/lieberlieber\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"liebsoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/liebsoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"literatu\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/literatu\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"loadbalancer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/loadbalancer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logi-analytics\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logi-analytics\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"loginpeople\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/loginpeople\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logiticks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logiticks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logmein\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logmein\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logsign\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logsign\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logtrust\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logtrust\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"looker\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/looker\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"luxoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/luxoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mactores_inc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mactores_inc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"magelia\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/magelia\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"manageengine\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/manageengine\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mapr-technologies\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mapr-technologies\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mariadb\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mariadb\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"marklogic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/marklogic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"massiveanalytic-\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/massiveanalytic-\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mavinglobal\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mavinglobal\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"McAfee.EndpointSecurity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/McAfee.EndpointSecurity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"McAfee.EndpointSecurity.test3\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/McAfee.EndpointSecurity.test3\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"meanio\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/meanio\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mediazenie\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mediazenie\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"memsql\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/memsql\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mendix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mendix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mentalnotes\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mentalnotes\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mesosphere\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mesosphere\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"metavistech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/metavistech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mfiles\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mfiles\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mico\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mico\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"microsoft-ads\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/microsoft-ads\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Applications\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Applications\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Backup.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Backup.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Compute.Security\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Compute.Security\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Diagnostics\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Diagnostics\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Extensions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Extensions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Networking.SDN\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Networking.SDN\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.RecoveryServices\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.RecoveryServices\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.RecoveryServices.SiteRecovery\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.RecoveryServices.SiteRecovery\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Security\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Security\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Security.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Security.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.SiteRecovery.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.SiteRecovery.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Test.Identity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Test.Identity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.WindowsFabric.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.WindowsFabric.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.AzureCAT.AzureEnhancedMonitoring\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.AzureCAT.AzureEnhancedMonitoring\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.AzureCAT.AzureEnhancedMonitoringTest\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.AzureCAT.AzureEnhancedMonitoringTest\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.AzureSecurity.JITAccess\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.AzureSecurity.JITAccess\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.CloudBackup.Workload.Extension\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.CloudBackup.Workload.Extension\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.CloudBackup.Workload.Extension.Edp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.CloudBackup.Workload.Extension.Edp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Compute\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Compute\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.EnterpriseCloud.Monitoring\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.EnterpriseCloud.Monitoring\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.EnterpriseCloud.Monitoring.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.EnterpriseCloud.Monitoring.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Golive.Extensions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Golive.Extensions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.HDInsight.Current\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.HDInsight.Current\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.HpcCompute\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.HpcCompute\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.HpcPack\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.HpcPack\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.ManagedIdentity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.ManagedIdentity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.OSTCExtensions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.OSTCExtensions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.OSTCExtensions.Edp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.OSTCExtensions.Edp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.OSTCExtensions.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.OSTCExtensions.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Powershell\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Powershell\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Powershell.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Powershell.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Powershell.UUID\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Powershell.UUID\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.SqlServer.Managability.IaaS.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.SqlServer.Managability.IaaS.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.SqlServer.Management\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.SqlServer.Management\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.SystemCenter\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.SystemCenter\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Azure.ETWTraceListenerService\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Azure.ETWTraceListenerService\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Azure.RemoteDebug\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Azure.RemoteDebug\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Azure.RemoteDebug.Json\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Azure.RemoteDebug.Json\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.ServiceProfiler\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.ServiceProfiler\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Services\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Services\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Windows.AzureRemoteApp.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Windows.AzureRemoteApp.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Windows.RemoteDesktop\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Windows.RemoteDesktop\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.WindowsAzure.Compute\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.WindowsAzure.Compute\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftAzureSiteRecovery\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftAzureSiteRecovery\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftBizTalkServer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftBizTalkServer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftDynamicsAX\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftDynamicsAX\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftDynamicsGP\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftDynamicsGP\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftDynamicsNAV\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftDynamicsNAV\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftHybridCloudStorage\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftHybridCloudStorage\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftOSTC\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftOSTC\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftRServer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftRServer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftSharePoint\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftSharePoint\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftSQLServer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftSQLServer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftVisualStudio\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftVisualStudio\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServerEssentials\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServerEssentials\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServerHPCPack\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServerHPCPack\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServerRemoteDesktop\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServerRemoteDesktop\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"midvision\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/midvision\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"miraclelinux\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/miraclelinux\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"miracl_linux\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/miracl_linux\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mobilab\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mobilab\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mokxa-technologies\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mokxa-technologies\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"moviemasher\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/moviemasher\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"msopentech\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/msopentech\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"msrazuresapservices\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/msrazuresapservices\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mtnfog\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mtnfog\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mvp-systems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mvp-systems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mxhero\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mxhero\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"my-com\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/my-com\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"namirial\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/namirial\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"narrativescience\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/narrativescience\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nasuni\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nasuni\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ncbi\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ncbi\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ndl\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ndl\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netapp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netapp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netatwork\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netatwork\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netgate\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netgate\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netiq\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netiq\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netsil\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netsil\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netwrix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netwrix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"neusoft-neteye\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/neusoft-neteye\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"new-signature\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/new-signature\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nextlimit\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nextlimit\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nexus\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nexus\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nginxinc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nginxinc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nicepeopleatwork\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nicepeopleatwork\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nodejsapi\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nodejsapi\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nodesource\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nodesource\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"noobaa\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/noobaa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"norsync\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/norsync\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nuxeo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nuxeo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"OctopusDeploy.Tentacle\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/OctopusDeploy.Tentacle\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"officeclipsuite\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/officeclipsuite\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"omega-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/omega-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ooyala\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ooyala\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"op5\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/op5\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opencell\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opencell\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"OpenLogic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/OpenLogic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"openmeap\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/openmeap\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opennebulasystems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opennebulasystems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opentext\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opentext\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opslogix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opslogix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Oracle\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Oracle\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"orckestra\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/orckestra\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"orfast-technologies\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/orfast-technologies\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"orientdb\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/orientdb\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"origam\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/origam\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"osisoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/osisoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"outsystems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/outsystems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"paloaltonetworks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/paloaltonetworks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"panorama-necto\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/panorama-necto\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"panzura-file-system\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/panzura-file-system\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"parallels\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/parallels\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"parasoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/parasoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"passlogy\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/passlogy\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pe-gromenko\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pe-gromenko\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pivotal\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pivotal\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"plesk\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/plesk\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pointmatter\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pointmatter\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"portalarchitects\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/portalarchitects\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"predictionio\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/predictionio\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"predixion\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/predixion\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"prestashop\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/prestashop\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"prime-strategy\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/prime-strategy\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"primesoft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/primesoft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"primestream\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/primestream\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"proarch\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/proarch\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"process-one\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/process-one\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"profisee\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/profisee\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"progelspa\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/progelspa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ptsecurity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ptsecurity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ptv_group\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ptv_group\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"puppet\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/puppet\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"PuppetLabs\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/PuppetLabs\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"PuppetLabs.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/PuppetLabs.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pxlag_swiss\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pxlag_swiss\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pydio\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pydio\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pyramidanalytics\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pyramidanalytics\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qlik\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qlik\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"quales\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/quales\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Qualys\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Qualys\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qualysguard\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qualysguard\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"quasardb\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/quasardb\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qubole\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qubole\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qubole-inc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qubole-inc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"radware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/radware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rancher\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rancher\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rapid7\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rapid7\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"realm\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/realm\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RedHat\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RedHat\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"redpoint-global\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/redpoint-global\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"relevance-lab\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/relevance-lab\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"remotelearner\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/remotelearner\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"res\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/res\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"revolution-analytics\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/revolution-analytics\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RightScaleLinux\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RightScaleLinux\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RightScaleWindowsServer\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RightScaleWindowsServer\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"riverbed\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/riverbed\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RiverbedTechnology\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RiverbedTechnology\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rocketsoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rocketsoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rocket_software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rocket_software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"saama\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/saama\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"saltstack\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/saltstack\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"samsung-sds\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/samsung-sds\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"samsungsds-cello\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/samsungsds-cello\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sap\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sap\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sapho\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sapho\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scalearc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scalearc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scalebase\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scalebase\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scalegrid\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scalegrid\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scsk\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scsk\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"seagate\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/seagate\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"searchblox\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/searchblox\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sensorberg\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sensorberg\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sentryone\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sentryone\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"servoy\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/servoy\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sestek\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sestek\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"shadow-soft\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/shadow-soft\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sharefile\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sharefile\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"shareshiftneeraj.test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/shareshiftneeraj.test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"shavlik\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/shavlik\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sightapps\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sightapps\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"silver-peak-systems\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/silver-peak-systems\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"simmachinesinc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/simmachinesinc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sinefa\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sinefa\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sios_datakeeper\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sios_datakeeper\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sisense\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sisense\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Site24x7\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Site24x7\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"slamby\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/slamby\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"snaplogic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/snaplogic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"snip2code\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/snip2code\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"soasta\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/soasta\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"softnas\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/softnas\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"soha\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/soha\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"solanolabs\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/solanolabs\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"solarwinds\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/solarwinds\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sophos\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sophos\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"spacecurve\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/spacecurve\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"spagobi\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/spagobi\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sphere3d\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sphere3d\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"splunk\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/splunk\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stackato-platform-as-a-service\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stackato-platform-as-a-service\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stackstorm\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stackstorm\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"starwind\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/starwind\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"StatusReport.Diagnostics.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/StatusReport.Diagnostics.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stealthbits\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stealthbits\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"steelhive\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/steelhive\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stonefly\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stonefly\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stormshield\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stormshield\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"storreduce\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/storreduce\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stratalux\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stratalux\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stratus-id\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stratus-id\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"streamsets\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/streamsets\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"striim\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/striim\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sumologic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sumologic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sunview-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sunview-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SUSE\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SUSE\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"suse-byos\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/suse-byos\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.QA\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.QA\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.staging\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.staging\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"symantectest1\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/symantectest1\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTest9\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTest9\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTestLsTestLogonImport\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTestLsTestLogonImport\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTestLsTestSerdefDat\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTestLsTestSerdefDat\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTestRU4\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTestRU4\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"syncfusion\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/syncfusion\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"syncfusionbigdataplatfor\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/syncfusionbigdataplatfor\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"syncfusiondashboard\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/syncfusiondashboard\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tableau\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tableau\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tactic\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tactic\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"talon\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/talon\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"targit\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/targit\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tavendo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tavendo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"techdivision\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/techdivision\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"telepat\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/telepat\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tenable\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tenable\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tentity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tentity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"teradata\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/teradata\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Teradici\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Teradici\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.Gemalto.SafeNet.ProtectV\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.Gemalto.SafeNet.ProtectV\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.HP.AppDefender\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.HP.AppDefender\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.Microsoft.VisualStudio.Services\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.Microsoft.VisualStudio.Services\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.NJHP.AppDefender\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.NJHP.AppDefender\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.TrendMicro.DeepSecurity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.TrendMicro.DeepSecurity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test1.NJHP.AppDefender\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test1.NJHP.AppDefender\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test3.Microsoft.VisualStudio.Services\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test3.Microsoft.VisualStudio.Services\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"thales-vormetric\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/thales-vormetric\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"thinkboxsoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/thinkboxsoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tibco-software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tibco-software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tig\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tig\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tokyosystemhouse\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tokyosystemhouse\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"topdesk\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/topdesk\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"torusware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/torusware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"townsend-security\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/townsend-security\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"transvault\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/transvault\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"trendmicro\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/trendmicro\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"TrendMicro.DeepSecurity\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/TrendMicro.DeepSecurity\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"TrendMicro.PortalProtect\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/TrendMicro.PortalProtect\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tsa-public-service\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tsa-public-service\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"twistlock\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/twistlock\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"typesafe\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/typesafe\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ubeeko\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ubeeko\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ubercloud\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ubercloud\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ulex\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ulex\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unidesk\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unidesk\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unidesk-corp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unidesk-corp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"uniprint-net\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/uniprint-net\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unisys-azuremp-stealth\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unisys-azuremp-stealth\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unitrends\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unitrends\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"usp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/usp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"varnish\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/varnish\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vbot\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vbot\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vecompsoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vecompsoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"veeam\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/veeam\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"velostrata\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/velostrata\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"velostrata-inc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/velostrata-inc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ventify\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ventify\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"veritas\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/veritas\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vertabelo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vertabelo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vidispine\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vidispine\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vidizmo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vidizmo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vintegris\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vintegris\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"viptela\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/viptela\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vircom\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vircom\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"virtualworks\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/virtualworks\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"visionware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/visionware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vision_solutions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vision_solutions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vizixiotplatformretail001\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vizixiotplatformretail001\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vmturbo\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vmturbo\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Vormetric\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Vormetric\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vte\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vte\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"WAD2AI.Diagnostics.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/WAD2AI.Diagnostics.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"WAD2EventHub.Diagnostics.Test\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/WAD2EventHub.Diagnostics.Test\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wallix\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wallix\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"waratek\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/waratek\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wardy-it-solutions\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wardy-it-solutions\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"warewolf-esb\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/warewolf-esb\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"watchfulsoftware\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/watchfulsoftware\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"waves\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/waves\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"websense-apmailpe\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/websense-apmailpe\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wipro-ltd\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wipro-ltd\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wmspanel\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wmspanel\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"workshare-technology\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/workshare-technology\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wowza\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wowza\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xebialabs\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xebialabs\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xfinityinc\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xfinityinc\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xmpro\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xmpro\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xrm\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xrm\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xtremedata\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xtremedata\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"yellowfin\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/yellowfin\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"your-shop-online\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/your-shop-online\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zealcorp\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zealcorp\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zementis\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zementis\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zend\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zend\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zerodown_software\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zerodown_software\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zerto\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zerto\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zoomdata\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zoomdata\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zscaler\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zscaler\"\ - \r\n }\r\n]"} + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:54:40 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:54:58 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:55:15 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:55:33 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:55:50 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:56:07 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:56:25 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:56:42 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:57:00 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:57:17 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:57:35 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:57:52 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:58:10 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:58:27 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:58:44 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:59:02 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:59:20 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:59:37 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 17:59:54 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:00:13 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:00:30 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:00:48 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:01:05 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:01:23 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:01:39 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:01:58 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} headers: Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:02:15 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:25:59 GMT'] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:02:33 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['134255'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2342,30 +1619,52 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [1797fa42-245c-11e7-ac2e-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers/Microsoft.Azure.NetworkWatcher/artifacttypes/vmextension/types?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "[\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"\ - NetworkWatcherAgentLinux\",\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentLinux\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"NetworkWatcherAgentWindows\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentWindows\"\ - \r\n }\r\n]"} + body: {string: ''} headers: Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:02:50 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:26:00 GMT'] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:03:07 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['583'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2374,66 +1673,214 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [17c9485e-245c-11e7-8822-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers/Microsoft.Azure.NetworkWatcher/artifacttypes/vmextension/types/NetworkWatcherAgentLinux/versions?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "[\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"\ - 1.4.13.0\",\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentLinux/Versions/1.4.13.0\"\ - \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"1.4.20.0\"\ - ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentLinux/Versions/1.4.20.0\"\ - \r\n }\r\n]"} + body: {string: ''} headers: Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:03:25 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:26:01 GMT'] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:03:43 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['583'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:04:00 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} - request: - body: '{"properties": {"typeHandlerVersion": "1.4", "type": "NetworkWatcherAgentLinux", - "autoUpgradeMinorVersion": true, "publisher": "Microsoft.Azure.NetworkWatcher"}, - "location": "westus"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['183'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [17f62b6c-245c-11e7-813f-a0b3ccf7272a] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux?api-version=2016-04-30-preview + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Creating\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n}"} + body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/westus/operations/29fb1799-efc4-4913-beec-872453d9f6fb?api-version=2016-04-30-preview'] Cache-Control: [no-cache] - Content-Length: ['547'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:04:18 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:26:02 GMT'] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:04:35 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] - status: {code: 201, message: Created} + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:04:52 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:05:10 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + Cache-Control: [no-cache] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:05:27 GMT'] + Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] + Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2442,28 +1889,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [17f62b6c-245c-11e7-813f-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/29fb1799-efc4-4913-beec-872453d9f6fb?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"startTime\": \"2017-04-18T17:26:01.8600818+00:00\",\r\ - \n \"status\": \"InProgress\",\r\n \"name\": \"29fb1799-efc4-4913-beec-872453d9f6fb\"\ - \r\n}"} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:26:31 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:05:45 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['134'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2472,28 +1916,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [17f62b6c-245c-11e7-813f-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/29fb1799-efc4-4913-beec-872453d9f6fb?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"startTime\": \"2017-04-18T17:26:01.8600818+00:00\",\r\ - \n \"endTime\": \"2017-04-18T17:26:53.659669+00:00\",\r\n \"status\": \"\ - Succeeded\",\r\n \"name\": \"29fb1799-efc4-4913-beec-872453d9f6fb\"\r\n}"} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:02 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:06:02 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['183'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2502,31 +1943,25 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [17f62b6c-245c-11e7-813f-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n}"} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:03 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:06:20 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['548'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2535,98 +1970,52 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [3cf6241c-245c-11e7-8f20-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: ''} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:03 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:06:37 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [93f5dd30-6844-4dc5-8c0b-a35f1861501a, f0ee2b52-588a-4f79-848e-f2b0770bd748] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: - body: '{"targetResourceGroupName": "cli_test_network_watcher"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['61'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [3d2a08a6-245c-11e7-b3d2-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/topology?api-version=2017-03-01 + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"id\": \"83ec6e57-0e58-48b4-9296-01f529de9902\",\r\n \ - \ \"createdDateTime\": \"2017-04-18T17:27:03.0202668Z\",\r\n \"lastModified\"\ - : \"2017-04-18T17:26:42.6238543Z\",\r\n \"resources\": [\r\n {\r\n \ - \ \"name\": \"vm1VNET\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ - \ {\r\n \"name\": \"vm1Subnet\",\r\n \"resourceId\":\ - \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - ,\r\n \"associationType\": \"Contains\"\r\n }\r\n ]\r\ - \n },\r\n {\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": []\r\n \ - \ },\r\n {\r\n \"name\": \"vm1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ - \ {\r\n \"name\": \"vm1VMNic\",\r\n \"resourceId\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"associationType\": \"Contains\"\r\n }\r\n ]\r\ - \n },\r\n {\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ - \ {\r\n \"name\": \"vm1\",\r\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"associationType\": \"Associated\"\r\n },\r\n \ - \ {\r\n \"name\": \"vm1NSG\",\r\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - ,\r\n \"associationType\": \"Associated\"\r\n },\r\n \ - \ {\r\n \"name\": \"vm1Subnet\",\r\n \"resourceId\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ - ,\r\n \"associationType\": \"Associated\"\r\n },\r\n \ - \ {\r\n \"name\": \"vm1PublicIP\",\r\n \"resourceId\"\ - : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ - ,\r\n \"associationType\": \"Associated\"\r\n }\r\n ]\r\ - \n },\r\n {\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ - \ {\r\n \"name\": \"default-allow-ssh\",\r\n \"resourceId\"\ - : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"associationType\": \"Contains\"\r\n }\r\n ]\r\ - \n },\r\n {\r\n \"name\": \"default-allow-ssh\",\r\n \"id\"\ - : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": []\r\n \ - \ },\r\n {\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ - ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ - \ {\r\n \"name\": \"vm1VMNic\",\r\n \"resourceId\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"associationType\": \"Associated\"\r\n }\r\n ]\r\ - \n }\r\n ]\r\n}"} + body: {string: ''} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/4185251f-8a8f-4d78-929a-fb51411511bd?api-version=2017-03-01'] Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:03 GMT'] + Content-Length: ['0'] + Date: ['Wed, 17 May 2017 18:06:55 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/4185251f-8a8f-4d78-929a-fb51411511bd?api-version=2017-03-01'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01'] Pragma: [no-cache] - Retry-After: ['10'] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Retry-After: ['17'] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['4413'] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: body: null headers: @@ -2635,54 +2024,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 storagemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [3d5de122-245c-11e7-a5ce-a0b3ccf7272a] + x-ms-client-request-id: [31d89c1e-3b29-11e7-8c57-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/ded84fd2-c38a-4122-848e-8ddb2c8798ca?monitor=true&api-version=2016-12-01 response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ - : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ - type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ - ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1","kind":"Storage","location":"westus","name":"clitestnwstorage1","properties":{"creationTime":"2017-05-17T17:49:44.5029253Z","primaryEndpoints":{"blob":"https://clitestnwstorage1.blob.core.windows.net/","file":"https://clitestnwstorage1.file.core.windows.net/","queue":"https://clitestnwstorage1.queue.core.windows.net/","table":"https://clitestnwstorage1.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available","supportsHttpsTrafficOnly":false},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} headers: Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:04 GMT'] + Content-Type: [application/json] + Date: ['Wed, 17 May 2017 18:07:12 GMT'] Expires: ['-1'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2729'] + content-length: ['774'] status: {code: 200, message: OK} - request: body: null @@ -2692,89 +2054,176 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [3d7a54b6-245c-11e7-ac45-a0b3ccf7272a] + x-ms-client-request-id: [a5483762-3b2b-11e7-be5a-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher?api-version=2017-05-10 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"c0dd6b55-d81f-4708-a1cc-25fbf5c327a8\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher","name":"cli_test_network_watcher","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:04 GMT'] + Date: ['Wed, 17 May 2017 18:07:13 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [f1c7f5cb-fa8e-42d9-b722-567724eec884, c5610522-b364-4171-a82d-56e3ae3125c9] + content-length: ['238'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Connection: [close] + Host: [raw.githubusercontent.com] + User-Agent: [Python-urllib/3.5] + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json + response: + body: {string: "{\n \"$schema\":\"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\"\ + ,\n \"contentVersion\":\"1.0.0.0\",\n \"parameters\":{},\n \"variables\"\ + :{},\n \"resources\":[],\n\n \"outputs\":{\n \"aliases\":{\n \"\ + type\":\"object\",\n \"value\":{\n\n \"Linux\":{\n \"\ + CentOS\":{\n \"publisher\":\"OpenLogic\",\n \"offer\"\ + :\"CentOS\",\n \"sku\":\"7.3\",\n \"version\":\"latest\"\ + \n },\n \"CoreOS\":{\n \"publisher\":\"CoreOS\"\ + ,\n \"offer\":\"CoreOS\",\n \"sku\":\"Stable\",\n \ + \ \"version\":\"latest\"\n },\n \"Debian\":{\n\ + \ \"publisher\":\"credativ\",\n \"offer\":\"Debian\"\ + ,\n \"sku\":\"8\",\n \"version\":\"latest\"\n \ + \ },\n \"openSUSE-Leap\": {\n \"publisher\":\"SUSE\"\ + ,\n \"offer\":\"openSUSE-Leap\",\n \"sku\":\"42.2\"\ + ,\n \"version\": \"latest\"\n },\n \"RHEL\":{\n\ + \ \"publisher\":\"RedHat\",\n \"offer\":\"RHEL\",\n\ + \ \"sku\":\"7.3\",\n \"version\":\"latest\"\n \ + \ },\n \"SLES\":{\n \"publisher\":\"SUSE\",\n \ + \ \"offer\":\"SLES\",\n \"sku\":\"12-SP2\",\n \ + \ \"version\":\"latest\"\n },\n \"UbuntuLTS\":{\n \ + \ \"publisher\":\"Canonical\",\n \"offer\":\"UbuntuServer\"\ + ,\n \"sku\":\"16.04-LTS\",\n \"version\":\"latest\"\n\ + \ }\n },\n\n \"Windows\":{\n \"Win2016Datacenter\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2016-Datacenter\",\n \ + \ \"version\":\"latest\"\n },\n \"Win2012R2Datacenter\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2012-R2-Datacenter\",\n\ + \ \"version\":\"latest\"\n },\n \"Win2012Datacenter\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2012-Datacenter\",\n \ + \ \"version\":\"latest\"\n },\n \"Win2008R2SP1\"\ + :{\n \"publisher\":\"MicrosoftWindowsServer\",\n \"\ + offer\":\"WindowsServer\",\n \"sku\":\"2008-R2-SP1\",\n \ + \ \"version\":\"latest\"\n }\n }\n }\n }\n }\n\ + }\n"} + headers: + Accept-Ranges: [bytes] + Access-Control-Allow-Origin: ['*'] + Cache-Control: [max-age=300] + Connection: [close] + Content-Length: ['2235'] + Content-Security-Policy: [default-src 'none'; style-src 'unsafe-inline'] + Content-Type: [text/plain; charset=utf-8] + Date: ['Wed, 17 May 2017 18:07:14 GMT'] + ETag: ['"d6824855d13e27c5258a680eb60f635d088fd05e"'] + Expires: ['Wed, 17 May 2017 18:12:14 GMT'] + Source-Age: ['142'] + Strict-Transport-Security: [max-age=31536000] + Vary: ['Authorization,Accept-Encoding'] + Via: [1.1 varnish] + X-Cache: [HIT] + X-Cache-Hits: ['1'] + X-Content-Type-Options: [nosniff] + X-Fastly-Request-ID: [6125d3887259a1ebbf8873042e28ed9967c4eb92] + X-Frame-Options: [deny] + X-Geo-Block-List: [''] + X-GitHub-Request-Id: ['F7B8:AE41:AC84F:B235E:591C90C4'] + X-Served-By: [cache-dfw1824-DFW] + X-Timer: ['S1495044435.596302,VS0,VE1'] + X-XSS-Protection: [1; mode=block] status: {code: 200, message: OK} - request: - body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1", - "localIPAddress": "10.0.0.4", "remoteIPAddress": "100.1.2.3", "localPort": "22", - "protocol": "TCP", "remotePort": "*", "direction": "Inbound"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['312'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [3dcc1f58-245c-11e7-85b7-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/ipFlowVerify?api-version=2017-03-01 + x-ms-client-request-id: [a58ce554-3b2b-11e7-bd26-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks?api-version=2017-03-01 response: - body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"securityRules/default-allow-ssh\"\ - \r\n}"} + body: {string: '{"value":[]}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:14 GMT'] + Date: ['Wed, 17 May 2017 18:07:14 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/a9b4051a-c9e9-4e50-8a58-2d713b0bc883?api-version=2017-03-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['75'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + content-length: ['12'] status: {code: 200, message: OK} - request: - body: null + body: '{"properties": {"mode": "Incremental", "parameters": {}, "template": {"parameters": + {}, "contentVersion": "1.0.0.0", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "outputs": {}, "resources": [{"location": "westus", "tags": {}, "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2015-06-15", "dependsOn": [], "properties": {"addressSpace": + {"addressPrefixes": ["10.0.0.0/16"]}, "subnets": [{"name": "vm1Subnet", "properties": + {"addressPrefix": "10.0.0.0/24"}}]}, "name": "vm1VNET"}, {"location": "westus", + "tags": {}, "type": "Microsoft.Network/networkSecurityGroups", "apiVersion": + "2015-06-15", "dependsOn": [], "properties": {"securityRules": [{"name": "default-allow-ssh", + "properties": {"destinationAddressPrefix": "*", "protocol": "Tcp", "sourcePortRange": + "*", "access": "Allow", "sourceAddressPrefix": "*", "destinationPortRange": + "22", "direction": "Inbound", "priority": 1000}}]}, "name": "vm1NSG"}, {"location": + "westus", "tags": {}, "type": "Microsoft.Network/publicIPAddresses", "apiVersion": + "2015-06-15", "dependsOn": [], "properties": {"publicIPAllocationMethod": "dynamic"}, + "name": "vm1PublicIP"}, {"location": "westus", "tags": {}, "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2015-06-15", "dependsOn": ["Microsoft.Network/virtualNetworks/vm1VNET", + "Microsoft.Network/networkSecurityGroups/vm1NSG", "Microsoft.Network/publicIpAddresses/vm1PublicIP"], + "properties": {"ipConfigurations": [{"name": "ipconfigvm1", "properties": {"publicIPAddress": + {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"}, + "privateIPAllocationMethod": "Dynamic", "subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet"}}}], + "networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}}, + "name": "vm1VMNic"}, {"location": "westus", "tags": {}, "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2016-04-30-preview", "dependsOn": ["Microsoft.Network/networkInterfaces/vm1VMNic"], + "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "storageProfile": + {"imageReference": {"version": "latest", "publisher": "Canonical", "sku": "16.04-LTS", + "offer": "UbuntuServer"}, "osDisk": {"caching": null, "managedDisk": {"storageAccountType": + "Premium_LRS"}, "name": "osdisk_zsw3gJW0hI", "createOption": "fromImage"}}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic"}]}, + "osProfile": {"adminUsername": "deploy", "adminPassword": "PassPass10!)", "computerName": + "vm1"}}, "name": "vm1"}], "variables": {}}}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['3006'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [3dcc1f58-245c-11e7-85b7-a0b3ccf7272a] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/a9b4051a-c9e9-4e50-8a58-2d713b0bc883?api-version=2017-03-01 + x-ms-client-request-id: [a5a7f708-3b2b-11e7-b0cd-a0b3ccf7272a] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10 response: - body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"securityRules/default-allow-ssh\"\ - \r\n}"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/vm_deploy_R3hPRxFGmMw1a32VhvS7RbuYNzLPsSJp","name":"vm_deploy_R3hPRxFGmMw1a32VhvS7RbuYNzLPsSJp","properties":{"templateHash":"11234453629923614285","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-05-17T18:07:16.1427112Z","duration":"PT0.6742895S","correlationId":"3cc46313-d654-44e6-b709-e16c670d63de","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}]}}'} headers: + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/vm_deploy_R3hPRxFGmMw1a32VhvS7RbuYNzLPsSJp/operationStatuses/08587065624500092092?api-version=2017-05-10'] Cache-Control: [no-cache] + Content-Length: ['2387'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:44 GMT'] + Date: ['Wed, 17 May 2017 18:07:16 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/a9b4051a-c9e9-4e50-8a58-2d713b0bc883?api-version=2017-03-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['75'] - status: {code: 200, message: OK} + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 201, message: Created} - request: body: null headers: @@ -2783,54 +2232,23 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [56456a00-245c-11e7-96f8-a0b3ccf7272a] + x-ms-client-request-id: [a5a7f708-3b2b-11e7-b0cd-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587065624500092092?api-version=2017-05-10 response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ - : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ - type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ - ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: '{"status":"Running"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:46 GMT'] + Date: ['Wed, 17 May 2017 18:07:46 GMT'] Expires: ['-1'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2729'] + content-length: ['20'] status: {code: 200, message: OK} - request: body: null @@ -2840,58 +2258,49 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [57018822-245c-11e7-a385-a0b3ccf7272a] + x-ms-client-request-id: [a5a7f708-3b2b-11e7-b0cd-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587065624500092092?api-version=2017-05-10 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"8d0d9a1b-e99e-4fe6-aac5-b186e23f4e02\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: '{"status":"Running"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:47 GMT'] + Date: ['Wed, 17 May 2017 18:08:16 GMT'] Expires: ['-1'] Pragma: [no-cache] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [0c2a3df8-d9ad-4481-9bd9-0800bf4dc713, 0ebe7bac-9c4a-4d34-a29c-456d59624a53] + content-length: ['20'] status: {code: 200, message: OK} - request: - body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1", - "localIPAddress": "10.0.0.4", "remoteIPAddress": "100.1.2.3", "localPort": "*", - "protocol": "TCP", "remotePort": "80", "direction": "Outbound"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['313'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [574378e8-245c-11e7-96bd-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/ipFlowVerify?api-version=2017-03-01 + x-ms-client-request-id: [a5a7f708-3b2b-11e7-b0cd-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587065624500092092?api-version=2017-05-10 response: - body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"defaultSecurityRules/AllowInternetOutBound\"\ - \r\n}"} + body: {string: '{"status":"Running"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:27:57 GMT'] + Date: ['Wed, 17 May 2017 18:08:46 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/ee09ebde-cd49-4c7a-8567-99207578aafd?api-version=2017-03-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['86'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + content-length: ['20'] status: {code: 200, message: OK} - request: body: null @@ -2901,27 +2310,23 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [574378e8-245c-11e7-96bd-a0b3ccf7272a] + x-ms-client-request-id: [a5a7f708-3b2b-11e7-b0cd-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/ee09ebde-cd49-4c7a-8567-99207578aafd?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587065624500092092?api-version=2017-05-10 response: - body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"defaultSecurityRules/AllowInternetOutBound\"\ - \r\n}"} + body: {string: '{"status":"Succeeded"}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:28:27 GMT'] + Date: ['Wed, 17 May 2017 18:09:17 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/ee09ebde-cd49-4c7a-8567-99207578aafd?api-version=2017-03-01'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['86'] + content-length: ['22'] status: {code: 200, message: OK} - request: body: null @@ -2931,54 +2336,23 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [6fbd93f4-245c-11e7-9b0d-a0b3ccf7272a] + x-ms-client-request-id: [a5a7f708-3b2b-11e7-b0cd-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10 response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ - : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ - type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ - ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Resources/deployments/vm_deploy_R3hPRxFGmMw1a32VhvS7RbuYNzLPsSJp","name":"vm_deploy_R3hPRxFGmMw1a32VhvS7RbuYNzLPsSJp","properties":{"templateHash":"11234453629923614285","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-05-17T18:09:06.7164592Z","duration":"PT1M51.2480375S","correlationId":"3cc46313-d654-44e6-b709-e16c670d63de","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET"}]}}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:28:27 GMT'] + Date: ['Wed, 17 May 2017 18:09:17 GMT'] Expires: ['-1'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2729'] + content-length: ['3229'] status: {code: 200, message: OK} - request: body: null @@ -2988,226 +2362,106 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [6fe32414-245c-11e7-88d3-a0b3ccf7272a] + x-ms-client-request-id: [ef8d40c0-3b2b-11e7-87bf-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?$expand=instanceView&api-version=2016-04-30-preview response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"4a48285c-ea69-4b56-b122-adba62c8fea7\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b7933411-7b6c-4d69-bf8b-ed176c5749fb\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_zsw3gJW0hI\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_zsw3gJW0hI\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"deploy\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ + : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.2.10\",\r\n\ + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ + Ready\",\r\n \"message\": \"Guest Agent is running\",\r\n \ + \ \"time\": \"2017-05-17T18:09:01+00:00\"\r\n }\r\n \ + \ ],\r\n \"extensionHandlers\": []\r\n },\r\n \"statuses\"\ + : [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\ + \n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning\ + \ succeeded\",\r\n \"time\": \"2017-05-17T18:08:59.8703483+00:00\"\ + \r\n },\r\n {\r\n \"code\": \"PowerState/running\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\ + \r\n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ + ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:28:28 GMT'] + Date: ['Wed, 17 May 2017 18:09:18 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [809a632d-9f86-4782-a23b-26fb3a6af617, 8d8f46e6-2e6e-4561-9d3f-954bc47cdac8] + content-length: ['2315'] status: {code: 200, message: OK} - request: - body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['169'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [702d03ba-245c-11e7-a02e-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/securityGroupView?api-version=2017-03-01 + x-ms-client-request-id: [efb67cf8-3b2b-11e7-983f-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01 response: - body: {string: "{\r\n \"networkInterfaces\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"securityRuleAssociations\": {\r\n \"networkInterfaceAssociation\"\ - : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"securityRules\": [\r\n {\r\n \"name\"\ - : \"default-allow-ssh\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\ - \"\",\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ - \ \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ - : \"Allow\",\r\n \"priority\": 1000,\r\n \"\ - direction\": \"Inbound\"\r\n }\r\n }\r\n \ - \ ]\r\n },\r\n \"defaultSecurityRules\": [\r\n {\r\n\ - \ \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ - \ from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ - \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ - \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ - \ \"direction\": \"Inbound\"\r\n }\r\n },\r\ - \n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\ - \n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ - \ from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\ - \n \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ - : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ - : \"Inbound\"\r\n }\r\n },\r\n {\r\n \ - \ \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\"\ - ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ - : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ - \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Inbound\"\r\n }\r\n\ - \ },\r\n {\r\n \"name\": \"AllowVnetOutBound\"\ - ,\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ - \ from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\"\ - ,\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ - \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ - \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ - \ \"direction\": \"Outbound\"\r\n }\r\n },\r\ - \n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \ - \ \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ - \ from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ - \ \"destinationAddressPrefix\": \"Internet\",\r\n \"access\"\ - : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ - : \"Outbound\"\r\n }\r\n },\r\n {\r\n \ - \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\"\ - ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ - : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ - \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Outbound\"\r\n }\r\n\ - \ }\r\n ],\r\n \"effectiveSecurityRules\": [\r\n \ - \ {\r\n \"name\": \"DefaultOutboundDenyAll\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ - ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ - sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultRule_AllowVnetOutBound\",\r\n\ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ - : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ - \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ - ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ - \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ - \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ - \n \"direction\": \"Outbound\"\r\n },\r\n {\r\ - \n \"name\": \"DefaultRule_AllowInternetOutBound\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ - ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ - sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ - : \"Internet\",\r\n \"expandedDestinationAddressPrefix\": [\r\n\ - \ \"32.0.0.0/3\",\r\n \"4.0.0.0/6\",\r\n \ - \ \"2.0.0.0/7\",\r\n \"1.0.0.0/8\",\r\n \"\ - 12.0.0.0/6\",\r\n \"8.0.0.0/7\",\r\n \"11.0.0.0/8\"\ - ,\r\n \"64.0.0.0/3\",\r\n \"112.0.0.0/5\",\r\n \ - \ \"120.0.0.0/6\",\r\n \"124.0.0.0/7\",\r\n \ - \ \"126.0.0.0/8\",\r\n \"128.0.0.0/3\",\r\n \ - \ \"176.0.0.0/4\",\r\n \"160.0.0.0/5\",\r\n \ - \ \"170.0.0.0/7\",\r\n \"168.0.0.0/8\",\r\n \"169.0.0.0/9\"\ - ,\r\n \"169.128.0.0/10\",\r\n \"169.192.0.0/11\"\ - ,\r\n \"169.224.0.0/12\",\r\n \"169.240.0.0/13\"\ - ,\r\n \"169.248.0.0/14\",\r\n \"169.252.0.0/15\"\ - ,\r\n \"169.255.0.0/16\",\r\n \"174.0.0.0/7\",\r\ - \n \"173.0.0.0/8\",\r\n \"172.128.0.0/9\",\r\n \ - \ \"172.64.0.0/10\",\r\n \"172.32.0.0/11\",\r\n \ - \ \"172.0.0.0/12\",\r\n \"208.0.0.0/4\",\r\n \ - \ \"200.0.0.0/5\",\r\n \"194.0.0.0/7\",\r\n \ - \ \"193.0.0.0/8\",\r\n \"192.64.0.0/10\",\r\n \ - \ \"192.32.0.0/11\",\r\n \"192.16.0.0/12\",\r\n \ - \ \"192.8.0.0/13\",\r\n \"192.4.0.0/14\",\r\n \ - \ \"192.2.0.0/15\",\r\n \"192.1.0.0/16\",\r\n \"\ - 192.0.128.0/17\",\r\n \"192.0.64.0/18\",\r\n \"\ - 192.0.32.0/19\",\r\n \"192.0.16.0/20\",\r\n \"192.0.8.0/21\"\ - ,\r\n \"192.0.4.0/22\",\r\n \"192.0.0.0/23\",\r\n\ - \ \"192.0.3.0/24\",\r\n \"192.192.0.0/10\",\r\n\ - \ \"192.128.0.0/11\",\r\n \"192.176.0.0/12\",\r\n\ - \ \"192.160.0.0/13\",\r\n \"192.172.0.0/14\",\r\n\ - \ \"192.170.0.0/15\",\r\n \"192.169.0.0/16\",\r\n\ - \ \"196.0.0.0/7\",\r\n \"199.0.0.0/8\",\r\n \ - \ \"198.128.0.0/9\",\r\n \"198.64.0.0/10\",\r\n \ - \ \"198.32.0.0/11\",\r\n \"198.0.0.0/12\",\r\n \ - \ \"198.24.0.0/13\",\r\n \"198.20.0.0/14\",\r\n \ - \ \"198.16.0.0/15\",\r\n \"104.0.0.0/5\",\r\n \ - \ \"96.0.0.0/6\",\r\n \"102.0.0.0/7\",\r\n \ - \ \"101.0.0.0/8\",\r\n \"100.128.0.0/9\",\r\n \"\ - 100.0.0.0/10\",\r\n \"16.0.0.0/5\",\r\n \"28.0.0.0/6\"\ - ,\r\n \"26.0.0.0/7\",\r\n \"24.0.0.0/8\"\r\n \ - \ ],\r\n \"access\": \"Allow\",\r\n \"priority\"\ - : 65001,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultRule_DenyAllOutBound\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ - : \"0.0.0.0/0\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultInboundDenyAll\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ - ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ - sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Inbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultRule_AllowVnetInBound\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ - : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ - \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ - ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ - \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ - \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ - \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ - \ \"name\": \"DefaultRule_AllowAzureLoadBalancerInBound\",\r\n\ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"\ - expandedSourceAddressPrefix\": [\r\n \"168.63.129.16/32\"\r\n\ - \ ],\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ - ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\ - \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ - \ \"name\": \"DefaultRule_DenyAllInBound\",\r\n \"protocol\"\ - : \"All\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ - \ \"destinationPortRange\": \"0-65535\",\r\n \"sourceAddressPrefix\"\ - : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ - ,\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\ - \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ - \ \"name\": \"UserRule_default-allow-ssh\",\r\n \"protocol\"\ - : \"Tcp\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ - \ \"destinationPortRange\": \"22-22\",\r\n \"sourceAddressPrefix\"\ - : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ - ,\r\n \"access\": \"Allow\",\r\n \"priority\": 1000,\r\ - \n \"direction\": \"Inbound\"\r\n }\r\n ]\r\n \ - \ }\r\n }\r\n ]\r\n}"} + body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"etag\": \"W/\\\"a0b95da3-3e12-4853-bc28-6b9531019638\\\"\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"c2b6e61d-354e-4e4f-9fad-78d37d511903\"\ + ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ + ,\r\n \"etag\": \"W/\\\"a0b95da3-3e12-4853-bc28-6b9531019638\\\"\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\ + : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\ + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ + \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ + \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\ + : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\ + \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\ + internalDomainNameSuffix\": \"s2uogyc11d5ulkyom3ybgkzhlg.dx.internal.cloudapp.net\"\ + \r\n },\r\n \"macAddress\": \"00-0D-3A-36-C9-3E\",\r\n \"enableAcceleratedNetworking\"\ + : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\ + : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ + \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \ + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\ + \n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:28:36 GMT'] + Date: ['Wed, 17 May 2017 18:09:19 GMT'] + ETag: [W/"a0b95da3-3e12-4853-bc28-6b9531019638"] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/6b6f95ea-6609-417f-ba71-3a9bdc6aafa4?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['12218'] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + content-length: ['2225'] status: {code: 200, message: OK} - request: body: null @@ -3217,197 +2471,1494 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [702d03ba-245c-11e7-a02e-a0b3ccf7272a] + x-ms-client-request-id: [efdf64ac-3b2b-11e7-be6a-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/6b6f95ea-6609-417f-ba71-3a9bdc6aafa4?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP?api-version=2017-03-01 response: - body: {string: "{\r\n \"networkInterfaces\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"securityRuleAssociations\": {\r\n \"networkInterfaceAssociation\"\ - : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - ,\r\n \"securityRules\": [\r\n {\r\n \"name\"\ - : \"default-allow-ssh\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\ - \"\",\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ - \ \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ - : \"Allow\",\r\n \"priority\": 1000,\r\n \"\ - direction\": \"Inbound\"\r\n }\r\n }\r\n \ - \ ]\r\n },\r\n \"defaultSecurityRules\": [\r\n {\r\n\ - \ \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ - \ from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ - \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ - \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ - \ \"direction\": \"Inbound\"\r\n }\r\n },\r\ - \n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\ - \n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ - \ from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\ - \n \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ - : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ - : \"Inbound\"\r\n }\r\n },\r\n {\r\n \ - \ \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\"\ - ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ - : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ - \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Inbound\"\r\n }\r\n\ - \ },\r\n {\r\n \"name\": \"AllowVnetOutBound\"\ - ,\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ - \ from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\"\ - ,\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ - \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ - \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ - \ \"direction\": \"Outbound\"\r\n }\r\n },\r\ - \n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \ - \ \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ - \ from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \ - \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ - : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ - \ \"destinationAddressPrefix\": \"Internet\",\r\n \"access\"\ - : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ - : \"Outbound\"\r\n }\r\n },\r\n {\r\n \ - \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\"\ - ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ - : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ - \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Outbound\"\r\n }\r\n\ - \ }\r\n ],\r\n \"effectiveSecurityRules\": [\r\n \ - \ {\r\n \"name\": \"DefaultOutboundDenyAll\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ - ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ - sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultRule_AllowVnetOutBound\",\r\n\ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ - : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ - \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ - ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ - \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ - \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ - \n \"direction\": \"Outbound\"\r\n },\r\n {\r\ - \n \"name\": \"DefaultRule_AllowInternetOutBound\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ - ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ - sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ - : \"Internet\",\r\n \"expandedDestinationAddressPrefix\": [\r\n\ - \ \"32.0.0.0/3\",\r\n \"4.0.0.0/6\",\r\n \ - \ \"2.0.0.0/7\",\r\n \"1.0.0.0/8\",\r\n \"\ - 12.0.0.0/6\",\r\n \"8.0.0.0/7\",\r\n \"11.0.0.0/8\"\ - ,\r\n \"64.0.0.0/3\",\r\n \"112.0.0.0/5\",\r\n \ - \ \"120.0.0.0/6\",\r\n \"124.0.0.0/7\",\r\n \ - \ \"126.0.0.0/8\",\r\n \"128.0.0.0/3\",\r\n \ - \ \"176.0.0.0/4\",\r\n \"160.0.0.0/5\",\r\n \ - \ \"170.0.0.0/7\",\r\n \"168.0.0.0/8\",\r\n \"169.0.0.0/9\"\ - ,\r\n \"169.128.0.0/10\",\r\n \"169.192.0.0/11\"\ - ,\r\n \"169.224.0.0/12\",\r\n \"169.240.0.0/13\"\ - ,\r\n \"169.248.0.0/14\",\r\n \"169.252.0.0/15\"\ - ,\r\n \"169.255.0.0/16\",\r\n \"174.0.0.0/7\",\r\ - \n \"173.0.0.0/8\",\r\n \"172.128.0.0/9\",\r\n \ - \ \"172.64.0.0/10\",\r\n \"172.32.0.0/11\",\r\n \ - \ \"172.0.0.0/12\",\r\n \"208.0.0.0/4\",\r\n \ - \ \"200.0.0.0/5\",\r\n \"194.0.0.0/7\",\r\n \ - \ \"193.0.0.0/8\",\r\n \"192.64.0.0/10\",\r\n \ - \ \"192.32.0.0/11\",\r\n \"192.16.0.0/12\",\r\n \ - \ \"192.8.0.0/13\",\r\n \"192.4.0.0/14\",\r\n \ - \ \"192.2.0.0/15\",\r\n \"192.1.0.0/16\",\r\n \"\ - 192.0.128.0/17\",\r\n \"192.0.64.0/18\",\r\n \"\ - 192.0.32.0/19\",\r\n \"192.0.16.0/20\",\r\n \"192.0.8.0/21\"\ - ,\r\n \"192.0.4.0/22\",\r\n \"192.0.0.0/23\",\r\n\ - \ \"192.0.3.0/24\",\r\n \"192.192.0.0/10\",\r\n\ - \ \"192.128.0.0/11\",\r\n \"192.176.0.0/12\",\r\n\ - \ \"192.160.0.0/13\",\r\n \"192.172.0.0/14\",\r\n\ - \ \"192.170.0.0/15\",\r\n \"192.169.0.0/16\",\r\n\ - \ \"196.0.0.0/7\",\r\n \"199.0.0.0/8\",\r\n \ - \ \"198.128.0.0/9\",\r\n \"198.64.0.0/10\",\r\n \ - \ \"198.32.0.0/11\",\r\n \"198.0.0.0/12\",\r\n \ - \ \"198.24.0.0/13\",\r\n \"198.20.0.0/14\",\r\n \ - \ \"198.16.0.0/15\",\r\n \"104.0.0.0/5\",\r\n \ - \ \"96.0.0.0/6\",\r\n \"102.0.0.0/7\",\r\n \ - \ \"101.0.0.0/8\",\r\n \"100.128.0.0/9\",\r\n \"\ - 100.0.0.0/10\",\r\n \"16.0.0.0/5\",\r\n \"28.0.0.0/6\"\ - ,\r\n \"26.0.0.0/7\",\r\n \"24.0.0.0/8\"\r\n \ - \ ],\r\n \"access\": \"Allow\",\r\n \"priority\"\ - : 65001,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultRule_DenyAllOutBound\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ - : \"0.0.0.0/0\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultInboundDenyAll\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ - ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ - sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ - : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ - : 65500,\r\n \"direction\": \"Inbound\"\r\n },\r\n \ - \ {\r\n \"name\": \"DefaultRule_AllowVnetInBound\",\r\n \ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ - : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ - \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ - ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ - \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ - \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ - \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ - \ \"name\": \"DefaultRule_AllowAzureLoadBalancerInBound\",\r\n\ - \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ - 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ - \ \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"\ - expandedSourceAddressPrefix\": [\r\n \"168.63.129.16/32\"\r\n\ - \ ],\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ - ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\ - \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ - \ \"name\": \"DefaultRule_DenyAllInBound\",\r\n \"protocol\"\ - : \"All\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ - \ \"destinationPortRange\": \"0-65535\",\r\n \"sourceAddressPrefix\"\ - : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ - ,\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\ - \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ - \ \"name\": \"UserRule_default-allow-ssh\",\r\n \"protocol\"\ - : \"Tcp\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ - \ \"destinationPortRange\": \"22-22\",\r\n \"sourceAddressPrefix\"\ - : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ - ,\r\n \"access\": \"Allow\",\r\n \"priority\": 1000,\r\ - \n \"direction\": \"Inbound\"\r\n }\r\n ]\r\n \ - \ }\r\n }\r\n ]\r\n}"} + body: {string: "{\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ + ,\r\n \"etag\": \"W/\\\"0df50ec6-2d36-46e1-825c-ee6888f08417\\\"\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\ + \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"ced991c4-541d-4601-9dff-db2c2e9ef81e\"\ + ,\r\n \"ipAddress\": \"13.64.117.217\",\r\n \"publicIPAddressVersion\"\ + : \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\"\ + : 4,\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\ + \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\"\r\ + \n}"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 17 May 2017 18:09:19 GMT'] + ETag: [W/"0df50ec6-2d36-46e1-825c-ee6888f08417"] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['849'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [f002ea80-3b2b-11e7-9291-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?$expand=instanceView&api-version=2016-04-30-preview + response: + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b7933411-7b6c-4d69-bf8b-ed176c5749fb\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_zsw3gJW0hI\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_zsw3gJW0hI\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"deploy\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\",\r\n \"instanceView\"\ + : {\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.2.10\",\r\n\ + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"\ + Ready\",\r\n \"message\": \"Guest Agent is running\",\r\n \ + \ \"time\": \"2017-05-17T18:09:01+00:00\"\r\n }\r\n \ + \ ],\r\n \"extensionHandlers\": []\r\n },\r\n \"statuses\"\ + : [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\ + \n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning\ + \ succeeded\",\r\n \"time\": \"2017-05-17T18:08:59.8703483+00:00\"\ + \r\n },\r\n {\r\n \"code\": \"PowerState/running\"\ + ,\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\ + \r\n }\r\n ]\r\n }\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines\"\ + ,\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 17 May 2017 18:09:18 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['2315'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] + accept-language: [en-US] + x-ms-client-request-id: [f029311a-3b2b-11e7-9ca0-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers?api-version=2016-04-30-preview + response: + body: {string: "[\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"\ + 4psa\",\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/4psa\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"4ward365\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/4ward365\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"7isolutions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/7isolutions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"a10networks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/a10networks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"abiquo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/abiquo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"accellion\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/accellion\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Acronis\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Acronis\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Acronis.Backup\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Acronis.Backup\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"actian_matrix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/actian_matrix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"actifio\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/actifio\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"active-navigation\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/active-navigation\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"activeeon\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/activeeon\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adam-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adam-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adatao\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adatao\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adobe_test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adobe_test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"adra-match\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/adra-match\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"advantech\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/advantech\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"advantech-webaccess\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/advantech-webaccess\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"advellence\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/advellence\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aerospike\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aerospike\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aerospike-database\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aerospike-database\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aimsinnovation\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aimsinnovation\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AIP.Diagnostics.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AIP.Diagnostics.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aiscaler-cache-control-ddos-and-url-rewriting-\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aiscaler-cache-control-ddos-and-url-rewriting-\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"akeron\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/akeron\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"akumina\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/akumina\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alachisoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alachisoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alertlogic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alertlogic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AlertLogic.Extension\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AlertLogic.Extension\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"algebraix-data\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/algebraix-data\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alienvault\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alienvault\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alldigital-brevity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alldigital-brevity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alteryx\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alteryx\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"altiar\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/altiar\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"alvao\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/alvao\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"analitica\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/analitica\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"angoss\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/angoss\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"apigee\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/apigee\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appcelerator\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appcelerator\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appex-networks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appex-networks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appistry\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appistry\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appscale-marketplace\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appscale-marketplace\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appveyorci\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appveyorci\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"appzero\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/appzero\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aqua-security\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aqua-security\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"arangodb\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/arangodb\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aras\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aras\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"archive360\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/archive360\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"array_networks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/array_networks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"arvatosystems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/arvatosystems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"asigra\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/asigra\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aspex\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aspex\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aspex-managed-cloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aspex-managed-cloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"atlassian\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/atlassian\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"atmosera\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/atmosera\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"atomicorp\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/atomicorp\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"attunity_cloudbeam\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/attunity_cloudbeam\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"auraportal\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/auraportal\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"auriq-systems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/auriq-systems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"avds\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/avds\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"avepoint\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/avepoint\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"averesystems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/averesystems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"aviatrix-systems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/aviatrix-systems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"awingu\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/awingu\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"axinom\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/axinom\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"axway\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/axway\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azul\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azul\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AzureRT.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AzureRT.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azuresyncfusion\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azuresyncfusion\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azuretesting\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azuretesting\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"azuretesting2\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/azuretesting2\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"AzureTools1type\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/AzureTools1type\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"balabit\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/balabit\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"barracudanetworks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/barracudanetworks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"basho\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/basho\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"batch\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/batch\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bdy\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bdy\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"beyondtrust\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/beyondtrust\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Bing\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Bing\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Bitnami\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Bitnami\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bizagi\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bizagi\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"biztalk360\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/biztalk360\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blackberry\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blackberry\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blockapps\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blockapps\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blockchain-foundry\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blockchain-foundry\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"blockstack\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/blockstack\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bluetalon\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bluetalon\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bmc.ctm\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bmc.ctm\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bmcctm.test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bmcctm.test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"boundlessgeo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/boundlessgeo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"boxless\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/boxless\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"brainshare-it\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/brainshare-it\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"brocade_communications\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/brocade_communications\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bryte\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bryte\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bssw\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bssw\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"buddhalabs\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/buddhalabs\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bugrius\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bugrius\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"bwappengine\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/bwappengine\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Canonical\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Canonical\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"caringo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/caringo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cask\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cask\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"catechnologies\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/catechnologies\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cautelalabs\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cautelalabs\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cavirin\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cavirin\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cbrdashboard\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cbrdashboard\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cbreplicator\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cbreplicator\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cds\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cds\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"certivox\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/certivox\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cfd-direct\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cfd-direct\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"chain\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/chain\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"checkpoint\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/checkpoint\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"checkpointsystems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/checkpointsystems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"chef-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/chef-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Chef.Bootstrap.WindowsAzure\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Chef.Bootstrap.WindowsAzure\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cherwell\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cherwell\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cipherpoint\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cipherpoint\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"circleci\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/circleci\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cires21\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cires21\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cisco\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cisco\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"citrix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/citrix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clear-linux-project\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clear-linux-project\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"click2cloud-inc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/click2cloud-inc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clickberry\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clickberry\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clouber\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clouber\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloud-cruiser\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloud-cruiser\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudbees\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudbees\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudbees-enterprise-jenkins\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudbees-enterprise-jenkins\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudbolt-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudbolt-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudboost\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudboost\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudcoreo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudcoreo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudcruiser\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudcruiser\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudera\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudera\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudera1qaz2wsx\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudera1qaz2wsx\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudhouse\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudhouse\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudify\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudify\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudlink\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudlink\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CloudLinkEMC.SecureVM\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CloudLinkEMC.SecureVM\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CloudLinkEMC.SecureVM.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CloudLinkEMC.SecureVM.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CloudLinkEMC.SecureVM.Test2\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CloudLinkEMC.SecureVM.Test2\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudneeti\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudneeti\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudsecurity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudsecurity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cloudsoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cloudsoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"clustrix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/clustrix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"codelathe\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/codelathe\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"codenvy\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/codenvy\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"coffingdw\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/coffingdw\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cognosys\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cognosys\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cohesity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cohesity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cohesive\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cohesive\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"commvault\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/commvault\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"companyname-short\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/companyname-short\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"composable\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/composable\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"comunity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/comunity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Confer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Confer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"confluentinc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/confluentinc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"connecting-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/connecting-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"consensys\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/consensys\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"convertigo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/convertigo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"corda\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/corda\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cordis\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cordis\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"corent-technology-pvt\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/corent-technology-pvt\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"CoreOS\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/CoreOS\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"couchbase\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/couchbase\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"crate-io\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/crate-io\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"credativ\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/credativ\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cristie-software-clonemanager\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cristie-software-clonemanager\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"cryptzone\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/cryptzone\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"csstest\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/csstest\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ctm.bmc.com\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ctm.bmc.com\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dalet\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dalet\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"danielsol.AzureTools1\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/danielsol.AzureTools1\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Dans.Windows.App\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Dans.Windows.App\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Dans3.Windows.App\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Dans3.Windows.App\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataart\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataart\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datacastle\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datacastle\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datacore\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datacore\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Datadog.Agent\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Datadog.Agent\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataexpeditioninc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataexpeditioninc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataiku\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataiku\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datalayer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datalayer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dataliberation\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dataliberation\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datastax\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datastax\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datasunrise\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datasunrise\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"datometry\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/datometry\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"defacto_global_\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/defacto_global_\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dell-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dell-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dellemc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dellemc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dell_software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dell_software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"denyall\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/denyall\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"derdack\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/derdack\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dgsecure\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dgsecure\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"digitaloffice\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/digitaloffice\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"docker\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/docker\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"docscorp-us\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/docscorp-us\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dolbydeveloper\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dolbydeveloper\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dome9\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dome9\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"donovapub\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/donovapub\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"drone\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/drone\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dsi\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dsi\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dundas\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dundas\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dynatrace\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dynatrace\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"dynatrace.ruxit\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/dynatrace.ruxit\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eastbanctech\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eastbanctech\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"easyterritory\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/easyterritory\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"edevtech\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/edevtech\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"egnyte\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/egnyte\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"egress\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/egress\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eip\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eip\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eip-eipower\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eip-eipower\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elastacloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elastacloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elasticbox\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elasticbox\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elecard\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elecard\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"electric-cloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/electric-cloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"element-it\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/element-it\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elementrem\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elementrem\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"elfiqnetworks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/elfiqnetworks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eloquera\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eloquera\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"emercoin\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/emercoin\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"enforongo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/enforongo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"enterprise-ethereum-alliance\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/enterprise-ethereum-alliance\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eperi\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eperi\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"equalum\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/equalum\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"equilibrium\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/equilibrium\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"esdenera\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/esdenera\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ESET\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ESET\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"esri\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/esri\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ethcore\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ethcore\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ethereum\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ethereum\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"eventtracker\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/eventtracker\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"evostream-inc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/evostream-inc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"exasol\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/exasol\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"exit-games\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/exit-games\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"expertime\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/expertime\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"f5-networks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/f5-networks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"falconstorsoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/falconstorsoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fidesys\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fidesys\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"filebridge\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/filebridge\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"firehost\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/firehost\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"flexerasoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/flexerasoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"flowforma\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/flowforma\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fluid-mobility\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fluid-mobility\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"flynet\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/flynet\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"foghorn-systems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/foghorn-systems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"folio3-dynamics-services\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/folio3-dynamics-services\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"forscene\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/forscene\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fortinet\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fortinet\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fortycloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fortycloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fptjapan\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fptjapan\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"fw\",\r\ + \n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/fw\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"g-data-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/g-data-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gbs\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gbs\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gemalto-safenet\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gemalto-safenet\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Gemalto.SafeNet.ProtectV\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Gemalto.SafeNet.ProtectV\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"GitHub\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/GitHub\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gitlab\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gitlab\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"globalscape\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/globalscape\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gordic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gordic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"graphitegtc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/graphitegtc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"greathorn\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/greathorn\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"greensql\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/greensql\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"gridgain\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/gridgain\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"guardicore\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/guardicore\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"h2o-ai\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/h2o-ai\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"haivision\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/haivision\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"halobicloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/halobicloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hanu\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hanu\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"HDInsight\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/HDInsight\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hewlett-packard\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hewlett-packard\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hillstone-networks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hillstone-networks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hitachi-solutions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hitachi-solutions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hortonworks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hortonworks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hpe\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hpe\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"HPE.Security.ApplicationDefender\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/HPE.Security.ApplicationDefender\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"http-cisco-com\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/http-cisco-com\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"humanlogic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/humanlogic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hush-hush\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hush-hush\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hvr\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hvr\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hyperglance\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hyperglance\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hypergrid\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hypergrid\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"hytrust\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/hytrust\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"iaansys\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/iaansys\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"iamcloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/iamcloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ibabs-eu\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ibabs-eu\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"idcspa\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/idcspa\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ikan\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ikan\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"imaginecommunications\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/imaginecommunications\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"imc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/imc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"imperva\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/imperva\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"incredibuild\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/incredibuild\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"infoblox\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/infoblox\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"infolibrarian\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/infolibrarian\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"informatica\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/informatica\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"informatica-cloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/informatica-cloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"informationbuilders\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/informationbuilders\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"infostrat\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/infostrat\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ingrammicro\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ingrammicro\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"inriver\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/inriver\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"insitesoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/insitesoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"intel\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/intel\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"intelligent-plant-ltd\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/intelligent-plant-ltd\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"intigua\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/intigua\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"iquest\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/iquest\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ishlangu-load-balancer-adc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ishlangu-load-balancer-adc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"itelios\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/itelios\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jamcracker\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jamcracker\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jedox\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jedox\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jelastic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jelastic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jetnexus\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jetnexus\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jfrog\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jfrog\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"jitterbit_integration\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/jitterbit_integration\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kaazing\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kaazing\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kali-linux\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kali-linux\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Kaspersky.Lab\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Kaspersky.Lab\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kaspersky_lab\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kaspersky_lab\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kelverion\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kelverion\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kemptech\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kemptech\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kepion\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kepion\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"knime\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/knime\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"kollective\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/kollective\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"lakesidesoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/lakesidesoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"lansa\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/lansa\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"le\",\r\ + \n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/le\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"learningtechnolgy\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/learningtechnolgy\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"lieberlieber\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/lieberlieber\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"liebsoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/liebsoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"literatu\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/literatu\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"loadbalancer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/loadbalancer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logi-analytics\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logi-analytics\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"loginpeople\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/loginpeople\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logiticks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logiticks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logmein\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logmein\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logsign\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logsign\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"logtrust\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/logtrust\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"looker\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/looker\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"luxoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/luxoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mactores_inc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mactores_inc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"magelia\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/magelia\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"manageengine\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/manageengine\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mapr-technologies\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mapr-technologies\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mariadb\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mariadb\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"marklogic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/marklogic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"massiveanalytic-\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/massiveanalytic-\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mavinglobal\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mavinglobal\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"McAfee.EndpointSecurity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/McAfee.EndpointSecurity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"McAfee.EndpointSecurity.test3\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/McAfee.EndpointSecurity.test3\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"meanio\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/meanio\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mediazenie\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mediazenie\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"memsql\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/memsql\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mendix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mendix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mentalnotes\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mentalnotes\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mesosphere\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mesosphere\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"metavistech\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/metavistech\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mfiles\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mfiles\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mico\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mico\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"microsoft-ads\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/microsoft-ads\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Applications\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Applications\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Backup.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Backup.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Compute.Security\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Compute.Security\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Diagnostics\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Diagnostics\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Diagnostics.Build.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Diagnostics.Build.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Extensions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Extensions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Networking.SDN\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Networking.SDN\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.RecoveryServices\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.RecoveryServices\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.RecoveryServices.SiteRecovery\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.RecoveryServices.SiteRecovery\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Security\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Security\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Security.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Security.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.SiteRecovery.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.SiteRecovery.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.Test.Identity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.Test.Identity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Azure.WindowsFabric.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.WindowsFabric.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.AzureCAT.AzureEnhancedMonitoring\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.AzureCAT.AzureEnhancedMonitoring\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.AzureCAT.AzureEnhancedMonitoringTest\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.AzureCAT.AzureEnhancedMonitoringTest\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.AzureSecurity.JITAccess\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.AzureSecurity.JITAccess\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.CloudBackup.Workload.Extension\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.CloudBackup.Workload.Extension\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Compute\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Compute\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.EnterpriseCloud.Monitoring\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.EnterpriseCloud.Monitoring\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.EnterpriseCloud.Monitoring.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.EnterpriseCloud.Monitoring.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Golive.Extensions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Golive.Extensions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.HDInsight.Current\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.HDInsight.Current\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.HpcCompute\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.HpcCompute\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.HpcPack\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.HpcPack\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.ManagedIdentity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.ManagedIdentity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.OSTCExtensions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.OSTCExtensions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.OSTCExtensions.Edp\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.OSTCExtensions.Edp\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.OSTCExtensions.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.OSTCExtensions.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Powershell\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Powershell\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Powershell.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Powershell.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Powershell.WinClient\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Powershell.WinClient\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.SqlServer.Managability.IaaS.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.SqlServer.Managability.IaaS.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.SqlServer.Management\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.SqlServer.Management\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.SystemCenter\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.SystemCenter\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Azure.ETWTraceListenerService\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Azure.ETWTraceListenerService\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Azure.RemoteDebug\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Azure.RemoteDebug\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Azure.RemoteDebug.Json\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Azure.RemoteDebug.Json\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.ServiceProfiler\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.ServiceProfiler\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.VisualStudio.Services\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.VisualStudio.Services\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Windows.AzureRemoteApp.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Windows.AzureRemoteApp.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.Windows.RemoteDesktop\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Windows.RemoteDesktop\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Microsoft.WindowsAzure.Compute\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.WindowsAzure.Compute\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftAzureSiteRecovery\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftAzureSiteRecovery\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftBizTalkServer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftBizTalkServer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftDynamicsAX\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftDynamicsAX\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftDynamicsGP\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftDynamicsGP\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftDynamicsNAV\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftDynamicsNAV\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftHybridCloudStorage\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftHybridCloudStorage\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftOSTC\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftOSTC\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftRServer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftRServer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftSharePoint\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftSharePoint\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftSQLServer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftSQLServer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftVisualStudio\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftVisualStudio\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServerEssentials\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServerEssentials\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServerHPCPack\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServerHPCPack\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"MicrosoftWindowsServerRemoteDesktop\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServerRemoteDesktop\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"midvision\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/midvision\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"miraclelinux\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/miraclelinux\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"miracl_linux\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/miracl_linux\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mobilab\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mobilab\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mokxa-technologies\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mokxa-technologies\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"moviemasher\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/moviemasher\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"msopentech\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/msopentech\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"msrazuresapservices\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/msrazuresapservices\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mtnfog\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mtnfog\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mvp-systems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mvp-systems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"mxhero\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/mxhero\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"my-com\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/my-com\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"namirial\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/namirial\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"narrativescience\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/narrativescience\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nasuni\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nasuni\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ncbi\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ncbi\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ndl\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ndl\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netapp\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netapp\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netatwork\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netatwork\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netgate\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netgate\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netiq\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netiq\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netmail\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netmail\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netsil\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netsil\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"netwrix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/netwrix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"neusoft-neteye\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/neusoft-neteye\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"new-signature\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/new-signature\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nextlimit\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nextlimit\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nexus\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nexus\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nginxinc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nginxinc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nicepeopleatwork\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nicepeopleatwork\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nodejsapi\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nodejsapi\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nodesource\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nodesource\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"noobaa\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/noobaa\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"norsync\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/norsync\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"nuxeo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/nuxeo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"OctopusDeploy.Tentacle\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/OctopusDeploy.Tentacle\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"officeclipsuite\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/officeclipsuite\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"omega-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/omega-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ooyala\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ooyala\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"op5\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/op5\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opencell\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opencell\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"OpenLogic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/OpenLogic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"openmeap\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/openmeap\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opennebulasystems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opennebulasystems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opentext\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opentext\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"opslogix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/opslogix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Oracle\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Oracle\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"orckestra\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/orckestra\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"orfast-technologies\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/orfast-technologies\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"orientdb\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/orientdb\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"origam\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/origam\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"osisoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/osisoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"outsystems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/outsystems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"paloaltonetworks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/paloaltonetworks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"panorama-necto\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/panorama-necto\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"panzura-file-system\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/panzura-file-system\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"parallels\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/parallels\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"parasoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/parasoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"passlogy\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/passlogy\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pe-gromenko\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pe-gromenko\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pivotal\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pivotal\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"plesk\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/plesk\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pointmatter\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pointmatter\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"portalarchitects\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/portalarchitects\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"postgres-pro\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/postgres-pro\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"predictionio\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/predictionio\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"predixion\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/predixion\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"prestashop\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/prestashop\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"prime-strategy\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/prime-strategy\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"primesoft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/primesoft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"primestream\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/primestream\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"proarch\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/proarch\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"process-one\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/process-one\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"profisee\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/profisee\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"progelspa\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/progelspa\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ptsecurity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ptsecurity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ptv_group\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ptv_group\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"puppet\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/puppet\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"PuppetLabs\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/PuppetLabs\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"PuppetLabs.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/PuppetLabs.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pxlag_swiss\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pxlag_swiss\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pydio\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pydio\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"pyramidanalytics\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/pyramidanalytics\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qlik\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qlik\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"quales\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/quales\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Qualys\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Qualys\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qualysguard\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qualysguard\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"quasardb\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/quasardb\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qubole\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qubole\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"qubole-inc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/qubole-inc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"radware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/radware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rancher\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rancher\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rapid7\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rapid7\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"realm\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/realm\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RedHat\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RedHat\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"redpoint-global\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/redpoint-global\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"relevance-lab\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/relevance-lab\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"remotelearner\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/remotelearner\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"res\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/res\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"revolution-analytics\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/revolution-analytics\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RightScaleLinux\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RightScaleLinux\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RightScaleWindowsServer\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RightScaleWindowsServer\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"riverbed\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/riverbed\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"RiverbedTechnology\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/RiverbedTechnology\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rocketsoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rocketsoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"rocket_software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/rocket_software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"saama\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/saama\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"saltstack\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/saltstack\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"samsung-sds\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/samsung-sds\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"samsungsds-cello\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/samsungsds-cello\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sap\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sap\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sapho\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sapho\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scalearc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scalearc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scalebase\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scalebase\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scalegrid\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scalegrid\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"scsk\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/scsk\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"seagate\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/seagate\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"searchblox\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/searchblox\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sensorberg\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sensorberg\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sentryone\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sentryone\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"servoy\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/servoy\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sestek\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sestek\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"shadow-soft\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/shadow-soft\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sharefile\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sharefile\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"shareshiftneeraj.test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/shareshiftneeraj.test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"shavlik\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/shavlik\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sightapps\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sightapps\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"silver-peak-systems\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/silver-peak-systems\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"simmachinesinc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/simmachinesinc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sinefa\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sinefa\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sios_datakeeper\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sios_datakeeper\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sisense\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sisense\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Site24x7\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Site24x7\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"skyarc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/skyarc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"slamby\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/slamby\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"smartmessage-autoflow\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/smartmessage-autoflow\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"snaplogic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/snaplogic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"snip2code\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/snip2code\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"soasta\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/soasta\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"softnas\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/softnas\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"soha\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/soha\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"solanolabs\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/solanolabs\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"solarwinds\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/solarwinds\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sophos\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sophos\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"spacecurve\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/spacecurve\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"spagobi\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/spagobi\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sphere3d\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sphere3d\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"splunk\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/splunk\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stackato-platform-as-a-service\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stackato-platform-as-a-service\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stackstorm\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stackstorm\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"starwind\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/starwind\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"StatusReport.Diagnostics.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/StatusReport.Diagnostics.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stealthbits\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stealthbits\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"steelhive\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/steelhive\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stonefly\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stonefly\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stormshield\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stormshield\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"storreduce\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/storreduce\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stratalux\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stratalux\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"stratus-id\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/stratus-id\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"streamsets\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/streamsets\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"striim\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/striim\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sumologic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sumologic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"sunview-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/sunview-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SUSE\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SUSE\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"suse-byos\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/suse-byos\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.QA\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.QA\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.SCWP.Agent.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.SCWP.Agent.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.SCWP.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.SCWP.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.staging\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.staging\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Symantec.test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Symantec.test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"symantectest1\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/symantectest1\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTest9\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTest9\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTestLsTestLogonImport\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTestLsTestLogonImport\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTestLsTestSerdefDat\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTestLsTestSerdefDat\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SymantecTestRU4\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/SymantecTestRU4\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"syncfusion\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/syncfusion\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"syncfusionbigdataplatfor\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/syncfusionbigdataplatfor\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"syncfusiondashboard\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/syncfusiondashboard\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tableau\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tableau\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tactic\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tactic\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"talon\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/talon\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"targit\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/targit\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tavendo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tavendo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"techdivision\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/techdivision\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"telepat\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/telepat\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tenable\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tenable\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tentity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tentity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"teradata\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/teradata\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Teradici\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Teradici\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.Gemalto.SafeNet.ProtectV\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.Gemalto.SafeNet.ProtectV\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.HP.AppDefender\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.HP.AppDefender\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.Microsoft.VisualStudio.Services\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.Microsoft.VisualStudio.Services\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.NJHP.AppDefender\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.NJHP.AppDefender\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test.TrendMicro.DeepSecurity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test.TrendMicro.DeepSecurity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test1.NJHP.AppDefender\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test1.NJHP.AppDefender\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Test3.Microsoft.VisualStudio.Services\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Test3.Microsoft.VisualStudio.Services\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"thales-vormetric\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/thales-vormetric\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"thinkboxsoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/thinkboxsoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tibco-software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tibco-software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tig\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tig\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tokyosystemhouse\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tokyosystemhouse\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"topdesk\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/topdesk\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"torusware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/torusware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"townsend-security\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/townsend-security\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"transvault\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/transvault\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"trendmicro\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/trendmicro\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"TrendMicro.DeepSecurity\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/TrendMicro.DeepSecurity\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"TrendMicro.PortalProtect\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/TrendMicro.PortalProtect\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"tsa-public-service\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/tsa-public-service\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"twistlock\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/twistlock\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"typesafe\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/typesafe\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ubeeko\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ubeeko\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ubercloud\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ubercloud\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ulex\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ulex\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unidesk\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unidesk\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unidesk-corp\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unidesk-corp\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"uniprint-net\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/uniprint-net\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unisys-azuremp-stealth\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unisys-azuremp-stealth\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"unitrends\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/unitrends\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"usp\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/usp\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"varnish\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/varnish\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vbot\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vbot\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vecompsoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vecompsoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"veeam\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/veeam\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"velostrata\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/velostrata\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"velostrata-inc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/velostrata-inc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"ventify\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/ventify\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"veritas\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/veritas\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"versasec\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/versasec\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vertabelo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vertabelo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vidispine\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vidispine\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vidizmo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vidizmo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vintegris\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vintegris\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"viptela\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/viptela\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vircom\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vircom\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"virtualworks\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/virtualworks\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"visionware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/visionware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vision_solutions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vision_solutions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vizixiotplatformretail001\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vizixiotplatformretail001\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vmturbo\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vmturbo\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"Vormetric\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Vormetric\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"vte\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/vte\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"WAD2AI.Diagnostics.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/WAD2AI.Diagnostics.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"WAD2EventHub.Diagnostics.Test\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/WAD2EventHub.Diagnostics.Test\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wallix\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wallix\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"waratek\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/waratek\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wardy-it-solutions\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wardy-it-solutions\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"warewolf-esb\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/warewolf-esb\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"watchfulsoftware\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/watchfulsoftware\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"waves\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/waves\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"websense-apmailpe\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/websense-apmailpe\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"winmagic_securedoc_cloudvm\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/winmagic_securedoc_cloudvm\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wipro-ltd\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wipro-ltd\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wmspanel\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wmspanel\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"workshare-technology\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/workshare-technology\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"workspot\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/workspot\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"wowza\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/wowza\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xebialabs\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xebialabs\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xfinityinc\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xfinityinc\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xmpro\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xmpro\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xrm\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xrm\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"xtremedata\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/xtremedata\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"yellowfin\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/yellowfin\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"your-shop-online\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/your-shop-online\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zealcorp\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zealcorp\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zementis\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zementis\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zend\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zend\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zerodown_software\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zerodown_software\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zerto\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zerto\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zoomdata\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zoomdata\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"zscaler\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/zscaler\"\ + \r\n }\r\n]"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:06 GMT'] + Date: ['Wed, 17 May 2017 18:09:19 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/6b6f95ea-6609-417f-ba71-3a9bdc6aafa4?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['12330'] + content-length: ['138454'] status: {code: 200, message: OK} - request: body: null @@ -3418,53 +3969,28 @@ interactions: Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [86e0b330-245c-11e7-bc5f-a0b3ccf7272a] + x-ms-client-request-id: [f07c5278-3b2b-11e7-b19a-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers/Microsoft.Azure.NetworkWatcher/artifacttypes/vmextension/types?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ - : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ - type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ - ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: "[\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"\ + NetworkWatcherAgentLinux\",\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentLinux\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"NetworkWatcherAgentWindows\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentWindows\"\ + \r\n }\r\n]"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:07 GMT'] + Date: ['Wed, 17 May 2017 18:09:20 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2729'] + content-length: ['583'] status: {code: 200, message: OK} - request: body: null @@ -3474,58 +4000,65 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [87004d92-245c-11e7-8d77-a0b3ccf7272a] + x-ms-client-request-id: [f0957dba-3b2b-11e7-bcba-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers/Microsoft.Azure.NetworkWatcher/artifacttypes/vmextension/types/NetworkWatcherAgentLinux/versions?api-version=2016-04-30-preview response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"ac5bb09d-df32-4c3d-b829-f6a40596a666\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "[\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"\ + 1.4.13.0\",\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentLinux/Versions/1.4.13.0\"\ + \r\n },\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"1.4.20.0\"\ + ,\r\n \"id\": \"/Subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/Providers/Microsoft.Compute/Locations/westus/Publishers/Microsoft.Azure.NetworkWatcher/ArtifactTypes/VMExtension/Types/NetworkWatcherAgentLinux/Versions/1.4.20.0\"\ + \r\n }\r\n]"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:07 GMT'] + Date: ['Wed, 17 May 2017 18:09:20 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [b5c5410a-2523-44bd-84de-a062f2a2bb77, 61a50158-0c33-434d-8122-e75121117fa7] + content-length: ['583'] status: {code: 200, message: OK} - request: - body: '{"destinationIPAddress": "10.0.0.6", "sourceIPAddress": "123.4.5.6", "targetResourceId": - "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1"}' + body: '{"location": "westus", "properties": {"typeHandlerVersion": "1.4", "publisher": + "Microsoft.Azure.NetworkWatcher", "autoUpgradeMinorVersion": true, "type": "NetworkWatcherAgentLinux"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['237'] + Content-Length: ['183'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [87369770-245c-11e7-8884-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/nextHop?api-version=2017-03-01 + x-ms-client-request-id: [f0c8654a-3b2b-11e7-98c9-a0b3ccf7272a] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"nextHopType\": \"VnetLocal\",\r\n \"routeTableId\":\ - \ \"System Route\"\r\n}"} + body: {string: "{\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ + : \"Creating\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ + ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ + ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n}"} headers: + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Compute/locations/westus/operations/cc0813b6-7728-44f2-9202-3ae151a2904a?api-version=2016-04-30-preview'] Cache-Control: [no-cache] + Content-Length: ['547'] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:19 GMT'] + Date: ['Wed, 17 May 2017 18:09:21 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/9ea774a5-1363-4f55-9093-28bf65b14af1?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - content-length: ['69'] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - status: {code: 200, message: OK} + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} - request: body: null headers: @@ -3534,27 +4067,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [87369770-245c-11e7-8884-a0b3ccf7272a] + x-ms-client-request-id: [f0c8654a-3b2b-11e7-98c9-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/9ea774a5-1363-4f55-9093-28bf65b14af1?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/cc0813b6-7728-44f2-9202-3ae151a2904a?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"nextHopType\": \"VnetLocal\",\r\n \"routeTableId\":\ - \ \"System Route\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-05-17T18:09:22.2471024+00:00\",\r\ + \n \"status\": \"InProgress\",\r\n \"name\": \"cc0813b6-7728-44f2-9202-3ae151a2904a\"\ + \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:49 GMT'] + Date: ['Wed, 17 May 2017 18:09:51 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/9ea774a5-1363-4f55-9093-28bf65b14af1?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['69'] + content-length: ['134'] status: {code: 200, message: OK} - request: body: null @@ -3565,53 +4098,26 @@ interactions: Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a0eb6628-245c-11e7-bbef-a0b3ccf7272a] + x-ms-client-request-id: [f0c8654a-3b2b-11e7-98c9-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/operations/cc0813b6-7728-44f2-9202-3ae151a2904a?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ - : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ - type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ - ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: "{\r\n \"startTime\": \"2017-05-17T18:09:22.2471024+00:00\",\r\ + \n \"endTime\": \"2017-05-17T18:10:06.3266153+00:00\",\r\n \"status\": \"\ + Succeeded\",\r\n \"name\": \"cc0813b6-7728-44f2-9202-3ae151a2904a\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:50 GMT'] + Date: ['Wed, 17 May 2017 18:10:22 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2729'] + content-length: ['184'] status: {code: 200, message: OK} - request: body: null @@ -3621,24 +4127,30 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a108d79e-245c-11e7-bd24-a0b3ccf7272a] + x-ms-client-request-id: [f0c8654a-3b2b-11e7-98c9-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux?api-version=2016-04-30-preview response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"b86608a6-2af4-4b94-a56c-2dddda76b4f0\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ + ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ + ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:51 GMT'] + Date: ['Wed, 17 May 2017 18:10:21 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [0ec0a9a1-5f0d-44f4-8d02-78b4cfb67775, 94eaee93-efbd-428b-8716-14aa01dbb0ea] + content-length: ['548'] status: {code: 200, message: OK} - request: body: null @@ -3648,54 +4160,23 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a14b3628-245c-11e7-9cf0-a0b3ccf7272a] + x-ms-client-request-id: [15b6226e-3b2c-11e7-953e-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_network_watcher?api-version=2017-05-10 response: - body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"2391ed7e-4579-4e07-bde3-ab3889095130\"\ - ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ - \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ - \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ - ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ - \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ - \ \"name\": \"osdisk_EF1e9VAb72\",\r\n \"createOption\": \"FromImage\"\ - ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ - \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_EF1e9VAb72\"\ - \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ - : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ - ,\r\n \"adminUsername\": \"trpresco\",\r\n \"linuxConfiguration\"\ - : {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\"\ - : {\r\n \"publicKeys\": [\r\n {\r\n \"path\"\ - : \"/home/trpresco/.ssh/authorized_keys\",\r\n \"keyData\": \"\ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLkUy/BFb7o47gQqFcMiioYD4w3Tu/7bpy7t/3pQVhjmsEEaWk09dA1Ju1UbukKaLpOprch/r9bgUWu1oTEP7E5evwaJl0TvLX0gsxGGItfPc58bbQ77uxuXhMfYEZ6oiS+Ybt5nUjjDUUNhSIrKSLhCHCmQ9JnOd/AObf9G4iR38bsABIAVxmbYT6OQKm4oRwNs1c99B5TsfnREFs7yawCV3hjKVHsD3bRo83bBbBG3d/CHYfcnEbpK4weagw899YodAXDiUh0qYfOy0mGz4zWaQ4rcCitk9od/WSDhLAOy74cqwzKJwoR9DcALxkWVMuJW7xBF9tWEroVvFrh6/N\"\ - \r\n }\r\n ]\r\n }\r\n },\r\n \"secrets\"\ - : []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\"\ - :\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ - }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ - : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ - ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ - : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ - ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ - ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ - type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ - ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"name\": \"vm1\"\r\n}"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher","name":"cli_test_network_watcher","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:51 GMT'] + Date: ['Wed, 17 May 2017 18:10:22 GMT'] Expires: ['-1'] Pragma: [no-cache] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['2729'] + content-length: ['238'] status: {code: 200, message: OK} - request: body: null @@ -3705,91 +4186,104 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a163bb7e-245c-11e7-a1a8-a0b3ccf7272a] + x-ms-client-request-id: [15cab324-3b2c-11e7-b80e-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"b86608a6-2af4-4b94-a56c-2dddda76b4f0\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"14cf38ce-15b8-4743-bdc5-cc262339035c\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:52 GMT'] + Date: ['Wed, 17 May 2017 18:10:23 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [4e332321-ea41-4c2a-9743-0d9981f584ec, b1ef39b3-118e-4924-8066-eeaef4adcb97] + content-length: ['520'] status: {code: 200, message: OK} - request: - body: '{"properties": {"target": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1", - "storageLocation": {"filePath": "capture\\capture.cap"}}}' - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['232'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] - accept-language: [en-US] - x-ms-client-request-id: [a1a9e63a-245c-11e7-9d79-a0b3ccf7272a] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1?api-version=2017-03-01 - response: - body: {string: "{\r\n \"name\": \"capture1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1\"\ - ,\r\n \"etag\": \"W/\\\"1f7a5dd5-382d-4430-9651-78b3d6655ca6\\\"\",\r\n \ - \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\ - target\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"bytesToCapturePerPacket\": 0,\r\n \"totalBytesPerSession\":\ - \ 1073741824,\r\n \"timeLimitInSeconds\": 18000,\r\n \"storageLocation\"\ - : {\r\n \"storagePath\": \"\",\r\n \"filePath\": \"capture\\\\capture.cap\"\ - \r\n },\r\n \"filters\": []\r\n }\r\n}"} - headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/5a500e01-072b-4e1f-8b30-2a54ca20e902?api-version=2017-03-01'] - Cache-Control: [no-cache] - Content-Length: ['710'] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:29:52 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Retry-After: ['10'] - Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - status: {code: 201, message: Created} -- request: - body: null + body: '{"targetResourceGroupName": "cli_test_network_watcher"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['61'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a1a9e63a-245c-11e7-9d79-a0b3ccf7272a] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/5a500e01-072b-4e1f-8b30-2a54ca20e902?api-version=2017-03-01 + x-ms-client-request-id: [15faf62e-3b2c-11e7-ac07-a0b3ccf7272a] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/topology?api-version=2017-03-01 response: - body: {string: "{\r\n \"status\": \"InProgress\"\r\n}"} + body: {string: "{\r\n \"id\": \"8343a696-3ca0-43b8-816d-5eafa286a47b\",\r\n \ + \ \"createdDateTime\": \"2017-05-17T18:10:24.380616Z\",\r\n \"lastModified\"\ + : \"2017-05-17T18:09:42.0696256Z\",\r\n \"resources\": [\r\n {\r\n \ + \ \"name\": \"vm1VNET\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ + \ {\r\n \"name\": \"vm1Subnet\",\r\n \"resourceId\":\ + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ + ,\r\n \"associationType\": \"Contains\"\r\n }\r\n ]\r\ + \n },\r\n {\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": []\r\n \ + \ },\r\n {\r\n \"name\": \"vm1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ + \ {\r\n \"name\": \"vm1VMNic\",\r\n \"resourceId\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"associationType\": \"Contains\"\r\n }\r\n ]\r\ + \n },\r\n {\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ + \ {\r\n \"name\": \"vm1\",\r\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"associationType\": \"Associated\"\r\n },\r\n \ + \ {\r\n \"name\": \"vm1NSG\",\r\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ + ,\r\n \"associationType\": \"Associated\"\r\n },\r\n \ + \ {\r\n \"name\": \"vm1Subnet\",\r\n \"resourceId\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\ + ,\r\n \"associationType\": \"Associated\"\r\n },\r\n \ + \ {\r\n \"name\": \"vm1PublicIP\",\r\n \"resourceId\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ + ,\r\n \"associationType\": \"Associated\"\r\n }\r\n ]\r\ + \n },\r\n {\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ + \ {\r\n \"name\": \"default-allow-ssh\",\r\n \"resourceId\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ + ,\r\n \"associationType\": \"Contains\"\r\n }\r\n ]\r\ + \n },\r\n {\r\n \"name\": \"default-allow-ssh\",\r\n \"id\"\ + : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": []\r\n \ + \ },\r\n {\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\ + ,\r\n \"location\": \"westus\",\r\n \"associations\": [\r\n \ + \ {\r\n \"name\": \"vm1VMNic\",\r\n \"resourceId\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"associationType\": \"Associated\"\r\n }\r\n ]\r\ + \n }\r\n ]\r\n}"} headers: + Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/92d07cbf-171c-43b1-9b5d-11da558cc1e1?api-version=2017-03-01'] Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:03 GMT'] + Date: ['Wed, 17 May 2017 18:10:23 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/92d07cbf-171c-43b1-9b5d-11da558cc1e1?api-version=2017-03-01'] Pragma: [no-cache] Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['30'] + content-length: ['4412'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: body: null @@ -3799,25 +4293,50 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a1a9e63a-245c-11e7-9d79-a0b3ccf7272a] + x-ms-client-request-id: [162f6efa-3b2c-11e7-ba66-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/5a500e01-072b-4e1f-8b30-2a54ca20e902?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b7933411-7b6c-4d69-bf8b-ed176c5749fb\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_zsw3gJW0hI\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_zsw3gJW0hI\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"deploy\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ + : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ + ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ + ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ + type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ + ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:13 GMT'] + Date: ['Wed, 17 May 2017 18:10:23 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['29'] + content-length: ['2157'] status: {code: 200, message: OK} - request: body: null @@ -3827,60 +4346,65 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [a1a9e63a-245c-11e7-9d79-a0b3ccf7272a] + x-ms-client-request-id: [16559192-3b2c-11e7-adf3-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"capture1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1\"\ - ,\r\n \"etag\": \"W/\\\"2a8de57f-96e4-4e5c-b636-c16f30424248\\\"\",\r\n \ - \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ - target\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"bytesToCapturePerPacket\": 0,\r\n \"totalBytesPerSession\":\ - \ 1073741824,\r\n \"timeLimitInSeconds\": 18000,\r\n \"storageLocation\"\ - : {\r\n \"storagePath\": \"\",\r\n \"filePath\": \"capture\\\\capture.cap\"\ - \r\n },\r\n \"filters\": []\r\n }\r\n}"} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"14cf38ce-15b8-4743-bdc5-cc262339035c\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:13 GMT'] - ETag: [W/"2a8de57f-96e4-4e5c-b636-c16f30424248"] + Date: ['Wed, 17 May 2017 18:10:24 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['711'] + content-length: ['520'] status: {code: 200, message: OK} - request: - body: null + body: '{"localPort": "22", "remoteIPAddress": "100.1.2.3", "remotePort": "*", + "localIPAddress": "10.0.0.4", "protocol": "TCP", "targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1", + "direction": "Inbound"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['312'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [aed028c8-245c-11e7-a7e7-a0b3ccf7272a] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + x-ms-client-request-id: [167b3f9e-3b2c-11e7-881f-a0b3ccf7272a] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/ipFlowVerify?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"2a8de57f-96e4-4e5c-b636-c16f30424248\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"securityRules/default-allow-ssh\"\ + \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:14 GMT'] + Date: ['Wed, 17 May 2017 18:10:31 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/8cb5d2f8-154b-41be-abed-7c1f8e74f5be?api-version=2017-03-01'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [5bdd8776-4777-44ef-a445-4759c56502c8, dde95a53-d58d-4076-8b1f-36026c929107] + content-length: ['75'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -3890,33 +4414,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af163a40-245c-11e7-936a-a0b3ccf7272a] + x-ms-client-request-id: [167b3f9e-3b2c-11e7-881f-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/8cb5d2f8-154b-41be-abed-7c1f8e74f5be?api-version=2017-03-01 response: - body: {string: "{\r\n \"name\": \"capture1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1\"\ - ,\r\n \"etag\": \"W/\\\"2a8de57f-96e4-4e5c-b636-c16f30424248\\\"\",\r\n \ - \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ - target\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"bytesToCapturePerPacket\": 0,\r\n \"totalBytesPerSession\":\ - \ 1073741824,\r\n \"timeLimitInSeconds\": 18000,\r\n \"storageLocation\"\ - : {\r\n \"storagePath\": \"\",\r\n \"filePath\": \"capture\\\\capture.cap\"\ - \r\n },\r\n \"filters\": []\r\n }\r\n}"} + body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"securityRules/default-allow-ssh\"\ + \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:14 GMT'] - ETag: [W/"2a8de57f-96e4-4e5c-b636-c16f30424248"] + Date: ['Wed, 17 May 2017 18:11:02 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/8cb5d2f8-154b-41be-abed-7c1f8e74f5be?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['711'] + content-length: ['75'] status: {code: 200, message: OK} - request: body: null @@ -3926,24 +4444,50 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af4c31f8-245c-11e7-907a-a0b3ccf7272a] + x-ms-client-request-id: [2db6954a-3b2c-11e7-a4d4-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"2a8de57f-96e4-4e5c-b636-c16f30424248\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b7933411-7b6c-4d69-bf8b-ed176c5749fb\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_zsw3gJW0hI\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_zsw3gJW0hI\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"deploy\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ + : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ + ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ + ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ + type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ + ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:15 GMT'] + Date: ['Wed, 17 May 2017 18:11:02 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [dae5b4b7-dfaa-4a9b-b8a3-e03643cfa1e3, bee2ad7d-2fc8-42ab-8ad7-6ffee9efdcb8] + content-length: ['2157'] status: {code: 200, message: OK} - request: body: null @@ -3951,57 +4495,67 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af95b2d0-245c-11e7-b0e9-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1/stop?api-version=2017-03-01 + x-ms-client-request-id: [2dd0f0b4-3b2c-11e7-9be3-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: ''} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"f024d3fb-9f90-413a-a43c-11ce6edb1827\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/cf2cda71-f753-4191-9b32-b0fad0627ee9?api-version=2017-03-01'] Cache-Control: [no-cache] - Content-Length: ['0'] - Date: ['Tue, 18 Apr 2017 17:30:15 GMT'] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 17 May 2017 18:11:02 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/cf2cda71-f753-4191-9b32-b0fad0627ee9?api-version=2017-03-01'] Pragma: [no-cache] - Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - status: {code: 202, message: Accepted} + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['520'] + status: {code: 200, message: OK} - request: - body: null + body: '{"localPort": "*", "remoteIPAddress": "100.1.2.3", "remotePort": "80", + "localIPAddress": "10.0.0.4", "protocol": "TCP", "targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1", + "direction": "Outbound"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['313'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [af95b2d0-245c-11e7-b0e9-a0b3ccf7272a] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/cf2cda71-f753-4191-9b32-b0fad0627ee9?api-version=2017-03-01 + x-ms-client-request-id: [2dfbc750-3b2c-11e7-be61-a0b3ccf7272a] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/ipFlowVerify?api-version=2017-03-01 response: - body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} + body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"defaultSecurityRules/AllowInternetOutBound\"\ + \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:25 GMT'] + Date: ['Wed, 17 May 2017 18:11:09 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/672ffbc1-9a68-4248-bee9-798fc2d685af?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['29'] + content-length: ['86'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -4011,24 +4565,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b62d0428-245c-11e7-b96f-a0b3ccf7272a] + x-ms-client-request-id: [2dfbc750-3b2c-11e7-be61-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/672ffbc1-9a68-4248-bee9-798fc2d685af?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"33072e8b-debd-41fe-8be6-baea52110c63\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"access\": \"Allow\",\r\n \"ruleName\": \"defaultSecurityRules/AllowInternetOutBound\"\ + \r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:27 GMT'] + Date: ['Wed, 17 May 2017 18:11:40 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/672ffbc1-9a68-4248-bee9-798fc2d685af?api-version=2017-03-01'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [35e28cbb-00e6-421d-b9d0-c7bf3a04ee0e, 24855f90-fdce-4659-9ff8-4f861dcdae2c] + content-length: ['86'] status: {code: 200, message: OK} - request: body: null @@ -4036,32 +4593,52 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b67030b4-245c-11e7-ab98-a0b3ccf7272a] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1/queryStatus?api-version=2017-03-01 + x-ms-client-request-id: [4406cf68-3b2c-11e7-a8ee-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview response: - body: {string: "{\r\n \"name\": \"capture1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1\"\ - ,\r\n \"captureStartTime\": \"2017-04-18T17:30:05.0528196Z\",\r\n \"packetCaptureStatus\"\ - : \"Stopped\",\r\n \"stopReason\": \"Manual\",\r\n \"packetCaptureError\"\ - : []\r\n}"} + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b7933411-7b6c-4d69-bf8b-ed176c5749fb\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_zsw3gJW0hI\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_zsw3gJW0hI\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"deploy\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ + : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ + ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ + ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ + type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ + ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:27 GMT'] + Date: ['Wed, 17 May 2017 18:11:40 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['343'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + content-length: ['2157'] status: {code: 200, message: OK} - request: body: null @@ -4071,61 +4648,233 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b711fb7e-245c-11e7-a359-a0b3ccf7272a] + x-ms-client-request-id: [442f3cfe-3b2c-11e7-987b-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"33072e8b-debd-41fe-8be6-baea52110c63\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"1ffa87f0-9a7b-4a70-abf7-ff7a6659af5d\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:28 GMT'] + Date: ['Wed, 17 May 2017 18:11:41 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [10b20e98-228c-4a88-a9ae-e6e96a6364a8, e69f43f7-cb1e-4401-ab67-3b57c28fde47] + content-length: ['520'] status: {code: 200, message: OK} - request: - body: null + body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['169'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b755aa78-245c-11e7-afae-a0b3ccf7272a] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures?api-version=2017-03-01 + x-ms-client-request-id: [446397a2-3b2c-11e7-b11d-a0b3ccf7272a] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/securityGroupView?api-version=2017-03-01 response: - body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"capture1\",\r\ - \n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1\"\ - ,\r\n \"etag\": \"W/\\\"33072e8b-debd-41fe-8be6-baea52110c63\\\"\",\r\ - \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ - ,\r\n \"target\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ - ,\r\n \"bytesToCapturePerPacket\": 0,\r\n \"totalBytesPerSession\"\ - : 1073741824,\r\n \"timeLimitInSeconds\": 18000,\r\n \"storageLocation\"\ - : {\r\n \"storagePath\": \"\",\r\n \"filePath\": \"capture\\\ - \\capture.cap\"\r\n },\r\n \"filters\": []\r\n }\r\n \ - \ }\r\n ]\r\n}"} + body: {string: "{\r\n \"networkInterfaces\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"securityRuleAssociations\": {\r\n \"networkInterfaceAssociation\"\ + : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"securityRules\": [\r\n {\r\n \"name\"\ + : \"default-allow-ssh\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\ + \"\",\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ + \ \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ + : \"Allow\",\r\n \"priority\": 1000,\r\n \"\ + direction\": \"Inbound\"\r\n }\r\n }\r\n \ + \ ]\r\n },\r\n \"defaultSecurityRules\": [\r\n {\r\n\ + \ \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ + \ from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ + \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ + \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Inbound\"\r\n }\r\n },\r\ + \n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\ + \n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ + \ from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\ + \n \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ + : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n },\r\n {\r\n \ + \ \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ + : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ + \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Inbound\"\r\n }\r\n\ + \ },\r\n {\r\n \"name\": \"AllowVnetOutBound\"\ + ,\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ + \ from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\"\ + ,\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ + \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ + \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Outbound\"\r\n }\r\n },\r\ + \n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \ + \ \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ + \ from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ + \ \"destinationAddressPrefix\": \"Internet\",\r\n \"access\"\ + : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ + : \"Outbound\"\r\n }\r\n },\r\n {\r\n \ + \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ + : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ + \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Outbound\"\r\n }\r\n\ + \ }\r\n ],\r\n \"effectiveSecurityRules\": [\r\n \ + \ {\r\n \"name\": \"DefaultOutboundDenyAll\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ + ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ + sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultRule_AllowVnetOutBound\",\r\n\ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ + : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ + \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ + \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ + \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ + \n \"direction\": \"Outbound\"\r\n },\r\n {\r\ + \n \"name\": \"DefaultRule_AllowInternetOutBound\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ + ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ + sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ + : \"Internet\",\r\n \"expandedDestinationAddressPrefix\": [\r\n\ + \ \"32.0.0.0/3\",\r\n \"4.0.0.0/6\",\r\n \ + \ \"2.0.0.0/7\",\r\n \"1.0.0.0/8\",\r\n \"\ + 12.0.0.0/6\",\r\n \"8.0.0.0/7\",\r\n \"11.0.0.0/8\"\ + ,\r\n \"64.0.0.0/3\",\r\n \"112.0.0.0/5\",\r\n \ + \ \"120.0.0.0/6\",\r\n \"124.0.0.0/7\",\r\n \ + \ \"126.0.0.0/8\",\r\n \"128.0.0.0/3\",\r\n \ + \ \"176.0.0.0/4\",\r\n \"160.0.0.0/5\",\r\n \ + \ \"170.0.0.0/7\",\r\n \"168.0.0.0/8\",\r\n \"169.0.0.0/9\"\ + ,\r\n \"169.128.0.0/10\",\r\n \"169.192.0.0/11\"\ + ,\r\n \"169.224.0.0/12\",\r\n \"169.240.0.0/13\"\ + ,\r\n \"169.248.0.0/14\",\r\n \"169.252.0.0/15\"\ + ,\r\n \"169.255.0.0/16\",\r\n \"174.0.0.0/7\",\r\ + \n \"173.0.0.0/8\",\r\n \"172.128.0.0/9\",\r\n \ + \ \"172.64.0.0/10\",\r\n \"172.32.0.0/11\",\r\n \ + \ \"172.0.0.0/12\",\r\n \"208.0.0.0/4\",\r\n \ + \ \"200.0.0.0/5\",\r\n \"194.0.0.0/7\",\r\n \ + \ \"193.0.0.0/8\",\r\n \"192.64.0.0/10\",\r\n \ + \ \"192.32.0.0/11\",\r\n \"192.16.0.0/12\",\r\n \ + \ \"192.8.0.0/13\",\r\n \"192.4.0.0/14\",\r\n \ + \ \"192.2.0.0/15\",\r\n \"192.1.0.0/16\",\r\n \"\ + 192.0.128.0/17\",\r\n \"192.0.64.0/18\",\r\n \"\ + 192.0.32.0/19\",\r\n \"192.0.16.0/20\",\r\n \"192.0.8.0/21\"\ + ,\r\n \"192.0.4.0/22\",\r\n \"192.0.0.0/23\",\r\n\ + \ \"192.0.3.0/24\",\r\n \"192.192.0.0/10\",\r\n\ + \ \"192.128.0.0/11\",\r\n \"192.176.0.0/12\",\r\n\ + \ \"192.160.0.0/13\",\r\n \"192.172.0.0/14\",\r\n\ + \ \"192.170.0.0/15\",\r\n \"192.169.0.0/16\",\r\n\ + \ \"196.0.0.0/7\",\r\n \"199.0.0.0/8\",\r\n \ + \ \"198.128.0.0/9\",\r\n \"198.64.0.0/10\",\r\n \ + \ \"198.32.0.0/11\",\r\n \"198.0.0.0/12\",\r\n \ + \ \"198.24.0.0/13\",\r\n \"198.20.0.0/14\",\r\n \ + \ \"198.16.0.0/15\",\r\n \"104.0.0.0/5\",\r\n \ + \ \"96.0.0.0/6\",\r\n \"102.0.0.0/7\",\r\n \ + \ \"101.0.0.0/8\",\r\n \"100.128.0.0/9\",\r\n \"\ + 100.0.0.0/10\",\r\n \"16.0.0.0/5\",\r\n \"28.0.0.0/6\"\ + ,\r\n \"26.0.0.0/7\",\r\n \"24.0.0.0/8\"\r\n \ + \ ],\r\n \"access\": \"Allow\",\r\n \"priority\"\ + : 65001,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultRule_DenyAllOutBound\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ + : \"0.0.0.0/0\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultInboundDenyAll\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ + ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ + sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Inbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultRule_AllowVnetInBound\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ + : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ + \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ + \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ + \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ + \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ + \ \"name\": \"DefaultRule_AllowAzureLoadBalancerInBound\",\r\n\ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"\ + expandedSourceAddressPrefix\": [\r\n \"168.63.129.16/32\"\r\n\ + \ ],\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\ + \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ + \ \"name\": \"DefaultRule_DenyAllInBound\",\r\n \"protocol\"\ + : \"All\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ + \ \"destinationPortRange\": \"0-65535\",\r\n \"sourceAddressPrefix\"\ + : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ + ,\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\ + \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ + \ \"name\": \"UserRule_default-allow-ssh\",\r\n \"protocol\"\ + : \"Tcp\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ + \ \"destinationPortRange\": \"22-22\",\r\n \"sourceAddressPrefix\"\ + : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 1000,\r\ + \n \"direction\": \"Inbound\"\r\n }\r\n ]\r\n \ + \ }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:28 GMT'] + Date: ['Wed, 17 May 2017 18:11:46 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/6885b0dc-d551-42cf-9ded-8227eeeecdb8?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['804'] + content-length: ['12218'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: body: null @@ -4135,24 +4884,197 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b77470fe-245c-11e7-9380-a0b3ccf7272a] + x-ms-client-request-id: [446397a2-3b2c-11e7-b11d-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/6885b0dc-d551-42cf-9ded-8227eeeecdb8?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"33072e8b-debd-41fe-8be6-baea52110c63\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"networkInterfaces\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"securityRuleAssociations\": {\r\n \"networkInterfaceAssociation\"\ + : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + ,\r\n \"securityRules\": [\r\n {\r\n \"name\"\ + : \"default-allow-ssh\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\ + \"\",\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ + \ \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ + : \"Allow\",\r\n \"priority\": 1000,\r\n \"\ + direction\": \"Inbound\"\r\n }\r\n }\r\n \ + \ ]\r\n },\r\n \"defaultSecurityRules\": [\r\n {\r\n\ + \ \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowVnetInBound\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ + \ from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ + \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ + \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Inbound\"\r\n }\r\n },\r\ + \n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\ + \n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow inbound traffic\ + \ from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\ + \n \"destinationAddressPrefix\": \"*\",\r\n \"access\"\ + : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ + : \"Inbound\"\r\n }\r\n },\r\n {\r\n \ + \ \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/DenyAllInBound\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ + : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ + \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Inbound\"\r\n }\r\n\ + \ },\r\n {\r\n \"name\": \"AllowVnetOutBound\"\ + ,\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowVnetOutBound\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ + \ from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\"\ + ,\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n\ + \ \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \ + \ \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ + \ \"direction\": \"Outbound\"\r\n }\r\n },\r\ + \n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \ + \ \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/AllowInternetOutBound\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Allow outbound traffic\ + \ from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \ + \ \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\ + : \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \ + \ \"destinationAddressPrefix\": \"Internet\",\r\n \"access\"\ + : \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\"\ + : \"Outbound\"\r\n }\r\n },\r\n {\r\n \ + \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/DenyAllOutBound\"\ + ,\r\n \"properties\": {\r\n \"provisioningState\"\ + : \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\"\ + ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ + : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \ + \ \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Outbound\"\r\n }\r\n\ + \ }\r\n ],\r\n \"effectiveSecurityRules\": [\r\n \ + \ {\r\n \"name\": \"DefaultOutboundDenyAll\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ + ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ + sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultRule_AllowVnetOutBound\",\r\n\ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ + : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ + \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ + \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ + \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ + \n \"direction\": \"Outbound\"\r\n },\r\n {\r\ + \n \"name\": \"DefaultRule_AllowInternetOutBound\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ + ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ + sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ + : \"Internet\",\r\n \"expandedDestinationAddressPrefix\": [\r\n\ + \ \"32.0.0.0/3\",\r\n \"4.0.0.0/6\",\r\n \ + \ \"2.0.0.0/7\",\r\n \"1.0.0.0/8\",\r\n \"\ + 12.0.0.0/6\",\r\n \"8.0.0.0/7\",\r\n \"11.0.0.0/8\"\ + ,\r\n \"64.0.0.0/3\",\r\n \"112.0.0.0/5\",\r\n \ + \ \"120.0.0.0/6\",\r\n \"124.0.0.0/7\",\r\n \ + \ \"126.0.0.0/8\",\r\n \"128.0.0.0/3\",\r\n \ + \ \"176.0.0.0/4\",\r\n \"160.0.0.0/5\",\r\n \ + \ \"170.0.0.0/7\",\r\n \"168.0.0.0/8\",\r\n \"169.0.0.0/9\"\ + ,\r\n \"169.128.0.0/10\",\r\n \"169.192.0.0/11\"\ + ,\r\n \"169.224.0.0/12\",\r\n \"169.240.0.0/13\"\ + ,\r\n \"169.248.0.0/14\",\r\n \"169.252.0.0/15\"\ + ,\r\n \"169.255.0.0/16\",\r\n \"174.0.0.0/7\",\r\ + \n \"173.0.0.0/8\",\r\n \"172.128.0.0/9\",\r\n \ + \ \"172.64.0.0/10\",\r\n \"172.32.0.0/11\",\r\n \ + \ \"172.0.0.0/12\",\r\n \"208.0.0.0/4\",\r\n \ + \ \"200.0.0.0/5\",\r\n \"194.0.0.0/7\",\r\n \ + \ \"193.0.0.0/8\",\r\n \"192.64.0.0/10\",\r\n \ + \ \"192.32.0.0/11\",\r\n \"192.16.0.0/12\",\r\n \ + \ \"192.8.0.0/13\",\r\n \"192.4.0.0/14\",\r\n \ + \ \"192.2.0.0/15\",\r\n \"192.1.0.0/16\",\r\n \"\ + 192.0.128.0/17\",\r\n \"192.0.64.0/18\",\r\n \"\ + 192.0.32.0/19\",\r\n \"192.0.16.0/20\",\r\n \"192.0.8.0/21\"\ + ,\r\n \"192.0.4.0/22\",\r\n \"192.0.0.0/23\",\r\n\ + \ \"192.0.3.0/24\",\r\n \"192.192.0.0/10\",\r\n\ + \ \"192.128.0.0/11\",\r\n \"192.176.0.0/12\",\r\n\ + \ \"192.160.0.0/13\",\r\n \"192.172.0.0/14\",\r\n\ + \ \"192.170.0.0/15\",\r\n \"192.169.0.0/16\",\r\n\ + \ \"196.0.0.0/7\",\r\n \"199.0.0.0/8\",\r\n \ + \ \"198.128.0.0/9\",\r\n \"198.64.0.0/10\",\r\n \ + \ \"198.32.0.0/11\",\r\n \"198.0.0.0/12\",\r\n \ + \ \"198.24.0.0/13\",\r\n \"198.20.0.0/14\",\r\n \ + \ \"198.16.0.0/15\",\r\n \"104.0.0.0/5\",\r\n \ + \ \"96.0.0.0/6\",\r\n \"102.0.0.0/7\",\r\n \ + \ \"101.0.0.0/8\",\r\n \"100.128.0.0/9\",\r\n \"\ + 100.0.0.0/10\",\r\n \"16.0.0.0/5\",\r\n \"28.0.0.0/6\"\ + ,\r\n \"26.0.0.0/7\",\r\n \"24.0.0.0/8\"\r\n \ + \ ],\r\n \"access\": \"Allow\",\r\n \"priority\"\ + : 65001,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultRule_DenyAllOutBound\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\"\ + : \"0.0.0.0/0\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Outbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultInboundDenyAll\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"0-65535\"\ + ,\r\n \"destinationPortRange\": \"0-65535\",\r\n \"\ + sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\ + : \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\"\ + : 65500,\r\n \"direction\": \"Inbound\"\r\n },\r\n \ + \ {\r\n \"name\": \"DefaultRule_AllowVnetInBound\",\r\n \ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"expandedSourceAddressPrefix\"\ + : [\r\n \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\ + \r\n ],\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\ + ,\r\n \"expandedDestinationAddressPrefix\": [\r\n \ + \ \"10.0.0.0/16\",\r\n \"168.63.129.16/32\"\r\n ],\r\ + \n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\ + \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ + \ \"name\": \"DefaultRule_AllowAzureLoadBalancerInBound\",\r\n\ + \ \"protocol\": \"All\",\r\n \"sourcePortRange\": \"\ + 0-65535\",\r\n \"destinationPortRange\": \"0-65535\",\r\n \ + \ \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"\ + expandedSourceAddressPrefix\": [\r\n \"168.63.129.16/32\"\r\n\ + \ ],\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\ + \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ + \ \"name\": \"DefaultRule_DenyAllInBound\",\r\n \"protocol\"\ + : \"All\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ + \ \"destinationPortRange\": \"0-65535\",\r\n \"sourceAddressPrefix\"\ + : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ + ,\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\ + \n \"direction\": \"Inbound\"\r\n },\r\n {\r\n\ + \ \"name\": \"UserRule_default-allow-ssh\",\r\n \"protocol\"\ + : \"Tcp\",\r\n \"sourcePortRange\": \"0-65535\",\r\n \ + \ \"destinationPortRange\": \"22-22\",\r\n \"sourceAddressPrefix\"\ + : \"0.0.0.0/0\",\r\n \"destinationAddressPrefix\": \"0.0.0.0/0\"\ + ,\r\n \"access\": \"Allow\",\r\n \"priority\": 1000,\r\ + \n \"direction\": \"Inbound\"\r\n }\r\n ]\r\n \ + \ }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:28 GMT'] + Date: ['Wed, 17 May 2017 18:12:17 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/6885b0dc-d551-42cf-9ded-8227eeeecdb8?api-version=2017-03-01'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [68ae6432-4230-4c5e-acac-b9238e1cdc7c, dda2b7bf-d11c-4a7e-b69c-1ff78991009d] + content-length: ['12330'] status: {code: 200, message: OK} - request: body: null @@ -4160,30 +5082,53 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b7c22080-245c-11e7-b3cd-a0b3ccf7272a] - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures/capture1?api-version=2017-03-01 + x-ms-client-request-id: [5a7395d0-3b2c-11e7-a3df-a0b3ccf7272a] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview response: - body: {string: ''} + body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b7933411-7b6c-4d69-bf8b-ed176c5749fb\"\ + ,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\ + \n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \ + \ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\ + ,\r\n \"sku\": \"16.04-LTS\",\r\n \"version\": \"latest\"\r\n\ + \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \ + \ \"name\": \"osdisk_zsw3gJW0hI\",\r\n \"createOption\": \"FromImage\"\ + ,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\ + \ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\ + /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/disks/osdisk_zsw3gJW0hI\"\ + \r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\ + : []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\ + ,\r\n \"adminUsername\": \"deploy\",\r\n \"linuxConfiguration\"\ + : {\r\n \"disablePasswordAuthentication\": false\r\n },\r\n \ + \ \"secrets\": []\r\n },\r\n \"networkProfile\": {\"networkInterfaces\"\ + :[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\ + }]},\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"resources\"\ + : [\r\n {\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Azure.NetworkWatcher\"\ + ,\r\n \"type\": \"NetworkWatcherAgentLinux\",\r\n \"typeHandlerVersion\"\ + : \"1.4\",\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"type\": \"Microsoft.Compute/virtualMachines/extensions\"\ + ,\r\n \"location\": \"westus\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1/extensions/NetworkWatcherAgentLinux\"\ + ,\r\n \"name\": \"NetworkWatcherAgentLinux\"\r\n }\r\n ],\r\n \"\ + type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\"\ + ,\r\n \"tags\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1\"\ + ,\r\n \"name\": \"vm1\"\r\n}"} headers: - Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/77de8d02-6d06-42ac-9410-640b3e290a68?api-version=2017-03-01'] Cache-Control: [no-cache] - Content-Length: ['0'] - Date: ['Tue, 18 Apr 2017 17:30:29 GMT'] + Content-Type: [application/json; charset=utf-8] + Date: ['Wed, 17 May 2017 18:12:18 GMT'] Expires: ['-1'] - Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/77de8d02-6d06-42ac-9410-640b3e290a68?api-version=2017-03-01'] Pragma: [no-cache] - Retry-After: ['10'] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] - status: {code: 202, message: Accepted} + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['2157'] + status: {code: 200, message: OK} - request: body: null headers: @@ -4192,52 +5137,64 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [b7c22080-245c-11e7-b3cd-a0b3ccf7272a] + x-ms-client-request-id: [5a99d492-3b2c-11e7-8a42-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/77de8d02-6d06-42ac-9410-640b3e290a68?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"247fc44f-4b27-4fda-b00a-6bc0a361e015\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:39 GMT'] + Date: ['Wed, 17 May 2017 18:12:18 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['29'] + content-length: ['520'] status: {code: 200, message: OK} - request: - body: null + body: '{"sourceIPAddress": "123.4.5.6", "destinationIPAddress": "10.0.0.6", "targetResourceId": + "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Compute/virtualMachines/vm1"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] + Content-Length: ['237'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [be56f686-245c-11e7-b967-a0b3ccf7272a] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 + x-ms-client-request-id: [5aca3536-3b2c-11e7-ba19-a0b3ccf7272a] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/nextHop?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"dfd9df62-e6f3-45e3-b735-1347fcf09733\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"nextHopType\": \"VnetLocal\",\r\n \"routeTableId\":\ + \ \"System Route\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:40 GMT'] + Date: ['Wed, 17 May 2017 18:12:25 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/02ae9f60-a8ba-429c-8c8a-9324b4af01a9?api-version=2017-03-01'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [3b3a2378-97fb-428a-816e-57e68ff39daa, 7e06feb7-6d40-40f1-863e-33a6f1ff2033] + content-length: ['69'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -4247,25 +5204,27 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [be975e5e-245c-11e7-b975-a0b3ccf7272a] + x-ms-client-request-id: [5aca3536-3b2c-11e7-ba19-a0b3ccf7272a] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/packetCaptures?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operationResults/02ae9f60-a8ba-429c-8c8a-9324b4af01a9?api-version=2017-03-01 response: - body: {string: "{\r\n \"value\": []\r\n}"} + body: {string: "{\r\n \"nextHopType\": \"VnetLocal\",\r\n \"routeTableId\":\ + \ \"System Route\"\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:40 GMT'] + Date: ['Wed, 17 May 2017 18:12:55 GMT'] Expires: ['-1'] + Location: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operationResults/02ae9f60-a8ba-429c-8c8a-9324b4af01a9?api-version=2017-03-01'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['19'] + content-length: ['69'] status: {code: 200, message: OK} - request: body: null @@ -4275,21 +5234,21 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [bebbaf80-245c-11e7-93c4-a0b3ccf7272a] + x-ms-client-request-id: [716fffdc-3b2c-11e7-a920-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"bef1c5b7-fe7a-4f4c-b9d0-5a79fc3de2b8\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"10d1088f-ef47-43cd-bcb6-28a454e99563\"\ ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\ *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\ @@ -4298,7 +5257,7 @@ interactions: : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4308,7 +5267,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4317,7 +5276,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -4326,7 +5285,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -4335,7 +5294,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4344,7 +5303,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"d1339094-205b-4ade-a7fc-719e9b17c36f\\\"\"\ + ,\r\n \"etag\": \"W/\\\"510099fc-4ac7-42ba-954f-6cc3e3c90cad\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -4357,8 +5316,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:41 GMT'] - ETag: [W/"d1339094-205b-4ade-a7fc-719e9b17c36f"] + Date: ['Wed, 17 May 2017 18:12:56 GMT'] + ETag: [W/"510099fc-4ac7-42ba-954f-6cc3e3c90cad"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4375,24 +5334,31 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [bee6199e-245c-11e7-8dfa-a0b3ccf7272a] + x-ms-client-request-id: [71925cba-3b2c-11e7-b7b0-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"dfd9df62-e6f3-45e3-b735-1347fcf09733\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"4193236f-4ead-4280-9e0a-6b141a5993a4\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:41 GMT'] + Date: ['Wed, 17 May 2017 18:12:57 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [ac76b7d5-2aba-4f1e-b9e6-c134cbd87f2a, 121c5eb1-fa3e-43c1-9249-5b4d14a7019f] + content-length: ['520'] status: {code: 200, message: OK} - request: body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}' @@ -4403,12 +5369,12 @@ interactions: Content-Length: ['178'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [bf05e262-245c-11e7-80c1-a0b3ccf7272a] + x-ms-client-request-id: [71bd1742-3b2c-11e7-b490-a0b3ccf7272a] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/queryFlowLogStatus?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/queryFlowLogStatus?api-version=2017-03-01 response: body: {string: "{\r\n \"targetResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ ,\r\n \"properties\": {\r\n \"enabled\": false,\r\n \"retentionPolicy\"\ @@ -4416,7 +5382,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:42 GMT'] + Date: ['Wed, 17 May 2017 18:12:59 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4427,9 +5393,9 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 200, message: OK} - request: - body: '{"properties": {"storageId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1", - "enabled": true, "retentionPolicy": {"days": 5, "enabled": true}}, "targetResourceId": - "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}' + body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG", + "properties": {"storageId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1", + "retentionPolicy": {"days": 5, "enabled": true}, "enabled": true}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -4437,12 +5403,12 @@ interactions: Content-Length: ['436'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c0374ae2-245c-11e7-9707-a0b3ccf7272a] + x-ms-client-request-id: [7386d158-3b2c-11e7-93b4-a0b3ccf7272a] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/configureFlowLog?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/configureFlowLog?api-version=2017-03-01 response: body: {string: "{\r\n \"targetResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ ,\r\n \"properties\": {\r\n \"storageId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1\"\ @@ -4451,7 +5417,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:46 GMT'] + Date: ['Wed, 17 May 2017 18:13:03 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4459,7 +5425,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['486'] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -4469,21 +5435,21 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c2a076d4-245c-11e7-a3df-a0b3ccf7272a] + x-ms-client-request-id: [7559ef24-3b2c-11e7-86df-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"bef1c5b7-fe7a-4f4c-b9d0-5a79fc3de2b8\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"10d1088f-ef47-43cd-bcb6-28a454e99563\"\ ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\ *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\ @@ -4492,7 +5458,7 @@ interactions: : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4502,7 +5468,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4511,7 +5477,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -4520,7 +5486,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -4529,7 +5495,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4538,7 +5504,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"d29bdd31-fc65-4372-b610-266d81733b3e\\\"\"\ + ,\r\n \"etag\": \"W/\\\"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -4551,8 +5517,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:47 GMT'] - ETag: [W/"d29bdd31-fc65-4372-b610-266d81733b3e"] + Date: ['Wed, 17 May 2017 18:13:03 GMT'] + ETag: [W/"0beed153-4cbb-4bc9-bc15-85c0b3a83ce1"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4569,24 +5535,31 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c2cb9224-245c-11e7-8ce0-a0b3ccf7272a] + x-ms-client-request-id: [758f5e0a-3b2c-11e7-b89a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"16bc459a-15d2-4bd5-b275-25e10f671942\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"607f5007-3939-4e8a-a4e1-391e01daa300\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:47 GMT'] + Date: ['Wed, 17 May 2017 18:13:04 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [27e26e09-98ef-46d2-8886-7efa00d4b63d, 4cad2d29-c1f9-4472-9ced-fc710d960f40] + content-length: ['520'] status: {code: 200, message: OK} - request: body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}' @@ -4597,12 +5570,12 @@ interactions: Content-Length: ['178'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c30e5cf6-245c-11e7-8b13-a0b3ccf7272a] + x-ms-client-request-id: [75c2a3f0-3b2c-11e7-ac61-a0b3ccf7272a] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/queryFlowLogStatus?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/queryFlowLogStatus?api-version=2017-03-01 response: body: {string: "{\r\n \"targetResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ ,\r\n \"properties\": {\r\n \"storageId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1\"\ @@ -4611,7 +5584,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:48 GMT'] + Date: ['Wed, 17 May 2017 18:13:04 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4619,12 +5592,12 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['486'] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 200, message: OK} - request: - body: '{"properties": {"storageId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1", - "enabled": true, "retentionPolicy": {"days": 0, "enabled": false}}, "targetResourceId": - "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}' + body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG", + "properties": {"storageId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1", + "retentionPolicy": {"days": 0, "enabled": false}, "enabled": true}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -4632,12 +5605,12 @@ interactions: Content-Length: ['437'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c3a75a0c-245c-11e7-bd2f-a0b3ccf7272a] + x-ms-client-request-id: [765b7c58-3b2c-11e7-b82d-a0b3ccf7272a] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/configureFlowLog?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/configureFlowLog?api-version=2017-03-01 response: body: {string: "{\r\n \"targetResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ ,\r\n \"properties\": {\r\n \"storageId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1\"\ @@ -4646,7 +5619,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:52 GMT'] + Date: ['Wed, 17 May 2017 18:13:06 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4654,7 +5627,7 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['487'] - x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -4664,21 +5637,21 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c6134f1c-245c-11e7-83c9-a0b3ccf7272a] + x-ms-client-request-id: [782ebc7e-3b2c-11e7-8d98-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01 response: body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\",\r\n \ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\",\r\n \ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\ - : \"Succeeded\",\r\n \"resourceGuid\": \"bef1c5b7-fe7a-4f4c-b9d0-5a79fc3de2b8\"\ + : \"Succeeded\",\r\n \"resourceGuid\": \"10d1088f-ef47-43cd-bcb6-28a454e99563\"\ ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\ *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\ @@ -4687,7 +5660,7 @@ interactions: : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4697,7 +5670,7 @@ interactions: \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4706,7 +5679,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -4715,7 +5688,7 @@ interactions: access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\ @@ -4724,7 +5697,7 @@ interactions: ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\ @@ -4733,7 +5706,7 @@ interactions: \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\ - ,\r\n \"etag\": \"W/\\\"f229d106-046f-46e5-bb87-7008ed874d43\\\"\"\ + ,\r\n \"etag\": \"W/\\\"dbc15dfd-f82f-43d2-8d79-92ad587d3d37\\\"\"\ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \ @@ -4746,8 +5719,8 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:53 GMT'] - ETag: [W/"f229d106-046f-46e5-bb87-7008ed874d43"] + Date: ['Wed, 17 May 2017 18:13:08 GMT'] + ETag: [W/"dbc15dfd-f82f-43d2-8d79-92ad587d3d37"] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4764,24 +5737,31 @@ interactions: Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c6472eee-245c-11e7-bd36-a0b3ccf7272a] + x-ms-client-request-id: [785f40ec-3b2c-11e7-ae3a-a0b3ccf7272a] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkWatchers?api-version=2017-03-01 response: - body: {string: '{"value":[{"name":"westus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher","etag":"W/\"e051b0d8-09f7-424a-a4c6-758eda67af3d\"","type":"Microsoft.Network/networkWatchers","location":"westus","tags":{"foo":"doo"},"properties":{"provisioningState":"Succeeded","runningOperationIds":[]}},{"name":"eastus-watcher","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/eastus-watcher","etag":"W/\"48095d1b-2cf2-457e-b99f-b8e79b9684a3\"","type":"Microsoft.Network/networkWatchers","location":"eastus","properties":{"provisioningState":"Succeeded","runningOperationIds":[]}}]}'} + body: {string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"westus-watcher\"\ + ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher\"\ + ,\r\n \"etag\": \"W/\\\"1aefe8e6-5397-4652-9432-eb65db5c4c88\\\"\",\r\ + \n \"type\": \"Microsoft.Network/networkWatchers\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"doo\"\r\n },\r\ + \n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\ + ,\r\n \"runningOperationIds\": []\r\n }\r\n }\r\n ]\r\n}"} headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:53 GMT'] + Date: ['Wed, 17 May 2017 18:13:08 GMT'] Expires: ['-1'] Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] Vary: [Accept-Encoding] - content-length: ['738'] - x-ms-original-request-ids: [cb6d839a-9ddb-44b9-89f6-0e3a761fc760, e2b36fc3-54c8-4f3f-9d13-ab5014c0711f] + content-length: ['520'] status: {code: 200, message: OK} - request: body: '{"targetResourceId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"}' @@ -4792,12 +5772,12 @@ interactions: Content-Length: ['178'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 - msrest_azure/0.4.7 networkmanagementclient/1.0.0rc1 Azure-SDK-For-Python - AZURECLI/TEST/2.0.2+dev] + msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python + AZURECLI/TEST/2.0.6+dev] accept-language: [en-US] - x-ms-client-request-id: [c6706068-245c-11e7-84be-a0b3ccf7272a] + x-ms-client-request-id: [78893b1c-3b2c-11e7-9de8-a0b3ccf7272a] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-nw/providers/Microsoft.Network/networkWatchers/westus-watcher/queryFlowLogStatus?api-version=2017-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tjp-vm/providers/Microsoft.Network/networkWatchers/westus-watcher/queryFlowLogStatus?api-version=2017-03-01 response: body: {string: "{\r\n \"targetResourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\ ,\r\n \"properties\": {\r\n \"storageId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_network_watcher/providers/Microsoft.Storage/storageAccounts/clitestnwstorage1\"\ @@ -4806,7 +5786,7 @@ interactions: headers: Cache-Control: [no-cache] Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 18 Apr 2017 17:30:53 GMT'] + Date: ['Wed, 17 May 2017 18:13:09 GMT'] Expires: ['-1'] Pragma: [no-cache] Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0] @@ -4814,6 +5794,6 @@ interactions: Transfer-Encoding: [chunked] Vary: [Accept-Encoding] content-length: ['487'] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 200, message: OK} version: 1 diff --git a/src/command_modules/azure-cli-network/tests/test_network_commands.py b/src/command_modules/azure-cli-network/tests/test_network_commands.py index 89442016f..ba92c9ea1 100644 --- a/src/command_modules/azure-cli-network/tests/test_network_commands.py +++ b/src/command_modules/azure-cli-network/tests/test_network_commands.py @@ -1317,15 +1317,16 @@ class NetworkVpnGatewayScenarioTest(ResourceGroupVCRTestBase): # pylint: disable self.cmd('network vpn-connection update -n {} -g {} --routing-weight 25'.format(conn12, rg), checks=JMESPathCheck('routingWeight', 25)) + # TODO: Re-enable test once issue #3385 is fixed. # test network watcher troubleshooting commands - storage_account = 'clitestnwstorage2' - container_name = 'troubleshooting-results' - self.cmd('storage account create -g {} -l westus --sku Standard_LRS -n {}'.format(rg, storage_account)) - self.cmd('storage container create --account-name {} -n {}'.format(storage_account, container_name)) - storage_path = 'https://{}.blob.core.windows.net/{}'.format(storage_account, container_name) - self.cmd('network watcher configure -g {} --locations westus --enabled'.format(rg)) - self.cmd('network watcher troubleshooting start -g {} --resource {} --resource-type vpnConnection --storage-account {} --storage-path {}'.format(rg, conn12, storage_account, storage_path)) - self.cmd('network watcher troubleshooting show -g {} --resource {} --resource-type vpnConnection'.format(rg, conn12)) + # storage_account = 'clitestnwstorage2' + # container_name = 'troubleshooting-results' + # self.cmd('storage account create -g {} -l westus --sku Standard_LRS -n {}'.format(rg, storage_account)) + # self.cmd('storage container create --account-name {} -n {}'.format(storage_account, container_name)) + # storage_path = 'https://{}.blob.core.windows.net/{}'.format(storage_account, container_name) + # self.cmd('network watcher configure -g {} --locations westus --enabled'.format(rg)) + # self.cmd('network watcher troubleshooting start -g {} --resource {} --resource-type vpnConnection --storage-account {} --storage-path {}'.format(rg, conn12, storage_account, storage_path)) + # self.cmd('network watcher troubleshooting show -g {} --resource {} --resource-type vpnConnection'.format(rg, conn12)) class NetworkTrafficManagerScenarioTest(ResourceGroupVCRTestBase): @@ -1500,7 +1501,7 @@ class NetworkWatcherScenarioTest(ResourceGroupVCRTestBase): self.cmd('vm create -g {} -n {} --image UbuntuLTS --authentication-type password --admin-username deploy --admin-password PassPass10!)'.format(resource_group, vm)) self.cmd('vm extension set -g {} --vm-name {} -n NetworkWatcherAgentLinux --publisher Microsoft.Azure.NetworkWatcher'.format(resource_group, vm)) - self.cmd('network watcher show-topology -g {} -l westus'.format(resource_group)) + self.cmd('network watcher show-topology -g {}'.format(resource_group)) self.cmd('network watcher test-ip-flow -g {} --vm {} --direction inbound --local 10.0.0.4:22 --protocol tcp --remote 100.1.2.3:*'.format(resource_group, vm)) self.cmd('network watcher test-ip-flow -g {} --vm {} --direction outbound --local 10.0.0.4:* --protocol tcp --remote 100.1.2.3:80'.format(resource_group, vm)) @@ -1509,15 +1510,16 @@ class NetworkWatcherScenarioTest(ResourceGroupVCRTestBase): self.cmd('network watcher show-next-hop -g {} --vm {} --source-ip 123.4.5.6 --dest-ip 10.0.0.6'.format(resource_group, vm)) - capture = 'capture1' - location = 'westus' - self.cmd('network watcher packet-capture create -g {} --vm {} -n {} --file-path capture/capture.cap'.format(resource_group, vm, capture)) - self.cmd('network watcher packet-capture show -l {} -n {}'.format(location, capture)) - self.cmd('network watcher packet-capture stop -l {} -n {}'.format(location, capture)) - self.cmd('network watcher packet-capture show-status -l {} -n {}'.format(location, capture)) - self.cmd('network watcher packet-capture list -l {}'.format(location, capture)) - self.cmd('network watcher packet-capture delete -l {} -n {}'.format(location, capture)) - self.cmd('network watcher packet-capture list -l {}'.format(location, capture)) + # TODO: Re-enable once issue #3385 is resolved + #capture = 'capture1' + #location = 'westus' + #self.cmd('network watcher packet-capture create -g {} --vm {} -n {} --file-path capture/capture.cap'.format(resource_group, vm, capture)) + #self.cmd('network watcher packet-capture show -l {} -n {}'.format(location, capture)) + #self.cmd('network watcher packet-capture stop -l {} -n {}'.format(location, capture)) + #self.cmd('network watcher packet-capture show-status -l {} -n {}'.format(location, capture)) + #self.cmd('network watcher packet-capture list -l {}'.format(location, capture)) + #self.cmd('network watcher packet-capture delete -l {} -n {}'.format(location, capture)) + #self.cmd('network watcher packet-capture list -l {}'.format(location, capture)) nsg = '{}NSG'.format(vm) self.cmd('network watcher flow-log configure -g {} --nsg {} --enabled --retention 5 --storage-account {}'.format(resource_group, nsg, storage_account))
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_added_files", "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": -1, "issue_text_score": 2, "test_score": -1 }, "num_modified_files": 12 }
2.0
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==1.4.9 attrs==22.2.0 autopep8==1.2.4 azure-batch==2.0.1 -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_cdn&subdirectory=src/command_modules/azure-cli-cdn -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_cosmosdb&subdirectory=src/command_modules/azure-cli-cosmosdb -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_interactive&subdirectory=src/command_modules/azure-cli-interactive -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_rdbms&subdirectory=src/command_modules/azure-cli-rdbms -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_sf&subdirectory=src/command_modules/azure-cli-sf -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@5bb6b7bb83f5396ee9b6a8c5f458eeb629215703#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.9 azure-graphrbac==0.30.0rc6 azure-keyvault==0.3.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==3.0.1 azure-mgmt-cdn==0.30.2 azure-mgmt-cognitiveservices==1.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-containerregistry==0.2.1 azure-mgmt-datalake-analytics==0.1.4 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.4 azure-mgmt-devtestlabs==2.0.0 azure-mgmt-dns==1.0.1 azure-mgmt-documentdb==0.1.3 azure-mgmt-iothub==0.2.2 azure-mgmt-keyvault==0.31.0 azure-mgmt-monitor==0.2.1 azure-mgmt-network==1.0.0rc3 azure-mgmt-nspkg==1.0.0 azure-mgmt-rdbms==0.1.0 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.1.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0 azure-mgmt-web==0.32.0 azure-monitor==0.3.0 azure-multiapi-storage==0.1.0 azure-nspkg==1.0.0 azure-servicefabric==5.6.130 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 prompt-toolkit==3.0.36 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pydocumentdb==2.3.5 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.5.4 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.7 tomli==1.2.3 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 vsts-cd-manager==1.0.2 wcwidth==0.2.13 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==1.4.9 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==2.0.1 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.9 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.3.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==3.0.1 - azure-mgmt-cdn==0.30.2 - azure-mgmt-cognitiveservices==1.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-containerregistry==0.2.1 - azure-mgmt-datalake-analytics==0.1.4 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.4 - azure-mgmt-devtestlabs==2.0.0 - azure-mgmt-dns==1.0.1 - azure-mgmt-documentdb==0.1.3 - azure-mgmt-iothub==0.2.2 - azure-mgmt-keyvault==0.31.0 - azure-mgmt-monitor==0.2.1 - azure-mgmt-network==1.0.0rc3 - azure-mgmt-nspkg==1.0.0 - azure-mgmt-rdbms==0.1.0 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.1.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0 - azure-mgmt-web==0.32.0 - azure-monitor==0.3.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==1.0.0 - azure-servicefabric==5.6.130 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pydocumentdb==2.3.5 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.5.4 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.7 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - vsts-cd-manager==1.0.2 - wcwidth==0.2.13 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-monitor/tests/test_custom.py::MonitorNameOrIdTest::test_monitor_resource_id", "src/command_modules/azure-cli-monitor/tests/test_monitor.py::MonitorTests::test_monitor", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkWatcherScenarioTest::test_network_watcher" ]
[]
[ "src/command_modules/azure-cli-monitor/tests/test_custom.py::FilterBuilderTests::test_activity_logs_select_filter_builder", "src/command_modules/azure-cli-monitor/tests/test_custom.py::FilterBuilderTests::test_build_activity_logs_odata_filter", "src/command_modules/azure-cli-monitor/tests/test_custom.py::FilterBuilderTests::test_build_odata_filter", "src/command_modules/azure-cli-monitor/tests/test_custom.py::FilterBuilderTests::test_metric_names_filter_builder", "src/command_modules/azure-cli-monitor/tests/test_custom.py::FilterBuilderTests::test_metrics_odata_filter_builder", "src/command_modules/azure-cli-monitor/tests/test_custom.py::FilterBuilderTests::test_scaffold_autoscale_settings_parameters", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkMultiIdsShowScenarioTest::test_multi_id_show", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkUsageListScenarioTest::test_network_usage_list", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayDefaultScenarioTest::test_network_app_gateway_with_defaults", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayExistingSubnetScenarioTest::test_network_app_gateway_with_existing_subnet", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayNoWaitScenarioTest::test_network_app_gateway_no_wait", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayPrivateIpScenarioTest::test_network_app_gateway_with_private_ip", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayPublicIpScenarioTest::test_network_app_gateway_with_public_ip", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayWafConfigScenarioTest::test_network_app_gateway_waf_config", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkPublicIpScenarioTest::test_network_public_ip", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkExpressRouteScenarioTest::test_network_express_route", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerScenarioTest::test_network_load_balancer", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerIpConfigScenarioTest::test_network_load_balancer_ip_config", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerSubresourceScenarioTest::test_network_load_balancer_subresources", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLocalGatewayScenarioTest::test_network_local_gateway", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicScenarioTest::test_network_nic", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicSubresourceScenarioTest::test_network_nic_subresources", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicConvenienceCommandsScenarioTest::test_network_nic_convenience_commands", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkSecurityGroupScenarioTest::test_network_nsg", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkRouteTableOperationScenarioTest::test_network_route_table_operation", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVNetScenarioTest::test_network_vnet", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVNetPeeringScenarioTest::test_network_vnet_peering", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkSubnetSetScenarioTest::test_network_subnet_set", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkActiveActiveCrossPremiseScenarioTest::test_network_active_active_cross_premise_connection", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkActiveActiveVnetVnetScenarioTest::test_network_active_active_vnet_vnet_connection", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVpnGatewayScenarioTest::test_network_vpn_gateway", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkTrafficManagerScenarioTest::test_network_traffic_manager", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkDnsScenarioTest::test_network_dns", "src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkZoneImportExportTest::test_network_dns_zone_import_export" ]
[]
MIT License
1,256
[ "azure-cli.pyproj", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_client_factory.py", "src/command_modules/azure-cli-network/HISTORY.rst", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/actions.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py", "src/azure-cli-core/HISTORY.rst", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/params.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py", "src/command_modules/azure-cli-monitor/HISTORY.rst", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/commands.py", "src/azure-cli-core/azure/cli/core/commands/parameters.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_exception_handler.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/custom.py" ]
[ "azure-cli.pyproj", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_client_factory.py", "src/command_modules/azure-cli-network/HISTORY.rst", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/actions.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py", "src/azure-cli-core/HISTORY.rst", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/params.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py", "src/command_modules/azure-cli-monitor/HISTORY.rst", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/commands.py", "src/azure-cli-core/azure/cli/core/commands/parameters.py", "src/command_modules/azure-cli-network/azure/cli/command_modules/network/_validators.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_exception_handler.py", "src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/custom.py" ]
jbasko__configmanager-75
c11fa7479ce47e0363250abbf68339d9c41b502a
2017-05-16 23:08:23
c11fa7479ce47e0363250abbf68339d9c41b502a
diff --git a/configmanager/__init__.py b/configmanager/__init__.py index 216dfa2..5051026 100644 --- a/configmanager/__init__.py +++ b/configmanager/__init__.py @@ -1,3 +1,3 @@ -__version__ = '1.1.7' +__version__ = '1.1.8' from .v1 import * diff --git a/configmanager/lightweight/managers.py b/configmanager/lightweight/managers.py index 62fa678..b35729c 100644 --- a/configmanager/lightweight/managers.py +++ b/configmanager/lightweight/managers.py @@ -7,12 +7,12 @@ import six from configmanager.base import BaseSection, is_config_item from configmanager.lightweight.parsers import ConfigDeclarationParser -from configmanager.persistence import ConfigParserMixin +from configmanager.persistence import ConfigParserAdapter from configmanager.utils import not_set from .items import LwItem -class LwConfig(ConfigParserMixin, BaseSection): +class LwConfig(BaseSection): """ Represents a collection of config items or sections of items which in turn are instances of Config. @@ -24,17 +24,25 @@ class LwConfig(ConfigParserMixin, BaseSection): """ cm__item_cls = LwItem - cm__config_parser_factory = configparser.ConfigParser + cm__configparser_factory = configparser.ConfigParser - def __new__(cls, config_declaration=None, item_cls=None): + def __new__(cls, config_declaration=None, item_cls=None, configparser_factory=None): instance = super(LwConfig, cls).__new__(cls) + instance._cm__section = None instance._cm__configs = collections.OrderedDict() + instance._cm__configparser_adapter = None + if item_cls: instance.cm__item_cls = item_cls + if configparser_factory: + instance.cm__configparser_factory = configparser_factory + instance.cm__process_config_declaration = ConfigDeclarationParser(section=instance) + if config_declaration: instance.cm__process_config_declaration(config_declaration) + return instance def __repr__(self): @@ -161,3 +169,16 @@ class LwConfig(ConfigParserMixin, BaseSection): def added_to_section(self, alias, section): self._cm__section = section + + @property + def configparser(self): + """ + Returns: + ConfigParserAdapter + """ + if self._cm__configparser_adapter is None: + self._cm__configparser_adapter = ConfigParserAdapter( + config=self, + config_parser_factory=self.cm__configparser_factory, + ) + return self._cm__configparser_adapter diff --git a/configmanager/persistence.py b/configmanager/persistence.py index 39d90f6..fbe41f4 100644 --- a/configmanager/persistence.py +++ b/configmanager/persistence.py @@ -1,14 +1,20 @@ +import configparser + import six from configmanager.utils import not_set -class ConfigParserMixin(object): +class ConfigParserAdapter(object): + def __init__(self, config, config_parser_factory=None): + self.config = config + self.config_parser_factory = config_parser_factory or configparser.ConfigParser + def read(self, *args, **kwargs): as_defaults = kwargs.pop('as_defaults', False) used_filenames = [] - cp = self.cm__config_parser_factory() + cp = self.config_parser_factory() def get_filenames(): for arg in args: @@ -28,12 +34,12 @@ class ConfigParserMixin(object): return used_filenames def read_file(self, fileobj, as_defaults=False): - cp = self.cm__config_parser_factory() + cp = self.config_parser_factory() cp.read_file(fileobj) self.load_from_config_parser(cp, as_defaults=as_defaults) def read_string(self, string, source=not_set, as_defaults=False): - cp = self.cm__config_parser_factory() + cp = self.config_parser_factory() if source is not not_set: args = (string, source) else: @@ -42,7 +48,7 @@ class ConfigParserMixin(object): self.load_from_config_parser(cp, as_defaults=as_defaults) def read_dict(self, dictionary, source=not_set, as_defaults=False): - cp = self.cm__config_parser_factory() + cp = self.config_parser_factory() if source is not not_set: args = (dictionary, source) else: @@ -50,14 +56,14 @@ class ConfigParserMixin(object): cp.read_dict(*args) self.load_from_config_parser(cp, as_defaults=as_defaults) - def write(self, fileobj_or_path): + def write(self, fileobj_or_path, with_defaults=False): """ Write configuration to a file object or a path. This differs from ``ConfigParser.write`` in that it accepts a path too. """ - cp = self.cm__config_parser_factory() - self.load_into_config_parser(cp) + cp = self.config_parser_factory() + self.load_into_config_parser(cp, with_defaults=with_defaults) if isinstance(fileobj_or_path, six.string_types): with open(fileobj_or_path, 'w') as f: @@ -70,27 +76,27 @@ class ConfigParserMixin(object): for option in cp.options(section): value = cp.get(section, option) if as_defaults: - if section not in self: - self[section] = self.__class__() - if option not in self[section]: - self[section][option] = self.cm__create_item(option, default=value) + if section not in self.config: + self.config.cm__add_section(section, self.config.cm__create_section()) + if option not in self.config[section]: + self.config[section].cm__add_item(option, self.config.cm__create_item(option, default=value)) else: - self[section][option].default = value + self.config[section][option].default = value else: - if section not in self: + if section not in self.config: continue - if option not in self[section]: + if option not in self.config[section]: continue - self[section][option].value = value + self.config[section][option].value = value - def load_into_config_parser(self, cp): - for item_path, item in self.iter_items(): + def load_into_config_parser(self, cp, with_defaults=False): + for item_path, item in self.config.iter_items(): if len(item_path) > 2: raise RuntimeError( '{cls} with more than 2 path segments cannot be loaded into ConfigParser'.format( cls=item.__class__.__name__, )) - if item.is_default: + if not with_defaults and item.is_default: continue if len(item_path) == 2:
Move persistence code out of from Config completely, include in a class not part of v1
jbasko/configmanager
diff --git a/tests/conftest.py b/tests/conftest.py index 634b37c..e69de29 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,39 +0,0 @@ -import pytest - -from configmanager.v1 import Config - - [email protected] -def simple_config(): - return Config({ - 'simple': { - 'str': '', - 'int': 0, - 'float': 0.0, - }, - 'random': { - 'name': 'Bob', - }, - }) - - [email protected] -def empty_config_file(tmpdir): - path = tmpdir.join('empty.ini') - with open(path.strpath, 'w') as f: - f.write('') - return path.strpath - - [email protected] -def simple_config_file(tmpdir): - path = tmpdir.join('simple.ini') - with open(path.strpath, 'w') as f: - f.write('[simple]\n') - f.write('str = hello\n') - f.write('int = 5\n') - f.write('float = 33.33\n') - f.write('\n') - f.write('[random]\n') - f.write('name = Johnny') - return path.strpath diff --git a/tests/test_persistence.py b/tests/test_persistence.py index da9e2a2..a42268f 100644 --- a/tests/test_persistence.py +++ b/tests/test_persistence.py @@ -3,9 +3,45 @@ import pytest from configmanager.v1 import Config, Item [email protected] +def simple_config(): + return Config({ + 'simple': { + 'str': '', + 'int': 0, + 'float': 0.0, + }, + 'random': { + 'name': 'Bob', + }, + }) + + [email protected] +def empty_config_file(tmpdir): + path = tmpdir.join('empty.ini') + with open(path.strpath, 'w') as f: + f.write('') + return path.strpath + + [email protected] +def simple_config_file(tmpdir): + path = tmpdir.join('simple.ini') + with open(path.strpath, 'w') as f: + f.write('[simple]\n') + f.write('str = hello\n') + f.write('int = 5\n') + f.write('float = 33.33\n') + f.write('\n') + f.write('[random]\n') + f.write('name = Johnny') + return path.strpath + + def test_reads_empty_config_from_file_obj(simple_config, empty_config_file): with open(empty_config_file) as f: - simple_config.read_file(f) + simple_config.configparser.read_file(f) assert simple_config.to_dict() == { 'simple': { @@ -21,7 +57,7 @@ def test_reads_empty_config_from_file_obj(simple_config, empty_config_file): def test_reads_simple_config_from_file_obj(simple_config, simple_config_file): with open(simple_config_file) as f: - simple_config.read_file(f) + simple_config.configparser.read_file(f) assert simple_config.to_dict() == { 'simple': { @@ -43,7 +79,7 @@ def test_writes_config_to_file(tmpdir): }) config_path = tmpdir.join('config1.ini').strpath with open(config_path, 'w') as f: - m.write(f) + m.configparser.write(f) # default value shouldn't be written with open(config_path) as f: @@ -52,7 +88,7 @@ def test_writes_config_to_file(tmpdir): m['random']['name'].value = 'Harry' with open(config_path, 'w') as f: - m.write(f) + m.configparser.write(f) with open(config_path) as f: assert f.read() == '[random]\nname = Harry\n\n' @@ -72,12 +108,12 @@ def test_preserves_bool_notation(tmpdir): f.write('[flags]\nenabled = Yes\n\n') with open(config_path) as f: - m.read_file(f) + m.configparser.read_file(f) assert m.flags.enabled.value is True with open(config_path, 'w') as f: - m.write(f) + m.configparser.write(f) with open(config_path) as f: assert f.read() == '[flags]\nenabled = Yes\n\n' @@ -95,7 +131,7 @@ def test_configparser_writer_does_not_accept_three_deep_paths(tmpdir): with pytest.raises(RuntimeError): with open(config_path, 'w') as f: - m.write(f) + m.configparser.write(f) def test_read_reads_multiple_files_in_order(tmpdir): @@ -115,29 +151,29 @@ def test_read_reads_multiple_files_in_order(tmpdir): path3 = tmpdir.join('config3.ini').strpath # Empty file - m.write(path1) + m.configparser.write(path1) # Can read from one empty file - m.read(path1) + m.configparser.read(path1) assert m.is_default m.a.x.value = 0.33 m.b.n.value = 42 - m.write(path2) + m.configparser.write(path2) # Can read from one non-empty file m.reset() - m.read(path2) + m.configparser.read(path2) assert not m.is_default assert m.a.x.value == 0.33 m.reset() m.a.x.value = 0.66 m.b.m.value = 'YES' - m.write(path3) + m.configparser.write(path3) m.reset() - m.read([path1, path2, path3]) + m.configparser.read([path1, path2, path3]) assert m.a.x.value == 0.66 assert m.a.y.is_default @@ -146,7 +182,7 @@ def test_read_reads_multiple_files_in_order(tmpdir): assert m.b.n.value == 42 m.reset() - m.read([path3, path2, path1]) + m.configparser.read([path3, path2, path1]) assert m.a.x.value == 0.33 # this is the only difference with the above order assert m.a.y.is_default @@ -156,7 +192,7 @@ def test_read_reads_multiple_files_in_order(tmpdir): # Make sure multiple paths supported in non-list syntax. m.reset() - m.read(path3, path2, path1) + m.configparser.read(path3, path2, path1) assert m.a.x.value == 0.33 assert m.b.m.value is True @@ -172,7 +208,7 @@ def test_read_string(): }, }) - m.read_string(u'[a]\nx = haha\ny = yaya\n') + m.configparser.read_string(u'[a]\nx = haha\ny = yaya\n') assert m.a.x.value == 'haha' assert m.a.y.value == 'yaya' @@ -187,7 +223,7 @@ def test_read_dict(): }, }) - m.read_dict({ + m.configparser.read_dict({ 'a': {'x': 'xoxo', 'y': 'yaya'}, 'b': {'m': 'mama', 'n': 'nono'}, }) @@ -205,7 +241,7 @@ def test_read_as_defaults_treats_all_values_as_declarations(tmpdir): f.write('[messages]\ngreeting = Hello, home!\n') m = Config() - m.read(path, as_defaults=True) + m.configparser.read(path, as_defaults=True) assert m.uploads assert m.uploads.threads.value == '5' @@ -216,11 +252,32 @@ def test_read_as_defaults_treats_all_values_as_declarations(tmpdir): # Reading again with as_defaults=True should not change the values, only the defaults m.uploads.threads.value = '55' - m.read(path, as_defaults=True) + m.configparser.read(path, as_defaults=True) assert m.uploads.threads.value == '55' assert m.uploads.threads.default == '5' # But reading with as_defaults=False should change the value - m.read(path) + m.configparser.read(path) assert m.uploads.threads.value == '5' assert m.uploads.threads.default == '5' + + +def test_write_with_defaults_writes_defaults_too(tmpdir): + path = tmpdir.join('conf.ini').strpath + + m = Config({'a': {'b': 1, 'c': 'd', 'e': True}}) + + m.configparser.write(path) + with open(path, 'r') as f: + assert len(f.read()) == 0 + + m.configparser.write(path, with_defaults=True) + with open(path, 'r') as f: + assert len(f.read()) > 0 + + n = Config() + n.configparser.read(path, as_defaults=True) + + assert n.a.b.value == '1' # it is a string because n has no idea about types + assert n.a.e.value == 'True' # same + assert n.a.c.value == 'd' diff --git a/tests/test_v1.py b/tests/test_v1.py index cfdfd09..df2cd3c 100644 --- a/tests/test_v1.py +++ b/tests/test_v1.py @@ -165,3 +165,28 @@ def test_exceptions(): password = Item('password', required=True) with pytest.raises(ConfigValueMissing): assert not password.value + + +def test_configparser_integration(tmpdir): + defaults_ini_path = tmpdir.join('defaults.ini').strpath + custom_ini_path = tmpdir.join('custom.ini').strpath + + # Config sections expose ConfigParser adapter as configparser property: + config = Config() + + # assuming that defaults.ini exists, this would initialise Config + # with all values mentioned in defaults.ini set as defaults. + # Just like with ConfigParser, this won't fail if the file does not exist. + config.configparser.read(defaults_ini_path, as_defaults=True) + + # if you have already declared defaults, you can load custom + # configuration without specifying as_defaults=True: + config.configparser.read(custom_ini_path) + + # other ConfigParser-like methods such as read_dict, read_string, read_file are provided too. + # when you are done setting config values, you can write them to file too. + config.configparser.write(custom_ini_path) + + # Note that default values won't be written unless you explicitly request it + # by passing with_defaults=True + config.configparser.write(custom_ini_path, with_defaults=True)
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 3 }
unknown
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": null, "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 -e git+https://github.com/jbasko/configmanager.git@c11fa7479ce47e0363250abbf68339d9c41b502a#egg=configmanager configparser==5.2.0 coverage==6.2 distlib==0.3.9 filelock==3.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig==1.1.1 packaging==21.3 platformdirs==2.4.0 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 six==1.17.0 toml==0.10.2 tomli==1.2.3 tox==3.28.0 typing_extensions==4.1.1 virtualenv==20.17.1 zipp==3.6.0
name: configmanager channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - configparser==5.2.0 - coverage==6.2 - distlib==0.3.9 - filelock==3.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - iniconfig==1.1.1 - packaging==21.3 - platformdirs==2.4.0 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - six==1.17.0 - toml==0.10.2 - tomli==1.2.3 - tox==3.28.0 - typing-extensions==4.1.1 - virtualenv==20.17.1 - zipp==3.6.0 prefix: /opt/conda/envs/configmanager
[ "tests/test_persistence.py::test_reads_empty_config_from_file_obj", "tests/test_persistence.py::test_reads_simple_config_from_file_obj", "tests/test_persistence.py::test_writes_config_to_file", "tests/test_persistence.py::test_preserves_bool_notation", "tests/test_persistence.py::test_configparser_writer_does_not_accept_three_deep_paths", "tests/test_persistence.py::test_read_reads_multiple_files_in_order", "tests/test_persistence.py::test_read_string", "tests/test_persistence.py::test_read_dict", "tests/test_persistence.py::test_read_as_defaults_treats_all_values_as_declarations", "tests/test_persistence.py::test_write_with_defaults_writes_defaults_too", "tests/test_v1.py::test_configparser_integration" ]
[]
[ "tests/test_v1.py::test_simple_config", "tests/test_v1.py::test_nested_config", "tests/test_v1.py::test_exceptions" ]
[]
MIT License
1,257
[ "configmanager/persistence.py", "configmanager/lightweight/managers.py", "configmanager/__init__.py" ]
[ "configmanager/persistence.py", "configmanager/lightweight/managers.py", "configmanager/__init__.py" ]
hylang__hy-1294
7c53a07b93084a0970cdf192d4aa2d712d557154
2017-05-16 23:42:41
5c720c0110908e3f47dba2e4cc1c820d16f359a1
gilch: I would also prefer one canonical capitalization, but I'm more inclined to use all-lowercase `nan` and `inf`, since that is the Python repr. ``` >>> float('NaN') nan >>> float('Inf') inf ``` Kodiologist: I noticed that, but I figured that starting with a capital letter is better for symmetry with `False`, `True`, and `None`, and the meaning of `NaN` is clearer when written in CamelCase. Also, I'm not 100% sure that the Python `repr` is platform-independent. tuturto: For what it's worth, I get all lowercase inf and nan when doing ```float('NaN')``` on my Windows 10 machine or Linux machine, on both Python 2.x and 3.x. That said, I kind of like ```NaN``` nicer looking than ```nan```. I would be inclined to choose ```NaN``` and ```Inf```` over ```nan``` and ```inf````, but I don't feel about this particularly strongly. gilch: I'm not sure what to think. I guess my feelings are not that strong either. @kirbyfan64, what say you? kirbyfan64: My only question is whether or not it's actually *worthwhile* to add so much extra code just to check the inf and NaN capitalization... Kodiologist: I'm all for concise implementation, but surely you don't mean to suggest that we should interpret all of `Nan`, `nan`, `nAN`, etc. as the special floating-point value, in defiance of the case-sensitivity of the rest of the language, do you? Surely a bunch of code is a reasonable price to pay for avoiding that. Kodiologist: C'mon, guys, nothing will happen if you don't make any decisions. kirbyfan64: @Kodiologist can you rebase this?
diff --git a/NEWS b/NEWS index a21c5142..4c963f4f 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Changes from 0.13.0 * The compiler now automatically promotes values to Hy model objects as necessary, so you can write ``(eval `(+ 1 ~n))`` instead of ``(eval `(+ 1 ~(HyInteger n)))`` + * Literal `Inf`s and `NaN`s must now be capitalized like that [ Bug Fixes ] * Numeric literals are no longer parsed as symbols when followed by a dot diff --git a/docs/language/api.rst b/docs/language/api.rst index 5ed646d0..5241b3ab 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -52,6 +52,9 @@ digits. (print 10,000,000,000 10_000_000_000) +Unlike Python, Hy provides literal forms for NaN and infinity: `NaN`, `Inf`, +and `-Inf`. + string literals --------------- diff --git a/hy/contrib/hy_repr.hy b/hy/contrib/hy_repr.hy index b5289740..20535044 100644 --- a/hy/contrib/hy_repr.hy +++ b/hy/contrib/hy_repr.hy @@ -2,8 +2,10 @@ ;; This file is part of Hy, which is free software licensed under the Expat ;; license. See the LICENSE. -(import [hy._compat [PY3 str-type bytes-type long-type]]) -(import [hy.models [HyObject HyExpression HySymbol HyKeyword HyInteger HyList HyDict HySet HyString HyBytes]]) +(import + [math [isnan]] + [hy._compat [PY3 str-type bytes-type long-type]] + [hy.models [HyObject HyExpression HySymbol HyKeyword HyInteger HyFloat HyComplex HyList HyDict HySet HyString HyBytes]]) (defn hy-repr [obj] (setv seen (set)) @@ -72,8 +74,14 @@ (.format "(int {})" (repr x)) (and (not PY3) (in t [long_type HyInteger])) (.rstrip (repr x) "L") - (is t complex) - (.strip (repr x) "()") + (and (in t [float HyFloat]) (isnan x)) + "NaN" + (= x Inf) + "Inf" + (= x -Inf) + "-Inf" + (in t [complex HyComplex]) + (.replace (.replace (.strip (repr x) "()") "inf" "Inf") "nan" "NaN") (is t fraction) (.format "{}/{}" (f x.numerator q) (f x.denominator q)) ; else diff --git a/hy/models.py b/hy/models.py index 93cce18a..77c580fb 100644 --- a/hy/models.py +++ b/hy/models.py @@ -3,6 +3,7 @@ # license. See the LICENSE. from __future__ import unicode_literals +from math import isnan, isinf from hy._compat import PY3, str_type, bytes_type, long_type, string_types from fractions import Fraction @@ -142,15 +143,24 @@ if not PY3: # do not add long on python3 _wrappers[long_type] = HyInteger +def check_inf_nan_cap(arg, value): + if isinstance(arg, string_types): + if isinf(value) and "Inf" not in arg: + raise ValueError('Inf must be capitalized as "Inf"') + if isnan(value) and "NaN" not in arg: + raise ValueError('NaN must be capitalized as "NaN"') + + class HyFloat(HyObject, float): """ Internal representation of a Hy Float. May raise a ValueError as if float(foo) was called, given HyFloat(foo). """ - def __new__(cls, number, *args, **kwargs): - number = float(strip_digit_separators(number)) - return super(HyFloat, cls).__new__(cls, number) + def __new__(cls, num, *args, **kwargs): + value = super(HyFloat, cls).__new__(cls, strip_digit_separators(num)) + check_inf_nan_cap(num, value) + return value _wrappers[float] = HyFloat @@ -161,9 +171,18 @@ class HyComplex(HyObject, complex): complex(foo) was called, given HyComplex(foo). """ - def __new__(cls, number, *args, **kwargs): - number = complex(strip_digit_separators(number)) - return super(HyComplex, cls).__new__(cls, number) + def __new__(cls, num, *args, **kwargs): + value = super(HyComplex, cls).__new__(cls, strip_digit_separators(num)) + if isinstance(num, string_types): + p1, _, p2 = num.lstrip("+-").replace("-", "+").partition("+") + if p2: + check_inf_nan_cap(p1, value.real) + check_inf_nan_cap(p2, value.imag) + elif "j" in p1: + check_inf_nan_cap(p1, value.imag) + else: + check_inf_nan_cap(p1, value.real) + return value _wrappers[complex] = HyComplex
Any capitalization of "nan" or "inf" is interpreted as a float, not a symbol For example: => (setv Nan 5) File "<input>", line 1, column 7 (setv Nan 5) ^--^ HyTypeError: b"Can't assign or delete a HyFloat" The fact that Hy accepts literals for floating-point infinity and NaN, albeit unintentional, is a nice feature that we might as well keep. But, Hy ought to recognize only one capitalization.
hylang/hy
diff --git a/tests/native_tests/contrib/hy_repr.hy b/tests/native_tests/contrib/hy_repr.hy index 0a678b41..9bbdd095 100644 --- a/tests/native_tests/contrib/hy_repr.hy +++ b/tests/native_tests/contrib/hy_repr.hy @@ -3,16 +3,17 @@ ;; license. See the LICENSE. (import + [math [isnan]] [hy.contrib.hy-repr [hy-repr]]) (defn test-hy-repr-roundtrip-from-value [] ; Test that a variety of values round-trip properly. (setv values [ None False True - 5 5.1 '5 '5.1 + 5 5.1 '5 '5.1 Inf -Inf (int 5) 1/2 - 5j 5.1j 2+1j 1.2+3.4j + 5j 5.1j 2+1j 1.2+3.4j Inf-Infj "" b"" '"" 'b"" "apple bloom" b"apple bloom" "⚘" @@ -32,10 +33,17 @@ (for [original-val values] (setv evaled (eval (read-str (hy-repr original-val)))) (assert (= evaled original-val)) - (assert (is (type evaled) (type original-val))))) + (assert (is (type evaled) (type original-val)))) + (assert (isnan (eval (read-str (hy-repr NaN)))))) (defn test-hy-repr-roundtrip-from-str [] (setv strs [ + "'Inf" + "'-Inf" + "'NaN" + "1+2j" + "NaN+NaNj" + "'NaN+NaNj" "[1 2 3]" "'[1 2 3]" "[1 'a 3]" diff --git a/tests/test_lex.py b/tests/test_lex.py index e5f43223..dfac923c 100644 --- a/tests/test_lex.py +++ b/tests/test_lex.py @@ -2,6 +2,7 @@ # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. +from math import isnan from hy.models import (HyExpression, HyInteger, HyFloat, HyComplex, HySymbol, HyString, HyDict, HyList, HySet, HyCons) from hy.lex import LexException, PrematureEndOfInput, tokenize @@ -91,16 +92,38 @@ def test_lex_expression_float(): assert objs == [HyExpression([HySymbol("foo"), HyFloat(1.e7)])] +def test_lex_nan_and_inf(): + + assert isnan(tokenize("NaN")[0]) + assert tokenize("Nan") == [HySymbol("Nan")] + assert tokenize("nan") == [HySymbol("nan")] + assert tokenize("NAN") == [HySymbol("NAN")] + + assert tokenize("Inf") == [HyFloat(float("inf"))] + assert tokenize("inf") == [HySymbol("inf")] + assert tokenize("INF") == [HySymbol("INF")] + + assert tokenize("-Inf") == [HyFloat(float("-inf"))] + assert tokenize("-inf") == [HySymbol("_inf")] + assert tokenize("-INF") == [HySymbol("_INF")] + + def test_lex_expression_complex(): """ Make sure expressions can produce complex """ - objs = tokenize("(foo 2.j)") - assert objs == [HyExpression([HySymbol("foo"), HyComplex(2.j)])] - objs = tokenize("(foo -0.5j)") - assert objs == [HyExpression([HySymbol("foo"), HyComplex(-0.5j)])] - objs = tokenize("(foo 1.e7j)") - assert objs == [HyExpression([HySymbol("foo"), HyComplex(1.e7j)])] - objs = tokenize("(foo j)") - assert objs == [HyExpression([HySymbol("foo"), HySymbol("j")])] + + def t(x): return tokenize("(foo {})".format(x)) + + def f(x): return [HyExpression([HySymbol("foo"), x])] + + assert t("2.j") == f(HyComplex(2.j)) + assert t("-0.5j") == f(HyComplex(-0.5j)) + assert t("1.e7j") == f(HyComplex(1e7j)) + assert t("j") == f(HySymbol("j")) + assert isnan(t("NaNj")[0][1].imag) + assert t("nanj") == f(HySymbol("nanj")) + assert t("Inf+Infj") == f(HyComplex(complex(float("inf"), float("inf")))) + assert t("Inf-Infj") == f(HyComplex(complex(float("inf"), float("-inf")))) + assert t("Inf-INFj") == f(HySymbol("Inf_INFj")) def test_lex_digit_separators():
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 4 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "tox", "Pygments>=1.6", "Sphinx", "sphinx_rtd_theme" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 appdirs==1.4.4 args==0.1.0 astor==0.8.1 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 clint==0.5.1 distlib==0.3.9 docutils==0.18.1 filelock==3.4.1 -e git+https://github.com/hylang/hy.git@7c53a07b93084a0970cdf192d4aa2d712d557154#egg=hy idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work Jinja2==3.0.3 MarkupSafe==2.0.1 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work Pygments==2.14.0 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytz==2025.2 requests==2.27.1 rply==0.7.8 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 toml @ file:///tmp/build/80754af9/toml_1616166611790/work tox==3.28.0 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work urllib3==1.26.20 virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: hy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - appdirs==1.4.4 - args==0.1.0 - astor==0.8.1 - babel==2.11.0 - charset-normalizer==2.0.12 - clint==0.5.1 - distlib==0.3.9 - docutils==0.18.1 - filelock==3.4.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - jinja2==3.0.3 - markupsafe==2.0.1 - platformdirs==2.4.0 - pygments==2.14.0 - pytz==2025.2 - requests==2.27.1 - rply==0.7.8 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tox==3.28.0 - urllib3==1.26.20 - virtualenv==20.17.1 prefix: /opt/conda/envs/hy
[ "tests/native_tests/contrib/hy_repr.hy::test_hy_repr_roundtrip_from_str", "tests/test_lex.py::test_lex_nan_and_inf", "tests/test_lex.py::test_lex_expression_complex" ]
[]
[ "tests/native_tests/contrib/hy_repr.hy::test_hy_repr_roundtrip_from_value", "tests/native_tests/contrib/hy_repr.hy::test_hy_model_constructors", "tests/native_tests/contrib/hy_repr.hy::test_hy_repr_self_reference", "tests/native_tests/contrib/hy_repr.hy::test_hy_repr_dunder_method", "tests/native_tests/contrib/hy_repr.hy::test_hy_repr_fallback", "tests/test_lex.py::test_lex_exception", "tests/test_lex.py::test_unbalanced_exception", "tests/test_lex.py::test_lex_single_quote_err", "tests/test_lex.py::test_lex_expression_symbols", "tests/test_lex.py::test_lex_expression_strings", "tests/test_lex.py::test_lex_expression_integer", "tests/test_lex.py::test_lex_symbols", "tests/test_lex.py::test_lex_strings", "tests/test_lex.py::test_lex_integers", "tests/test_lex.py::test_lex_fractions", "tests/test_lex.py::test_lex_expression_float", "tests/test_lex.py::test_lex_digit_separators", "tests/test_lex.py::test_lex_bad_attrs", "tests/test_lex.py::test_lex_line_counting", "tests/test_lex.py::test_lex_line_counting_multi", "tests/test_lex.py::test_lex_line_counting_multi_inner", "tests/test_lex.py::test_dicts", "tests/test_lex.py::test_sets", "tests/test_lex.py::test_nospace", "tests/test_lex.py::test_escapes", "tests/test_lex.py::test_unicode_escapes", "tests/test_lex.py::test_hashbang", "tests/test_lex.py::test_complex", "tests/test_lex.py::test_tag_macro", "tests/test_lex.py::test_lex_comment_382", "tests/test_lex.py::test_lex_mangling_star", "tests/test_lex.py::test_lex_mangling_hyphen", "tests/test_lex.py::test_lex_mangling_qmark", "tests/test_lex.py::test_lex_mangling_bang", "tests/test_lex.py::test_unmangle", "tests/test_lex.py::test_simple_cons", "tests/test_lex.py::test_dotted_list", "tests/test_lex.py::test_cons_list" ]
[]
MIT License
1,258
[ "NEWS", "hy/models.py", "hy/contrib/hy_repr.hy", "docs/language/api.rst" ]
[ "NEWS", "hy/models.py", "hy/contrib/hy_repr.hy", "docs/language/api.rst" ]
msgpack__msgpack-python-229
a8d9162ca6cff6101c1f6b9547e94749c6acae96
2017-05-17 10:09:40
0e2021d3a3d1218ca191f4e802df0af3bbfaa51f
jfolz: Tiny niggle: It now says "Str is too large" instead of "Bytes is too large" in 2.7 if the object exceeds `ITEM_LIMIT`.
diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx index f24aa70..5a81709 100644 --- a/msgpack/_packer.pyx +++ b/msgpack/_packer.pyx @@ -10,6 +10,8 @@ from msgpack import ExtType cdef extern from "Python.h": int PyMemoryView_Check(object obj) + int PyByteArray_Check(object obj) + int PyByteArray_CheckExact(object obj) cdef extern from "pack.h": @@ -39,6 +41,14 @@ cdef int DEFAULT_RECURSE_LIMIT=511 cdef size_t ITEM_LIMIT = (2**32)-1 +cdef inline int PyBytesLike_Check(object o): + return PyBytes_Check(o) or PyByteArray_Check(o) + + +cdef inline int PyBytesLike_CheckExact(object o): + return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o) + + cdef class Packer(object): """ MessagePack Packer @@ -174,10 +184,10 @@ cdef class Packer(object): else: dval = o ret = msgpack_pack_double(&self.pk, dval) - elif PyBytes_CheckExact(o) if strict_types else PyBytes_Check(o): + elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o): L = len(o) if L > ITEM_LIMIT: - raise PackValueError("bytes is too large") + raise PackValueError("%s is too large" % type(o).__name__) rawval = o ret = msgpack_pack_bin(&self.pk, L) if ret == 0: diff --git a/msgpack/fallback.py b/msgpack/fallback.py index 508fd06..a02cbe1 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -38,6 +38,8 @@ if hasattr(sys, 'pypy_version_info'): def write(self, s): if isinstance(s, memoryview): s = s.tobytes() + elif isinstance(s, bytearray): + s = bytes(s) self.builder.append(s) def getvalue(self): return self.builder.build() @@ -728,10 +730,10 @@ class Packer(object): default_used = True continue raise PackOverflowError("Integer value out of range") - if check(obj, bytes): + if check(obj, (bytes, bytearray)): n = len(obj) if n >= 2**32: - raise PackValueError("Bytes is too large") + raise PackValueError("%s is too large" % type(obj).__name__) self._pack_bin_header(n) return self._buffer.write(obj) if check(obj, Unicode):
can't serialize bytearray If value = bytearray(b'\x01\x87h\x05') then packb(value, use_bin_type=True) returns the error: can't serialize bytearray(b'\x01\x87h\x05') Is this a known problem?
msgpack/msgpack-python
diff --git a/test/test_pack.py b/test/test_pack.py index e945902..a704fdb 100644 --- a/test/test_pack.py +++ b/test/test_pack.py @@ -58,6 +58,13 @@ def testPackBytes(): for td in test_data: check(td) +def testPackByteArrays(): + test_data = [ + bytearray(b""), bytearray(b"abcd"), (bytearray(b"defgh"),), + ] + for td in test_data: + check(td) + def testIgnoreUnicodeErrors(): re = unpackb(packb(b'abc\xeddef'), encoding='utf-8', unicode_errors='ignore', use_list=1) assert re == "abcdef"
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 2 }
0.4
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 Cython==0.25.2 importlib-metadata==4.8.3 iniconfig==1.1.1 -e git+https://github.com/msgpack/msgpack-python.git@a8d9162ca6cff6101c1f6b9547e94749c6acae96#egg=msgpack_python packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: msgpack-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - cython==0.25.2 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/msgpack-python
[ "test/test_pack.py::testPackByteArrays" ]
[]
[ "test/test_pack.py::testPack", "test/test_pack.py::testPackUnicode", "test/test_pack.py::testPackUTF32", "test/test_pack.py::testPackBytes", "test/test_pack.py::testIgnoreUnicodeErrors", "test/test_pack.py::testStrictUnicodeUnpack", "test/test_pack.py::testStrictUnicodePack", "test/test_pack.py::testIgnoreErrorsPack", "test/test_pack.py::testNoEncoding", "test/test_pack.py::testDecodeBinary", "test/test_pack.py::testPackFloat", "test/test_pack.py::testArraySize", "test/test_pack.py::test_manualreset", "test/test_pack.py::testMapSize", "test/test_pack.py::test_odict", "test/test_pack.py::test_pairlist" ]
[]
Apache License 2.0
1,259
[ "msgpack/_packer.pyx", "msgpack/fallback.py" ]
[ "msgpack/_packer.pyx", "msgpack/fallback.py" ]
zopefoundation__zope.security-24
2b82f83048802017a451d2abcdc2a2bae8ece182
2017-05-17 12:13:22
c192803b8e92255aea5c45349fdbd478b173224f
diff --git a/CHANGES.rst b/CHANGES.rst index 0203e6a..aea7438 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,12 @@ Changes 4.1.1 (unreleased) ------------------ -- TBD +- Fix `issue 23 <https://github.com/zopefoundation/zope.security/issues/23>`_: + iteration of ``collections.OrderedDict`` and its various views is + now allowed by default on all versions of Python. + +- As a further fix for issue 20, iteration of BTree itself is now + allowed by default. 4.1.0 (2017-04-24) ------------------ diff --git a/src/zope/security/checker.py b/src/zope/security/checker.py index 3187afc..344428c 100644 --- a/src/zope/security/checker.py +++ b/src/zope/security/checker.py @@ -770,6 +770,27 @@ if PYTHON2: _default_checkers[type({}.iterkeys())] = _iteratorChecker _default_checkers[type({}.itervalues())] = _iteratorChecker +def _fixup_dictlike(dict_type): + empty_dict = dict_type() + populated_dict = dict_type({1: 2}) + for dictlike in (empty_dict, populated_dict): + for attr in ('__iter__', 'keys', 'items', 'values'): + obj = getattr(dictlike, attr)() + o_type = type(obj) + if o_type not in _default_checkers: + _default_checkers[o_type] = _iteratorChecker + +def _fixup_odict(): + # OrderedDicts have three different implementations: Python 2 (pure + # python, returns generators and lists), Python <=3.4 (pure Python, + # uses view classes) and CPython 3.5+ (implemented in C). These should + # all be iterable. + from collections import OrderedDict + _fixup_dictlike(OrderedDict) + +_fixup_odict() +del _fixup_odict + try: import BTrees except ImportError: # pragma: no cover @@ -794,20 +815,14 @@ else: for name in ('IF', 'II', 'IO', 'OI', 'OO'): for family_name in ('family32', 'family64'): family = getattr(BTrees, family_name) - btree = getattr(family, name).BTree() - - empty_type = type(btree.items()) - if empty_type not in _default_checkers: - _default_checkers[empty_type] = _iteratorChecker - - btree[1] = 1 - populated_type = type(btree.items()) - if populated_type not in _default_checkers: - _default_checkers[populated_type] = _iteratorChecker + btree = getattr(family, name).BTree + _fixup_dictlike(btree) _fixup_btrees() del _fixup_btrees +del _fixup_dictlike + def _clear(): _checkers.clear() _checkers.update(_default_checkers)
Iteration of OrderedDict broken under Python 3 Python 3.5 re-implemented OrderedDict in C, which results in it having custom classes for `.keys()`, `.values()`, `.items()` and `__iter__`. Likewise, Python 3 reimplemented OrderedDict to use Python "view classes" for its `__iter__`, etc. These aren't covered by the default checkers anymore. The result is code that worked prior to 3.5 suddenly raising exceptions. (Under Python 2, `__iter__` was a generator, and `keys`, `values` and `items` returned actual `list` objects.) I think this should be handled like `dict` and `BTrees` and access granted in `_default_checkers`. This was spotted in https://github.com/zopefoundation/zope.app.onlinehelp/pull/2 ``` File "//lib/python3.5/site-packages/zope/app/tree/node.py", line 95, in getChildObjects children = self._get_child_objects_adapter().getChildObjects() File "/lib/python3.5/site-packages/zope/app/tree/adapters.py", line 94, in getChildObjects return list(self.context.values()) if self.hasChildren() else [] zope.security.interfaces.ForbiddenAttribute: ('__iter__', odict_values([<zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic object at 0x10f87aac8>, <zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic object at 0x10f87a128>])) ```
zopefoundation/zope.security
diff --git a/src/zope/security/tests/test_checker.py b/src/zope/security/tests/test_checker.py index ceda502..03a8883 100644 --- a/src/zope/security/tests/test_checker.py +++ b/src/zope/security/tests/test_checker.py @@ -391,34 +391,48 @@ class CheckerTestsBase(object): finally: _clear() - @_skip_if_no_btrees - def test_iteration_of_btree_items(self): - # iteration of BTree.items() is allowed by default. + def _check_iteration_of_dict_like(self, dict_like): from zope.security.proxy import Proxy from zope.security.checker import Checker - from zope.security.checker import CheckerPublic - import BTrees + from zope.security.checker import _default_checkers + + checker = _default_checkers[dict] + + proxy = Proxy(dict_like, checker) + # empty + self.assertEqual([], list(proxy.items())) + self.assertEqual([], list(proxy.keys())) + self.assertEqual([], list(proxy.values())) + self.assertEqual([], list(proxy)) - checker = Checker({'items': CheckerPublic, - 'keys': CheckerPublic, - 'values': CheckerPublic}) + # With an object + dict_like[1] = 2 + self.assertEqual([(1, 2)], list(proxy.items())) + self.assertEqual([1], list(proxy.keys())) + self.assertEqual([1], list(proxy)) + self.assertEqual([2], list(proxy.values())) + + @_skip_if_no_btrees + def test_iteration_of_btree_items_keys_values(self): + # iteration of BTree.items() is allowed by default. + import BTrees for name in ('IF', 'II', 'IO', 'OI', 'OO'): for family_name in ('family32', 'family64'): family = getattr(BTrees, family_name) btree = getattr(family, name).BTree() - proxy = Proxy(btree, checker) - # empty - self.assertEqual([], list(proxy.items())) - self.assertEqual([], list(proxy.keys())) - self.assertEqual([], list(proxy.values())) - - # With an object - btree[1] = 2 - self.assertEqual([(1, 2)], list(proxy.items())) - self.assertEqual([1], list(proxy.keys())) - self.assertEqual([2], list(proxy.values())) + self._check_iteration_of_dict_like(btree) + + def test_iteration_of_odict_items_keys_values(self): + # iteration of OrderedDict.items() is allowed by default. + from collections import OrderedDict + + odict = OrderedDict() + self._check_iteration_of_dict_like(odict) + def test_iteration_of_dict_items_keys_values(self): + # iteration of regular dict is allowed by default + self._check_iteration_of_dict_like(dict()) class CheckerPyTests(unittest.TestCase, CheckerTestsBase):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 2 }
4.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[test]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 BTrees==4.11.3 certifi==2021.5.30 cffi==1.15.1 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 persistent==4.9.3 pluggy==1.0.0 py==1.11.0 pycparser==2.21 pyparsing==3.1.4 pytest==7.0.1 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0 zope.component==5.1.0 zope.configuration==4.4.1 zope.event==4.6 zope.exceptions==4.6 zope.hookable==5.4 zope.i18nmessageid==5.1.1 zope.interface==5.5.2 zope.location==4.3 zope.proxy==4.6.1 zope.schema==6.2.1 -e git+https://github.com/zopefoundation/zope.security.git@2b82f83048802017a451d2abcdc2a2bae8ece182#egg=zope.security zope.testing==5.0.1 zope.testrunner==5.6
name: zope.security channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - btrees==4.11.3 - cffi==1.15.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - persistent==4.9.3 - pluggy==1.0.0 - py==1.11.0 - pycparser==2.21 - pyparsing==3.1.4 - pytest==7.0.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 - zope-component==5.1.0 - zope-configuration==4.4.1 - zope-event==4.6 - zope-exceptions==4.6 - zope-hookable==5.4 - zope-i18nmessageid==5.1.1 - zope-interface==5.5.2 - zope-location==4.3 - zope-proxy==4.6.1 - zope-schema==6.2.1 - zope-testing==5.0.1 - zope-testrunner==5.6 prefix: /opt/conda/envs/zope.security
[ "src/zope/security/tests/test_checker.py::CheckerPyTests::test_iteration_of_btree_items_keys_values", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_iteration_of_odict_items_keys_values", "src/zope/security/tests/test_checker.py::CheckerTests::test_iteration_of_btree_items_keys_values", "src/zope/security/tests/test_checker.py::CheckerTests::test_iteration_of_odict_items_keys_values" ]
[]
[ "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_no_checker_no_dunder_no_select", "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_no_checker_no_dunder_w_select", "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_no_checker_w_dunder", "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_already_proxied_different_checker", "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_already_proxied_no_checker", "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_already_proxied_same_checker", "src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_explicit_checker", "src/zope/security/tests/test_checker.py::Test_canWrite::test_ok", "src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_forbidden_getattr_allowed", "src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_forbidden_getattr_forbidden", "src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_forbidden_getattr_unauth", "src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_unauth", "src/zope/security/tests/test_checker.py::Test_canAccess::test_ok", "src/zope/security/tests/test_checker.py::Test_canAccess::test_w_getattr_unauth", "src/zope/security/tests/test_checker.py::Test_canAccess::test_w_setattr_forbidden_getattr_allowed", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_available_by_default", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_miss", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_non_public_w_interaction_allows", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_non_public_w_interaction_denies", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_public", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_miss", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_miss_none_set", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_public", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_w_interaction_allows", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_w_interaction_denies", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_class_conforms_to_IChecker", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_ctor_w_non_dict_get_permissions", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_ctor_w_non_dict_set_permissions", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_instance_conforms_to_IChecker", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_iteration_of_dict_items_keys_values", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_permission_id_hit", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_permission_id_miss", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_already_proxied", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_no_checker_no_dunder_w_select", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_no_checker_w_dunder", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_no_dunder_no_select", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_setattr_permission_id_hit", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_setattr_permission_id_miss", "src/zope/security/tests/test_checker.py::CheckerPyTests::test_setattr_permission_id_miss_none_set", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_available_by_default", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_miss", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_non_public_w_interaction_allows", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_non_public_w_interaction_denies", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_public", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_miss", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_miss_none_set", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_public", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_w_interaction_allows", "src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_w_interaction_denies", "src/zope/security/tests/test_checker.py::CheckerTests::test_class_conforms_to_IChecker", "src/zope/security/tests/test_checker.py::CheckerTests::test_ctor_w_non_dict_get_permissions", "src/zope/security/tests/test_checker.py::CheckerTests::test_ctor_w_non_dict_set_permissions", "src/zope/security/tests/test_checker.py::CheckerTests::test_instance_conforms_to_IChecker", "src/zope/security/tests/test_checker.py::CheckerTests::test_iteration_of_dict_items_keys_values", "src/zope/security/tests/test_checker.py::CheckerTests::test_permission_id_hit", "src/zope/security/tests/test_checker.py::CheckerTests::test_permission_id_miss", "src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_already_proxied", "src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_no_checker_no_dunder_w_select", "src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_no_checker_w_dunder", "src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_no_dunder_no_select", "src/zope/security/tests/test_checker.py::CheckerTests::test_setattr_permission_id_hit", "src/zope/security/tests/test_checker.py::CheckerTests::test_setattr_permission_id_miss", "src/zope/security/tests/test_checker.py::CheckerTests::test_setattr_permission_id_miss_none_set", "src/zope/security/tests/test_checker.py::TracebackSupplementTests::test_getInfo_builtin_types", "src/zope/security/tests/test_checker.py::TracebackSupplementTests::test_getInfo_newstyle_instance", "src/zope/security/tests/test_checker.py::GlobalTests::test___reduce__", "src/zope/security/tests/test_checker.py::GlobalTests::test___repr__", "src/zope/security/tests/test_checker.py::GlobalTests::test_ctor_name_and_module", "src/zope/security/tests/test_checker.py::Test_NamesChecker::test_empty_names_no_kw", "src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_no_kw", "src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_no_kw_explicit_permission", "src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_w_kw_no_clash", "src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_w_kw_w_clash", "src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_derived_iface", "src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_simple_iface_w_explicit_permission", "src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_simple_iface_w_kw", "src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_simple_iface_wo_kw", "src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_w_clash", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_empty", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_iface", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_mapping", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names_and_iface", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names_and_iface_clash", "src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names_and_mapping_clash", "src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_basic_types_NoProxy", "src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_checker_inst", "src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_factory", "src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_returning_NoProxy", "src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_returning_None", "src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_returning_checker", "src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_basic_types_NoProxy", "src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_checker_inst", "src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_factory", "src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_returning_NoProxy", "src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_returning_None", "src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_returning_checker", "src/zope/security/tests/test_checker.py::Test_getCheckerForInstancesOf::test_hit", "src/zope/security/tests/test_checker.py::Test_getCheckerForInstancesOf::test_miss", "src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_duplicate", "src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_module", "src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_newstyle_class", "src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_wrong_type", "src/zope/security/tests/test_checker.py::Test_undefineChecker::test_hit", "src/zope/security/tests/test_checker.py::Test_undefineChecker::test_miss", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_forbidden_rhs_forbidden", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_forbidden_rhs_ok", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_forbidden_rhs_unauth", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_ok_rhs_not_called", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_unauth_rhs_forbidden", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_unauth_rhs_ok", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_unauth_rhs_unauth", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_forbidden_rhs_forbidden", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_forbidden_rhs_ok", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_forbidden_rhs_unauth", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_ok_rhs_not_called", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_unauth_rhs_forbidden", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_unauth_rhs_ok", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_unauth_rhs_unauth", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_class_conforms_to_IChecker", "src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_instance_conforms_to_IChecker", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_forbidden_attribute", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_forbidden_attribute", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_ok_normal_verbosity", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_ok_raised_verbosity_available_by_default", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_ok_raised_verbosity_normal_name", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_unauthorized", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_ok_normal_verbosity", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_ok_raised_verbosity_available_by_default", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_ok_raised_verbosity_normal_name", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_forbidden_attribute", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_ok_normal_verbosity", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_ok_raised_verbosity_normal_name", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_unauthorized", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setitem_unauthorized", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_unauthorized", "src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_unauthorized_raised_verbosity", "src/zope/security/tests/test_checker.py::Test__instanceChecker::test_hit", "src/zope/security/tests/test_checker.py::Test__instanceChecker::test_miss", "src/zope/security/tests/test_checker.py::Test_moduleChecker::test_hit", "src/zope/security/tests/test_checker.py::Test_moduleChecker::test_miss", "src/zope/security/tests/test_checker.py::BasicTypesTests::test___delitem__", "src/zope/security/tests/test_checker.py::BasicTypesTests::test___setitem__", "src/zope/security/tests/test_checker.py::BasicTypesTests::test_clear", "src/zope/security/tests/test_checker.py::BasicTypesTests::test_update", "src/zope/security/tests/test_checker.py::Test::testAlwaysAvailable", "src/zope/security/tests/test_checker.py::Test::testLayeredProxies", "src/zope/security/tests/test_checker.py::Test::testMultiChecker", "src/zope/security/tests/test_checker.py::Test::test_ProxyFactory", "src/zope/security/tests/test_checker.py::Test::test_ProxyFactory_using_proxy", "src/zope/security/tests/test_checker.py::Test::test_canWrite_canAccess", "src/zope/security/tests/test_checker.py::Test::test_defineChecker_error", "src/zope/security/tests/test_checker.py::Test::test_defineChecker_module", "src/zope/security/tests/test_checker.py::Test::test_defineChecker_newstyle_class", "src/zope/security/tests/test_checker.py::Test::test_define_and_undefineChecker", "src/zope/security/tests/test_checker.py::Test::test_iteration", "src/zope/security/tests/test_checker.py::TestCheckerPublic::test_that_CheckerPublic_identity_works_even_when_proxied", "src/zope/security/tests/test_checker.py::TestCheckerPublic::test_that_pickling_CheckerPublic_retains_identity", "src/zope/security/tests/test_checker.py::TestCombinedChecker::test_checking", "src/zope/security/tests/test_checker.py::TestCombinedChecker::test_interface", "src/zope/security/tests/test_checker.py::TestBasicTypes::test", "src/zope/security/tests/test_checker.py::test_suite" ]
[]
Zope Public License 2.1
1,260
[ "src/zope/security/checker.py", "CHANGES.rst" ]
[ "src/zope/security/checker.py", "CHANGES.rst" ]
cherrypy__cherrypy-1596
2c5643367147bae270e83dfba25c1897f37dbe18
2017-05-17 12:22:19
2c5643367147bae270e83dfba25c1897f37dbe18
diff --git a/cherrypy/_helper.py b/cherrypy/_helper.py index 5875ec0f..9b727eac 100644 --- a/cherrypy/_helper.py +++ b/cherrypy/_helper.py @@ -223,6 +223,30 @@ def url(path='', qs='', script_name=None, base=None, relative=None): if qs: qs = '?' + qs + def normalize_path(path): + if './' not in path: + return path + + # Normalize the URL by removing ./ and ../ + atoms = [] + for atom in path.split('/'): + if atom == '.': + pass + elif atom == '..': + # Don't pop from empty list + # (i.e. ignore redundant '..') + if atoms: + atoms.pop() + elif atom: + atoms.append(atom) + + newpath = '/'.join(atoms) + # Preserve leading '/' + if path.startswith('/'): + newpath = '/' + newpath + + return newpath + if cherrypy.request.app: if not path.startswith('/'): # Append/remove trailing slash from path_info as needed @@ -246,7 +270,7 @@ def url(path='', qs='', script_name=None, base=None, relative=None): if base is None: base = cherrypy.request.base - newurl = base + script_name + path + qs + newurl = base + script_name + normalize_path(path) + qs else: # No request.app (we're being called outside a request). # We'll have to guess the base from server.* attributes. @@ -256,19 +280,7 @@ def url(path='', qs='', script_name=None, base=None, relative=None): base = cherrypy.server.base() path = (script_name or '') + path - newurl = base + path + qs - - if './' in newurl: - # Normalize the URL by removing ./ and ../ - atoms = [] - for atom in newurl.split('/'): - if atom == '.': - pass - elif atom == '..': - atoms.pop() - else: - atoms.append(atom) - newurl = '/'.join(atoms) + newurl = base + normalize_path(path) + qs # At this point, we should have a fully-qualified absolute URL.
`cherrypy.url` fails to normalize path This call to `cherrypy.url` fails with `IndexError`: ``` >>> cherrypy.url(qs='../../../../../../etc/passwd') ... IndexError: pop from empty list ``` The culprit seems in this logic, which strips `newurl` of as many `atoms` as there are `..`: https://github.com/cherrypy/cherrypy/blob/master/cherrypy/_helper.py#L261,L271 There are various problems. - That logic should only applied to the "path" part of `newurl`, not to the full url. - As a consequence of the point above, `..` in the query string `qs` should not be considered - To consider: redundant `..` should be ignored, to mimic `os.path.normpath`: ``` >>> os.path.normpath('/etc/../../../usr') '/usr' ```
cherrypy/cherrypy
diff --git a/cherrypy/test/test_core.py b/cherrypy/test/test_core.py index f16efd58..252c1ac5 100644 --- a/cherrypy/test/test_core.py +++ b/cherrypy/test/test_core.py @@ -74,6 +74,9 @@ class CoreRequestHandlingTest(helper.CPWebCase): relative = bool(relative) return cherrypy.url(path_info, relative=relative) + def qs(self, qs): + return cherrypy.url(qs=qs) + def log_status(): Status.statuses.append(cherrypy.response.status) cherrypy.tools.log_status = cherrypy.Tool( @@ -647,6 +650,8 @@ class CoreRequestHandlingTest(helper.CPWebCase): self.assertBody('%s/url/other/page1' % self.base()) self.getPage('/url/?path_info=/other/./page1') self.assertBody('%s/other/page1' % self.base()) + self.getPage('/url/?path_info=/other/././././page1') + self.assertBody('%s/other/page1' % self.base()) # Double dots self.getPage('/url/leaf?path_info=../page1') @@ -655,6 +660,20 @@ class CoreRequestHandlingTest(helper.CPWebCase): self.assertBody('%s/url/page1' % self.base()) self.getPage('/url/leaf?path_info=/other/../page1') self.assertBody('%s/page1' % self.base()) + self.getPage('/url/leaf?path_info=/other/../../../page1') + self.assertBody('%s/page1' % self.base()) + self.getPage('/url/leaf?path_info=/other/../../../../../page1') + self.assertBody('%s/page1' % self.base()) + + # qs param is not normalized as a path + self.getPage('/url/qs?qs=/other') + self.assertBody('%s/url/qs?/other' % self.base()) + self.getPage('/url/qs?qs=/other/../page1') + self.assertBody('%s/url/qs?/other/../page1' % self.base()) + self.getPage('/url/qs?qs=../page1') + self.assertBody('%s/url/qs?../page1' % self.base()) + self.getPage('/url/qs?qs=../../page1') + self.assertBody('%s/url/qs?../../page1' % self.base()) # Output relative to current path or script_name self.getPage('/url/?path_info=page1&relative=True')
{ "commit_name": "head_commit", "failed_lite_validators": [], "has_test_patch": true, "is_lite": true, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 1 }
10.2
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev" ], "python": "3.9", "reqs_path": [ "requirements/base.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
cheroot==10.0.1 -e git+https://github.com/cherrypy/cherrypy.git@2c5643367147bae270e83dfba25c1897f37dbe18#egg=CherryPy exceptiongroup==1.2.2 iniconfig==2.1.0 jaraco.functools==4.1.0 more-itertools==10.6.0 packaging==24.2 pluggy==1.5.0 portend==3.2.0 pytest==8.3.5 python-dateutil==2.9.0.post0 six==1.17.0 tempora==5.8.0 tomli==2.2.1
name: cherrypy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cheroot==10.0.1 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - jaraco-functools==4.1.0 - more-itertools==10.6.0 - packaging==24.2 - pluggy==1.5.0 - portend==3.2.0 - pytest==8.3.5 - python-dateutil==2.9.0.post0 - six==1.17.0 - tempora==5.8.0 - tomli==2.2.1 prefix: /opt/conda/envs/cherrypy
[ "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_cherrypy_url" ]
[]
[ "cherrypy/test/test_core.py::CoreRequestHandlingTest::testCookies", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testDefaultContentType", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testFavicon", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testFlatten", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testRanges", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testRedirect", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testSlashes", "cherrypy/test/test_core.py::CoreRequestHandlingTest::testStatus", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_InternalRedirect", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_expose_decorator", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_multiple_headers", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_on_end_resource_status", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_redirect_with_unicode", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_redirect_with_xss", "cherrypy/test/test_core.py::CoreRequestHandlingTest::test_gc", "cherrypy/test/test_core.py::ErrorTests::test_contextmanager", "cherrypy/test/test_core.py::ErrorTests::test_start_response_error", "cherrypy/test/test_core.py::ErrorTests::test_gc", "cherrypy/test/test_core.py::TestBinding::test_bind_ephemeral_port" ]
[]
BSD 3-Clause "New" or "Revised" License
1,261
[ "cherrypy/_helper.py" ]
[ "cherrypy/_helper.py" ]
borgbackup__borg-2527
eaf90cb73dfbe2e7996ae444d5c6bffd0ea89f7a
2017-05-17 17:34:07
a439fa3e720c8bb2a82496768ffcce282fb7f7b7
codecov-io: # [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=h1) Report > Merging [#2527](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=desc) into [master](https://codecov.io/gh/borgbackup/borg/commit/eaf90cb73dfbe2e7996ae444d5c6bffd0ea89f7a?src=pr&el=desc) will **decrease** coverage by `0.06%`. > The diff coverage is `68.18%`. [![Impacted file tree graph](https://codecov.io/gh/borgbackup/borg/pull/2527/graphs/tree.svg?width=650&height=150&src=pr&token=LssEpmW3o4)](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2527 +/- ## ========================================== - Coverage 83.53% 83.46% -0.07% ========================================== Files 22 22 Lines 7938 7966 +28 Branches 1349 1360 +11 ========================================== + Hits 6631 6649 +18 - Misses 936 942 +6 - Partials 371 375 +4 ``` | [Impacted Files](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [src/borg/helpers.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvaGVscGVycy5weQ==) | `87.52% <ø> (+0.17%)` | :arrow_up: | | [src/borg/logger.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvbG9nZ2VyLnB5) | `70.68% <100%> (+0.77%)` | :arrow_up: | | [src/borg/archiver.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvYXJjaGl2ZXIucHk=) | `82.9% <100%> (+0.02%)` | :arrow_up: | | [src/borg/remote.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvcmVtb3RlLnB5) | `76.36% <60%> (-1.39%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=footer). Last update [eaf90cb...6cedd7f](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). enkore: Thanks, I clarified these in f0b84042.
diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 0ddfe1fe..9946dd47 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -3815,15 +3815,15 @@ def _setup_implied_logging(self, args): """ turn on INFO level logging for args that imply that they will produce output """ # map of option name to name of logger for that option option_logger = { - 'output_list': 'borg.output.list', - 'show_version': 'borg.output.show-version', - 'show_rc': 'borg.output.show-rc', - 'stats': 'borg.output.stats', - 'progress': 'borg.output.progress', - } + 'output_list': 'borg.output.list', + 'show_version': 'borg.output.show-version', + 'show_rc': 'borg.output.show-rc', + 'stats': 'borg.output.stats', + 'progress': 'borg.output.progress', + } for option, logger_name in option_logger.items(): - if args.get(option, False): - logging.getLogger(logger_name).setLevel('INFO') + option_set = args.get(option, False) + logging.getLogger(logger_name).setLevel('INFO' if option_set else 'WARN') def _setup_topic_debugging(self, args): """Turn on DEBUG level logging for specified --debug-topics.""" @@ -3839,8 +3839,10 @@ def run(self, args): # This works around http://bugs.python.org/issue9351 func = getattr(args, 'func', None) or getattr(args, 'fallback_func') # do not use loggers before this! - setup_logging(level=args.log_level, is_serve=func == self.do_serve, json=args.log_json) + is_serve = func == self.do_serve + setup_logging(level=args.log_level, is_serve=is_serve, json=args.log_json) self.log_json = args.log_json + args.progress |= is_serve self._setup_implied_logging(vars(args)) self._setup_topic_debugging(args) if args.show_version: diff --git a/src/borg/helpers.py b/src/borg/helpers.py index ec06946e..a93ba710 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -1226,6 +1226,14 @@ def __init__(self, msgid=None): if self.logger.level == logging.NOTSET: self.logger.setLevel(logging.WARN) self.logger.propagate = False + + # If --progress is not set then the progress logger level will be WARN + # due to setup_implied_logging (it may be NOTSET with a logging config file, + # but the interactions there are generally unclear), so self.emit becomes + # False, which is correct. + # If --progress is set then the level will be INFO as per setup_implied_logging; + # note that this is always the case for serve processes due to a "args.progress |= is_serve". + # In this case self.emit is True. self.emit = self.logger.getEffectiveLevel() == logging.INFO def __del__(self): diff --git a/src/borg/logger.py b/src/borg/logger.py index 6300776d..69cb86f1 100644 --- a/src/borg/logger.py +++ b/src/borg/logger.py @@ -88,15 +88,21 @@ def setup_logging(stream=None, conf_fname=None, env_var='BORG_LOGGING_CONF', lev # if we did not / not successfully load a logging configuration, fallback to this: logger = logging.getLogger('') handler = logging.StreamHandler(stream) - if is_serve: + if is_serve and not json: fmt = '$LOG %(levelname)s %(name)s Remote: %(message)s' else: fmt = '%(message)s' - formatter = JsonFormatter(fmt) if json and not is_serve else logging.Formatter(fmt) + formatter = JsonFormatter(fmt) if json else logging.Formatter(fmt) handler.setFormatter(formatter) borg_logger = logging.getLogger('borg') borg_logger.formatter = formatter borg_logger.json = json + if configured and logger.handlers: + # The RepositoryServer can call setup_logging a second time to adjust the output + # mode from text-ish is_serve to json is_serve. + # Thus, remove the previously installed handler, if any. + logger.handlers[0].close() + logger.handlers.clear() logger.addHandler(handler) logger.setLevel(level.upper()) configured = True @@ -224,6 +230,8 @@ def format(self, record): data = { 'type': 'log_message', 'time': record.created, + 'message': '', + 'levelname': 'CRITICAL', } for attr in self.RECORD_ATTRIBUTES: value = getattr(record, attr, None) diff --git a/src/borg/remote.py b/src/borg/remote.py index c32ba9e6..1a67930e 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -2,29 +2,30 @@ import fcntl import functools import inspect +import json import logging import os import select import shlex import sys import tempfile -import traceback import textwrap import time +import traceback from subprocess import Popen, PIPE import msgpack from . import __version__ from .helpers import Error, IntegrityError -from .helpers import get_home_dir -from .helpers import sysinfo from .helpers import bin_to_hex -from .helpers import replace_placeholders +from .helpers import get_home_dir from .helpers import hostname_is_unique +from .helpers import replace_placeholders +from .helpers import sysinfo +from .logger import create_logger, setup_logging from .repository import Repository, MAX_OBJECT_SIZE, LIST_SCAN_LIMIT from .version import parse_version, format_version -from .logger import create_logger logger = create_logger(__name__) @@ -312,6 +313,10 @@ def negotiate(self, client_data): # clients since 1.1.0b3 use a dict as client_data if isinstance(client_data, dict): self.client_version = client_data[b'client_version'] + if client_data.get(b'client_supports_log_v3', False): + level = logging.getLevelName(logging.getLogger('').level) + setup_logging(is_serve=True, json=True, level=level) + logger.debug('Initialized logging system for new (v3) protocol') else: self.client_version = BORG_VERSION # seems to be newer than current version (no known old format) @@ -555,7 +560,10 @@ def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock try: try: - version = self.call('negotiate', {'client_data': {b'client_version': BORG_VERSION}}) + version = self.call('negotiate', {'client_data': { + b'client_version': BORG_VERSION, + b'client_supports_log_v3': True, + }}) except ConnectionClosed: raise ConnectionClosedWithHint('Is borg working on the server?') from None if version == RPC_PROTOCOL_VERSION: @@ -646,12 +654,23 @@ def borg_cmd(self, args, testing): opts.append('--critical') else: raise ValueError('log level missing, fix this code') - try: - borg_logger = logging.getLogger('borg') - if borg_logger.json: - opts.append('--log-json') - except AttributeError: - pass + + # Tell the remote server about debug topics it may need to consider. + # Note that debug topics are usable for "spew" or "trace" logs which would + # be too plentiful to transfer for normal use, so the server doesn't send + # them unless explicitly enabled. + # + # Needless to say, if you do --debug-topic=repository.compaction, for example, + # with a 1.0.x server it won't work, because the server does not recognize the + # option. + # + # This is not considered a problem, since this is a debugging feature that + # should not be used for regular use. + for topic in args.debug_topics: + if '.' not in topic: + topic = 'borg.debug.' + topic + if 'repository' in topic: + opts.append('--debug-topic=%s' % topic) env_vars = [] if not hostname_is_unique(): env_vars.append('BORG_HOSTNAME_IS_UNIQUE=no') @@ -930,7 +949,63 @@ def preload(self, ids): def handle_remote_line(line): - if line.startswith('$LOG '): + """ + Handle a remote log line. + + This function is remarkably complex because it handles multiple wire formats. + """ + if line.startswith('{'): + # This format is used by Borg since 1.1.0b6 for new-protocol clients. + # It is the same format that is exposed by --log-json. + msg = json.loads(line) + + if msg['type'] not in ('progress_message', 'progress_percent', 'log_message'): + logger.warning('Dropped remote log message with unknown type %r: %s', msg['type'], line) + return + + if msg['type'] == 'log_message': + # Re-emit log messages on the same level as the remote to get correct log suppression and verbosity. + level = getattr(logging, msg['levelname'], logging.CRITICAL) + assert isinstance(level, int) + target_logger = logging.getLogger(msg['name']) + msg['message'] = 'Remote: ' + msg['message'] + # In JSON mode, we manually check whether the log message should be propagated. + if logging.getLogger('borg').json and level >= target_logger.getEffectiveLevel(): + sys.stderr.write(json.dumps(msg) + '\n') + else: + target_logger.log(level, '%s', msg['message']) + elif msg['type'].startswith('progress_'): + # Progress messages are a bit more complex. + # First of all, we check whether progress output is enabled. This is signalled + # through the effective level of the borg.output.progress logger + # (also see ProgressIndicatorBase in borg.helpers). + progress_logger = logging.getLogger('borg.output.progress') + if progress_logger.getEffectiveLevel() == logging.INFO: + # When progress output is enabled, we check whether the client is in + # --log-json mode, as signalled by the "json" attribute on the "borg" logger. + if logging.getLogger('borg').json: + # In --log-json mode we re-emit the progress JSON line as sent by the server, + # with the message, if any, prefixed with "Remote: ". + if 'message' in msg: + msg['message'] = 'Remote: ' + msg['message'] + sys.stderr.write(json.dumps(msg) + '\n') + elif 'message' in msg: + # In text log mode we write only the message to stderr and terminate with \r + # (carriage return, i.e. move the write cursor back to the beginning of the line) + # so that the next message, progress or not, overwrites it. This mirrors the behaviour + # of local progress displays. + sys.stderr.write('Remote: ' + msg['message'] + '\r') + elif line.startswith('$LOG '): + # This format is used by Borg since 1.1.0b1. + # It prefixed log lines with $LOG as a marker, followed by the log level + # and optionally a logger name, then "Remote:" as a separator followed by the original + # message. + # + # It is the oldest format supported by these servers, so it was important to make + # it readable with older (1.0.x) clients. + # + # TODO: Remove this block (so it'll be handled by the "else:" below) with a Borg 1.1 RC. + # Also check whether client_supports_log_v3 should be removed. _, level, msg = line.split(' ', 2) level = getattr(logging, level, logging.CRITICAL) # str -> int if msg.startswith('Remote:'): @@ -941,7 +1016,15 @@ def handle_remote_line(line): logname, msg = msg.split(' ', 1) logging.getLogger(logname).log(level, msg.rstrip()) else: - sys.stderr.write('Remote: ' + line) + # Plain 1.0.x and older format - re-emit to stderr (mirroring what the 1.0.x + # client did) or as a generic log message. + # We don't know what priority the line had. + if logging.getLogger('borg').json: + logging.getLogger('').warning('Remote: ' + line.strip()) + else: + # In non-JSON mode we circumvent logging to preserve carriage returns (\r) + # which are generated by remote progress displays. + sys.stderr.write('Remote: ' + line) class RepositoryNoCache:
--progress for serve/RPC doesn't work I think this was broken with the implied logging stuff? --- :moneybag: [there is a bounty for this](https://www.bountysource.com/issues/42549881-progress-for-serve-rpc-doesn-t-work)
borgbackup/borg
diff --git a/src/borg/testsuite/repository.py b/src/borg/testsuite/repository.py index 2819c64c..16f47b91 100644 --- a/src/borg/testsuite/repository.py +++ b/src/borg/testsuite/repository.py @@ -714,6 +714,7 @@ def test_borg_cmd(self): class MockArgs: remote_path = 'borg' umask = 0o077 + debug_topics = [] assert self.repository.borg_cmd(None, testing=True) == [sys.executable, '-m', 'borg.archiver', 'serve'] args = MockArgs() @@ -723,6 +724,9 @@ class MockArgs: assert self.repository.borg_cmd(args, testing=False) == ['borg', 'serve', '--umask=077', '--info'] args.remote_path = 'borg-0.28.2' assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info'] + args.debug_topics = ['something_client_side', 'repository_compaction'] + assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info', + '--debug-topic=borg.debug.repository_compaction'] class RemoteLegacyFree(RepositoryTestCaseBase):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_hyperlinks", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 4 }
1.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest pytest-xdist pytest-cov pytest-benchmark" ], "pre_install": [ "apt-get update", "apt-get install -y gcc libssl-dev libacl1-dev liblz4-dev libfuse-dev" ], "python": "3.9", "reqs_path": [ "requirements.d/development.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/borgbackup/borg.git@eaf90cb73dfbe2e7996ae444d5c6bffd0ea89f7a#egg=borgbackup cachetools==5.5.2 chardet==5.2.0 colorama==0.4.6 coverage==7.8.0 Cython==3.0.12 distlib==0.3.9 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.18.0 iniconfig==2.1.0 msgpack-python==0.5.6 packaging==24.2 platformdirs==4.3.7 pluggy==1.5.0 py-cpuinfo==9.0.0 pyproject-api==1.9.0 pytest==8.3.5 pytest-benchmark==5.1.0 pytest-cov==6.0.0 pytest-xdist==3.6.1 setuptools-scm==8.2.0 tomli==2.2.1 tox==4.25.0 typing_extensions==4.13.0 virtualenv==20.29.3
name: borg channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - cachetools==5.5.2 - chardet==5.2.0 - colorama==0.4.6 - coverage==7.8.0 - cython==3.0.12 - distlib==0.3.9 - exceptiongroup==1.2.2 - execnet==2.1.1 - filelock==3.18.0 - iniconfig==2.1.0 - msgpack-python==0.5.6 - packaging==24.2 - platformdirs==4.3.7 - pluggy==1.5.0 - py-cpuinfo==9.0.0 - pyproject-api==1.9.0 - pytest==8.3.5 - pytest-benchmark==5.1.0 - pytest-cov==6.0.0 - pytest-xdist==3.6.1 - setuptools-scm==8.2.0 - tomli==2.2.1 - tox==4.25.0 - typing-extensions==4.13.0 - virtualenv==20.29.3 prefix: /opt/conda/envs/borg
[ "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_borg_cmd" ]
[ "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test1", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_consistency", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_invalid_rpc", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_max_data_size", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_rpc_exception_transport", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_corrupted_commit_segment", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_corrupted_segment", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_commit_segment", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_no_commits" ]
[ "src/borg/testsuite/repository.py::RepositoryTestCase::test1", "src/borg/testsuite/repository.py::RepositoryTestCase::test2", "src/borg/testsuite/repository.py::RepositoryTestCase::test_consistency", "src/borg/testsuite/repository.py::RepositoryTestCase::test_consistency2", "src/borg/testsuite/repository.py::RepositoryTestCase::test_list", "src/borg/testsuite/repository.py::RepositoryTestCase::test_max_data_size", "src/borg/testsuite/repository.py::RepositoryTestCase::test_overwrite_in_same_transaction", "src/borg/testsuite/repository.py::RepositoryTestCase::test_scan", "src/borg/testsuite/repository.py::RepositoryTestCase::test_single_kind_transactions", "src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse1", "src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse2", "src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse_delete", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_compact_segments", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_deleting_compacted_segments", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_write_index", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_ignores_commit_tag_in_data", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_moved_deletes_are_tracked", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_lock_upgrade", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_lock_upgrade_old", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_of_missing_index", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_shadow_index_rollback", "src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_shadowed_entries_are_preserved", "src/borg/testsuite/repository.py::RepositoryAppendOnlyTestCase::test_append_only", "src/borg/testsuite/repository.py::RepositoryAppendOnlyTestCase::test_destroy_append_only", "src/borg/testsuite/repository.py::RepositoryFreeSpaceTestCase::test_additional_free_space", "src/borg/testsuite/repository.py::RepositoryFreeSpaceTestCase::test_create_free_space", "src/borg/testsuite/repository.py::NonceReservation::test_commit_nonce_reservation", "src/borg/testsuite/repository.py::NonceReservation::test_commit_nonce_reservation_asserts", "src/borg/testsuite/repository.py::NonceReservation::test_get_free_nonce", "src/borg/testsuite/repository.py::NonceReservation::test_get_free_nonce_asserts", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_corrupted_hints", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_deleted_hints", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_deleted_index", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_index", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_index_outside_transaction", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_unreadable_hints", "src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_unreadable_index", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_crash_before_compact", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_corrupted_commit_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_corrupted_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_index_too_new", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_commit_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_index", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_segment", "src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_no_commits", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test2", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_consistency2", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_list", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_overwrite_in_same_transaction", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_scan", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_single_kind_transactions", "src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_ssh_cmd", "src/borg/testsuite/repository.py::RemoteLegacyFree::test_legacy_free", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_crash_before_compact", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_index_too_new", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_index", "src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_segment", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_info_to_correct_local_child", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_post11_format_messages", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_pre11_format_messages", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_remote_messages_screened", "src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_stderr_messages" ]
[]
BSD License
1,262
[ "src/borg/helpers.py", "src/borg/logger.py", "src/borg/remote.py", "src/borg/archiver.py" ]
[ "src/borg/helpers.py", "src/borg/logger.py", "src/borg/remote.py", "src/borg/archiver.py" ]
dask__dask-2356
38ac6a98bca27a28fc97ae30022ff44340590744
2017-05-17 18:59:24
b25fcaf1f84521425faa935f3c586f418c83760a
diff --git a/dask/array/ufunc.py b/dask/array/ufunc.py index 7096c4071..e8e21f22c 100644 --- a/dask/array/ufunc.py +++ b/dask/array/ufunc.py @@ -1,10 +1,13 @@ from __future__ import absolute_import, division, print_function from operator import getitem +from functools import partial import numpy as np +from toolz import curry -from .core import Array, elemwise +from .core import Array, elemwise, atop, apply_infer_dtype, asarray +from ..base import Base from .. import core, sharedict from ..utils import skip_doctest @@ -13,6 +16,12 @@ def __array_wrap__(numpy_ufunc, x, *args, **kwargs): return x.__array_wrap__(numpy_ufunc(x, *args, **kwargs)) +@curry +def copy_docstring(target, source=None): + target.__doc__ = skip_doctest(source.__doc__) + return target + + def wrap_elemwise(numpy_ufunc, array_wrap=False): """ Wrap up numpy function into dask.array """ @@ -33,112 +42,183 @@ def wrap_elemwise(numpy_ufunc, array_wrap=False): return wrapped +class ufunc(object): + _forward_attrs = {'nin', 'nargs', 'nout', 'ntypes', 'identity', + 'signature', 'types'} + + def __init__(self, ufunc): + if not isinstance(ufunc, np.ufunc): + raise TypeError("must be an instance of `ufunc`, " + "got `%s" % type(ufunc).__name__) + self._ufunc = ufunc + self.__name__ = ufunc.__name__ + copy_docstring(self, ufunc) + + def __getattr__(self, key): + if key in self._forward_attrs: + return getattr(self._ufunc, key) + raise AttributeError("%r object has no attribute " + "%r" % (type(self).__name__, key)) + + def __dir__(self): + return list(self._forward_attrs.union(dir(type(self)), self.__dict__)) + + def __repr__(self): + return repr(self._ufunc) + + def __call__(self, *args, **kwargs): + dsk = [arg for arg in args if hasattr(arg, '_elemwise')] + if len(dsk) > 0: + return dsk[0]._elemwise(self._ufunc, *args, **kwargs) + else: + return self._ufunc(*args, **kwargs) + + @copy_docstring(source=np.ufunc.outer) + def outer(self, A, B, **kwargs): + if self.nin != 2: + raise ValueError("outer product only supported for binary functions") + if 'out' in kwargs: + raise ValueError("`out` kwarg not supported") + + A_is_dask = isinstance(A, Base) + B_is_dask = isinstance(B, Base) + if not A_is_dask and not B_is_dask: + return self._ufunc.outer(A, B, **kwargs) + elif (A_is_dask and not isinstance(A, Array) or + B_is_dask and not isinstance(B, Array)): + raise NotImplementedError("Dask objects besides `dask.array.Array` " + "are not supported at this time.") + + A = asarray(A) + B = asarray(B) + ndim = A.ndim + B.ndim + out_inds = tuple(range(ndim)) + A_inds = out_inds[:A.ndim] + B_inds = out_inds[A.ndim:] + + dtype = apply_infer_dtype(self._ufunc.outer, [A, B], kwargs, + 'ufunc.outer', suggest_dtype=False) + + if 'dtype' in kwargs: + func = partial(self._ufunc.outer, dtype=kwargs.pop('dtype')) + else: + func = self._ufunc.outer + + return atop(func, out_inds, A, A_inds, B, B_inds, dtype=dtype, + token=self.__name__ + '.outer', **kwargs) + + # ufuncs, copied from this page: # http://docs.scipy.org/doc/numpy/reference/ufuncs.html # math operations -add = wrap_elemwise(np.add) -subtract = wrap_elemwise(np.subtract) -multiply = wrap_elemwise(np.multiply) -divide = wrap_elemwise(np.divide) -logaddexp = wrap_elemwise(np.logaddexp) -logaddexp2 = wrap_elemwise(np.logaddexp2) -true_divide = wrap_elemwise(np.true_divide) -floor_divide = wrap_elemwise(np.floor_divide) -negative = wrap_elemwise(np.negative) -power = wrap_elemwise(np.power) -remainder = wrap_elemwise(np.remainder) -mod = wrap_elemwise(np.mod) +add = ufunc(np.add) +subtract = ufunc(np.subtract) +multiply = ufunc(np.multiply) +divide = ufunc(np.divide) +logaddexp = ufunc(np.logaddexp) +logaddexp2 = ufunc(np.logaddexp2) +true_divide = ufunc(np.true_divide) +floor_divide = ufunc(np.floor_divide) +negative = ufunc(np.negative) +power = ufunc(np.power) +remainder = ufunc(np.remainder) +mod = ufunc(np.mod) # fmod: see below -conj = wrap_elemwise(np.conj) -exp = wrap_elemwise(np.exp) -exp2 = wrap_elemwise(np.exp2) -log = wrap_elemwise(np.log) -log2 = wrap_elemwise(np.log2) -log10 = wrap_elemwise(np.log10) -log1p = wrap_elemwise(np.log1p) -expm1 = wrap_elemwise(np.expm1) -sqrt = wrap_elemwise(np.sqrt) -square = wrap_elemwise(np.square) -cbrt = wrap_elemwise(np.cbrt) -reciprocal = wrap_elemwise(np.reciprocal) +conj = ufunc(np.conj) +exp = ufunc(np.exp) +exp2 = ufunc(np.exp2) +log = ufunc(np.log) +log2 = ufunc(np.log2) +log10 = ufunc(np.log10) +log1p = ufunc(np.log1p) +expm1 = ufunc(np.expm1) +sqrt = ufunc(np.sqrt) +square = ufunc(np.square) +cbrt = ufunc(np.cbrt) +reciprocal = ufunc(np.reciprocal) # trigonometric functions -sin = wrap_elemwise(np.sin) -cos = wrap_elemwise(np.cos) -tan = wrap_elemwise(np.tan) -arcsin = wrap_elemwise(np.arcsin) -arccos = wrap_elemwise(np.arccos) -arctan = wrap_elemwise(np.arctan) -arctan2 = wrap_elemwise(np.arctan2) -hypot = wrap_elemwise(np.hypot) -sinh = wrap_elemwise(np.sinh) -cosh = wrap_elemwise(np.cosh) -tanh = wrap_elemwise(np.tanh) -arcsinh = wrap_elemwise(np.arcsinh) -arccosh = wrap_elemwise(np.arccosh) -arctanh = wrap_elemwise(np.arctanh) -deg2rad = wrap_elemwise(np.deg2rad) -rad2deg = wrap_elemwise(np.rad2deg) +sin = ufunc(np.sin) +cos = ufunc(np.cos) +tan = ufunc(np.tan) +arcsin = ufunc(np.arcsin) +arccos = ufunc(np.arccos) +arctan = ufunc(np.arctan) +arctan2 = ufunc(np.arctan2) +hypot = ufunc(np.hypot) +sinh = ufunc(np.sinh) +cosh = ufunc(np.cosh) +tanh = ufunc(np.tanh) +arcsinh = ufunc(np.arcsinh) +arccosh = ufunc(np.arccosh) +arctanh = ufunc(np.arctanh) +deg2rad = ufunc(np.deg2rad) +rad2deg = ufunc(np.rad2deg) # comparison functions -greater = wrap_elemwise(np.greater) -greater_equal = wrap_elemwise(np.greater_equal) -less = wrap_elemwise(np.less) -less_equal = wrap_elemwise(np.less_equal) -not_equal = wrap_elemwise(np.not_equal) -equal = wrap_elemwise(np.equal) -logical_and = wrap_elemwise(np.logical_and) -logical_or = wrap_elemwise(np.logical_or) -logical_xor = wrap_elemwise(np.logical_xor) -logical_not = wrap_elemwise(np.logical_not) -maximum = wrap_elemwise(np.maximum) -minimum = wrap_elemwise(np.minimum) -fmax = wrap_elemwise(np.fmax) -fmin = wrap_elemwise(np.fmin) +greater = ufunc(np.greater) +greater_equal = ufunc(np.greater_equal) +less = ufunc(np.less) +less_equal = ufunc(np.less_equal) +not_equal = ufunc(np.not_equal) +equal = ufunc(np.equal) +logical_and = ufunc(np.logical_and) +logical_or = ufunc(np.logical_or) +logical_xor = ufunc(np.logical_xor) +logical_not = ufunc(np.logical_not) +maximum = ufunc(np.maximum) +minimum = ufunc(np.minimum) +fmax = ufunc(np.fmax) +fmin = ufunc(np.fmin) # floating functions -isreal = wrap_elemwise(np.isreal, array_wrap=True) -iscomplex = wrap_elemwise(np.iscomplex, array_wrap=True) -isfinite = wrap_elemwise(np.isfinite) -isinf = wrap_elemwise(np.isinf) -isnan = wrap_elemwise(np.isnan) -signbit = wrap_elemwise(np.signbit) -copysign = wrap_elemwise(np.copysign) -nextafter = wrap_elemwise(np.nextafter) -spacing = wrap_elemwise(np.spacing) +isfinite = ufunc(np.isfinite) +isinf = ufunc(np.isinf) +isnan = ufunc(np.isnan) +signbit = ufunc(np.signbit) +copysign = ufunc(np.copysign) +nextafter = ufunc(np.nextafter) +spacing = ufunc(np.spacing) # modf: see below -ldexp = wrap_elemwise(np.ldexp) +ldexp = ufunc(np.ldexp) # frexp: see below -fmod = wrap_elemwise(np.fmod) -floor = wrap_elemwise(np.floor) -ceil = wrap_elemwise(np.ceil) -trunc = wrap_elemwise(np.trunc) -divide = wrap_elemwise(np.divide) +fmod = ufunc(np.fmod) +floor = ufunc(np.floor) +ceil = ufunc(np.ceil) +trunc = ufunc(np.trunc) +divide = ufunc(np.divide) # more math routines, from this page: # http://docs.scipy.org/doc/numpy/reference/routines.math.html -degrees = wrap_elemwise(np.degrees) -radians = wrap_elemwise(np.radians) - -rint = wrap_elemwise(np.rint) -fix = wrap_elemwise(np.fix, array_wrap=True) - -angle = wrap_elemwise(np.angle, array_wrap=True) +degrees = ufunc(np.degrees) +radians = ufunc(np.radians) +rint = ufunc(np.rint) +fabs = ufunc(np.fabs) +sign = ufunc(np.sign) +absolute = ufunc(np.absolute) + +# non-ufunc elementwise functions +clip = wrap_elemwise(np.clip) +isreal = wrap_elemwise(np.isreal, array_wrap=True) +iscomplex = wrap_elemwise(np.iscomplex, array_wrap=True) real = wrap_elemwise(np.real, array_wrap=True) imag = wrap_elemwise(np.imag, array_wrap=True) +fix = wrap_elemwise(np.fix, array_wrap=True) +i0 = wrap_elemwise(np.i0, array_wrap=True) +sinc = wrap_elemwise(np.sinc, array_wrap=True) +nan_to_num = wrap_elemwise(np.nan_to_num, array_wrap=True) -clip = wrap_elemwise(np.clip) -fabs = wrap_elemwise(np.fabs) -sign = wrap_elemwise(np.sign) -absolute = wrap_elemwise(np.absolute) - -i0 = wrap_elemwise(np.i0) -sinc = wrap_elemwise(np.sinc) -nan_to_num = wrap_elemwise(np.nan_to_num) +@copy_docstring(source=np.angle) +def angle(x, deg=0): + deg = bool(deg) + if hasattr(x, '_elemwise'): + return x._elemwise(__array_wrap__, np.angle, x, deg) + return np.angle(x, deg=deg) +@copy_docstring(source=np.frexp) def frexp(x): # Not actually object dtype, just need to specify something tmp = elemwise(np.frexp, x, dtype=object) @@ -159,9 +239,7 @@ def frexp(x): return L, R -frexp.__doc__ = skip_doctest(np.frexp.__doc__) - - +@copy_docstring(source=np.modf) def modf(x): # Not actually object dtype, just need to specify something tmp = elemwise(np.modf, x, dtype=object) @@ -180,6 +258,3 @@ def modf(x): L = Array(sharedict.merge(tmp.dask, (left, ldsk)), left, chunks=tmp.chunks, dtype=ldt) R = Array(sharedict.merge(tmp.dask, (right, rdsk)), right, chunks=tmp.chunks, dtype=rdt) return L, R - - -modf.__doc__ = skip_doctest(np.modf.__doc__) diff --git a/dask/bytes/core.py b/dask/bytes/core.py index 975e7d44f..45d731f09 100644 --- a/dask/bytes/core.py +++ b/dask/bytes/core.py @@ -12,7 +12,7 @@ from .utils import (SeekableFile, read_block, infer_compression, from ..compatibility import PY2, unicode from ..base import tokenize, normalize_token from ..delayed import delayed -from ..utils import import_required, ensure_bytes, ensure_unicode +from ..utils import import_required, ensure_bytes, ensure_unicode, is_integer def write_block_to_file(data, lazy_file): @@ -138,6 +138,11 @@ def read_bytes(urlpath, delimiter=None, not_zero=False, blocksize=2**27, if len(paths) == 0: raise IOError("%s resolved to no files" % urlpath) + if blocksize is not None: + if not is_integer(blocksize): + raise TypeError("blocksize must be an integer") + blocksize = int(blocksize) + blocks, lengths, machines = fs.get_block_locations(paths) if blocks: offsets = blocks diff --git a/dask/utils.py b/dask/utils.py index b519a7eca..637f7bd82 100644 --- a/dask/utils.py +++ b/dask/utils.py @@ -11,12 +11,13 @@ from errno import ENOENT from collections import Iterator from contextlib import contextmanager from importlib import import_module +from numbers import Integral from threading import Lock import multiprocessing as mp import uuid from weakref import WeakValueDictionary -from .compatibility import long, getargspec, PY3, unicode, urlsplit +from .compatibility import getargspec, PY3, unicode, urlsplit from .core import get_deps from .context import _globals from .optimize import key_split # noqa: F401 @@ -285,15 +286,7 @@ def is_integer(i): >>> is_integer('abc') False """ - import numpy as np - if isinstance(i, (int, long)): - return True - if isinstance(i, float): - return (i).is_integer() - if issubclass(type(i), np.integer): - return i - else: - return False + return isinstance(i, Integral) or (isinstance(i, float) and i.is_integer()) ONE_ARITY_BUILTINS = set([abs, all, any, bool, bytearray, bytes, callable, chr,
blocksize option to read_csv doesn't accept floats The read_csv docstring presents floats as supported: ``` 2. In some cases it can break up large files as follows: >>> df = dd.read_csv('largefile.csv', blocksize=25e6) # 25MB chunks # doctest: +SKIP ``` but on Python 3 at least you get an error: ``` File "/home/antoine/miniconda3/envs/cfmdemo/lib/python3.6/site-packages/dask/bytes/core.py", line 166, in read_bytes off = list(range(0, size, blocksize)) TypeError: 'float' object cannot be interpreted as an integer ```
dask/dask
diff --git a/dask/array/tests/test_ufunc.py b/dask/array/tests/test_ufunc.py index ceccd6c32..3f777e219 100644 --- a/dask/array/tests/test_ufunc.py +++ b/dask/array/tests/test_ufunc.py @@ -18,16 +18,39 @@ def test_ufunc_meta(): assert da.frexp.__doc__.replace(' # doctest: +SKIP', '') == np.frexp.__doc__ [email protected]('ufunc', - ['conj', 'exp', 'exp2', 'log', 'log2', 'log10', - 'log1p', 'expm1', 'sqrt', 'cbrt', 'square', 'sin', - 'cos', 'tan', 'arctan', 'sinh', 'cosh', 'tanh', - 'arcsinh', 'arccosh', 'deg2rad', 'rad2deg', - 'isfinite', 'isinf', 'isnan', 'signbit', 'i0', - 'reciprocal', 'degrees', 'radians', 'rint', 'fabs', - 'sign', 'absolute', 'floor', 'ceil', 'trunc', - 'logical_not', 'spacing', 'sinc', 'nan_to_num']) -def test_ufunc(ufunc): +def test_ufunc(): + for attr in ['nin', 'nargs', 'nout', 'ntypes', 'identity', + 'signature', 'types']: + assert getattr(da.log, attr) == getattr(np.log, attr) + + with pytest.raises(AttributeError): + da.log.not_an_attribute + + assert repr(da.log) == repr(np.log) + assert 'nin' in dir(da.log) + assert 'outer' in dir(da.log) + + +binary_ufuncs = ['add', 'arctan2', 'copysign', 'divide', 'equal', + 'floor_divide', 'fmax', 'fmin', 'fmod', 'greater', + 'greater_equal', 'hypot', 'ldexp', 'less', 'less_equal', + 'logaddexp', 'logaddexp2', 'logical_and', 'logical_or', + 'logical_xor', 'maximum', 'minimum', 'mod', 'multiply', + 'nextafter', 'not_equal', 'power', 'remainder', 'subtract', + 'true_divide'] + +unary_ufuncs = ['absolute', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', + 'arctanh', 'cbrt', 'ceil', 'conj', 'cos', 'cosh', 'deg2rad', + 'degrees', 'exp', 'exp2', 'expm1', 'fabs', 'fix', 'floor', + 'i0', 'isfinite', 'isinf', 'isnan', 'log', 'log10', 'log1p', + 'log2', 'logical_not', 'nan_to_num', 'negative', 'rad2deg', + 'radians', 'reciprocal', 'rint', 'sign', 'signbit', 'sin', + 'sinc', 'sinh', 'spacing', 'sqrt', 'square', 'tan', 'tanh', + 'trunc'] + + [email protected]('ufunc', unary_ufuncs) +def test_unary_ufunc(ufunc): dafunc = getattr(da, ufunc) npfunc = getattr(np, ufunc) @@ -37,27 +60,19 @@ def test_ufunc(ufunc): # applying Dask ufunc doesn't trigger computation assert isinstance(dafunc(darr), da.Array) - assert_eq(dafunc(darr), npfunc(arr)) + assert_eq(dafunc(darr), npfunc(arr), equal_nan=True) # applying NumPy ufunc triggers computation assert isinstance(npfunc(darr), np.ndarray) - assert_eq(npfunc(darr), npfunc(arr)) + assert_eq(npfunc(darr), npfunc(arr), equal_nan=True) # applying Dask ufunc to normal ndarray triggers computation assert isinstance(dafunc(arr), np.ndarray) - assert_eq(dafunc(arr), npfunc(arr)) + assert_eq(dafunc(arr), npfunc(arr), equal_nan=True) [email protected]('ufunc', ['add', 'subtract', 'multiply', 'divide', - 'true_divide', 'floor_divide', 'power', - 'remainder', 'mod', 'fmax', 'fmin', - 'logaddexp', 'logaddexp2', 'arctan2', - 'hypot', 'copysign', 'nextafter', 'ldexp', - 'fmod', 'logical_and', 'logical_or', - 'logical_xor', 'maximum', 'minimum', - 'greater', 'greater_equal', 'less', - 'less_equal', 'not_equal', 'equal']) -def test_ufunc_2args(ufunc): [email protected]('ufunc', binary_ufuncs) +def test_binary_ufunc(ufunc): dafunc = getattr(da, ufunc) npfunc = getattr(np, ufunc) @@ -94,6 +109,45 @@ def test_ufunc_2args(ufunc): assert_eq(dafunc(10, arr1), npfunc(10, arr1)) +def test_ufunc_outer(): + arr1 = np.random.randint(1, 100, size=20) + darr1 = da.from_array(arr1, 3) + + arr2 = np.random.randint(1, 100, size=(10, 3)) + darr2 = da.from_array(arr2, 3) + + # Check output types + assert isinstance(da.add.outer(darr1, darr2), da.Array) + assert isinstance(da.add.outer(arr1, darr2), da.Array) + assert isinstance(da.add.outer(darr1, arr2), da.Array) + assert isinstance(da.add.outer(arr1, arr2), np.ndarray) + + # Check mix of dimensions, dtypes, and numpy/dask/object + cases = [((darr1, darr2), (arr1, arr2)), + ((darr2, darr1), (arr2, arr1)), + ((darr2, darr1.astype('f8')), (arr2, arr1.astype('f8'))), + ((darr1, arr2), (arr1, arr2)), + ((darr1, 1), (arr1, 1)), + ((1, darr2), (1, arr2)), + ((1.5, darr2), (1.5, arr2)), + (([1, 2, 3], darr2), ([1, 2, 3], arr2)), + ((darr1.sum(), darr2), (arr1.sum(), arr2)), + ((np.array(1), darr2), (np.array(1), arr2))] + + for (dA, dB), (A, B) in cases: + assert_eq(da.add.outer(dA, dB), np.add.outer(A, B)) + + # Check dtype kwarg works + assert_eq(da.add.outer(darr1, darr2, dtype='f8'), + np.add.outer(arr1, arr2, dtype='f8')) + + with pytest.raises(ValueError): + da.add.outer(darr1, darr2, out=arr1) + + with pytest.raises(ValueError): + da.sin.outer(darr1, darr2) + + @pytest.mark.parametrize('ufunc', ['isreal', 'iscomplex', 'real', 'imag']) def test_complex(ufunc): @@ -170,3 +224,15 @@ def test_clip(): assert_eq(x.clip(max=5), d.clip(max=5)) assert_eq(x.clip(max=1, min=5), d.clip(max=1, min=5)) assert_eq(x.clip(min=1, max=5), d.clip(min=1, max=5)) + + +def test_angle(): + real = np.random.randint(1, 100, size=(20, 20)) + imag = np.random.randint(1, 100, size=(20, 20)) * 1j + comp = real + imag + dacomp = da.from_array(comp, 3) + + assert_eq(da.angle(dacomp), np.angle(comp)) + assert_eq(da.angle(dacomp, deg=True), np.angle(comp, deg=True)) + assert isinstance(da.angle(comp), np.ndarray) + assert_eq(da.angle(comp), np.angle(comp)) diff --git a/dask/bytes/tests/test_local.py b/dask/bytes/tests/test_local.py index 5ab3b2e22..79ccab5a5 100644 --- a/dask/bytes/tests/test_local.py +++ b/dask/bytes/tests/test_local.py @@ -62,6 +62,18 @@ def test_read_bytes_blocksize_none(): assert sum(map(len, values)) == len(files) +def test_read_bytes_blocksize_float(): + with filetexts(files, mode='b'): + sample, vals = read_bytes('.test.account*', blocksize=5.0) + results = compute(*concat(vals)) + ourlines = b"".join(results).split(b'\n') + testlines = b"".join(files.values()).split(b'\n') + assert set(ourlines) == set(testlines) + + with pytest.raises(TypeError): + read_bytes('.test.account*', blocksize=5.5) + + def test_with_urls(): with filetexts(files, mode='b'): # OS-independent file:// URI with glob *
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 3 }
0.14
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[complete]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "docs/requirements-docs.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
aiobotocore==2.1.2 aiohttp==3.8.6 aioitertools==0.11.0 aiosignal==1.2.0 alabaster==0.7.13 async-timeout==4.0.2 asynctest==0.13.0 attrs==22.2.0 Babel==2.11.0 botocore==1.23.24 certifi==2021.5.30 charset-normalizer==2.0.12 click==8.0.4 cloudpickle==2.2.1 -e git+https://github.com/dask/dask.git@38ac6a98bca27a28fc97ae30022ff44340590744#egg=dask distributed==1.19.3 docutils==0.18.1 frozenlist==1.2.0 fsspec==2022.1.0 HeapDict==1.0.1 idna==3.10 idna-ssl==1.1.0 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 Jinja2==3.0.3 jmespath==0.10.0 locket==1.0.0 MarkupSafe==2.0.1 msgpack-python==0.5.6 multidict==5.2.0 numpy==1.19.5 numpydoc==1.1.0 packaging==21.3 pandas==1.1.5 partd==1.2.0 pluggy==1.0.0 psutil==7.0.0 py==1.11.0 Pygments==2.14.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 requests==2.27.1 s3fs==2022.1.0 six==1.17.0 snowballstemmer==2.2.0 sortedcontainers==2.4.0 Sphinx==5.3.0 sphinx-rtd-theme==2.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jquery==4.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tblib==1.7.0 tomli==1.2.3 toolz==0.12.0 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 wrapt==1.16.0 yarl==1.7.2 zict==2.1.0 zipp==3.6.0
name: dask channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - aiobotocore==2.1.2 - aiohttp==3.8.6 - aioitertools==0.11.0 - aiosignal==1.2.0 - alabaster==0.7.13 - async-timeout==4.0.2 - asynctest==0.13.0 - attrs==22.2.0 - babel==2.11.0 - botocore==1.23.24 - charset-normalizer==2.0.12 - click==8.0.4 - cloudpickle==2.2.1 - distributed==1.19.3 - docutils==0.18.1 - frozenlist==1.2.0 - fsspec==2022.1.0 - heapdict==1.0.1 - idna==3.10 - idna-ssl==1.1.0 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - jinja2==3.0.3 - jmespath==0.10.0 - locket==1.0.0 - markupsafe==2.0.1 - msgpack-python==0.5.6 - multidict==5.2.0 - numpy==1.19.5 - numpydoc==1.1.0 - packaging==21.3 - pandas==1.1.5 - partd==1.2.0 - pluggy==1.0.0 - psutil==7.0.0 - py==1.11.0 - pygments==2.14.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - requests==2.27.1 - s3fs==2022.1.0 - six==1.17.0 - snowballstemmer==2.2.0 - sortedcontainers==2.4.0 - sphinx==5.3.0 - sphinx-rtd-theme==2.0.0 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jquery==4.1 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tblib==1.7.0 - tomli==1.2.3 - toolz==0.12.0 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - wrapt==1.16.0 - yarl==1.7.2 - zict==2.1.0 - zipp==3.6.0 prefix: /opt/conda/envs/dask
[ "dask/array/tests/test_ufunc.py::test_ufunc", "dask/array/tests/test_ufunc.py::test_ufunc_outer", "dask/array/tests/test_ufunc.py::test_angle", "dask/bytes/tests/test_local.py::test_read_bytes_blocksize_float" ]
[ "dask/array/tests/test_ufunc.py::test_complex[isreal]", "dask/array/tests/test_ufunc.py::test_complex[real]", "dask/array/tests/test_ufunc.py::test_complex[imag]", "dask/bytes/tests/test_local.py::test_not_found" ]
[ "dask/array/tests/test_ufunc.py::test_ufunc_meta", "dask/array/tests/test_ufunc.py::test_unary_ufunc[absolute]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[arccos]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[arccosh]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[arcsin]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[arcsinh]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[arctan]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[arctanh]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[cbrt]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[ceil]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[conj]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[cos]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[cosh]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[deg2rad]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[degrees]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[exp]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[exp2]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[expm1]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[fabs]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[fix]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[floor]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[i0]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[isfinite]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[isinf]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[isnan]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[log]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[log10]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[log1p]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[log2]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[logical_not]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[nan_to_num]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[negative]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[rad2deg]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[radians]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[reciprocal]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[rint]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[sign]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[signbit]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[sin]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[sinc]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[sinh]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[spacing]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[sqrt]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[square]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[tan]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[tanh]", "dask/array/tests/test_ufunc.py::test_unary_ufunc[trunc]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[add]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[arctan2]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[copysign]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[divide]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[equal]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[floor_divide]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[fmax]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[fmin]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[fmod]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[greater]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[greater_equal]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[hypot]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[ldexp]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[less]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[less_equal]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[logaddexp]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[logaddexp2]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[logical_and]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[logical_or]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[logical_xor]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[maximum]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[minimum]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[mod]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[multiply]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[nextafter]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[not_equal]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[power]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[remainder]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[subtract]", "dask/array/tests/test_ufunc.py::test_binary_ufunc[true_divide]", "dask/array/tests/test_ufunc.py::test_complex[iscomplex]", "dask/array/tests/test_ufunc.py::test_ufunc_2results[frexp]", "dask/array/tests/test_ufunc.py::test_ufunc_2results[modf]", "dask/array/tests/test_ufunc.py::test_clip", "dask/bytes/tests/test_local.py::test_read_bytes", "dask/bytes/tests/test_local.py::test_read_bytes_sample_delimiter", "dask/bytes/tests/test_local.py::test_read_bytes_blocksize_none", "dask/bytes/tests/test_local.py::test_with_urls", "dask/bytes/tests/test_local.py::test_read_bytes_block", "dask/bytes/tests/test_local.py::test_read_bytes_delimited", "dask/bytes/tests/test_local.py::test_compression[gzip-None]", "dask/bytes/tests/test_local.py::test_compression[None-None]", "dask/bytes/tests/test_local.py::test_compression[xz-None]", "dask/bytes/tests/test_local.py::test_compression[bz2-None]", "dask/bytes/tests/test_local.py::test_compression[None-10]", "dask/bytes/tests/test_local.py::test_registered_read_bytes", "dask/bytes/tests/test_local.py::test_registered_open_files", "dask/bytes/tests/test_local.py::test_registered_open_text_files[utf-8]", "dask/bytes/tests/test_local.py::test_registered_open_text_files[ascii]", "dask/bytes/tests/test_local.py::test_open_files", "dask/bytes/tests/test_local.py::test_compression_binary[gzip]", "dask/bytes/tests/test_local.py::test_compression_binary[None]", "dask/bytes/tests/test_local.py::test_compression_binary[xz]", "dask/bytes/tests/test_local.py::test_compression_binary[bz2]", "dask/bytes/tests/test_local.py::test_compression_text[gzip]", "dask/bytes/tests/test_local.py::test_compression_text[None]", "dask/bytes/tests/test_local.py::test_compression_text[xz]", "dask/bytes/tests/test_local.py::test_compression_text[bz2]", "dask/bytes/tests/test_local.py::test_getsize[None]", "dask/bytes/tests/test_local.py::test_bad_compression", "dask/bytes/tests/test_local.py::test_simple_write", "dask/bytes/tests/test_local.py::test_compressed_write", "dask/bytes/tests/test_local.py::test_open_files_write", "dask/bytes/tests/test_local.py::test_pickability_of_lazy_files", "dask/bytes/tests/test_local.py::test_py2_local_bytes", "dask/bytes/tests/test_local.py::test_abs_paths" ]
[]
BSD 3-Clause "New" or "Revised" License
1,263
[ "dask/bytes/core.py", "dask/array/ufunc.py", "dask/utils.py" ]
[ "dask/bytes/core.py", "dask/array/ufunc.py", "dask/utils.py" ]
jaywink__federation-84
e0dd39d518136eef5d36fa3c2cb36dc4b32d4a63
2017-05-17 20:02:49
e0dd39d518136eef5d36fa3c2cb36dc4b32d4a63
pep8speaks: Hello @jaywink! Thanks for submitting the PR. - In the file [`federation/entities/diaspora/entities.py`](https://github.com/jaywink/federation/blob/7c5d86a3475b96eabaf6f7af37005ed5ebb82024/federation/entities/diaspora/entities.py), following are the PEP8 issues : > [Line 122:1](https://github.com/jaywink/federation/blob/7c5d86a3475b96eabaf6f7af37005ed5ebb82024/federation/entities/diaspora/entities.py#L122): [W293](https://duckduckgo.com/?q=pep8%20W293) blank line contains whitespace
diff --git a/federation/entities/base.py b/federation/entities/base.py index 1185248..97a055a 100644 --- a/federation/entities/base.py +++ b/federation/entities/base.py @@ -5,7 +5,7 @@ from dirty_validators.basic import Email __all__ = ( - "Post", "Image", "Comment", "Reaction", "Relationship", "Profile", "Retraction" + "Post", "Image", "Comment", "Reaction", "Relationship", "Profile", "Retraction", "Follow", ) @@ -266,6 +266,21 @@ class Relationship(CreatedAtMixin, HandleMixin): )) +class Follow(CreatedAtMixin, HandleMixin): + """Represents a handle following or unfollowing another handle.""" + target_handle = "" + following = True + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._required += ["target_handle", "following"] + + def validate_target_handle(self): + validator = Email() + if not validator.is_valid(self.target_handle): + raise ValueError("Target handle is not valid") + + class Profile(CreatedAtMixin, HandleMixin, OptionalRawContentMixin, PublicMixin, GUIDMixin): """Represents a profile for a user.""" name = "" diff --git a/federation/entities/diaspora/entities.py b/federation/entities/diaspora/entities.py index e81bfa6..39d00ca 100644 --- a/federation/entities/diaspora/entities.py +++ b/federation/entities/diaspora/entities.py @@ -1,6 +1,6 @@ from lxml import etree -from federation.entities.base import Comment, Post, Reaction, Relationship, Profile, Retraction, BaseEntity +from federation.entities.base import Comment, Post, Reaction, Relationship, Profile, Retraction, BaseEntity, Follow from federation.entities.diaspora.utils import format_dt, struct_to_xml, get_base_attributes from federation.exceptions import SignatureVerificationError from federation.protocols.diaspora.signatures import verify_relayable_signature, create_relayable_signature @@ -104,7 +104,7 @@ class DiasporaLike(DiasporaRelayableMixin, Reaction): class DiasporaRequest(DiasporaEntityMixin, Relationship): - """Diaspora relationship request.""" + """Diaspora legacy request.""" relationship = "sharing" def to_xml(self): @@ -117,6 +117,24 @@ class DiasporaRequest(DiasporaEntityMixin, Relationship): return element +class DiasporaContact(DiasporaEntityMixin, Follow): + """Diaspora contact. + + Note we don't implement 'sharing' at the moment so just send it as the same as 'following'. + """ + + def to_xml(self): + """Convert to XML message.""" + element = etree.Element("contact") + struct_to_xml(element, [ + {"author": self.handle}, + {"recipient": self.target_handle}, + {"following": "true" if self.following else "false"}, + {"sharing": "true" if self.following else "false"}, + ]) + return element + + class DiasporaProfile(DiasporaEntityMixin, Profile): """Diaspora profile.""" diff --git a/federation/entities/diaspora/mappers.py b/federation/entities/diaspora/mappers.py index 57828b3..22a7cd3 100644 --- a/federation/entities/diaspora/mappers.py +++ b/federation/entities/diaspora/mappers.py @@ -3,10 +3,10 @@ from datetime import datetime from lxml import etree -from federation.entities.base import Image, Relationship, Post, Reaction, Comment, Profile, Retraction +from federation.entities.base import Image, Relationship, Post, Reaction, Comment, Profile, Retraction, Follow from federation.entities.diaspora.entities import ( DiasporaPost, DiasporaComment, DiasporaLike, DiasporaRequest, DiasporaProfile, DiasporaRetraction, - DiasporaRelayableMixin) + DiasporaRelayableMixin, DiasporaContact) from federation.protocols.diaspora.signatures import get_element_child_info from federation.utils.diaspora import retrieve_and_parse_profile @@ -20,16 +20,19 @@ MAPPINGS = { "request": DiasporaRequest, "profile": DiasporaProfile, "retraction": DiasporaRetraction, + "contact": DiasporaContact, } TAGS = [ # Order is important. Any top level tags should be before possibly child tags - "status_message", "comment", "like", "request", "profile", "retraction", "photo", + "status_message", "comment", "like", "request", "profile", "retraction", "photo", "contact", ] BOOLEAN_KEYS = ( "public", "nsfw", + "following", + "sharing", ) DATETIME_KEYS = ( @@ -205,7 +208,8 @@ def get_outbound_entity(entity, private_key): """ outbound = None cls = entity.__class__ - if cls in [DiasporaPost, DiasporaRequest, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction]: + if cls in [DiasporaPost, DiasporaRequest, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction, + DiasporaContact]: # Already fine outbound = entity elif cls == Post: @@ -219,6 +223,8 @@ def get_outbound_entity(entity, private_key): if entity.relationship in ["sharing", "following"]: # Unfortunately we must send out in both cases since in Diaspora they are the same thing outbound = DiasporaRequest.from_base(entity) + elif cls == Follow: + outbound = DiasporaContact.from_base(entity) elif cls == Profile: outbound = DiasporaProfile.from_base(entity) elif cls == Retraction:
Add support for Diaspora contact payload This replaces the old `request` payload. See diaspora/diaspora_federation#32
jaywink/federation
diff --git a/federation/tests/entities/diaspora/test_entities.py b/federation/tests/entities/diaspora/test_entities.py index 32f8b2c..23d0ac0 100644 --- a/federation/tests/entities/diaspora/test_entities.py +++ b/federation/tests/entities/diaspora/test_entities.py @@ -6,7 +6,7 @@ from lxml import etree from federation.entities.base import Profile from federation.entities.diaspora.entities import ( DiasporaComment, DiasporaPost, DiasporaLike, DiasporaRequest, DiasporaProfile, DiasporaRetraction, -) + DiasporaContact) from federation.exceptions import SignatureVerificationError from federation.tests.fixtures.keys import get_dummy_private_key @@ -81,6 +81,14 @@ class TestEntitiesConvertToXML(): b"<target_guid>xxxxxxxxxxxxxxxx</target_guid><target_type>Post</target_type></retraction>" assert etree.tostring(result) == converted + def test_contact_to_xml(self): + entity = DiasporaContact(handle="[email protected]", target_handle="[email protected]", following=True) + result = entity.to_xml() + assert result.tag == "contact" + converted = b"<contact><author>[email protected]</author><recipient>[email protected]</recipient>" \ + b"<following>true</following><sharing>true</sharing></contact>" + assert etree.tostring(result) == converted + class TestDiasporaProfileFillExtraAttributes(): def test_raises_if_no_handle(self): diff --git a/federation/tests/entities/diaspora/test_mappers.py b/federation/tests/entities/diaspora/test_mappers.py index 1516ae4..bd2b96b 100644 --- a/federation/tests/entities/diaspora/test_mappers.py +++ b/federation/tests/entities/diaspora/test_mappers.py @@ -4,18 +4,17 @@ from unittest.mock import patch, Mock import pytest from federation.entities.base import ( - Comment, Post, Reaction, Relationship, Profile, Retraction, Image -) + Comment, Post, Reaction, Relationship, Profile, Retraction, Image, + Follow) from federation.entities.diaspora.entities import ( DiasporaPost, DiasporaComment, DiasporaLike, DiasporaRequest, - DiasporaProfile, DiasporaRetraction -) + DiasporaProfile, DiasporaRetraction, DiasporaContact) from federation.entities.diaspora.mappers import message_to_objects, get_outbound_entity from federation.tests.fixtures.keys import get_dummy_private_key from federation.tests.fixtures.payloads import ( DIASPORA_POST_SIMPLE, DIASPORA_POST_COMMENT, DIASPORA_POST_LIKE, DIASPORA_REQUEST, DIASPORA_PROFILE, DIASPORA_POST_INVALID, DIASPORA_RETRACTION, - DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY) + DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY, DIASPORA_CONTACT) def mock_fill(attributes): @@ -155,6 +154,15 @@ class TestDiasporaEntityMappersReceive(): assert entity.target_guid == "x" * 16 assert entity.entity_type == "Post" + def test_message_to_objects_contact(self): + entities = message_to_objects(DIASPORA_CONTACT) + assert len(entities) == 1 + entity = entities[0] + assert isinstance(entity, DiasporaContact) + assert entity.handle == "[email protected]" + assert entity.target_handle == "[email protected]" + assert entity.following is True + @patch("federation.entities.diaspora.mappers.logger.error") def test_invalid_entity_logs_an_error(self, mock_logger): entities = message_to_objects(DIASPORA_POST_INVALID) @@ -191,6 +199,8 @@ class TestGetOutboundEntity(): assert get_outbound_entity(entity, dummy_key) == entity entity = DiasporaProfile() assert get_outbound_entity(entity, dummy_key) == entity + entity = DiasporaContact() + assert get_outbound_entity(entity, dummy_key) == entity def test_post_is_converted_to_diasporapost(self): entity = Post() @@ -229,6 +239,10 @@ class TestGetOutboundEntity(): entity = Retraction() assert isinstance(get_outbound_entity(entity, get_dummy_private_key()), DiasporaRetraction) + def test_follow_is_converted_to_diasporacontact(self): + entity = Follow() + assert isinstance(get_outbound_entity(entity, get_dummy_private_key()), DiasporaContact) + def test_signs_relayable_if_no_signature(self): entity = DiasporaComment() dummy_key = get_dummy_private_key() diff --git a/federation/tests/entities/test_base.py b/federation/tests/entities/test_base.py index 6035868..5eaa10a 100644 --- a/federation/tests/entities/test_base.py +++ b/federation/tests/entities/test_base.py @@ -4,7 +4,7 @@ import pytest from federation.entities.base import ( BaseEntity, Relationship, Profile, RawContentMixin, GUIDMixin, HandleMixin, PublicMixin, Image, Retraction, -) + Follow) from federation.tests.factories.entities import TaggedPostFactory, PostFactory @@ -160,3 +160,18 @@ class TestRetractionEntity(): ) with pytest.raises(ValueError): entity.validate() + + +class TestFollowEntity(): + def test_instance_creation(self): + entity = Follow( + handle="[email protected]", target_handle="[email protected]", following=True + ) + entity.validate() + + def test_required_validates(self): + entity = Follow( + handle="[email protected]", following=True + ) + with pytest.raises(ValueError): + entity.validate() diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py index b58c95e..ead44d5 100644 --- a/federation/tests/fixtures/payloads.py +++ b/federation/tests/fixtures/payloads.py @@ -173,3 +173,12 @@ DIASPORA_RETRACTION = """ <target_type>Post</target_type> </retraction> """ + +DIASPORA_CONTACT = """ + <contact> + <author>[email protected]</author> + <recipient>[email protected]</recipient> + <following>true</following> + <sharing>true</sharing> + </contact> +"""
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 3 }, "num_modified_files": 3 }
0.11
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": null, "pre_install": [ "apt-get update", "apt-get install -y libxml2-dev libxslt1-dev" ], "python": "3.6", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "py.test --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
alabaster==0.7.13 arrow==1.2.3 attrs==22.2.0 Babel==2.11.0 certifi==2021.5.30 charset-normalizer==2.0.12 codecov==2.1.13 colorama==0.4.5 commonmark==0.9.1 coverage==6.2 cssselect==1.1.0 dirty-validators==0.5.4 docutils==0.18.1 factory-boy==3.2.1 Faker==14.2.1 -e git+https://github.com/jaywink/federation.git@e0dd39d518136eef5d36fa3c2cb36dc4b32d4a63#egg=federation idna==3.10 imagesize==1.4.1 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 Jinja2==3.0.3 jsonschema==3.2.0 livereload==2.6.3 lxml==5.3.1 MarkupSafe==2.0.1 packaging==21.3 pluggy==1.0.0 py==1.11.0 pycrypto==2.6.1 Pygments==2.14.0 pyparsing==3.1.4 pyrsistent==0.18.0 pytest==7.0.1 pytest-cov==4.0.0 pytest-warnings==0.3.1 python-dateutil==2.9.0.post0 python-xrd==0.1 pytz==2025.2 recommonmark==0.7.1 requests==2.27.1 six==1.17.0 snowballstemmer==2.2.0 Sphinx==5.3.0 sphinx-autobuild==2021.3.14 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 tomli==1.2.3 tornado==6.1 typing_extensions==4.1.1 urllib3==1.26.20 zipp==3.6.0
name: federation channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - alabaster==0.7.13 - arrow==1.2.3 - attrs==22.2.0 - babel==2.11.0 - charset-normalizer==2.0.12 - codecov==2.1.13 - colorama==0.4.5 - commonmark==0.9.1 - coverage==6.2 - cssselect==1.1.0 - dirty-validators==0.5.4 - docutils==0.18.1 - factory-boy==3.2.1 - faker==14.2.1 - idna==3.10 - imagesize==1.4.1 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - jinja2==3.0.3 - jsonschema==3.2.0 - livereload==2.6.3 - lxml==5.3.1 - markupsafe==2.0.1 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pycrypto==2.6.1 - pygments==2.14.0 - pyparsing==3.1.4 - pyrsistent==0.18.0 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-warnings==0.3.1 - python-dateutil==2.9.0.post0 - python-xrd==0.1 - pytz==2025.2 - recommonmark==0.7.1 - requests==2.27.1 - six==1.17.0 - snowballstemmer==2.2.0 - sphinx==5.3.0 - sphinx-autobuild==2021.3.14 - sphinxcontrib-applehelp==1.0.2 - sphinxcontrib-devhelp==1.0.2 - sphinxcontrib-htmlhelp==2.0.0 - sphinxcontrib-jsmath==1.0.1 - sphinxcontrib-qthelp==1.0.3 - sphinxcontrib-serializinghtml==1.1.5 - tomli==1.2.3 - tornado==6.1 - typing-extensions==4.1.1 - urllib3==1.26.20 - zipp==3.6.0 prefix: /opt/conda/envs/federation
[ "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_post_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_comment_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_like_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_request_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_profile_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_retraction_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestEntitiesConvertToXML::test_contact_to_xml", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaProfileFillExtraAttributes::test_raises_if_no_handle", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaProfileFillExtraAttributes::test_calls_retrieve_and_parse_profile", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaRetractionEntityConverters::test_entity_type_from_remote", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaRetractionEntityConverters::test_entity_type_to_remote", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaRelayableEntitySigning::test_signing_comment_works", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaRelayableEntitySigning::test_signing_like_works", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaRelayableEntityValidate::test_raises_if_no_sender_key", "federation/tests/entities/diaspora/test_entities.py::TestDiasporaRelayableEntityValidate::test_calls_verify_signature", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_simple_post", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_post_legacy", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_legact_timestamp", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_post_with_photos", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_comment", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_like", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_request", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_profile", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_retraction", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_contact", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_invalid_entity_logs_an_error", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_adds_source_protocol_to_entity", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_element_to_objects_calls_sender_key_fetcher", "federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_element_to_objects_calls_retrieve_remote_profile", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_already_fine_entities_are_returned_as_is", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_post_is_converted_to_diasporapost", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_comment_is_converted_to_diasporacomment", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_reaction_of_like_is_converted_to_diasporalike", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_relationship_of_sharing_or_following_is_converted_to_diasporarequest", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_profile_is_converted_to_diasporaprofile", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_other_reaction_raises", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_other_relation_raises", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_retraction_is_converted_to_diasporaretraction", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_follow_is_converted_to_diasporacontact", "federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_signs_relayable_if_no_signature", "federation/tests/entities/test_base.py::TestPostEntityTags::test_post_entity_returns_list_of_tags", "federation/tests/entities/test_base.py::TestPostEntityTags::test_post_entity_without_raw_content_tags_returns_empty_set", "federation/tests/entities/test_base.py::TestBaseEntityCallsValidateMethods::test_entity_calls_attribute_validate_method", "federation/tests/entities/test_base.py::TestBaseEntityCallsValidateMethods::test_entity_calls_main_validate_methods", "federation/tests/entities/test_base.py::TestBaseEntityCallsValidateMethods::test_validate_children", "federation/tests/entities/test_base.py::TestGUIDMixinValidate::test_validate_guid_raises_on_low_length", "federation/tests/entities/test_base.py::TestHandleMixinValidate::test_validate_handle_raises_on_invalid_format", "federation/tests/entities/test_base.py::TestPublicMixinValidate::test_validate_public_raises_on_low_length", "federation/tests/entities/test_base.py::TestEntityRequiredAttributes::test_entity_checks_for_required_attributes", "federation/tests/entities/test_base.py::TestEntityRequiredAttributes::test_validate_checks_required_values_are_not_empty", "federation/tests/entities/test_base.py::TestRelationshipEntity::test_instance_creation", "federation/tests/entities/test_base.py::TestRelationshipEntity::test_instance_creation_validates_relationship_value", "federation/tests/entities/test_base.py::TestRelationshipEntity::test_instance_creation_validates_target_handle_value", "federation/tests/entities/test_base.py::TestProfileEntity::test_instance_creation", "federation/tests/entities/test_base.py::TestProfileEntity::test_instance_creation_validates_email_value", "federation/tests/entities/test_base.py::TestProfileEntity::test_guid_is_mandatory", "federation/tests/entities/test_base.py::TestImageEntity::test_instance_creation", "federation/tests/entities/test_base.py::TestImageEntity::test_required_fields", "federation/tests/entities/test_base.py::TestRetractionEntity::test_instance_creation", "federation/tests/entities/test_base.py::TestRetractionEntity::test_required_validates", "federation/tests/entities/test_base.py::TestFollowEntity::test_instance_creation", "federation/tests/entities/test_base.py::TestFollowEntity::test_required_validates" ]
[]
[]
[]
BSD 3-Clause "New" or "Revised" License
1,264
[ "federation/entities/base.py", "federation/entities/diaspora/mappers.py", "federation/entities/diaspora/entities.py" ]
[ "federation/entities/base.py", "federation/entities/diaspora/mappers.py", "federation/entities/diaspora/entities.py" ]
nipy__nipype-2030
cda3fdc3be231f2c9d7bdbdbadee472a0bad9e92
2017-05-17 22:13:57
14161a590a3166b5a9c0f4afd42ff1acf843a960
diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py index 4a55a4ea7..ddf35ef44 100644 --- a/nipype/interfaces/spm/model.py +++ b/nipype/interfaces/spm/model.py @@ -29,7 +29,7 @@ from ...utils.filemanip import (filename_to_list, list_to_filename, from ..base import (Bunch, traits, TraitedSpec, File, Directory, OutputMultiPath, InputMultiPath, isdefined) from .base import (SPMCommand, SPMCommandInputSpec, - scans_for_fnames) + scans_for_fnames, ImageFileSPM) __docformat__ = 'restructuredtext' logger = logging.getLogger('interface') @@ -179,27 +179,38 @@ class Level1Design(SPMCommand): class EstimateModelInputSpec(SPMCommandInputSpec): spm_mat_file = File(exists=True, field='spmmat', - desc='absolute path to SPM.mat', - copyfile=True, - mandatory=True) - estimation_method = traits.Dict(traits.Enum('Classical', 'Bayesian2', - 'Bayesian'), - field='method', - desc=('Classical, Bayesian2, ' - 'Bayesian (dict)'), - mandatory=True) - flags = traits.Str(desc='optional arguments (opt)') + copyfile=True, mandatory=True, + desc='Absolute path to SPM.mat') + estimation_method = traits.Dict( + traits.Enum('Classical', 'Bayesian2', 'Bayesian'), + field='method', mandatory=True, + desc=('Dictionary of either Classical: 1, Bayesian: 1, ' + 'or Bayesian2: 1 (dict)')) + write_residuals = traits.Bool(field='write_residuals', + desc="Write individual residual images") + flags = traits.Dict(desc='Additional arguments') class EstimateModelOutputSpec(TraitedSpec): - mask_image = File(exists=True, - desc='binary mask to constrain estimation') - beta_images = OutputMultiPath(File(exists=True), - desc='design parameter estimates') - residual_image = File(exists=True, - desc='Mean-squared image of the residuals') - RPVimage = File(exists=True, desc='Resels per voxel image') + mask_image = ImageFileSPM(exists=True, + desc='binary mask to constrain estimation') + beta_images = OutputMultiPath(ImageFileSPM(exists=True), + desc='design parameter estimates') + residual_image = ImageFileSPM(exists=True, + desc='Mean-squared image of the residuals') + residual_images = OutputMultiPath(ImageFileSPM(exists=True), + desc="individual residual images (requires `write_residuals`") + RPVimage = ImageFileSPM(exists=True, desc='Resels per voxel image') spm_mat_file = File(exists=True, desc='Updated SPM mat file') + labels = ImageFileSPM(exists=True, desc="label file") + SDerror = OutputMultiPath(ImageFileSPM(exists=True), + desc="Images of the standard deviation of the error") + ARcoef = OutputMultiPath(ImageFileSPM(exists=True), + desc="Images of the AR coefficient") + Cbetas = OutputMultiPath(ImageFileSPM(exists=True), + desc="Images of the parameter posteriors") + SDbetas = OutputMultiPath(ImageFileSPM(exists=True), + desc="Images of the standard deviation of parameter posteriors") class EstimateModel(SPMCommand): @@ -211,6 +222,7 @@ class EstimateModel(SPMCommand): -------- >>> est = EstimateModel() >>> est.inputs.spm_mat_file = 'SPM.mat' + >>> est.inputs.estimation_method = {'Classical': 1} >>> est.run() # doctest: +SKIP """ input_spec = EstimateModelInputSpec @@ -225,7 +237,7 @@ class EstimateModel(SPMCommand): return np.array([str(val)], dtype=object) if opt == 'estimation_method': if isinstance(val, (str, bytes)): - return {'%s' % val: 1} + return {'{}'.format(val): 1} else: return val return super(EstimateModel, self)._format_arg(opt, spec, val) @@ -235,36 +247,43 @@ class EstimateModel(SPMCommand): """ einputs = super(EstimateModel, self)._parse_inputs(skip=('flags')) if isdefined(self.inputs.flags): - einputs[0].update(self.inputs.flags) + einputs[0].update({flag: val for (flag, val) in + self.inputs.flags.items()}) return einputs def _list_outputs(self): outputs = self._outputs().get() - pth, _ = os.path.split(self.inputs.spm_mat_file) - spm12 = '12' in self.version.split('.')[0] - if spm12: - mask = os.path.join(pth, 'mask.nii') - else: - mask = os.path.join(pth, 'mask.img') - outputs['mask_image'] = mask + pth = os.path.dirname(self.inputs.spm_mat_file) + outtype = 'nii' if '12' in self.version.split('.')[0] else 'img' spm = sio.loadmat(self.inputs.spm_mat_file, struct_as_record=False) - betas = [] - for vbeta in spm['SPM'][0, 0].Vbeta[0]: - betas.append(str(os.path.join(pth, vbeta.fname[0]))) - if betas: - outputs['beta_images'] = betas - if spm12: - resms = os.path.join(pth, 'ResMS.nii') - else: - resms = os.path.join(pth, 'ResMS.img') - outputs['residual_image'] = resms - if spm12: - rpv = os.path.join(pth, 'RPV.nii') - else: - rpv = os.path.join(pth, 'RPV.img') - outputs['RPVimage'] = rpv - spm = os.path.join(pth, 'SPM.mat') - outputs['spm_mat_file'] = spm + + betas = [vbeta.fname[0] for vbeta in spm['SPM'][0, 0].Vbeta[0]] + if ('Bayesian' in self.inputs.estimation_method.keys() or + 'Bayesian2' in self.inputs.estimation_method.keys()): + outputs['labels'] = os.path.join(pth, + 'labels.{}'.format(outtype)) + outputs['SDerror'] = glob(os.path.join(pth, 'Sess*_SDerror*')) + outputs['ARcoef'] = glob(os.path.join(pth, 'Sess*_AR_*')) + if betas: + outputs['Cbetas'] = [os.path.join(pth, 'C{}'.format(beta)) + for beta in betas] + outputs['SDbetas'] = [os.path.join(pth, 'SD{}'.format(beta)) + for beta in betas] + + if 'Classical' in self.inputs.estimation_method.keys(): + outputs['residual_image'] = os.path.join(pth, + 'ResMS.{}'.format(outtype)) + outputs['RPVimage'] = os.path.join(pth, + 'RPV.{}'.format(outtype)) + if self.inputs.write_residuals: + outputs['residual_images'] = glob(os.path.join(pth, 'Res_*')) + if betas: + outputs['beta_images'] = [os.path.join(pth, beta) + for beta in betas] + + outputs['mask_image'] = os.path.join(pth, + 'mask.{}'.format(outtype)) + outputs['spm_mat_file'] = os.path.join(pth, 'SPM.mat') return outputs
spm.EstimateModel additional args broken ### Summary Issue brought up on [Neurostars#436](https://neurostars.org/t/nipype-interfaces-without-options-present-in-the-underlying-executable-function/436) ### Actual behavior `EstimateModel` expects a string for input `flags`, but later expects a dictionary. ### Expected behavior Additional inputs can be added. ### Platform details: Please paste the output of: `python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"` ``` {'pkg_path': '/code/nipype/nipype', 'commit_source': 'repository', 'commit_hash': '71e2140', 'nipype_version': '1.0.0-g71e2140.dev', 'sys_version': '3.6.1 | packaged by conda-forge | (default, Mar 23 2017, 21:05:12) \n[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]', 'sys_executable': '/home/mathias/miniconda2/envs/dev3/bin/python', 'sys_platform': 'linux', 'numpy_version': '1.12.1', 'scipy_version': '0.19.0', 'networkx_version': '1.11', 'nibabel_version': '2.1.0', 'traits_version': '4.6.0'} 1.0.0-g71e2140.dev ``` ### Execution environment Local Addressing this now
nipy/nipype
diff --git a/nipype/interfaces/spm/tests/test_auto_EstimateModel.py b/nipype/interfaces/spm/tests/test_auto_EstimateModel.py index c99ff7dd0..703c97c6f 100644 --- a/nipype/interfaces/spm/tests/test_auto_EstimateModel.py +++ b/nipype/interfaces/spm/tests/test_auto_EstimateModel.py @@ -23,6 +23,8 @@ def test_EstimateModel_inputs(): use_v8struct=dict(min_ver='8', usedefault=True, ), + write_residuals=dict(field='write_residuals', + ), ) inputs = EstimateModel.input_spec() @@ -32,10 +34,16 @@ def test_EstimateModel_inputs(): def test_EstimateModel_outputs(): - output_map = dict(RPVimage=dict(), + output_map = dict(ARcoef=dict(), + Cbetas=dict(), + RPVimage=dict(), + SDbetas=dict(), + SDerror=dict(), beta_images=dict(), + labels=dict(), mask_image=dict(), residual_image=dict(), + residual_images=dict(), spm_mat_file=dict(), ) outputs = EstimateModel.output_spec()
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 1 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 click==8.0.4 configparser==5.2.0 decorator==4.4.2 funcsigs==1.0.2 future==1.0.0 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 lxml==5.3.1 mock==5.2.0 networkx==2.5.1 nibabel==3.2.2 -e git+https://github.com/nipy/nipype.git@cda3fdc3be231f2c9d7bdbdbadee472a0bad9e92#egg=nipype numpy==1.19.5 packaging==21.3 pluggy==1.0.0 prov==2.0.1 py==1.11.0 pydotplus==2.0.2 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 rdflib==5.0.0 scipy==1.5.4 simplejson==3.20.1 six==1.17.0 tomli==1.2.3 traits==6.4.1 typing_extensions==4.1.1 zipp==3.6.0
name: nipype channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - click==8.0.4 - configparser==5.2.0 - decorator==4.4.2 - funcsigs==1.0.2 - future==1.0.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - lxml==5.3.1 - mock==5.2.0 - networkx==2.5.1 - nibabel==3.2.2 - numpy==1.19.5 - packaging==21.3 - pluggy==1.0.0 - prov==2.0.1 - py==1.11.0 - pydotplus==2.0.2 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - rdflib==5.0.0 - scipy==1.5.4 - simplejson==3.20.1 - six==1.17.0 - tomli==1.2.3 - traits==6.4.1 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/nipype
[ "nipype/interfaces/spm/tests/test_auto_EstimateModel.py::test_EstimateModel_inputs" ]
[]
[ "nipype/interfaces/spm/tests/test_auto_EstimateModel.py::test_EstimateModel_outputs" ]
[]
Apache License 2.0
1,265
[ "nipype/interfaces/spm/model.py" ]
[ "nipype/interfaces/spm/model.py" ]
nipy__nipype-2031
90cfdd8a63114dbe2e1ce6dea9dd739d04f84a4a
2017-05-18 12:42:34
14161a590a3166b5a9c0f4afd42ff1acf843a960
codecov-io: # [Codecov](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=h1) Report > Merging [#2031](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=desc) into [master](https://codecov.io/gh/nipy/nipype/commit/90cfdd8a63114dbe2e1ce6dea9dd739d04f84a4a?src=pr&el=desc) will **decrease** coverage by `<.01%`. > The diff coverage is `22.22%`. [![Impacted file tree graph](https://codecov.io/gh/nipy/nipype/pull/2031/graphs/tree.svg?width=650&height=150&src=pr&token=Tu0EnSSGVZ)](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #2031 +/- ## ========================================== - Coverage 72.2% 72.19% -0.01% ========================================== Files 1132 1132 Lines 57024 57032 +8 Branches 8165 8167 +2 ========================================== + Hits 41173 41175 +2 - Misses 14567 14572 +5 - Partials 1284 1285 +1 ``` | Flag | Coverage Δ | | |---|---|---| | #smoketests | `72.19% <22.22%> (-0.01%)` | :arrow_down: | | #unittests | `69.79% <22.22%> (-0.01%)` | :arrow_down: | | [Impacted Files](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [...ype/interfaces/freesurfer/tests/test\_BBRegister.py](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree#diff-bmlweXBlL2ludGVyZmFjZXMvZnJlZXN1cmZlci90ZXN0cy90ZXN0X0JCUmVnaXN0ZXIucHk=) | `77.77% <ø> (ø)` | :arrow_up: | | [nipype/interfaces/freesurfer/preprocess.py](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree#diff-bmlweXBlL2ludGVyZmFjZXMvZnJlZXN1cmZlci9wcmVwcm9jZXNzLnB5) | `64.84% <22.22%> (-0.32%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=footer). Last update [90cfdd8...ab826ef](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py index 0ff32ad74..4e164c342 100644 --- a/nipype/interfaces/freesurfer/preprocess.py +++ b/nipype/interfaces/freesurfer/preprocess.py @@ -1155,6 +1155,8 @@ class BBRegisterInputSpec(FSTraitedSpec): desc='degrees of freedom for initial registration (FSL)') out_fsl_file = traits.Either(traits.Bool, File, argstr="--fslmat %s", desc="write the transformation matrix in FSL FLIRT format") + out_lta_file = traits.Either(traits.Bool, File, argstr="--lta %s", min_ver='5.2.0', + desc="write the transformation matrix in LTA format") registered_file = traits.Either(traits.Bool, File, argstr='--o %s', desc='output warped sourcefile either True or filename') @@ -1171,6 +1173,7 @@ class BBRegisterInputSpec6(BBRegisterInputSpec): class BBRegisterOutputSpec(TraitedSpec): out_reg_file = File(exists=True, desc='Output registration file') out_fsl_file = File(desc='Output FLIRT-style registration file') + out_lta_file = File(desc='Output LTA-style registration file') min_cost_file = File(exists=True, desc='Output registration minimum cost file') registered_file = File(desc='Registered and resampled source file') @@ -1219,6 +1222,16 @@ class BBRegister(FSCommand): else: outputs['registered_file'] = op.abspath(_in.registered_file) + if isdefined(_in.out_lta_file): + if isinstance(_in.out_fsl_file, bool): + suffix = '_bbreg_%s.lta' % _in.subject_id + out_lta_file = fname_presuffix(_in.source_file, + suffix=suffix, + use_ext=False) + outputs['out_lta_file'] = out_lta_file + else: + outputs['out_lta_file'] = op.abspath(_in.out_lta_file) + if isdefined(_in.out_fsl_file): if isinstance(_in.out_fsl_file, bool): suffix = '_bbreg_%s.mat' % _in.subject_id @@ -1234,7 +1247,7 @@ class BBRegister(FSCommand): def _format_arg(self, name, spec, value): - if name in ['registered_file', 'out_fsl_file']: + if name in ['registered_file', 'out_fsl_file', 'out_lta_file']: if isinstance(value, bool): fname = self._list_outputs()[name] else:
bbregister api: new version allows saving to lta (preferred)
nipy/nipype
diff --git a/nipype/interfaces/freesurfer/tests/test_BBRegister.py b/nipype/interfaces/freesurfer/tests/test_BBRegister.py index 90305697d..e29ea17b6 100644 --- a/nipype/interfaces/freesurfer/tests/test_BBRegister.py +++ b/nipype/interfaces/freesurfer/tests/test_BBRegister.py @@ -15,6 +15,7 @@ def test_BBRegister_inputs(): init_reg_file=dict(argstr='--init-reg %s', mandatory=True, xor=['init'],), intermediate_file=dict(argstr='--int %s',), out_fsl_file=dict(argstr='--fslmat %s',), + out_lta_file=dict(argstr='--lta %s', min_ver='5.2.0',), out_reg_file=dict(argstr='--reg %s', genfile=True,), reg_frame=dict(argstr='--frame %d', xor=['reg_middle_frame'],), reg_middle_frame=dict(argstr='--mid-frame', xor=['reg_frame'],), @@ -37,6 +38,7 @@ def test_BBRegister_inputs(): init_reg_file=dict(argstr='--init-reg %s', xor=['init'],), intermediate_file=dict(argstr='--int %s',), out_fsl_file=dict(argstr='--fslmat %s',), + out_lta_file=dict(argstr='--lta %s', min_ver='5.2.0',), out_reg_file=dict(argstr='--reg %s', genfile=True,), reg_frame=dict(argstr='--frame %d', xor=['reg_middle_frame'],), reg_middle_frame=dict(argstr='--mid-frame', xor=['reg_frame'],), @@ -62,6 +64,7 @@ def test_BBRegister_inputs(): def test_BBRegister_outputs(): output_map = dict(min_cost_file=dict(), out_fsl_file=dict(), + out_lta_file=dict(), out_reg_file=dict(), registered_file=dict(), )
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 1 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 click==8.0.4 configparser==5.2.0 decorator==4.4.2 funcsigs==1.0.2 future==1.0.0 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.6.1 lxml==5.3.1 mock==5.2.0 networkx==2.5.1 nibabel==3.2.2 -e git+https://github.com/nipy/nipype.git@90cfdd8a63114dbe2e1ce6dea9dd739d04f84a4a#egg=nipype numpy==1.19.5 packaging==21.3 pluggy==1.0.0 prov==2.0.1 py==1.11.0 pydotplus==2.0.2 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 rdflib==5.0.0 scipy==1.5.4 simplejson==3.20.1 six==1.17.0 tomli==1.2.3 traits==6.4.1 typing_extensions==4.1.1 zipp==3.6.0
name: nipype channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - click==8.0.4 - configparser==5.2.0 - decorator==4.4.2 - funcsigs==1.0.2 - future==1.0.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.6.1 - lxml==5.3.1 - mock==5.2.0 - networkx==2.5.1 - nibabel==3.2.2 - numpy==1.19.5 - packaging==21.3 - pluggy==1.0.0 - prov==2.0.1 - py==1.11.0 - pydotplus==2.0.2 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - rdflib==5.0.0 - scipy==1.5.4 - simplejson==3.20.1 - six==1.17.0 - tomli==1.2.3 - traits==6.4.1 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/nipype
[ "nipype/interfaces/freesurfer/tests/test_BBRegister.py::test_BBRegister_inputs" ]
[]
[ "nipype/interfaces/freesurfer/tests/test_BBRegister.py::test_BBRegister_outputs" ]
[]
Apache License 2.0
1,267
[ "nipype/interfaces/freesurfer/preprocess.py" ]
[ "nipype/interfaces/freesurfer/preprocess.py" ]
python-cmd2__cmd2-101
398cec2fd27c7e09d1b01dc383c5aefeb28511c3
2017-05-18 15:00:05
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
diff --git a/cmd2.py b/cmd2.py index 1f65f5a1..1de93ec2 100755 --- a/cmd2.py +++ b/cmd2.py @@ -87,7 +87,7 @@ try: except ImportError: pass -__version__ = '0.7.1a' +__version__ = '0.7.1' # Pyparsing enablePackrat() can greatly speed up parsing, but problems have been seen in Python 3 in the past pyparsing.ParserElement.enablePackrat() @@ -1461,7 +1461,7 @@ class Cmd(cmd.Cmd): return [] # Get a list of every directory in the PATH environment variable and ignore symbolic links - paths = [p for p in os.getenv('PATH').split(':') if not os.path.islink(p)] + paths = [p for p in os.getenv('PATH').split(os.path.pathsep) if not os.path.islink(p)] # Find every executable file in the PATH that matches the pattern exes = [] diff --git a/setup.py b/setup.py index 58505a0a..d09c5fd3 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ Setuptools setup file, used to install or test 'cmd2' """ from setuptools import setup -VERSION = '0.7.1a' +VERSION = '0.7.1' DESCRIPTION = "Extra features for standard library's cmd module" LONG_DESCRIPTION = """cmd2 is an enhancement to the standard library's cmd module for Python 2.7
Shell command completion not working on windows Completion of shell commands isn't working on windows, though path completion is working just fine on Windows and shell command completion is working on fine on both Linux and Mac.
python-cmd2/cmd2
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 10ae4329..3b0f752e 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -22,7 +22,7 @@ from conftest import run_cmd, normalize, BASE_HELP, HELP_HISTORY, SHORTCUTS_TXT, def test_ver(): - assert cmd2.__version__ == '0.7.1a' + assert cmd2.__version__ == '0.7.1' def test_base_help(base_app):
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_short_problem_statement", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 3 }, "num_modified_files": 2 }
0.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "", "pip_packages": [ "mock", "pytest", "pyparsing" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 -e git+https://github.com/python-cmd2/cmd2.git@398cec2fd27c7e09d1b01dc383c5aefeb28511c3#egg=cmd2 importlib-metadata==4.8.3 iniconfig==1.1.1 mock==5.2.0 packaging==21.3 pluggy==1.0.0 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 six==1.17.0 tomli==1.2.3 typing_extensions==4.1.1 zipp==3.6.0
name: cmd2 channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - mock==5.2.0 - packaging==21.3 - pluggy==1.0.0 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - six==1.17.0 - tomli==1.2.3 - typing-extensions==4.1.1 - zipp==3.6.0 prefix: /opt/conda/envs/cmd2
[ "tests/test_cmd2.py::test_ver" ]
[ "tests/test_cmd2.py::test_output_redirection" ]
[ "tests/test_cmd2.py::test_base_help", "tests/test_cmd2.py::test_base_help_history", "tests/test_cmd2.py::test_base_shortcuts", "tests/test_cmd2.py::test_base_show", "tests/test_cmd2.py::test_base_show_long", "tests/test_cmd2.py::test_base_set", "tests/test_cmd2.py::test_base_set_not_supported", "tests/test_cmd2.py::test_base_shell", "tests/test_cmd2.py::test_base_py", "tests/test_cmd2.py::test_base_run_python_script", "tests/test_cmd2.py::test_base_error", "tests/test_cmd2.py::test_base_history", "tests/test_cmd2.py::test_base_list", "tests/test_cmd2.py::test_list_with_string_argument", "tests/test_cmd2.py::test_list_with_integer_argument", "tests/test_cmd2.py::test_list_with_integer_span", "tests/test_cmd2.py::test_base_cmdenvironment", "tests/test_cmd2.py::test_base_load", "tests/test_cmd2.py::test_base_load_default_file", "tests/test_cmd2.py::test_base_relative_load", "tests/test_cmd2.py::test_base_save", "tests/test_cmd2.py::test_allow_redirection", "tests/test_cmd2.py::test_input_redirection", "tests/test_cmd2.py::test_pipe_to_shell", "tests/test_cmd2.py::test_send_to_paste_buffer", "tests/test_cmd2.py::test_base_timing", "tests/test_cmd2.py::test_base_debug", "tests/test_cmd2.py::test_base_colorize", "tests/test_cmd2.py::test_edit_no_editor", "tests/test_cmd2.py::test_edit_file", "tests/test_cmd2.py::test_edit_number", "tests/test_cmd2.py::test_edit_blank", "tests/test_cmd2.py::test_base_py_interactive", "tests/test_cmd2.py::test_base_cmdloop_with_queue", "tests/test_cmd2.py::test_base_cmdloop_without_queue", "tests/test_cmd2.py::test_cmdloop_without_rawinput" ]
[]
MIT License
1,268
[ "setup.py", "cmd2.py" ]
[ "setup.py", "cmd2.py" ]
tox-dev__tox-519
cf1a1c00386ce42ff9c1d21744c1fab97853bc2c
2017-05-18 17:01:57
e374ce61bf101fb2cc2eddd955f57048df153017
diff --git a/CHANGELOG b/CHANGELOG index 8bdb5b8d..d0a878c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Not released yet - #474: Start using setuptools_scm for tag based versioning. - #506: With `-a`: do not show additional environments header if there are none +- #518: Forward `USERPROFILE` by default on Windows. 2.7.0 ----- diff --git a/tox/config.py b/tox/config.py index 406cc5de..a1b1cbf6 100755 --- a/tox/config.py +++ b/tox/config.py @@ -489,6 +489,7 @@ def tox_addoption(parser): passenv.add("COMSPEC") # needed for distutils cygwincompiler passenv.add("TEMP") passenv.add("TMP") + passenv.add("USERPROFILE") # needed for `os.path.expanduser()`. else: passenv.add("TMPDIR") for spec in value:
USERPROFILE is not automatically forwarded on Windows Hi there! Given the following `tox.ini`: ```ini [tox] skipsdist = true [testenv] commands = python -c 'import os.path; print(os.path.expanduser("~"))' ``` Then, on Windows, this will incorrectly print `~`. If you add a `passenv` section to forward `USERPROFILE`, then it gives the right output: ```ini [tox] skipsdist = true [testenv] passenv = USERPROFILE commands = python -c 'import os.path; print(os.path.expanduser("~"))' ``` This prints `C:\Users\...` as you would expect. If I'm not mistaken, I believe `HOME` is forwarded by default on other systems, I would assume `USERPROFILE` should also be forwarded by default on Windows. I'll gladly work on a patch if you're willing to accept such a contribution!
tox-dev/tox
diff --git a/tests/test_config.py b/tests/test_config.py index 4eac45e6..5a87159f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -864,6 +864,7 @@ class TestConfigTestEnv: assert "COMSPEC" in envconfig.passenv assert "TEMP" in envconfig.passenv assert "TMP" in envconfig.passenv + assert "USERPROFILE" in envconfig.passenv else: assert "TMPDIR" in envconfig.passenv assert "PATH" in envconfig.passenv
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
2.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-timeout" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 distlib==0.3.9 filelock==3.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-timeout==2.1.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work -e git+https://github.com/tox-dev/tox.git@cf1a1c00386ce42ff9c1d21744c1fab97853bc2c#egg=tox typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: tox channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - distlib==0.3.9 - filelock==3.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - platformdirs==2.4.0 - pytest-timeout==2.1.0 - virtualenv==20.17.1 prefix: /opt/conda/envs/tox
[ "tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[win32]" ]
[ "tests/test_config.py::TestVenvConfig::test_force_dep_with_url", "tests/test_config.py::TestIniParser::test_getbool" ]
[ "tests/test_config.py::TestVenvConfig::test_config_parsing_minimal", "tests/test_config.py::TestVenvConfig::test_config_parsing_multienv", "tests/test_config.py::TestVenvConfig::test_envdir_set_manually", "tests/test_config.py::TestVenvConfig::test_envdir_set_manually_with_substitutions", "tests/test_config.py::TestVenvConfig::test_force_dep_version", "tests/test_config.py::TestVenvConfig::test_is_same_dep", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_rex", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[win]", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[lin]", "tests/test_config.py::TestConfigPackage::test_defaults", "tests/test_config.py::TestConfigPackage::test_defaults_distshare", "tests/test_config.py::TestConfigPackage::test_defaults_changed_dir", "tests/test_config.py::TestConfigPackage::test_project_paths", "tests/test_config.py::TestParseconfig::test_search_parents", "tests/test_config.py::TestParseconfig::test_explicit_config_path", "tests/test_config.py::test_get_homedir", "tests/test_config.py::TestGetcontextname::test_blank", "tests/test_config.py::TestGetcontextname::test_jenkins", "tests/test_config.py::TestGetcontextname::test_hudson_legacy", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_multiline", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_posargs", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_section_and_posargs_substitution", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution", "tests/test_config.py::TestIniParser::test_getstring_single", "tests/test_config.py::TestIniParser::test_missing_substitution", "tests/test_config.py::TestIniParser::test_getstring_fallback_sections", "tests/test_config.py::TestIniParser::test_getstring_substitution", "tests/test_config.py::TestIniParser::test_getlist", "tests/test_config.py::TestIniParser::test_getdict", "tests/test_config.py::TestIniParser::test_getstring_environment_substitution", "tests/test_config.py::TestIniParser::test_getstring_environment_substitution_with_default", "tests/test_config.py::TestIniParser::test_value_matches_section_substituion", "tests/test_config.py::TestIniParser::test_value_doesn_match_section_substitution", "tests/test_config.py::TestIniParser::test_getstring_other_section_substitution", "tests/test_config.py::TestIniParser::test_argvlist", "tests/test_config.py::TestIniParser::test_argvlist_windows_escaping", "tests/test_config.py::TestIniParser::test_argvlist_multiline", "tests/test_config.py::TestIniParser::test_argvlist_quoting_in_command", "tests/test_config.py::TestIniParser::test_argvlist_comment_after_command", "tests/test_config.py::TestIniParser::test_argvlist_command_contains_hash", "tests/test_config.py::TestIniParser::test_argvlist_positional_substitution", "tests/test_config.py::TestIniParser::test_argvlist_quoted_posargs", "tests/test_config.py::TestIniParser::test_argvlist_posargs_with_quotes", "tests/test_config.py::TestIniParser::test_positional_arguments_are_only_replaced_when_standing_alone", "tests/test_config.py::TestIniParser::test_posargs_are_added_escaped_issue310", "tests/test_config.py::TestIniParser::test_substitution_with_multiple_words", "tests/test_config.py::TestIniParser::test_getargv", "tests/test_config.py::TestIniParser::test_getpath", "tests/test_config.py::TestIniParserPrefix::test_basic_section_access", "tests/test_config.py::TestIniParserPrefix::test_fallback_sections", "tests/test_config.py::TestIniParserPrefix::test_value_matches_prefixed_section_substituion", "tests/test_config.py::TestIniParserPrefix::test_value_doesn_match_prefixed_section_substitution", "tests/test_config.py::TestIniParserPrefix::test_other_section_substitution", "tests/test_config.py::TestConfigTestEnv::test_commentchars_issue33", "tests/test_config.py::TestConfigTestEnv::test_defaults", "tests/test_config.py::TestConfigTestEnv::test_sitepackages_switch", "tests/test_config.py::TestConfigTestEnv::test_installpkg_tops_develop", "tests/test_config.py::TestConfigTestEnv::test_specific_command_overrides", "tests/test_config.py::TestConfigTestEnv::test_whitelist_externals", "tests/test_config.py::TestConfigTestEnv::test_changedir", "tests/test_config.py::TestConfigTestEnv::test_ignore_errors", "tests/test_config.py::TestConfigTestEnv::test_envbindir", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[jython]", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy]", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy3]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[linux2]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[win32]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[linux2]", "tests/test_config.py::TestConfigTestEnv::test_passenv_with_factor", "tests/test_config.py::TestConfigTestEnv::test_passenv_from_global_env", "tests/test_config.py::TestConfigTestEnv::test_passenv_glob_from_global_env", "tests/test_config.py::TestConfigTestEnv::test_changedir_override", "tests/test_config.py::TestConfigTestEnv::test_install_command_setting", "tests/test_config.py::TestConfigTestEnv::test_install_command_must_contain_packages", "tests/test_config.py::TestConfigTestEnv::test_install_command_substitutions", "tests/test_config.py::TestConfigTestEnv::test_pip_pre", "tests/test_config.py::TestConfigTestEnv::test_pip_pre_cmdline_override", "tests/test_config.py::TestConfigTestEnv::test_simple", "tests/test_config.py::TestConfigTestEnv::test_substitution_error", "tests/test_config.py::TestConfigTestEnv::test_substitution_defaults", "tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue246", "tests/test_config.py::TestConfigTestEnv::test_substitution_positional", "tests/test_config.py::TestConfigTestEnv::test_substitution_noargs_issue240", "tests/test_config.py::TestConfigTestEnv::test_substitution_double", "tests/test_config.py::TestConfigTestEnv::test_posargs_backslashed_or_quoted", "tests/test_config.py::TestConfigTestEnv::test_rewrite_posargs", "tests/test_config.py::TestConfigTestEnv::test_rewrite_simple_posargs", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist0-deps0]", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist1-deps1]", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_section", "tests/test_config.py::TestConfigTestEnv::test_multilevel_substitution", "tests/test_config.py::TestConfigTestEnv::test_recursive_substitution_cycle_fails", "tests/test_config.py::TestConfigTestEnv::test_single_value_from_other_secton", "tests/test_config.py::TestConfigTestEnv::test_factors", "tests/test_config.py::TestConfigTestEnv::test_factor_ops", "tests/test_config.py::TestConfigTestEnv::test_default_factors", "tests/test_config.py::TestConfigTestEnv::test_factors_in_boolean", "tests/test_config.py::TestConfigTestEnv::test_factors_in_setenv", "tests/test_config.py::TestConfigTestEnv::test_factor_use_not_checked", "tests/test_config.py::TestConfigTestEnv::test_factors_groups_touch", "tests/test_config.py::TestConfigTestEnv::test_period_in_factor", "tests/test_config.py::TestConfigTestEnv::test_ignore_outcome", "tests/test_config.py::TestGlobalOptions::test_notest", "tests/test_config.py::TestGlobalOptions::test_verbosity", "tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_default", "tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_context", "tests/test_config.py::TestGlobalOptions::test_sdist_specification", "tests/test_config.py::TestGlobalOptions::test_env_selection", "tests/test_config.py::TestGlobalOptions::test_py_venv", "tests/test_config.py::TestGlobalOptions::test_default_environments", "tests/test_config.py::TestGlobalOptions::test_envlist_expansion", "tests/test_config.py::TestGlobalOptions::test_envlist_cross_product", "tests/test_config.py::TestGlobalOptions::test_envlist_multiline", "tests/test_config.py::TestGlobalOptions::test_minversion", "tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_true", "tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_false", "tests/test_config.py::TestGlobalOptions::test_defaultenv_commandline", "tests/test_config.py::TestGlobalOptions::test_defaultenv_partial_override", "tests/test_config.py::TestHashseedOption::test_default", "tests/test_config.py::TestHashseedOption::test_passing_integer", "tests/test_config.py::TestHashseedOption::test_passing_string", "tests/test_config.py::TestHashseedOption::test_passing_empty_string", "tests/test_config.py::TestHashseedOption::test_setenv", "tests/test_config.py::TestHashseedOption::test_noset", "tests/test_config.py::TestHashseedOption::test_noset_with_setenv", "tests/test_config.py::TestHashseedOption::test_one_random_hashseed", "tests/test_config.py::TestHashseedOption::test_setenv_in_one_testenv", "tests/test_config.py::TestSetenv::test_getdict_lazy", "tests/test_config.py::TestSetenv::test_getdict_lazy_update", "tests/test_config.py::TestSetenv::test_setenv_uses_os_environ", "tests/test_config.py::TestSetenv::test_setenv_default_os_environ", "tests/test_config.py::TestSetenv::test_setenv_uses_other_setenv", "tests/test_config.py::TestSetenv::test_setenv_recursive_direct", "tests/test_config.py::TestSetenv::test_setenv_overrides", "tests/test_config.py::TestSetenv::test_setenv_with_envdir_and_basepython", "tests/test_config.py::TestSetenv::test_setenv_ordering_1", "tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_issue294", "tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_twice", "tests/test_config.py::TestSetenv::test_setenv_cross_section_mixed", "tests/test_config.py::TestIndexServer::test_indexserver", "tests/test_config.py::TestIndexServer::test_parse_indexserver", "tests/test_config.py::TestIndexServer::test_multiple_homedir_relative_local_indexservers", "tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[:]", "tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[;]", "tests/test_config.py::TestConfigConstSubstitutions::test_pathsep_regex", "tests/test_config.py::TestParseEnv::test_parse_recreate", "tests/test_config.py::TestCmdInvocation::test_help", "tests/test_config.py::TestCmdInvocation::test_version", "tests/test_config.py::TestCmdInvocation::test_listenvs", "tests/test_config.py::TestCmdInvocation::test_listenvs_verbose_description", "tests/test_config.py::TestCmdInvocation::test_listenvs_all", "tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description", "tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description_no_additional_environments", "tests/test_config.py::TestCmdInvocation::test_config_specific_ini", "tests/test_config.py::TestCmdInvocation::test_no_tox_ini", "tests/test_config.py::TestCmdInvocation::test_override_workdir", "tests/test_config.py::TestCmdInvocation::test_showconfig_with_force_dep_version", "tests/test_config.py::test_env_spec[-e", "tests/test_config.py::TestCommandParser::test_command_parser_for_word", "tests/test_config.py::TestCommandParser::test_command_parser_for_posargs", "tests/test_config.py::TestCommandParser::test_command_parser_for_multiple_words", "tests/test_config.py::TestCommandParser::test_command_parser_for_substitution_with_spaces", "tests/test_config.py::TestCommandParser::test_command_parser_with_complex_word_set", "tests/test_config.py::TestCommandParser::test_command_with_runs_of_whitespace", "tests/test_config.py::TestCommandParser::test_command_with_split_line_in_subst_arguments", "tests/test_config.py::TestCommandParser::test_command_parsing_for_issue_10" ]
[]
MIT License
1,269
[ "tox/config.py", "CHANGELOG" ]
[ "tox/config.py", "CHANGELOG" ]
tox-dev__tox-520
88e5b59db694b6ecf4386a2a6ae61722fbd81dca
2017-05-18 17:08:09
e374ce61bf101fb2cc2eddd955f57048df153017
diff --git a/CHANGELOG b/CHANGELOG index befff952..84e10651 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,8 @@ Not released yet - #474: Start using setuptools_scm for tag based versioning. - #506: With `-a`: do not show additional environments header if there are none +- #517: Forward NUMBER_OF_PROCESSORS by default on Windows to fix + `multiprocessor.cpu_count()`. - #518: Forward `USERPROFILE` by default on Windows. 2.7.0 diff --git a/tox/config.py b/tox/config.py index a1b1cbf6..a61fe7ca 100755 --- a/tox/config.py +++ b/tox/config.py @@ -489,6 +489,9 @@ def tox_addoption(parser): passenv.add("COMSPEC") # needed for distutils cygwincompiler passenv.add("TEMP") passenv.add("TMP") + # for `multiprocessing.cpu_count()` on Windows + # (prior to Python 3.4). + passenv.add("NUMBER_OF_PROCESSORS") passenv.add("USERPROFILE") # needed for `os.path.expanduser()`. else: passenv.add("TMPDIR")
Foward NUMBER_OF_PROCESSORS environment variable by default Hi there! In one project, I have a Python 2.7-only dependency that uses [`multiprocessing.cpu_count()`](https://docs.python.org/2/library/multiprocessing.html#multiprocessing.cpu_count) on Windows. This has a hidden dependency on the `NUMBER_OF_PROCESSORS` environment variable. This is quite confusing when porting this type of project into Tox. **Note**: in Python 3.4+, this is API is superseeded by [`os.cpu_count()`](https://docs.python.org/3/library/os.html#os.cpu_count) which does not depend on this environment variable. The case is a bit weak (Python up to 3.3 only, plus multiprocessing is not popular on Windows), but I feel like the standard library should work by default inside a Tox test environment. I'm willing to work on a patch if you would accept such a contribution!
tox-dev/tox
diff --git a/tests/test_config.py b/tests/test_config.py index 5a87159f..827934ef 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -864,6 +864,7 @@ class TestConfigTestEnv: assert "COMSPEC" in envconfig.passenv assert "TEMP" in envconfig.passenv assert "TMP" in envconfig.passenv + assert "NUMBER_OF_PROCESSORS" in envconfig.passenv assert "USERPROFILE" in envconfig.passenv else: assert "TMPDIR" in envconfig.passenv
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
2.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest", "pytest-timeout" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 distlib==0.3.9 filelock==3.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-timeout==2.1.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work -e git+https://github.com/tox-dev/tox.git@88e5b59db694b6ecf4386a2a6ae61722fbd81dca#egg=tox typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: tox channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - distlib==0.3.9 - filelock==3.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - platformdirs==2.4.0 - pytest-timeout==2.1.0 - virtualenv==20.17.1 prefix: /opt/conda/envs/tox
[ "tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[win32]" ]
[ "tests/test_config.py::TestVenvConfig::test_force_dep_with_url", "tests/test_config.py::TestIniParser::test_getbool" ]
[ "tests/test_config.py::TestVenvConfig::test_config_parsing_minimal", "tests/test_config.py::TestVenvConfig::test_config_parsing_multienv", "tests/test_config.py::TestVenvConfig::test_envdir_set_manually", "tests/test_config.py::TestVenvConfig::test_envdir_set_manually_with_substitutions", "tests/test_config.py::TestVenvConfig::test_force_dep_version", "tests/test_config.py::TestVenvConfig::test_is_same_dep", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_rex", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[win]", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[lin]", "tests/test_config.py::TestConfigPackage::test_defaults", "tests/test_config.py::TestConfigPackage::test_defaults_distshare", "tests/test_config.py::TestConfigPackage::test_defaults_changed_dir", "tests/test_config.py::TestConfigPackage::test_project_paths", "tests/test_config.py::TestParseconfig::test_search_parents", "tests/test_config.py::TestParseconfig::test_explicit_config_path", "tests/test_config.py::test_get_homedir", "tests/test_config.py::TestGetcontextname::test_blank", "tests/test_config.py::TestGetcontextname::test_jenkins", "tests/test_config.py::TestGetcontextname::test_hudson_legacy", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_multiline", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_posargs", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_section_and_posargs_substitution", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution", "tests/test_config.py::TestIniParser::test_getstring_single", "tests/test_config.py::TestIniParser::test_missing_substitution", "tests/test_config.py::TestIniParser::test_getstring_fallback_sections", "tests/test_config.py::TestIniParser::test_getstring_substitution", "tests/test_config.py::TestIniParser::test_getlist", "tests/test_config.py::TestIniParser::test_getdict", "tests/test_config.py::TestIniParser::test_getstring_environment_substitution", "tests/test_config.py::TestIniParser::test_getstring_environment_substitution_with_default", "tests/test_config.py::TestIniParser::test_value_matches_section_substituion", "tests/test_config.py::TestIniParser::test_value_doesn_match_section_substitution", "tests/test_config.py::TestIniParser::test_getstring_other_section_substitution", "tests/test_config.py::TestIniParser::test_argvlist", "tests/test_config.py::TestIniParser::test_argvlist_windows_escaping", "tests/test_config.py::TestIniParser::test_argvlist_multiline", "tests/test_config.py::TestIniParser::test_argvlist_quoting_in_command", "tests/test_config.py::TestIniParser::test_argvlist_comment_after_command", "tests/test_config.py::TestIniParser::test_argvlist_command_contains_hash", "tests/test_config.py::TestIniParser::test_argvlist_positional_substitution", "tests/test_config.py::TestIniParser::test_argvlist_quoted_posargs", "tests/test_config.py::TestIniParser::test_argvlist_posargs_with_quotes", "tests/test_config.py::TestIniParser::test_positional_arguments_are_only_replaced_when_standing_alone", "tests/test_config.py::TestIniParser::test_posargs_are_added_escaped_issue310", "tests/test_config.py::TestIniParser::test_substitution_with_multiple_words", "tests/test_config.py::TestIniParser::test_getargv", "tests/test_config.py::TestIniParser::test_getpath", "tests/test_config.py::TestIniParserPrefix::test_basic_section_access", "tests/test_config.py::TestIniParserPrefix::test_fallback_sections", "tests/test_config.py::TestIniParserPrefix::test_value_matches_prefixed_section_substituion", "tests/test_config.py::TestIniParserPrefix::test_value_doesn_match_prefixed_section_substitution", "tests/test_config.py::TestIniParserPrefix::test_other_section_substitution", "tests/test_config.py::TestConfigTestEnv::test_commentchars_issue33", "tests/test_config.py::TestConfigTestEnv::test_defaults", "tests/test_config.py::TestConfigTestEnv::test_sitepackages_switch", "tests/test_config.py::TestConfigTestEnv::test_installpkg_tops_develop", "tests/test_config.py::TestConfigTestEnv::test_specific_command_overrides", "tests/test_config.py::TestConfigTestEnv::test_whitelist_externals", "tests/test_config.py::TestConfigTestEnv::test_changedir", "tests/test_config.py::TestConfigTestEnv::test_ignore_errors", "tests/test_config.py::TestConfigTestEnv::test_envbindir", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[jython]", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy]", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy3]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[linux2]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[win32]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[linux2]", "tests/test_config.py::TestConfigTestEnv::test_passenv_with_factor", "tests/test_config.py::TestConfigTestEnv::test_passenv_from_global_env", "tests/test_config.py::TestConfigTestEnv::test_passenv_glob_from_global_env", "tests/test_config.py::TestConfigTestEnv::test_changedir_override", "tests/test_config.py::TestConfigTestEnv::test_install_command_setting", "tests/test_config.py::TestConfigTestEnv::test_install_command_must_contain_packages", "tests/test_config.py::TestConfigTestEnv::test_install_command_substitutions", "tests/test_config.py::TestConfigTestEnv::test_pip_pre", "tests/test_config.py::TestConfigTestEnv::test_pip_pre_cmdline_override", "tests/test_config.py::TestConfigTestEnv::test_simple", "tests/test_config.py::TestConfigTestEnv::test_substitution_error", "tests/test_config.py::TestConfigTestEnv::test_substitution_defaults", "tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue246", "tests/test_config.py::TestConfigTestEnv::test_substitution_positional", "tests/test_config.py::TestConfigTestEnv::test_substitution_noargs_issue240", "tests/test_config.py::TestConfigTestEnv::test_substitution_double", "tests/test_config.py::TestConfigTestEnv::test_posargs_backslashed_or_quoted", "tests/test_config.py::TestConfigTestEnv::test_rewrite_posargs", "tests/test_config.py::TestConfigTestEnv::test_rewrite_simple_posargs", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist0-deps0]", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist1-deps1]", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_section", "tests/test_config.py::TestConfigTestEnv::test_multilevel_substitution", "tests/test_config.py::TestConfigTestEnv::test_recursive_substitution_cycle_fails", "tests/test_config.py::TestConfigTestEnv::test_single_value_from_other_secton", "tests/test_config.py::TestConfigTestEnv::test_factors", "tests/test_config.py::TestConfigTestEnv::test_factor_ops", "tests/test_config.py::TestConfigTestEnv::test_default_factors", "tests/test_config.py::TestConfigTestEnv::test_factors_in_boolean", "tests/test_config.py::TestConfigTestEnv::test_factors_in_setenv", "tests/test_config.py::TestConfigTestEnv::test_factor_use_not_checked", "tests/test_config.py::TestConfigTestEnv::test_factors_groups_touch", "tests/test_config.py::TestConfigTestEnv::test_period_in_factor", "tests/test_config.py::TestConfigTestEnv::test_ignore_outcome", "tests/test_config.py::TestGlobalOptions::test_notest", "tests/test_config.py::TestGlobalOptions::test_verbosity", "tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_default", "tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_context", "tests/test_config.py::TestGlobalOptions::test_sdist_specification", "tests/test_config.py::TestGlobalOptions::test_env_selection", "tests/test_config.py::TestGlobalOptions::test_py_venv", "tests/test_config.py::TestGlobalOptions::test_default_environments", "tests/test_config.py::TestGlobalOptions::test_envlist_expansion", "tests/test_config.py::TestGlobalOptions::test_envlist_cross_product", "tests/test_config.py::TestGlobalOptions::test_envlist_multiline", "tests/test_config.py::TestGlobalOptions::test_minversion", "tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_true", "tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_false", "tests/test_config.py::TestGlobalOptions::test_defaultenv_commandline", "tests/test_config.py::TestGlobalOptions::test_defaultenv_partial_override", "tests/test_config.py::TestHashseedOption::test_default", "tests/test_config.py::TestHashseedOption::test_passing_integer", "tests/test_config.py::TestHashseedOption::test_passing_string", "tests/test_config.py::TestHashseedOption::test_passing_empty_string", "tests/test_config.py::TestHashseedOption::test_setenv", "tests/test_config.py::TestHashseedOption::test_noset", "tests/test_config.py::TestHashseedOption::test_noset_with_setenv", "tests/test_config.py::TestHashseedOption::test_one_random_hashseed", "tests/test_config.py::TestHashseedOption::test_setenv_in_one_testenv", "tests/test_config.py::TestSetenv::test_getdict_lazy", "tests/test_config.py::TestSetenv::test_getdict_lazy_update", "tests/test_config.py::TestSetenv::test_setenv_uses_os_environ", "tests/test_config.py::TestSetenv::test_setenv_default_os_environ", "tests/test_config.py::TestSetenv::test_setenv_uses_other_setenv", "tests/test_config.py::TestSetenv::test_setenv_recursive_direct", "tests/test_config.py::TestSetenv::test_setenv_overrides", "tests/test_config.py::TestSetenv::test_setenv_with_envdir_and_basepython", "tests/test_config.py::TestSetenv::test_setenv_ordering_1", "tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_issue294", "tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_twice", "tests/test_config.py::TestSetenv::test_setenv_cross_section_mixed", "tests/test_config.py::TestIndexServer::test_indexserver", "tests/test_config.py::TestIndexServer::test_parse_indexserver", "tests/test_config.py::TestIndexServer::test_multiple_homedir_relative_local_indexservers", "tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[:]", "tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[;]", "tests/test_config.py::TestConfigConstSubstitutions::test_pathsep_regex", "tests/test_config.py::TestParseEnv::test_parse_recreate", "tests/test_config.py::TestCmdInvocation::test_help", "tests/test_config.py::TestCmdInvocation::test_version", "tests/test_config.py::TestCmdInvocation::test_listenvs", "tests/test_config.py::TestCmdInvocation::test_listenvs_verbose_description", "tests/test_config.py::TestCmdInvocation::test_listenvs_all", "tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description", "tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description_no_additional_environments", "tests/test_config.py::TestCmdInvocation::test_config_specific_ini", "tests/test_config.py::TestCmdInvocation::test_no_tox_ini", "tests/test_config.py::TestCmdInvocation::test_override_workdir", "tests/test_config.py::TestCmdInvocation::test_showconfig_with_force_dep_version", "tests/test_config.py::test_env_spec[-e", "tests/test_config.py::TestCommandParser::test_command_parser_for_word", "tests/test_config.py::TestCommandParser::test_command_parser_for_posargs", "tests/test_config.py::TestCommandParser::test_command_parser_for_multiple_words", "tests/test_config.py::TestCommandParser::test_command_parser_for_substitution_with_spaces", "tests/test_config.py::TestCommandParser::test_command_parser_with_complex_word_set", "tests/test_config.py::TestCommandParser::test_command_with_runs_of_whitespace", "tests/test_config.py::TestCommandParser::test_command_with_split_line_in_subst_arguments", "tests/test_config.py::TestCommandParser::test_command_parsing_for_issue_10" ]
[]
MIT License
1,270
[ "tox/config.py", "CHANGELOG" ]
[ "tox/config.py", "CHANGELOG" ]
tox-dev__tox-521
6889c81a4c31fedeb22af056e9f2b7e8f86f00cf
2017-05-18 18:00:01
e374ce61bf101fb2cc2eddd955f57048df153017
diff --git a/CHANGELOG b/CHANGELOG index 6da74217..eeb48cff 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ Not released yet - #517: Forward NUMBER_OF_PROCESSORS by default on Windows to fix `multiprocessor.cpu_count()`. - #518: Forward `USERPROFILE` by default on Windows. +- #515: Don't require environment variables in test environments + where they are not used. 2.7.0 ----- diff --git a/tox/config.py b/tox/config.py index d797951c..e5e616b3 100755 --- a/tox/config.py +++ b/tox/config.py @@ -792,7 +792,8 @@ class parseini: factors = set(name.split('-')) if section in self._cfg or factors <= known_factors: config.envconfigs[name] = \ - self.make_envconfig(name, section, reader._subs, config) + self.make_envconfig(name, section, reader._subs, config, + replace=name in config.envlist) all_develop = all(name in config.envconfigs and config.envconfigs[name].usedevelop @@ -808,7 +809,7 @@ class parseini: factors.update(*mapcat(_split_factor_expr, exprs)) return factors - def make_envconfig(self, name, section, subs, config): + def make_envconfig(self, name, section, subs, config, replace=True): factors = set(name.split('-')) reader = SectionReader(section, self._cfg, fallbacksections=["testenv"], factors=factors) @@ -823,7 +824,7 @@ class parseini: atype = env_attr.type if atype in ("bool", "path", "string", "dict", "dict_setenv", "argv", "argvlist"): meth = getattr(reader, "get" + atype) - res = meth(env_attr.name, env_attr.default) + res = meth(env_attr.name, env_attr.default, replace=replace) elif atype == "space-separated-list": res = reader.getlist(env_attr.name, sep=" ") elif atype == "line-list": @@ -942,9 +943,9 @@ class SectionReader: if _posargs: self.posargs = _posargs - def getpath(self, name, defaultpath): + def getpath(self, name, defaultpath, replace=True): toxinidir = self._subs['toxinidir'] - path = self.getstring(name, defaultpath) + path = self.getstring(name, defaultpath, replace=replace) if path is not None: return toxinidir.join(path, abs=True) @@ -954,12 +955,12 @@ class SectionReader: return [] return [x.strip() for x in s.split(sep) if x.strip()] - def getdict(self, name, default=None, sep="\n"): + def getdict(self, name, default=None, sep="\n", replace=True): value = self.getstring(name, None) return self._getdict(value, default=default, sep=sep) - def getdict_setenv(self, name, default=None, sep="\n"): - value = self.getstring(name, None, replace=True, crossonly=True) + def getdict_setenv(self, name, default=None, sep="\n", replace=True): + value = self.getstring(name, None, replace=replace, crossonly=True) definitions = self._getdict(value, default=default, sep=sep) self._setenv = SetenvDict(definitions, reader=self) return self._setenv @@ -976,8 +977,8 @@ class SectionReader: return d - def getbool(self, name, default=None): - s = self.getstring(name, default) + def getbool(self, name, default=None, replace=True): + s = self.getstring(name, default, replace=replace) if not s: s = default if s is None: @@ -994,12 +995,12 @@ class SectionReader: "boolean value %r needs to be 'True' or 'False'") return s - def getargvlist(self, name, default=""): + def getargvlist(self, name, default="", replace=True): s = self.getstring(name, default, replace=False) - return _ArgvlistReader.getargvlist(self, s) + return _ArgvlistReader.getargvlist(self, s, replace=replace) - def getargv(self, name, default=""): - return self.getargvlist(name, default)[0] + def getargv(self, name, default="", replace=True): + return self.getargvlist(name, default, replace=replace)[0] def getstring(self, name, default=None, replace=True, crossonly=False): x = None @@ -1153,7 +1154,7 @@ class Replacer: class _ArgvlistReader: @classmethod - def getargvlist(cls, reader, value): + def getargvlist(cls, reader, value, replace=True): """Parse ``commands`` argvlist multiline string. :param str name: Key name in a section. @@ -1178,7 +1179,7 @@ class _ArgvlistReader: replaced = reader._replace(current_command, crossonly=True) commands.extend(cls.getargvlist(reader, replaced)) else: - commands.append(cls.processcommand(reader, current_command)) + commands.append(cls.processcommand(reader, current_command, replace)) current_command = "" else: if current_command: @@ -1188,7 +1189,7 @@ class _ArgvlistReader: return commands @classmethod - def processcommand(cls, reader, command): + def processcommand(cls, reader, command, replace=True): posargs = getattr(reader, "posargs", "") posargs_string = list2cmdline([x for x in posargs if x]) @@ -1196,23 +1197,26 @@ class _ArgvlistReader: # appropriate to construct the new command string. This # string is then broken up into exec argv components using # shlex. - newcommand = "" - for word in CommandParser(command).words(): - if word == "{posargs}" or word == "[]": - newcommand += posargs_string - continue - elif word.startswith("{posargs:") and word.endswith("}"): - if posargs: + if replace: + newcommand = "" + for word in CommandParser(command).words(): + if word == "{posargs}" or word == "[]": newcommand += posargs_string continue - else: - word = word[9:-1] - new_arg = "" - new_word = reader._replace(word) - new_word = reader._replace(new_word) - new_word = new_word.replace('\\{', '{').replace('\\}', '}') - new_arg += new_word - newcommand += new_arg + elif word.startswith("{posargs:") and word.endswith("}"): + if posargs: + newcommand += posargs_string + continue + else: + word = word[9:-1] + new_arg = "" + new_word = reader._replace(word) + new_word = reader._replace(new_word) + new_word = new_word.replace('\\{', '{').replace('\\}', '}') + new_arg += new_word + newcommand += new_arg + else: + newcommand = command # Construct shlex object that will not escape any values, # use all values as is in argv.
Environment variables required across unrelated environments Hi there, I have an issue where if one environment uses an `{env:X}` subsitution (without default), then that environment variable is required in all environments regardless of whether they are necessary or not. Given this example `tox.ini` file: ```ini [tox] skipsdist = true [testenv:standard-greeting] commands = python -c 'print("Hello, world!")' [testenv:custom-greeting] passenv = NAME commands = python -c 'print("Hello, {env:NAME}!"' ``` Then `custom-greeting` environment cannot be used unless `NAME` is present in the calling environment, even if that environment doesn't use the `{env:NAME}`. ```shell $ tox -e standard-greeting tox.ConfigError: ConfigError: substitution env:'NAME': unknown environment variable 'NAME' or recursive definition. ``` I got this with tox 2.7.0 with both Python 3.5 and 2.7 on Windows.
tox-dev/tox
diff --git a/tests/test_config.py b/tests/test_config.py index 9254e992..743b08ed 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1088,6 +1088,27 @@ class TestConfigTestEnv: assert 'FOO' in env assert 'BAR' in env + def test_substitution_notfound_issue515(tmpdir, newconfig): + config = newconfig(""" + [tox] + envlist = standard-greeting + + [testenv:standard-greeting] + commands = + python -c 'print("Hello, world!")' + + [testenv:custom-greeting] + passenv = + NAME + commands = + python -c 'print("Hello, {env:NAME}!")' + """) + conf = config.envconfigs['standard-greeting'] + assert conf.commands == [ + ['python', '-c', 'print("Hello, world!")'], + ] + + @pytest.mark.xfail(raises=AssertionError, reason="issue #301") def test_substitution_nested_env_defaults_issue301(tmpdir, newconfig, monkeypatch): monkeypatch.setenv("IGNORE_STATIC_DEFAULT", "env") monkeypatch.setenv("IGNORE_DYNAMIC_DEFAULT", "env")
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 0 }, "num_modified_files": 2 }
2.7
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest>=2.3.5", "pytest-timeout", "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 distlib==0.3.9 filelock==3.4.1 importlib-metadata==4.8.3 importlib-resources==5.4.0 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work platformdirs==2.4.0 pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 pytest-timeout==2.1.0 toml @ file:///tmp/build/80754af9/toml_1616166611790/work -e git+https://github.com/tox-dev/tox.git@6889c81a4c31fedeb22af056e9f2b7e8f86f00cf#egg=tox typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work virtualenv==20.17.1 zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: tox channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - distlib==0.3.9 - filelock==3.4.1 - importlib-metadata==4.8.3 - importlib-resources==5.4.0 - platformdirs==2.4.0 - pytest-timeout==2.1.0 - virtualenv==20.17.1 prefix: /opt/conda/envs/tox
[ "tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue515" ]
[ "tests/test_config.py::TestVenvConfig::test_force_dep_with_url", "tests/test_config.py::TestIniParser::test_getbool" ]
[ "tests/test_config.py::TestVenvConfig::test_config_parsing_minimal", "tests/test_config.py::TestVenvConfig::test_config_parsing_multienv", "tests/test_config.py::TestVenvConfig::test_envdir_set_manually", "tests/test_config.py::TestVenvConfig::test_envdir_set_manually_with_substitutions", "tests/test_config.py::TestVenvConfig::test_force_dep_version", "tests/test_config.py::TestVenvConfig::test_is_same_dep", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_rex", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[win]", "tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[lin]", "tests/test_config.py::TestConfigPackage::test_defaults", "tests/test_config.py::TestConfigPackage::test_defaults_distshare", "tests/test_config.py::TestConfigPackage::test_defaults_changed_dir", "tests/test_config.py::TestConfigPackage::test_project_paths", "tests/test_config.py::TestParseconfig::test_search_parents", "tests/test_config.py::TestParseconfig::test_explicit_config_path", "tests/test_config.py::test_get_homedir", "tests/test_config.py::TestGetcontextname::test_blank", "tests/test_config.py::TestGetcontextname::test_jenkins", "tests/test_config.py::TestGetcontextname::test_hudson_legacy", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_multiline", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_posargs", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_section_and_posargs_substitution", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution", "tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution_global", "tests/test_config.py::TestIniParser::test_getstring_single", "tests/test_config.py::TestIniParser::test_missing_substitution", "tests/test_config.py::TestIniParser::test_getstring_fallback_sections", "tests/test_config.py::TestIniParser::test_getstring_substitution", "tests/test_config.py::TestIniParser::test_getlist", "tests/test_config.py::TestIniParser::test_getdict", "tests/test_config.py::TestIniParser::test_getstring_environment_substitution", "tests/test_config.py::TestIniParser::test_getstring_environment_substitution_with_default", "tests/test_config.py::TestIniParser::test_value_matches_section_substituion", "tests/test_config.py::TestIniParser::test_value_doesn_match_section_substitution", "tests/test_config.py::TestIniParser::test_getstring_other_section_substitution", "tests/test_config.py::TestIniParser::test_argvlist", "tests/test_config.py::TestIniParser::test_argvlist_windows_escaping", "tests/test_config.py::TestIniParser::test_argvlist_multiline", "tests/test_config.py::TestIniParser::test_argvlist_quoting_in_command", "tests/test_config.py::TestIniParser::test_argvlist_comment_after_command", "tests/test_config.py::TestIniParser::test_argvlist_command_contains_hash", "tests/test_config.py::TestIniParser::test_argvlist_positional_substitution", "tests/test_config.py::TestIniParser::test_argvlist_quoted_posargs", "tests/test_config.py::TestIniParser::test_argvlist_posargs_with_quotes", "tests/test_config.py::TestIniParser::test_positional_arguments_are_only_replaced_when_standing_alone", "tests/test_config.py::TestIniParser::test_posargs_are_added_escaped_issue310", "tests/test_config.py::TestIniParser::test_substitution_with_multiple_words", "tests/test_config.py::TestIniParser::test_getargv", "tests/test_config.py::TestIniParser::test_getpath", "tests/test_config.py::TestIniParserPrefix::test_basic_section_access", "tests/test_config.py::TestIniParserPrefix::test_fallback_sections", "tests/test_config.py::TestIniParserPrefix::test_value_matches_prefixed_section_substituion", "tests/test_config.py::TestIniParserPrefix::test_value_doesn_match_prefixed_section_substitution", "tests/test_config.py::TestIniParserPrefix::test_other_section_substitution", "tests/test_config.py::TestConfigTestEnv::test_commentchars_issue33", "tests/test_config.py::TestConfigTestEnv::test_defaults", "tests/test_config.py::TestConfigTestEnv::test_sitepackages_switch", "tests/test_config.py::TestConfigTestEnv::test_installpkg_tops_develop", "tests/test_config.py::TestConfigTestEnv::test_specific_command_overrides", "tests/test_config.py::TestConfigTestEnv::test_whitelist_externals", "tests/test_config.py::TestConfigTestEnv::test_changedir", "tests/test_config.py::TestConfigTestEnv::test_ignore_errors", "tests/test_config.py::TestConfigTestEnv::test_envbindir", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[jython]", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy]", "tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy3]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[win32]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[linux2]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[win32]", "tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[linux2]", "tests/test_config.py::TestConfigTestEnv::test_passenv_with_factor", "tests/test_config.py::TestConfigTestEnv::test_passenv_from_global_env", "tests/test_config.py::TestConfigTestEnv::test_passenv_glob_from_global_env", "tests/test_config.py::TestConfigTestEnv::test_changedir_override", "tests/test_config.py::TestConfigTestEnv::test_install_command_setting", "tests/test_config.py::TestConfigTestEnv::test_install_command_must_contain_packages", "tests/test_config.py::TestConfigTestEnv::test_install_command_substitutions", "tests/test_config.py::TestConfigTestEnv::test_pip_pre", "tests/test_config.py::TestConfigTestEnv::test_pip_pre_cmdline_override", "tests/test_config.py::TestConfigTestEnv::test_simple", "tests/test_config.py::TestConfigTestEnv::test_substitution_error", "tests/test_config.py::TestConfigTestEnv::test_substitution_defaults", "tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue246", "tests/test_config.py::TestConfigTestEnv::test_substitution_positional", "tests/test_config.py::TestConfigTestEnv::test_substitution_noargs_issue240", "tests/test_config.py::TestConfigTestEnv::test_substitution_double", "tests/test_config.py::TestConfigTestEnv::test_posargs_backslashed_or_quoted", "tests/test_config.py::TestConfigTestEnv::test_rewrite_posargs", "tests/test_config.py::TestConfigTestEnv::test_rewrite_simple_posargs", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist0-deps0]", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist1-deps1]", "tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_section", "tests/test_config.py::TestConfigTestEnv::test_multilevel_substitution", "tests/test_config.py::TestConfigTestEnv::test_recursive_substitution_cycle_fails", "tests/test_config.py::TestConfigTestEnv::test_single_value_from_other_secton", "tests/test_config.py::TestConfigTestEnv::test_factors", "tests/test_config.py::TestConfigTestEnv::test_factor_ops", "tests/test_config.py::TestConfigTestEnv::test_default_factors", "tests/test_config.py::TestConfigTestEnv::test_factors_in_boolean", "tests/test_config.py::TestConfigTestEnv::test_factors_in_setenv", "tests/test_config.py::TestConfigTestEnv::test_factor_use_not_checked", "tests/test_config.py::TestConfigTestEnv::test_factors_groups_touch", "tests/test_config.py::TestConfigTestEnv::test_period_in_factor", "tests/test_config.py::TestConfigTestEnv::test_ignore_outcome", "tests/test_config.py::TestGlobalOptions::test_notest", "tests/test_config.py::TestGlobalOptions::test_verbosity", "tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_default", "tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_context", "tests/test_config.py::TestGlobalOptions::test_sdist_specification", "tests/test_config.py::TestGlobalOptions::test_env_selection", "tests/test_config.py::TestGlobalOptions::test_py_venv", "tests/test_config.py::TestGlobalOptions::test_default_environments", "tests/test_config.py::TestGlobalOptions::test_envlist_expansion", "tests/test_config.py::TestGlobalOptions::test_envlist_cross_product", "tests/test_config.py::TestGlobalOptions::test_envlist_multiline", "tests/test_config.py::TestGlobalOptions::test_minversion", "tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_true", "tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_false", "tests/test_config.py::TestGlobalOptions::test_defaultenv_commandline", "tests/test_config.py::TestGlobalOptions::test_defaultenv_partial_override", "tests/test_config.py::TestHashseedOption::test_default", "tests/test_config.py::TestHashseedOption::test_passing_integer", "tests/test_config.py::TestHashseedOption::test_passing_string", "tests/test_config.py::TestHashseedOption::test_passing_empty_string", "tests/test_config.py::TestHashseedOption::test_setenv", "tests/test_config.py::TestHashseedOption::test_noset", "tests/test_config.py::TestHashseedOption::test_noset_with_setenv", "tests/test_config.py::TestHashseedOption::test_one_random_hashseed", "tests/test_config.py::TestHashseedOption::test_setenv_in_one_testenv", "tests/test_config.py::TestSetenv::test_getdict_lazy", "tests/test_config.py::TestSetenv::test_getdict_lazy_update", "tests/test_config.py::TestSetenv::test_setenv_uses_os_environ", "tests/test_config.py::TestSetenv::test_setenv_default_os_environ", "tests/test_config.py::TestSetenv::test_setenv_uses_other_setenv", "tests/test_config.py::TestSetenv::test_setenv_recursive_direct", "tests/test_config.py::TestSetenv::test_setenv_overrides", "tests/test_config.py::TestSetenv::test_setenv_with_envdir_and_basepython", "tests/test_config.py::TestSetenv::test_setenv_ordering_1", "tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_issue294", "tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_twice", "tests/test_config.py::TestSetenv::test_setenv_cross_section_mixed", "tests/test_config.py::TestIndexServer::test_indexserver", "tests/test_config.py::TestIndexServer::test_parse_indexserver", "tests/test_config.py::TestIndexServer::test_multiple_homedir_relative_local_indexservers", "tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[:]", "tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[;]", "tests/test_config.py::TestConfigConstSubstitutions::test_pathsep_regex", "tests/test_config.py::TestParseEnv::test_parse_recreate", "tests/test_config.py::TestCmdInvocation::test_help", "tests/test_config.py::TestCmdInvocation::test_version", "tests/test_config.py::TestCmdInvocation::test_listenvs", "tests/test_config.py::TestCmdInvocation::test_listenvs_verbose_description", "tests/test_config.py::TestCmdInvocation::test_listenvs_all", "tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description", "tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description_no_additional_environments", "tests/test_config.py::TestCmdInvocation::test_config_specific_ini", "tests/test_config.py::TestCmdInvocation::test_no_tox_ini", "tests/test_config.py::TestCmdInvocation::test_override_workdir", "tests/test_config.py::TestCmdInvocation::test_showconfig_with_force_dep_version", "tests/test_config.py::test_env_spec[-e", "tests/test_config.py::TestCommandParser::test_command_parser_for_word", "tests/test_config.py::TestCommandParser::test_command_parser_for_posargs", "tests/test_config.py::TestCommandParser::test_command_parser_for_multiple_words", "tests/test_config.py::TestCommandParser::test_command_parser_for_substitution_with_spaces", "tests/test_config.py::TestCommandParser::test_command_parser_with_complex_word_set", "tests/test_config.py::TestCommandParser::test_command_with_runs_of_whitespace", "tests/test_config.py::TestCommandParser::test_command_with_split_line_in_subst_arguments", "tests/test_config.py::TestCommandParser::test_command_parsing_for_issue_10" ]
[]
MIT License
1,271
[ "tox/config.py", "CHANGELOG" ]
[ "tox/config.py", "CHANGELOG" ]
hylang__hy-1296
e92ef484a0f4102b964525527b485bcc18b47ef8
2017-05-18 20:35:56
5c720c0110908e3f47dba2e4cc1c820d16f359a1
Kodiologist: @kirbyfan64 Is this good to merge? Kodiologist: @kirbyfan64 Poke. kirbyfan64: @Kodiologist FYI this has conflicts. Kodiologist: Yep, I'll take care of it and merge. Thanks.
diff --git a/Makefile b/Makefile index 1b618a76..4658b6fb 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ tox: venv tox flake: - flake8 hy tests --ignore=E121,E123,E126,E226,E24,E704,W503,E305 + flake8 hy tests --ignore=E121,E123,E126,E226,E24,E704,W503,E302,E305,E701 clear: clear diff --git a/NEWS b/NEWS index e96cd696..1a6c3d5e 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ Changes from 0.13.0 [ Language Changes ] * Single-character "sharp macros" changed to "tag macros", which can have longer names + * Periods are no longer allowed in keywords + + [ Bug Fixes ] + * Numeric literals are no longer parsed as symbols when followed by a dot + and a symbol Changes from 0.12.1 diff --git a/hy/lex/parser.py b/hy/lex/parser.py index aa579e3d..1be896b2 100755 --- a/hy/lex/parser.py +++ b/hy/lex/parser.py @@ -288,6 +288,24 @@ def t_partial_string(p): def t_identifier(p): obj = p[0].value + val = symbol_like(obj) + if val is not None: + return val + + if "." in obj and symbol_like(obj.split(".", 1)[0]) is not None: + # E.g., `5.attr` or `:foo.attr` + raise LexException( + 'Cannot access attribute on anything other than a name (in ' + 'order to get attributes of expressions, use ' + '`(. <expression> <attr>)` or `(.<attr> <expression>)`)', + p[0].source_pos.lineno, p[0].source_pos.colno) + + return HySymbol(".".join(hy_symbol_mangle(x) for x in obj.split("."))) + + +def symbol_like(obj): + "Try to interpret `obj` as a number or keyword." + try: return HyInteger(obj) except ValueError: @@ -312,13 +330,9 @@ def t_identifier(p): except ValueError: pass - if obj.startswith(":"): + if obj.startswith(":") and "." not in obj: return HyKeyword(obj) - obj = ".".join([hy_symbol_mangle(part) for part in obj.split(".")]) - - return HySymbol(obj) - @pg.error def error_handler(token):
Attributes of literals TL;DR: the way attributes, integers, and identifiers are parsed is a hot, hot mess. So, right now, parsing a number or symbol looks like this: - Lexer sees token and tags it as an identifier. - Parser grabs token, tries to covert it to an integer, float, or fraction, and, failing that, compiles it as a symbol. The second step means that there are a lot of corner cases that are currently quite bizarre: ``` ryan@DevPC-LX /media/ryan/stuff/hy attrerr $ ./run --spy hy 0.11.0 using CPython(default) 2.7.6 on Linux => (defn f [&rest args &kwargs kw]) def f(*args, **kw): pass => => 2.2 ; This is a float. 2.2 2.2 => a.2 ; This is interpreted as getting the attribute '2' on 'a'. a.2 Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'a' is not defined => 2.a ; This is interpreted as getting the attribute 'a' on an identifier '2'. 2.a Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name '2' is not defined => a/b ; This is parsed as a whole identifier 'a/b'... a/b Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'a/b' is not defined => 1/2 ; ...but this is a fraction. from hy.core.language import fraction fraction(1L, 2L) Fraction(1, 2) => (f :x? 1) ; Here, the ? isn't converted to is_ like usual. f(x?=1L) => (f :*x* 1) ; The two stars stay uncoverted. f(*x*=1L) => ryan@DevPC-LX /media/ryan/stuff/hy attrerr $ ```
hylang/hy
diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index 49b53056..5b2421f5 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -1446,7 +1446,6 @@ (assert (= (keyword 'foo) :foo)) (assert (= (keyword 'foo-bar) :foo-bar)) (assert (= (keyword 1) :1)) - (assert (= (keyword 1.0) :1.0)) (assert (= (keyword :foo_bar) :foo-bar))) (defn test-name-conversion [] diff --git a/tests/test_lex.py b/tests/test_lex.py index 33162e76..e5f43223 100644 --- a/tests/test_lex.py +++ b/tests/test_lex.py @@ -5,56 +5,31 @@ from hy.models import (HyExpression, HyInteger, HyFloat, HyComplex, HySymbol, HyString, HyDict, HyList, HySet, HyCons) from hy.lex import LexException, PrematureEndOfInput, tokenize +import pytest + +def peoi(): return pytest.raises(PrematureEndOfInput) +def lexe(): return pytest.raises(LexException) def test_lex_exception(): """ Ensure tokenize throws a fit on a partial input """ - try: - tokenize("(foo") - assert True is False - except PrematureEndOfInput: - pass - try: - tokenize("{foo bar") - assert True is False - except PrematureEndOfInput: - pass - try: - tokenize("(defn foo [bar]") - assert True is False - except PrematureEndOfInput: - pass - try: - tokenize("(foo \"bar") - assert True is False - except PrematureEndOfInput: - pass + with peoi(): tokenize("(foo") + with peoi(): tokenize("{foo bar") + with peoi(): tokenize("(defn foo [bar]") + with peoi(): tokenize("(foo \"bar") def test_unbalanced_exception(): """Ensure the tokenization fails on unbalanced expressions""" - try: - tokenize("(bar))") - assert True is False - except LexException: - pass - - try: - tokenize("(baz [quux]])") - assert True is False - except LexException: - pass + with lexe(): tokenize("(bar))") + with lexe(): tokenize("(baz [quux]])") def test_lex_single_quote_err(): "Ensure tokenizing \"' \" throws a LexException that can be stringified" # https://github.com/hylang/hy/issues/1252 - try: - tokenize("' ") - except LexException as e: - assert "Could not identify the next token" in str(e) - else: - assert False + with lexe() as e: tokenize("' ") + assert "Could not identify the next token" in str(e.value) def test_lex_expression_symbols(): @@ -154,6 +129,21 @@ def test_lex_digit_separators(): [HySymbol(",,,,___,__1__,,__,,2__,q,__")]) +def test_lex_bad_attrs(): + with lexe(): tokenize("1.foo") + with lexe(): tokenize("0.foo") + with lexe(): tokenize("1.5.foo") + with lexe(): tokenize("1e3.foo") + with lexe(): tokenize("5j.foo") + with lexe(): tokenize("3+5j.foo") + with lexe(): tokenize("3.1+5.1j.foo") + assert tokenize("j.foo") + with lexe(): tokenize("3/4.foo") + assert tokenize("a/1.foo") + assert tokenize("1/a.foo") + with lexe(): tokenize(":hello.foo") + + def test_lex_line_counting(): """ Make sure we can count lines / columns """ entry = tokenize("(foo (one two))")[0]
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 2, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 3 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "pytest", "pip_packages": [ "pytest" ], "pre_install": null, "python": "3.6", "reqs_path": null, "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
appdirs==1.4.4 args==0.1.0 astor==0.8.1 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work certifi==2021.5.30 clint==0.5.1 -e git+https://github.com/hylang/hy.git@e92ef484a0f4102b964525527b485bcc18b47ef8#egg=hy importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work py @ file:///opt/conda/conda-bld/py_1644396412707/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pytest==6.2.4 rply==0.7.8 toml @ file:///tmp/build/80754af9/toml_1616166611790/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
name: hy channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - attrs=21.4.0=pyhd3eb1b0_0 - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - importlib-metadata=4.8.1=py36h06a4308_0 - importlib_metadata=4.8.1=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - more-itertools=8.12.0=pyhd3eb1b0_0 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - packaging=21.3=pyhd3eb1b0_0 - pip=21.2.2=py36h06a4308_0 - pluggy=0.13.1=py36h06a4308_0 - py=1.11.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pytest=6.2.4=py36h06a4308_2 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - toml=0.10.2=pyhd3eb1b0_0 - typing_extensions=4.1.1=pyh06a4308_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zipp=3.6.0=pyhd3eb1b0_0 - zlib=1.2.13=h5eee18b_1 - pip: - appdirs==1.4.4 - args==0.1.0 - astor==0.8.1 - clint==0.5.1 - rply==0.7.8 prefix: /opt/conda/envs/hy
[ "tests/test_lex.py::test_lex_bad_attrs" ]
[ "tests/native_tests/language.hy::test_disassemble" ]
[ "tests/native_tests/language.hy::test_sys_argv", "tests/native_tests/language.hy::test_hex", "tests/native_tests/language.hy::test_octal", "tests/native_tests/language.hy::test_binary", "tests/native_tests/language.hy::test_fractions", "tests/native_tests/language.hy::test_lists", "tests/native_tests/language.hy::test_dicts", "tests/native_tests/language.hy::test_sets", "tests/native_tests/language.hy::test_setv_get", "tests/native_tests/language.hy::test_setv_builtin", "tests/native_tests/language.hy::test_setv_pairs", "tests/native_tests/language.hy::test_setv_returns_none", "tests/native_tests/language.hy::test_store_errors", "tests/native_tests/language.hy::test_fn_corner_cases", "tests/native_tests/language.hy::test_alias_names_in_errors", "tests/native_tests/language.hy::test_for_loop", "tests/native_tests/language.hy::test_nasty_for_nesting", "tests/native_tests/language.hy::test_while_loop", "tests/native_tests/language.hy::test_branching", "tests/native_tests/language.hy::test_branching_with_do", "tests/native_tests/language.hy::test_branching_expr_count_with_do", "tests/native_tests/language.hy::test_cond", "tests/native_tests/language.hy::test_if", "tests/native_tests/language.hy::test_index", "tests/native_tests/language.hy::test_fn", "tests/native_tests/language.hy::test_imported_bits", "tests/native_tests/language.hy::test_kwargs", "tests/native_tests/language.hy::test_apply", "tests/native_tests/language.hy::test_apply_with_methods", "tests/native_tests/language.hy::test_dotted", "tests/native_tests/language.hy::test_do", "tests/native_tests/language.hy::test_exceptions", "tests/native_tests/language.hy::test_earmuffs", "tests/native_tests/language.hy::test_threading", "tests/native_tests/language.hy::test_tail_threading", "tests/native_tests/language.hy::test_threading_two", "tests/native_tests/language.hy::test_as_threading", "tests/native_tests/language.hy::test_assoc", "tests/native_tests/language.hy::test_multiassoc", "tests/native_tests/language.hy::test_pass", "tests/native_tests/language.hy::test_yield", "tests/native_tests/language.hy::test_yield_with_return", "tests/native_tests/language.hy::test_yield_in_try", "tests/native_tests/language.hy::test_first", "tests/native_tests/language.hy::test_cut", "tests/native_tests/language.hy::test_rest", "tests/native_tests/language.hy::test_importas", "tests/native_tests/language.hy::test_context", "tests/native_tests/language.hy::test_context_yield", "tests/native_tests/language.hy::test_with_return", "tests/native_tests/language.hy::test_for_doodle", "tests/native_tests/language.hy::test_for_else", "tests/native_tests/language.hy::test_list_comprehensions", "tests/native_tests/language.hy::test_set_comprehensions", "tests/native_tests/language.hy::test_dict_comprehensions", "tests/native_tests/language.hy::test_generator_expressions", "tests/native_tests/language.hy::test_defn_order", "tests/native_tests/language.hy::test_defn_return", "tests/native_tests/language.hy::test_defn_lambdakey", "tests/native_tests/language.hy::test_defn_do", "tests/native_tests/language.hy::test_defn_do_return", "tests/native_tests/language.hy::test_defn_dunder_name", "tests/native_tests/language.hy::test_mangles", "tests/native_tests/language.hy::test_fn_return", "tests/native_tests/language.hy::test_if_mangler", "tests/native_tests/language.hy::test_nested_mangles", "tests/native_tests/language.hy::test_symbol_utf_8", "tests/native_tests/language.hy::test_symbol_dash", "tests/native_tests/language.hy::test_symbol_question_mark", "tests/native_tests/language.hy::test_and", "tests/native_tests/language.hy::test_and_#1151_do", "tests/native_tests/language.hy::test_and_#1151_for", "tests/native_tests/language.hy::test_and_#1151_del", "tests/native_tests/language.hy::test_or", "tests/native_tests/language.hy::test_or_#1151_do", "tests/native_tests/language.hy::test_or_#1151_for", "tests/native_tests/language.hy::test_or_#1151_del", "tests/native_tests/language.hy::test_xor", "tests/native_tests/language.hy::test_if_return_branching", "tests/native_tests/language.hy::test_keyword", "tests/native_tests/language.hy::test_keyword_clash", "tests/native_tests/language.hy::test_empty_keyword", "tests/native_tests/language.hy::test_nested_if", "tests/native_tests/language.hy::test_eval", "tests/native_tests/language.hy::test_eval_false", "tests/native_tests/language.hy::test_eval_globals", "tests/native_tests/language.hy::test_eval_failure", "tests/native_tests/language.hy::test_import_syntax", "tests/native_tests/language.hy::test_lambda_keyword_lists", "tests/native_tests/language.hy::test_key_arguments", "tests/native_tests/language.hy::test_optional_arguments", "tests/native_tests/language.hy::test_undefined_name", "tests/native_tests/language.hy::test_if_in_if", "tests/native_tests/language.hy::test_try_except_return", "tests/native_tests/language.hy::test_try_else_return", "tests/native_tests/language.hy::test_require", "tests/native_tests/language.hy::test_require_native", "tests/native_tests/language.hy::test_encoding_nightmares", "tests/native_tests/language.hy::test_keyword_dict_access", "tests/native_tests/language.hy::test_break_breaking", "tests/native_tests/language.hy::test_continue_continuation", "tests/native_tests/language.hy::test_empty_list", "tests/native_tests/language.hy::test_string", "tests/native_tests/language.hy::test_del", "tests/native_tests/language.hy::test_macroexpand", "tests/native_tests/language.hy::test_macroexpand_1", "tests/native_tests/language.hy::test_merge_with", "tests/native_tests/language.hy::test_calling_module_name", "tests/native_tests/language.hy::test_attribute_access", "tests/native_tests/language.hy::test_keyword_quoting", "tests/native_tests/language.hy::test_only_parse_lambda_list_in_defn", "tests/native_tests/language.hy::test_read", "tests/native_tests/language.hy::test_read_str", "tests/native_tests/language.hy::test_keyword_creation", "tests/native_tests/language.hy::test_name_conversion", "tests/native_tests/language.hy::test_keywords", "tests/native_tests/language.hy::test_keywords_and_macros", "tests/native_tests/language.hy::test_argument_destr", "tests/test_lex.py::test_lex_exception", "tests/test_lex.py::test_unbalanced_exception", "tests/test_lex.py::test_lex_single_quote_err", "tests/test_lex.py::test_lex_expression_symbols", "tests/test_lex.py::test_lex_expression_strings", "tests/test_lex.py::test_lex_expression_integer", "tests/test_lex.py::test_lex_symbols", "tests/test_lex.py::test_lex_strings", "tests/test_lex.py::test_lex_integers", "tests/test_lex.py::test_lex_fractions", "tests/test_lex.py::test_lex_expression_float", "tests/test_lex.py::test_lex_expression_complex", "tests/test_lex.py::test_lex_digit_separators", "tests/test_lex.py::test_lex_line_counting", "tests/test_lex.py::test_lex_line_counting_multi", "tests/test_lex.py::test_lex_line_counting_multi_inner", "tests/test_lex.py::test_dicts", "tests/test_lex.py::test_sets", "tests/test_lex.py::test_nospace", "tests/test_lex.py::test_escapes", "tests/test_lex.py::test_unicode_escapes", "tests/test_lex.py::test_hashbang", "tests/test_lex.py::test_complex", "tests/test_lex.py::test_tag_macro", "tests/test_lex.py::test_lex_comment_382", "tests/test_lex.py::test_lex_mangling_star", "tests/test_lex.py::test_lex_mangling_hyphen", "tests/test_lex.py::test_lex_mangling_qmark", "tests/test_lex.py::test_lex_mangling_bang", "tests/test_lex.py::test_unmangle", "tests/test_lex.py::test_simple_cons", "tests/test_lex.py::test_dotted_list", "tests/test_lex.py::test_cons_list" ]
[]
MIT License
1,272
[ "Makefile", "NEWS", "hy/lex/parser.py" ]
[ "Makefile", "NEWS", "hy/lex/parser.py" ]
csparpa__pyowm-189
93e2b8b77f96abc0428c8817ac411dc77169c6fc
2017-05-18 20:43:27
6030af24e66ce03b02612d754cedd06992146ff3
diff --git a/pyowm/utils/temputils.py b/pyowm/utils/temputils.py index 58c4ea9..8bc29c3 100644 --- a/pyowm/utils/temputils.py +++ b/pyowm/utils/temputils.py @@ -1,11 +1,15 @@ """ -Module containing utility functions for temperature units conversion +Module containing utility functions for temperature and wind units conversion """ +# Temperature coneversion constants KELVIN_OFFSET = 273.15 FAHRENHEIT_OFFSET = 32.0 FAHRENHEIT_DEGREE_SCALE = 1.8 +# Wind speed conversion constants +MILES_PER_HOUR_FOR_ONE_METER_PER_SEC = 2.23694 + def kelvin_dict_to(d, target_temperature_unit): """ @@ -66,3 +70,24 @@ def kelvin_to_fahrenheit(kelvintemp): fahrenheittemp = (kelvintemp - KELVIN_OFFSET) * \ FAHRENHEIT_DEGREE_SCALE + FAHRENHEIT_OFFSET return float("{0:.2f}".format(fahrenheittemp)) + + +def metric_wind_dict_to_imperial(d): + """ + Converts all the wind values in a dict from meters/sec (metric measurement + system) to miles/hour (imperial measurement system) + . + + :param d: the dictionary containing metric values + :type d: dict + :returns: a dict with the same keys as the input dict and values converted + to miles/hour + + """ + result = dict() + for key, value in d.items(): + if key != 'deg': # do not convert wind degree + result[key] = value * MILES_PER_HOUR_FOR_ONE_METER_PER_SEC + else: + result[key] = value + return result diff --git a/pyowm/webapi25/weather.py b/pyowm/webapi25/weather.py index ddd9c39..cfd3962 100644 --- a/pyowm/webapi25/weather.py +++ b/pyowm/webapi25/weather.py @@ -163,13 +163,22 @@ class Weather(object): """ return self._snow - def get_wind(self): + def get_wind(self, unit='meters_sec'): """Returns a dict containing wind info - + + :param unit: the unit of measure for the wind values. May be: + '*meters_sec*' (default) or '*miles_hour*' + :type unit: str :returns: a dict containing wind info """ - return self._wind + if unit == 'meters_sec': + return self._wind + elif unit == 'miles_hour': + wind_dict = {k: self._wind[k] for k in self._wind if self._wind[k] is not None} + return temputils.metric_wind_dict_to_imperial(wind_dict) + else: + raise ValueError("Invalid value for target wind conversion unit") def get_humidity(self): """Returns the atmospheric humidity as an int
[Feature suggestion] Change wind speed unit While `get_temperature() `supports unit parameter, `get_wind()` does not support it. OWM has wind speed unit available as Imperial (miles/hour) or Metric (meter/sec) unit. Suggested implementation: `w.get_wind(unit = 'Imperial')` or `w.get_wind(unit = 'miles/hour')` or `w.get_wind('Imperial')` References: [https://openweathermap.org/weather-data](url)
csparpa/pyowm
diff --git a/tests/unit/utils/test_temputils.py b/tests/unit/utils/test_temputils.py index e5bd43c..92a2aa9 100644 --- a/tests/unit/utils/test_temputils.py +++ b/tests/unit/utils/test_temputils.py @@ -48,3 +48,17 @@ class TestTempUtils(unittest.TestCase): def test_kelvin_to_fahrenheit_fails_with_negative_values(self): self.assertRaises(ValueError, temputils.kelvin_to_fahrenheit, -137.0) + + def test_metric_wind_dict_to_imperial(self): + input = { + 'speed': 2, + 'gust': 3, + 'deg': 7.89 + } + expected = { + 'speed': 4.47388, + 'gust': 6.71082, + 'deg': 7.89 + } + result = temputils.metric_wind_dict_to_imperial(input) + self.assertEqual(expected, result) diff --git a/tests/unit/webapi25/json_test_dumps.py b/tests/unit/webapi25/json_test_dumps.py index df2d2cb..448f7e7 100644 --- a/tests/unit/webapi25/json_test_dumps.py +++ b/tests/unit/webapi25/json_test_dumps.py @@ -15,7 +15,7 @@ WEATHER_JSON_DUMP = '{"status": "Clouds", "visibility_distance": 1000, ' \ '{"press": 1030.119, "sea_level": 1038.589}, ' \ '"sunrise_time": 1378449600, "heat_index": 40.0, ' \ '"weather_icon_name": "04d", "humidity": 57, "wind": ' \ - '{"speed": 1.1, "deg": 252.002}}' + '{"speed": 1.1, "deg": 252.002, "gust": 2.09}}' OBSERVATION_JSON_DUMP = '{"reception_time": 1234567, "Location": ' \ '{"country": "UK", "name": "test", "coordinates": ' \ diff --git a/tests/unit/webapi25/test_weather.py b/tests/unit/webapi25/test_weather.py index a3ffa7c..9bb6319 100644 --- a/tests/unit/webapi25/test_weather.py +++ b/tests/unit/webapi25/test_weather.py @@ -6,6 +6,7 @@ import unittest from pyowm.webapi25.weather import Weather, weather_from_dictionary from pyowm.utils.timeformatutils import UTC from tests.unit.webapi25.json_test_dumps import WEATHER_JSON_DUMP +from tests.unit.webapi25.xml_test_dumps import WEATHER_XML_DUMP from datetime import datetime @@ -22,7 +23,8 @@ class TestWeather(unittest.TestCase): __test_clouds = 67 __test_rain = {"all": 20} __test_snow = {"all": 0} - __test_wind = {"deg": 252.002, "speed": 1.100} + __test_wind = {"deg": 252.002, "speed": 1.100, "gust": 2.09} + __test_imperial_wind = {"deg": 252.002, "speed": 2.460634, "gust": 4.6752046} __test_humidity = 57 __test_pressure = {"press": 1030.119, "sea_level": 1038.589} __test_temperature = {"temp": 294.199, "temp_kf": -1.899, @@ -380,6 +382,21 @@ class TestWeather(unittest.TestCase): self.assertRaises(ValueError, Weather.get_temperature, self.__test_instance, 'xyz') + def test_returning_different_units_for_wind_values(self): + result_imperial = self.__test_instance.get_wind(unit='miles_hour') + result_metric = self.__test_instance.get_wind(unit='meters_sec') + result_unspecified = self.__test_instance.get_wind() + self.assertEqual(result_unspecified, result_metric) + for item in self.__test_wind: + self.assertEqual(result_metric[item], + self.__test_wind[item]) + self.assertEqual(result_imperial[item], + self.__test_imperial_wind[item]) + + def test_get_wind_fails_with_unknown_units(self): + self.assertRaises(ValueError, Weather.get_wind, + self.__test_instance, 'xyz') + # Test JSON and XML comparisons by ordering strings (this overcomes # interpeter-dependant serialization of XML/JSON objects) diff --git a/tests/unit/webapi25/xml_test_dumps.py b/tests/unit/webapi25/xml_test_dumps.py index c393de8..08088b7 100644 --- a/tests/unit/webapi25/xml_test_dumps.py +++ b/tests/unit/webapi25/xml_test_dumps.py @@ -6,7 +6,7 @@ LOCATION_XML_DUMP = """<?xml version='1.0' encoding='utf8'?> <location xmlns:l="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/location.xsd"><l:name>London</l:name><l:coordinates><l:lon>12.3</l:lon><l:lat>43.7</l:lat></l:coordinates><l:ID>1234</l:ID><l:country>UK</l:country></location>""" WEATHER_XML_DUMP = """<?xml version='1.0' encoding='utf8'?> -<weather xmlns:w="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/weather.xsd"><w:status>Clouds</w:status><w:weather_code>804</w:weather_code><w:rain><w:all>20</w:all></w:rain><w:snow><w:all>0</w:all></w:snow><w:pressure><w:press>1030.119</w:press><w:sea_level>1038.589</w:sea_level></w:pressure><w:sunrise_time>1378449600</w:sunrise_time><w:weather_icon_name>04d</w:weather_icon_name><w:clouds>67</w:clouds><w:temperature><w:temp_kf>-1.899</w:temp_kf><w:temp_min>294.199</w:temp_min><w:temp>294.199</w:temp><w:temp_max>296.098</w:temp_max></w:temperature><w:detailed_status>Overcast clouds</w:detailed_status><w:reference_time>1378459200</w:reference_time><w:sunset_time>1378496400</w:sunset_time><w:humidity>57</w:humidity><w:wind><w:speed>1.1</w:speed><w:deg>252.002</w:deg></w:wind><w:visibility_distance>1000</w:visibility_distance><w:dewpoint>300.0</w:dewpoint><w:humidex>298.0</w:humidex><w:heat_index>40.0</w:heat_index></weather>""" +<weather xmlns:w="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/weather.xsd"><w:status>Clouds</w:status><w:weather_code>804</w:weather_code><w:rain><w:all>20</w:all></w:rain><w:snow><w:all>0</w:all></w:snow><w:pressure><w:press>1030.119</w:press><w:sea_level>1038.589</w:sea_level></w:pressure><w:sunrise_time>1378449600</w:sunrise_time><w:weather_icon_name>04d</w:weather_icon_name><w:clouds>67</w:clouds><w:temperature><w:temp_kf>-1.899</w:temp_kf><w:temp_min>294.199</w:temp_min><w:temp>294.199</w:temp><w:temp_max>296.098</w:temp_max></w:temperature><w:detailed_status>Overcast clouds</w:detailed_status><w:reference_time>1378459200</w:reference_time><w:sunset_time>1378496400</w:sunset_time><w:humidity>57</w:humidity><w:wind><w:speed>1.1</w:speed><w:deg>252.002</w:deg><w:gust>2.09</w:gust></w:wind><w:visibility_distance>1000</w:visibility_distance><w:dewpoint>300.0</w:dewpoint><w:humidex>298.0</w:humidex><w:heat_index>40.0</w:heat_index></weather>""" OBSERVATION_XML_DUMP = """<?xml version='1.0' encoding='utf8'?> <observation xmlns:o="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/observation.xsd"><o:reception_time>1234567</o:reception_time><o:location><o:name>test</o:name><o:coordinates><o:lon>12.3</o:lon><o:lat>43.7</o:lat></o:coordinates><o:ID>987</o:ID><o:country>UK</o:country></o:location><o:weather><o:status>Clouds</o:status><o:weather_code>804</o:weather_code><o:rain><o:all>20</o:all></o:rain><o:snow><o:all>0</o:all></o:snow><o:pressure><o:press>1030.119</o:press><o:sea_level>1038.589</o:sea_level></o:pressure><o:sunrise_time>1378449600</o:sunrise_time><o:weather_icon_name>04d</o:weather_icon_name><o:clouds>67</o:clouds><o:temperature><o:temp_kf>-1.899</o:temp_kf><o:temp_min>294.199</o:temp_min><o:temp>294.199</o:temp><o:temp_max>296.098</o:temp_max></o:temperature><o:detailed_status>Overcast clouds</o:detailed_status><o:reference_time>1378459200</o:reference_time><o:sunset_time>1378496400</o:sunset_time><o:humidity>57</o:humidity><o:wind><o:speed>1.1</o:speed><o:deg>252.002</o:deg></o:wind><o:visibility_distance>1000</o:visibility_distance><o:dewpoint>300.0</o:dewpoint><o:humidex>298.0</o:humidex><o:heat_index>296.0</o:heat_index></o:weather></observation>"""
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_hyperlinks", "has_many_modified_files", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 0, "test_score": 2 }, "num_modified_files": 2 }
2.6
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-xdist", "pytest-mock", "pytest-asyncio" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.9", "reqs_path": [ "dev-requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
args==0.1.0 certifi==2025.1.31 charset-normalizer==3.4.1 clint==0.5.1 coverage==7.8.0 docutils==0.21.2 exceptiongroup==1.2.2 execnet==2.1.1 idna==3.10 iniconfig==2.1.0 Jinja2==3.1.6 MarkupSafe==3.0.2 packaging==24.2 pkginfo==1.12.1.2 pluggy==1.5.0 py==1.11.0 Pygments==2.19.1 -e git+https://github.com/csparpa/pyowm.git@93e2b8b77f96abc0428c8817ac411dc77169c6fc#egg=pyowm pytest==8.3.5 pytest-asyncio==0.26.0 pytest-cov==6.0.0 pytest-mock==3.14.0 pytest-xdist==3.6.1 requests==2.32.3 requests-toolbelt==1.0.0 Sphinx==1.2.1 tomli==2.2.1 tox==1.9.2 twine==1.8.1 typing_extensions==4.13.0 urllib3==2.3.0 virtualenv==12.0.7
name: pyowm channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - args==0.1.0 - certifi==2025.1.31 - charset-normalizer==3.4.1 - clint==0.5.1 - coverage==7.8.0 - docutils==0.21.2 - exceptiongroup==1.2.2 - execnet==2.1.1 - idna==3.10 - iniconfig==2.1.0 - jinja2==3.1.6 - markupsafe==3.0.2 - packaging==24.2 - pkginfo==1.12.1.2 - pluggy==1.5.0 - py==1.11.0 - pygments==2.19.1 - pytest==8.3.5 - pytest-asyncio==0.26.0 - pytest-cov==6.0.0 - pytest-mock==3.14.0 - pytest-xdist==3.6.1 - requests==2.32.3 - requests-toolbelt==1.0.0 - sphinx==1.2.1 - tomli==2.2.1 - tox==1.9.2 - twine==1.8.1 - typing-extensions==4.13.0 - urllib3==2.3.0 - virtualenv==12.0.7 prefix: /opt/conda/envs/pyowm
[ "tests/unit/utils/test_temputils.py::TestTempUtils::test_metric_wind_dict_to_imperial", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_wind_fails_with_unknown_units", "tests/unit/webapi25/test_weather.py::TestWeather::test_returning_different_units_for_wind_values" ]
[]
[ "tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_dict_to", "tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_dict_to_fails_with_unknown_temperature_units", "tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_celsius", "tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_celsius_fails_with_negative_values", "tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_fahrenheit", "tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_fahrenheit_fails_with_negative_values", "tests/unit/webapi25/test_weather.py::TestWeather::test_from_dictionary", "tests/unit/webapi25/test_weather.py::TestWeather::test_from_dictionary_when_data_fields_are_none", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_reference_time_fails_with_unknown_timeformat", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_reference_time_returning_different_formats", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunrise_time_fails_with_unknown_timeformat", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunrise_time_returning_different_formats", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunset_time_fails_with_unknown_timeformat", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunset_time_returning_different_formats", "tests/unit/webapi25/test_weather.py::TestWeather::test_get_temperature_fails_with_unknown_units", "tests/unit/webapi25/test_weather.py::TestWeather::test_getters_return_expected_data", "tests/unit/webapi25/test_weather.py::TestWeather::test_init_fails_when_negative_data_provided", "tests/unit/webapi25/test_weather.py::TestWeather::test_init_stores_negative_sunrise_time_as_none", "tests/unit/webapi25/test_weather.py::TestWeather::test_init_stores_negative_sunset_time_as_none", "tests/unit/webapi25/test_weather.py::TestWeather::test_init_when_wind_is_none", "tests/unit/webapi25/test_weather.py::TestWeather::test_returning_different_units_for_temperatures", "tests/unit/webapi25/test_weather.py::TestWeather::test_to_JSON" ]
[]
MIT License
1,273
[ "pyowm/webapi25/weather.py", "pyowm/utils/temputils.py" ]
[ "pyowm/webapi25/weather.py", "pyowm/utils/temputils.py" ]
auth0__auth0-python-64
0d7decce20e04703d11a614bffc8f9d9f6e9723e
2017-05-19 09:54:07
a9fd8e39c6aee52bf1654d96c494287121d9e141
diff --git a/auth0/v3/authentication/base.py b/auth0/v3/authentication/base.py index b4ccd1d..778912c 100644 --- a/auth0/v3/authentication/base.py +++ b/auth0/v3/authentication/base.py @@ -19,8 +19,8 @@ class AuthenticationBase(object): except ValueError: return response.text else: - if 'error' in text: - raise Auth0Error(status_code=text['error'], - error_code=text['error'], - message=text['error_description']) + if response.status_code is None or response.status_code >= 400: + raise Auth0Error(status_code=response.status_code, + error_code=text.get('error', ''), + message=text.get('error_description', '')) return text
Auth0Error not being raised due to inconsistent API error responses Currently `Auth0Error` is raised whenever the API response contains an `error` key in the response JSON. Unfortunately at least one endpoint (`/dbconnections/signup`) returns inconsistent error messages (that do not always contain the `error` key) for different scenarios and as a result `Auth0Error` is not raised when an error occurs. Examples of inconsistent responses: * when making a signup request with an email that is already registered: ``` { "code": "user_exists", "description": "The user already exists.", "name": "BadRequestError", "statusCode": 400 } ``` * when making a request with an invalid `client_id` (with public signup disabled) ``` { "name": "NotFoundError", "statusCode": 404 } ``` * when making a request with an invalid password (with password strength enabled) ``` { "code": "invalid_password", "description": { "rules": [ { "code": "lengthAtLeast", "format": [ 6 ], "message": "At least %d characters in length", "verified": false } ], "verified": false }, "message": "Password is too weak", "name": "PasswordStrengthError", "policy": "* At least 6 characters in length", "statusCode": 400 } ``` * when making a request with missing password ``` { "error": "password is required" } ``` The last example highlights a related issue. Even though there is an `error` key, a `KeyError` exception will ultimately occur because `AuthenticationBase._process_response` assumes the additional existence of an `error_description` key when creating the `Auth0Error` and setting its message.
auth0/auth0-python
diff --git a/auth0/v3/test/authentication/test_base.py b/auth0/v3/test/authentication/test_base.py index c058864..d6539c8 100644 --- a/auth0/v3/test/authentication/test_base.py +++ b/auth0/v3/test/authentication/test_base.py @@ -10,6 +10,7 @@ class TestBase(unittest.TestCase): def test_post(self, mock_post): ab = AuthenticationBase() + mock_post.return_value.status_code = 200 mock_post.return_value.text = '{"x": "y"}' data = ab.post('the-url', data={'a': 'b'}, headers={'c': 'd'}) @@ -23,12 +24,14 @@ class TestBase(unittest.TestCase): def test_post_error(self, mock_post): ab = AuthenticationBase() - mock_post.return_value.text = '{"error": "e0",' \ - '"error_description": "desc"}' + for error_status in [400, 500, None]: + mock_post.return_value.status_code = error_status + mock_post.return_value.text = '{"error": "e0",' \ + '"error_description": "desc"}' - with self.assertRaises(Auth0Error) as context: - data = ab.post('the-url', data={'a': 'b'}, headers={'c': 'd'}) + with self.assertRaises(Auth0Error) as context: + data = ab.post('the-url', data={'a': 'b'}, headers={'c': 'd'}) - self.assertEqual(context.exception.status_code, 'e0') - self.assertEqual(context.exception.error_code, 'e0') - self.assertEqual(context.exception.message, 'desc') + self.assertEqual(context.exception.status_code, error_status) + self.assertEqual(context.exception.error_code, 'e0') + self.assertEqual(context.exception.message, 'desc')
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 2, "test_score": 2 }, "num_modified_files": 1 }
3.1
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov" ], "pre_install": null, "python": "3.9", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
-e git+https://github.com/auth0/auth0-python.git@0d7decce20e04703d11a614bffc8f9d9f6e9723e#egg=auth0_python coverage==7.8.0 exceptiongroup==1.2.2 iniconfig==2.1.0 mock==1.3.0 packaging==24.2 pbr==6.1.1 pluggy==1.5.0 pytest==8.3.5 pytest-cov==6.0.0 requests==2.8.1 six==1.17.0 tomli==2.2.1
name: auth0-python channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.4.4=h6a678d5_1 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=3.0.16=h5eee18b_0 - pip=25.0=py39h06a4308_0 - python=3.9.21=he870216_1 - readline=8.2=h5eee18b_0 - setuptools=75.8.0=py39h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - tzdata=2025a=h04d1e81_0 - wheel=0.45.1=py39h06a4308_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - coverage==7.8.0 - exceptiongroup==1.2.2 - iniconfig==2.1.0 - mock==1.3.0 - packaging==24.2 - pbr==6.1.1 - pluggy==1.5.0 - pytest==8.3.5 - pytest-cov==6.0.0 - requests==2.8.1 - six==1.17.0 - tomli==2.2.1 prefix: /opt/conda/envs/auth0-python
[ "auth0/v3/test/authentication/test_base.py::TestBase::test_post_error" ]
[]
[ "auth0/v3/test/authentication/test_base.py::TestBase::test_post" ]
[]
MIT License
1,274
[ "auth0/v3/authentication/base.py" ]
[ "auth0/v3/authentication/base.py" ]
zhmcclient__python-zhmcclient-286
077e1ada5272d57143f1d453568ac5dd9daa6a8c
2017-05-19 14:18:55
9f0ff2df0f65b934e2e75b1bfdf0635677416ac7
GitCop: There were the following issues with your Pull Request * Commit: a2e553b013c36998d69c086281ac2156d71481d3 * Your commit message body contains a line that is longer than 80 characters Guidelines are available at https://github.com/zhmcclient/python-zhmcclient/blob/master/CONTRIBUTING.rst --- This message was auto-generated by https://gitcop.com GitCop: There were the following issues with your Pull Request * Commit: 56a1eaed0dc89da51487a141e15dc7912f86a9af * Your commit message body contains a line that is longer than 80 characters Guidelines are available at https://github.com/zhmcclient/python-zhmcclient/blob/master/CONTRIBUTING.rst --- This message was auto-generated by https://gitcop.com
diff --git a/docs/changes.rst b/docs/changes.rst index f6dccff..51adb06 100755 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -27,6 +27,10 @@ Released: not yet **Incompatible changes:** +* Changed the return value of ``TimeStatsKeeper.snapshot()`` from a list of + key/value tuples to a dictionary. This is more flexible and reduces the + number of data structure conversions in different scenarios. See issue #269. + **Deprecations:** **Bug fixes:** diff --git a/zhmcclient/_timestats.py b/zhmcclient/_timestats.py index e0d9c3d..07dc648 100644 --- a/zhmcclient/_timestats.py +++ b/zhmcclient/_timestats.py @@ -280,13 +280,13 @@ class TimeStatsKeeper(object): Returns: - : A list of tuples (name, stats) with: + dict: A dictionary of the time statistics by operation, where: - - name (:term:`string`): Name of the operation - - stats (:class:`~zhmcclient.TimeStats`): Time statistics for the + - key (:term:`string`): Name of the operation + - value (:class:`~zhmcclient.TimeStats`): Time statistics for the operation """ - return copy.deepcopy(self._time_stats).items() + return copy.deepcopy(self._time_stats) def __str__(self): """ @@ -303,7 +303,8 @@ class TimeStatsKeeper(object): ret = "Time statistics (times in seconds):\n" if self.enabled: ret += "Count Average Minimum Maximum Operation name\n" - snapshot_by_avg = sorted(self.snapshot(), + stats_dict = self.snapshot() + snapshot_by_avg = sorted(stats_dict.items(), key=lambda item: item[1].avg_time, reverse=True) for name, stats in snapshot_by_avg:
TimeStatsKeeper.snapshot() result not very handy The `TimeStatsKeeper.snapshot()` method returns a list of tuples (op_name, TimeStats), which it produces by appliying the `items()` method on the internal dictionary. Most uses of the snapshot I have seen so far, transform that back into a dictionary by using `dict(snapshot)`. It would be more efficient and more convenient if snapshot() simply returned (a copy of) the dictionary directly. Note that this would be an incompatible change.
zhmcclient/python-zhmcclient
diff --git a/tests/unit/test_timestats.py b/tests/unit/test_timestats.py index 1155489..1733f6f 100755 --- a/tests/unit/test_timestats.py +++ b/tests/unit/test_timestats.py @@ -142,7 +142,9 @@ class TimeStatsTests(unittest.TestCase): stats = keeper.get_stats('foo') dur = measure(stats, duration) - for _, stats in keeper.snapshot(): + stats_dict = keeper.snapshot() + for op_name in stats_dict: + stats = stats_dict[op_name] self.assertEqual(stats.count, 1) self.assertLess(time_abs_delta(stats.avg_time, dur), delta, "avg time: actual: %f, expected: %f, delta: %f" % @@ -174,7 +176,9 @@ class TimeStatsTests(unittest.TestCase): time.sleep(duration) stats.end() - for _, stats in keeper.snapshot(): + stats_dict = keeper.snapshot() + for op_name in stats_dict: + stats = stats_dict[op_name] self.assertEqual(stats.count, 0) self.assertEqual(stats.avg_time, 0) self.assertEqual(stats.min_time, float('inf')) @@ -196,7 +200,7 @@ class TimeStatsTests(unittest.TestCase): stats.end() # take the snapshot - snapshot = keeper.snapshot() + snap_stats_dict = keeper.snapshot() # produce a second data item stats.begin() @@ -204,7 +208,8 @@ class TimeStatsTests(unittest.TestCase): stats.end() # verify that only the first data item is in the snapshot - for _, snap_stats in snapshot: + for op_name in snap_stats_dict: + snap_stats = snap_stats_dict[op_name] self.assertEqual(snap_stats.count, 1) # verify that both data items are in the original stats object @@ -230,7 +235,9 @@ class TimeStatsTests(unittest.TestCase): max_dur = max(m_durations) avg_dur = sum(m_durations) / float(count) - for _, stats in keeper.snapshot(): + stats_dict = keeper.snapshot() + for op_name in stats_dict: + stats = stats_dict[op_name] self.assertEqual(stats.count, 3) self.assertLess(time_abs_delta(stats.avg_time, avg_dur), delta, "avg time: actual: %f, expected: %f, delta: %f" %
{ "commit_name": "head_commit", "failed_lite_validators": [ "has_many_modified_files" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 0, "issue_text_score": 0, "test_score": 0 }, "num_modified_files": 2 }
0.13
{ "env_vars": null, "env_yml_path": null, "install": "pip install -e .[dev]", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest", "pytest-cov", "pytest-mock", "pytest-xdist" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.6", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
attrs==22.2.0 certifi==2021.5.30 charset-normalizer==2.0.12 click==8.0.4 click-repl==0.3.0 click-spinner==0.1.10 coverage==6.2 decorator==5.1.1 docopt==0.6.2 execnet==1.9.0 idna==3.10 importlib-metadata==4.8.3 iniconfig==1.1.1 packaging==21.3 pbr==6.1.1 pluggy==1.0.0 progressbar2==3.55.0 prompt-toolkit==3.0.36 py==1.11.0 pyparsing==3.1.4 pytest==7.0.1 pytest-cov==4.0.0 pytest-mock==3.6.1 pytest-xdist==3.0.2 python-utils==3.5.2 requests==2.27.1 six==1.17.0 stomp.py==8.1.0 tabulate==0.8.10 tomli==1.2.3 typing_extensions==4.1.1 urllib3==1.26.20 wcwidth==0.2.13 websocket-client==1.3.1 -e git+https://github.com/zhmcclient/python-zhmcclient.git@077e1ada5272d57143f1d453568ac5dd9daa6a8c#egg=zhmcclient zipp==3.6.0
name: python-zhmcclient channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - pip=21.2.2=py36h06a4308_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - setuptools=58.0.4=py36h06a4308_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - attrs==22.2.0 - charset-normalizer==2.0.12 - click==8.0.4 - click-repl==0.3.0 - click-spinner==0.1.10 - coverage==6.2 - decorator==5.1.1 - docopt==0.6.2 - execnet==1.9.0 - idna==3.10 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - packaging==21.3 - pbr==6.1.1 - pluggy==1.0.0 - progressbar2==3.55.0 - prompt-toolkit==3.0.36 - py==1.11.0 - pyparsing==3.1.4 - pytest==7.0.1 - pytest-cov==4.0.0 - pytest-mock==3.6.1 - pytest-xdist==3.0.2 - python-utils==3.5.2 - requests==2.27.1 - six==1.17.0 - stomp-py==8.1.0 - tabulate==0.8.10 - tomli==1.2.3 - typing-extensions==4.1.1 - urllib3==1.26.20 - wcwidth==0.2.13 - websocket-client==1.3.1 - zipp==3.6.0 prefix: /opt/conda/envs/python-zhmcclient
[ "tests/unit/test_timestats.py::TimeStatsTests::test_measure_avg_min_max", "tests/unit/test_timestats.py::TimeStatsTests::test_measure_enabled", "tests/unit/test_timestats.py::TimeStatsTests::test_snapshot" ]
[]
[ "tests/unit/test_timestats.py::TimeStatsTests::test_enabling", "tests/unit/test_timestats.py::TimeStatsTests::test_get", "tests/unit/test_timestats.py::TimeStatsTests::test_measure_disabled", "tests/unit/test_timestats.py::TimeStatsTests::test_str_disabled", "tests/unit/test_timestats.py::TimeStatsTests::test_str_empty" ]
[]
Apache License 2.0
1,275
[ "docs/changes.rst", "zhmcclient/_timestats.py" ]
[ "docs/changes.rst", "zhmcclient/_timestats.py" ]
Azure__azure-cli-3409
40c111b3daa79c4cc326f09d47e60be5826ecccc
2017-05-19 20:00:44
58aac4203905792244f4bb244910354fd44425d6
brendandburns: @tjprescott fixed (test fixed too) tjprescott: ``` /home/travis/build/Azure/azure-cli/src/command_modules/azure-cli-resource/tests/test_resource_validators.py:20:1: E302 expected 2 blank lines, found 1 2 E302 expected 2 blank lines, found 1 ``` Have I mentioned I hate PEP8? yugangw-msft: @brendandburns, please add a functional test, say a VCR scenario test, to verify simple "az lock create/read/delete" command work. brendandburns: VCR test added, please take another look... codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=h1) Report > Merging [#3409](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/7c10cae4442c3d64d5570fe4dcdf96c47dd1531a?src=pr&el=desc) will **increase** coverage by `0.18%`. > The diff coverage is `100%`. [![Impacted file tree graph](https://codecov.io/gh/Azure/azure-cli/pull/3409/graphs/tree.svg?width=650&src=pr&token=2pog0TKvF8&height=150)](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #3409 +/- ## ========================================== + Coverage 70.73% 70.92% +0.18% ========================================== Files 394 394 Lines 25534 25534 Branches 3889 3889 ========================================== + Hits 18062 18110 +48 + Misses 6337 6279 -58 - Partials 1135 1145 +10 ``` | [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [.../azure/cli/command\_modules/resource/\_validators.py](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9fdmFsaWRhdG9ycy5weQ==) | `69.56% <100%> (ø)` | :arrow_up: | | [...nent/azure/cli/command\_modules/component/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktY29tcG9uZW50L2F6dXJlL2NsaS9jb21tYW5kX21vZHVsZXMvY29tcG9uZW50L2N1c3RvbS5weQ==) | `16.23% <0%> (ø)` | :arrow_up: | | [...dback/azure/cli/command\_modules/feedback/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktZmVlZGJhY2svYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9mZWVkYmFjay9jdXN0b20ucHk=) | `34.69% <0%> (ø)` | :arrow_up: | | [src/azure-cli-core/azure/cli/core/util.py](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL3V0aWwucHk=) | `68.61% <0%> (ø)` | :arrow_up: | | [...re/cli/command\_modules/resource/\_client\_factory.py](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9fY2xpZW50X2ZhY3RvcnkucHk=) | `88.46% <0%> (+5.76%)` | :arrow_up: | | [...ource/azure/cli/command\_modules/resource/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9jdXN0b20ucHk=) | `61.64% <0%> (+7.53%)` | :arrow_up: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=footer). Last update [7c10cae...abc205c](https://codecov.io/gh/Azure/azure-cli/pull/3409?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). brendandburns: Comments (mostly) addressed, please take another look.
diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 331db8c41..6a59bb8be 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -54,11 +54,13 @@ DEPENDENCIES = [ 'azure-cli-acs', 'azure-cli-appservice', 'azure-cli-batch', + 'azure-cli-billing', 'azure-cli-cdn', 'azure-cli-cloud', 'azure-cli-cognitiveservices', 'azure-cli-component', 'azure-cli-configure', + 'azure-cli-consumption', 'azure-cli-core', 'azure-cli-dla', 'azure-cli-dls', diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py index f2436813e..4348e2b7b 100644 --- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py +++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py @@ -64,8 +64,8 @@ def internal_validate_lock_parameters(resource_group_name, resource_provider_nam def validate_lock_parameters(namespace): - internal_validate_lock_parameters(namespace.get('resource_group_name', None), - namespace.get('resource_provider_namespace', None), - namespace.get('parent_resource_path', None), - namespace.get('resource_type', None), - namespace.get('resource_name', None)) + internal_validate_lock_parameters(getattr(namespace, 'resource_group_name', None), + getattr(namespace, 'resource_provider_namespace', None), + getattr(namespace, 'parent_resource_path', None), + getattr(namespace, 'resource_type', None), + getattr(namespace, 'resource_name', None)) diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py index f92f94630..39896c05e 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py @@ -292,7 +292,9 @@ def create_managed_disk(resource_group_name, disk_name, location=None, # below are generated internally from 'source' source_blob_uri=None, source_disk=None, source_snapshot=None, source_storage_account_id=None, no_wait=False, tags=None): - from azure.mgmt.compute.models import Disk, CreationData, DiskCreateOption + Disk, CreationData, DiskCreateOption = get_sdk(ResourceType.MGMT_COMPUTE, 'Disk', 'CreationData', + 'DiskCreateOption', mod='models') + location = location or get_resource_group_location(resource_group_name) if source_blob_uri: option = DiskCreateOption.import_enum @@ -402,7 +404,8 @@ def create_snapshot(resource_group_name, snapshot_name, location=None, size_gb=N # below are generated internally from 'source' source_blob_uri=None, source_disk=None, source_snapshot=None, source_storage_account_id=None, tags=None): - from azure.mgmt.compute.models import Snapshot, CreationData, DiskCreateOption + Snapshot, CreationData, DiskCreateOption = get_sdk(ResourceType.MGMT_COMPUTE, 'Snapshot', 'CreationData', + 'DiskCreateOption', mod='models') location = location or get_resource_group_location(resource_group_name) if source_blob_uri: @@ -474,8 +477,10 @@ def create_image(resource_group_name, name, os_type=None, location=None, # pyli os_blob_uri=None, data_blob_uris=None, os_snapshot=None, data_snapshots=None, os_disk=None, data_disks=None, tags=None): - from azure.mgmt.compute.models import (ImageOSDisk, ImageDataDisk, ImageStorageProfile, Image, SubResource, - OperatingSystemStateTypes) + ImageOSDisk, ImageDataDisk, ImageStorageProfile, Image, SubResource, OperatingSystemStateTypes = get_sdk( + ResourceType.MGMT_COMPUTE, 'ImageOSDisk', 'ImageDataDisk', 'ImageStorageProfile', 'Image', 'SubResource', + 'OperatingSystemStateTypes', mod='models') + # pylint: disable=line-too-long if source_virtual_machine: location = location or get_resource_group_location(resource_group_name)
[Lock] az create lock Fails ### Description Creating locks fails with: ``` az lock create: error: 'Namespace' object has no attribute 'get' ``` --- ### Environment summary **Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly) Answer here: `pip3` **CLI Version:** What version of the CLI and modules are installed? (Use `az --version`) Answer here: ``` azure-cli (2.0.6) acr (2.0.4) acs (2.0.6) appservice (0.1.6) batch (2.0.4) cdn (0.0.2) cloud (2.0.2) cognitiveservices (0.1.2) command-modules-nspkg (2.0.0) component (2.0.4) configure (2.0.6) core (2.0.6) cosmosdb (0.1.6) dla (0.0.6) dls (0.0.6) feedback (2.0.2) find (0.2.2) interactive (0.3.1) iot (0.1.5) keyvault (2.0.4) lab (0.0.4) monitor (0.0.4) network (2.0.6) nspkg (3.0.0) profile (2.0.4) rdbms (0.0.1) redis (0.2.3) resource (2.0.6) role (2.0.4) sf (1.0.1) sql (2.0.3) storage (2.0.6) vm (2.0.6) Python (Linux) 3.6.1 (default, Mar 27 2017, 00:27:06) [GCC 6.3.1 20170306] ``` **OS Version:** What OS and version are you using? Answer here: Arch Linux, kernel 4.10.8. But was tested in Ubuntu 17.04 container and it also fails. **Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows) Answer here: `bash` and `nash`. Both fails.
Azure/azure-cli
diff --git a/src/command_modules/azure-cli-resource/tests/recordings/test_list_locks.yaml b/src/command_modules/azure-cli-resource/tests/recordings/test_list_locks.yaml new file mode 100644 index 000000000..b43592289 --- /dev/null +++ b/src/command_modules/azure-cli-resource/tests/recordings/test_list_locks.yaml @@ -0,0 +1,28 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[]}'} + headers: + cache-control: [no-cache] + content-length: ['12'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:27:30 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/command_modules/azure-cli-resource/tests/recordings/test_lock_create_list_delete.yaml b/src/command_modules/azure-cli-resource/tests/recordings/test_lock_create_list_delete.yaml new file mode 100644 index 000000000..60cb34dd2 --- /dev/null +++ b/src/command_modules/azure-cli-resource/tests/recordings/test_lock_create_list_delete.yaml @@ -0,0 +1,260 @@ +interactions: +- request: + body: '{"name": "foo", "properties": {"level": "ReadOnly"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock create] + Connection: [keep-alive] + Content-Length: ['52'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['190'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:22 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['202'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:23 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['190'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:23 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['202'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:24 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 19 May 2017 23:38:25 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: '{"name": "foo", "properties": {"level": "CanNotDelete"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock create] + Connection: [keep-alive] + Content-Length: ['56'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['194'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:26 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['206'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:27 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['194'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:28 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['206'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:38:30 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 19 May 2017 23:38:30 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/command_modules/azure-cli-resource/tests/recordings/test_lock_create_list_delete_resource_group.yaml b/src/command_modules/azure-cli-resource/tests/recordings/test_lock_create_list_delete_resource_group.yaml new file mode 100644 index 000000000..d3cd445b4 --- /dev/null +++ b/src/command_modules/azure-cli-resource/tests/recordings/test_lock_create_list_delete_resource_group.yaml @@ -0,0 +1,315 @@ +interactions: +- request: + body: '{"tags": {"use": "az-test"}, "location": "westus"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:42:41 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1187'] + status: {code: 201, message: Created} +- request: + body: '{"properties": {"level": "ReadOnly"}, "name": "foo"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock create] + Connection: [keep-alive] + Content-Length: ['52'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['281'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:42:43 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1189'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg6hms5bk4lei5ddclway74mxxuyl46kfsfuygwco5al3eh7ousyhogw676rbllwli3/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"},{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['575'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:42:46 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['281'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:42:53 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg6hms5bk4lei5ddclway74mxxuyl46kfsfuygwco5al3eh7ousyhogw676rbllwli3/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"},{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['575'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:43:05 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 19 May 2017 23:43:07 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"level": "CanNotDelete"}, "name": "foo"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock create] + Connection: [keep-alive] + Content-Length: ['56'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['285'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:43:08 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg6hms5bk4lei5ddclway74mxxuyl46kfsfuygwco5al3eh7ousyhogw676rbllwli3/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"},{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['579'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:43:09 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: '{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}'} + headers: + cache-control: [no-cache] + content-length: ['285'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:43:11 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/locks?api-version=2016-09-01 + response: + body: {string: '{"value":[{"properties":{"level":"ReadOnly"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg6hms5bk4lei5ddclway74mxxuyl46kfsfuygwco5al3eh7ousyhogw676rbllwli3/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"},{"properties":{"level":"CanNotDelete"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo","type":"Microsoft.Authorization/locks","name":"foo"}]}'} + headers: + cache-control: [no-cache] + content-length: ['579'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 19 May 2017 23:43:12 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [lock delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 managementlockclient/1.1.0rc1 Azure-SDK-For-Python AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Authorization/locks/foo?api-version=2016-09-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 19 May 2017 23:43:13 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1188'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7 + msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python + AZURECLI/2.0.6+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2017-05-10 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 19 May 2017 23:43:15 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdORlVXV05FUE4zVlQzRkJDSlc1UUwzQUVMTFE3Mk1TQ1JXQnwxMEFGMEY1QzVBMjE5M0FCLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + retry-after: ['15'] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/command_modules/azure-cli-resource/tests/test_locks.py b/src/command_modules/azure-cli-resource/tests/test_locks.py new file mode 100644 index 000000000..fdee87239 --- /dev/null +++ b/src/command_modules/azure-cli-resource/tests/test_locks.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import unittest + +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer + + +class ResourceLockTests(ScenarioTest): + def test_list_locks(self): + # just make sure this doesn't throw + self.cmd('az lock list').get_output_in_json() + + # Test for subscription level locks + def test_lock_create_list_delete(self): + for lock_type in ['ReadOnly', 'CanNotDelete']: + self.cmd('az lock create -n foo --lock-type {}'.format(lock_type)) + locks_list = self.cmd('az lock list').get_output_in_json() + assert len(locks_list) > 0 + assert 'foo' in [l['name'] for l in locks_list] + lock = self.cmd('az lock show -n foo').get_output_in_json() + self.assertEqual(lock.get('name', None), 'foo') + self.assertEqual(lock.get('level', None), lock_type) + self.cmd('az lock delete -n foo') + + # Test for resource group level locks + @ResourceGroupPreparer() + def test_lock_create_list_delete_resource_group(self, resource_group): + for lock_type in ['ReadOnly', 'CanNotDelete']: + self.cmd('az lock create -n foo -g {} --lock-type {}'.format(resource_group, lock_type)) + locks_list = self.cmd('az lock list').get_output_in_json() + assert 'foo' in [l['name'] for l in locks_list] + assert len(locks_list) > 0 + lock = self.cmd('az lock show -g {} -n foo'.format(resource_group)).get_output_in_json() + self.assertEqual(lock.get('name', None), 'foo') + self.assertEqual(lock.get('level', None), lock_type) + self.cmd('az lock delete -g {} -n foo'.format(resource_group)) + + # TODO: test for resource group level locks + + +if __name__ == '__main__': + unittest.main() diff --git a/src/command_modules/azure-cli-resource/tests/test_resource_validators.py b/src/command_modules/azure-cli-resource/tests/test_resource_validators.py index ca533fd35..eea7b941b 100644 --- a/src/command_modules/azure-cli-resource/tests/test_resource_validators.py +++ b/src/command_modules/azure-cli-resource/tests/test_resource_validators.py @@ -4,8 +4,8 @@ # -------------------------------------------------------------------------------------------- import unittest -import mock import os.path +import mock from six import StringIO from azure.cli.core.util import CLIError @@ -15,6 +15,10 @@ from azure.cli.command_modules.resource._validators import ( ) +class NamespaceObject: + pass + + class Test_resource_validators(unittest.TestCase): def setUp(self): self.io = StringIO() @@ -59,9 +63,12 @@ class Test_resource_validators(unittest.TestCase): } ] for valid_namespace in valid: + namespace_obj = NamespaceObject() + for key in valid_namespace: + setattr(namespace_obj, key, valid_namespace[key]) try: # If unexpected invalid, this throws, so no need for asserts - validate_lock_parameters(valid_namespace) + validate_lock_parameters(namespace_obj) except CLIError as ex: self.fail('Test {} failed. {}'.format(valid_namespace['test'], ex)) @@ -102,7 +109,10 @@ class Test_resource_validators(unittest.TestCase): ] for invalid_namespace in invalid: with self.assertRaises(CLIError): - validate_lock_parameters(invalid_namespace) + namespace_obj = NamespaceObject() + for key in invalid_namespace: + setattr(namespace_obj, key, invalid_namespace[key]) + validate_lock_parameters(namespace_obj) def test_generate_deployment_name_from_file(self): # verify auto-gen from uri
{ "commit_name": "merge_commit", "failed_lite_validators": [ "has_many_modified_files", "has_many_hunks", "has_pytest_match_arg" ], "has_test_patch": true, "is_lite": false, "llm_score": { "difficulty_score": 1, "issue_text_score": 1, "test_score": 3 }, "num_modified_files": 3 }
0.3
{ "env_vars": null, "env_yml_path": null, "install": "python scripts/dev_setup.py", "log_parser": "parse_log_pytest", "no_use_env": null, "packages": "requirements.txt", "pip_packages": [ "pytest" ], "pre_install": [ "apt-get update", "apt-get install -y gcc" ], "python": "3.5", "reqs_path": [ "requirements.txt" ], "test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning" }
adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.8.0 astroid==2.11.7 attrs==22.2.0 autopep8==1.2.4 azure-batch==3.0.0 -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli&subdirectory=src/azure-cli -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_billing&subdirectory=src/command_modules/azure-cli-billing -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_cdn&subdirectory=src/command_modules/azure-cli-cdn -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_consumption&subdirectory=src/command_modules/azure-cli-consumption -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_core&subdirectory=src/azure-cli-core -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_cosmosdb&subdirectory=src/command_modules/azure-cli-cosmosdb -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_interactive&subdirectory=src/command_modules/azure-cli-interactive -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_rdbms&subdirectory=src/command_modules/azure-cli-rdbms -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_sf&subdirectory=src/command_modules/azure-cli-sf -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_utility_automation&subdirectory=scripts -e git+https://github.com/Azure/azure-cli.git@40c111b3daa79c4cc326f09d47e60be5826ecccc#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm azure-common==1.1.28 azure-core==1.24.2 azure-datalake-store==0.0.9 azure-graphrbac==0.30.0rc6 azure-keyvault==0.3.0 azure-mgmt-authorization==0.30.0rc6 azure-mgmt-batch==4.0.0 azure-mgmt-billing==0.1.0 azure-mgmt-cdn==0.30.2 azure-mgmt-cognitiveservices==1.0.0 azure-mgmt-compute==1.0.0rc1 azure-mgmt-consumption==0.1.0 azure-mgmt-containerregistry==0.2.1 azure-mgmt-datalake-analytics==0.1.4 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.1.4 azure-mgmt-devtestlabs==2.0.0 azure-mgmt-dns==1.0.1 azure-mgmt-documentdb==0.1.3 azure-mgmt-iothub==0.2.2 azure-mgmt-keyvault==0.31.0 azure-mgmt-monitor==0.2.1 azure-mgmt-network==1.0.0rc3 azure-mgmt-nspkg==1.0.0 azure-mgmt-rdbms==0.1.0 azure-mgmt-redis==1.0.0 azure-mgmt-resource==1.1.0rc1 azure-mgmt-sql==0.4.0 azure-mgmt-storage==1.0.0rc1 azure-mgmt-trafficmanager==0.30.0 azure-mgmt-web==0.32.0 azure-monitor==0.3.0 azure-multiapi-storage==0.1.0 azure-nspkg==1.0.0 azure-servicefabric==5.6.130 certifi==2021.5.30 cffi==1.15.1 colorama==0.3.7 coverage==4.2 cryptography==40.0.2 flake8==3.2.1 futures==3.1.1 humanfriendly==2.4 importlib-metadata==4.8.3 iniconfig==1.1.1 isodate==0.7.0 isort==5.10.1 jeepney==0.7.1 jmespath==0.10.0 keyring==23.4.1 lazy-object-proxy==1.7.1 mccabe==0.5.3 mock==1.3.0 msrest==0.4.29 msrestazure==0.4.34 nose==1.3.7 oauthlib==3.2.2 packaging==21.3 paramiko==2.0.2 pbr==6.1.1 pep8==1.7.1 pluggy==1.0.0 prompt-toolkit==3.0.36 py==1.11.0 pyasn1==0.5.1 pycodestyle==2.2.0 pycparser==2.21 pydocumentdb==2.3.5 pyflakes==1.3.0 Pygments==2.1.3 PyJWT==2.4.0 pylint==1.7.1 pyOpenSSL==16.2.0 pyparsing==3.1.4 pytest==7.0.1 python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==3.11 requests==2.9.1 requests-oauthlib==2.0.0 scp==0.15.0 SecretStorage==3.3.3 six==1.10.0 sshtunnel==0.4.0 tabulate==0.7.7 tomli==1.2.3 typed-ast==1.5.5 typing-extensions==4.1.1 urllib3==1.16 vcrpy==1.10.3 vsts-cd-manager==1.0.2 wcwidth==0.2.13 Whoosh==2.7.4 wrapt==1.16.0 xmltodict==0.14.2 zipp==3.6.0
name: azure-cli channels: - defaults - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/r - conda-forge dependencies: - _libgcc_mutex=0.1=main - _openmp_mutex=5.1=1_gnu - ca-certificates=2025.2.25=h06a4308_0 - certifi=2021.5.30=py36h06a4308_0 - ld_impl_linux-64=2.40=h12ee557_0 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1234567_1 - libgomp=11.2.0=h1234567_1 - libstdcxx-ng=11.2.0=h1234567_1 - ncurses=6.4=h6a678d5_0 - openssl=1.1.1w=h7f8727e_0 - python=3.6.13=h12debd9_1 - readline=8.2=h5eee18b_0 - sqlite=3.45.3=h5eee18b_0 - tk=8.6.14=h39e8969_0 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.6.4=h5eee18b_1 - zlib=1.2.13=h5eee18b_1 - pip: - adal==0.4.3 - applicationinsights==0.10.0 - argcomplete==1.8.0 - astroid==2.11.7 - attrs==22.2.0 - autopep8==1.2.4 - azure-batch==3.0.0 - azure-common==1.1.28 - azure-core==1.24.2 - azure-datalake-store==0.0.9 - azure-graphrbac==0.30.0rc6 - azure-keyvault==0.3.0 - azure-mgmt-authorization==0.30.0rc6 - azure-mgmt-batch==4.0.0 - azure-mgmt-billing==0.1.0 - azure-mgmt-cdn==0.30.2 - azure-mgmt-cognitiveservices==1.0.0 - azure-mgmt-compute==1.0.0rc1 - azure-mgmt-consumption==0.1.0 - azure-mgmt-containerregistry==0.2.1 - azure-mgmt-datalake-analytics==0.1.4 - azure-mgmt-datalake-nspkg==3.0.1 - azure-mgmt-datalake-store==0.1.4 - azure-mgmt-devtestlabs==2.0.0 - azure-mgmt-dns==1.0.1 - azure-mgmt-documentdb==0.1.3 - azure-mgmt-iothub==0.2.2 - azure-mgmt-keyvault==0.31.0 - azure-mgmt-monitor==0.2.1 - azure-mgmt-network==1.0.0rc3 - azure-mgmt-nspkg==1.0.0 - azure-mgmt-rdbms==0.1.0 - azure-mgmt-redis==1.0.0 - azure-mgmt-resource==1.1.0rc1 - azure-mgmt-sql==0.4.0 - azure-mgmt-storage==1.0.0rc1 - azure-mgmt-trafficmanager==0.30.0 - azure-mgmt-web==0.32.0 - azure-monitor==0.3.0 - azure-multiapi-storage==0.1.0 - azure-nspkg==1.0.0 - azure-servicefabric==5.6.130 - cffi==1.15.1 - colorama==0.3.7 - coverage==4.2 - cryptography==40.0.2 - flake8==3.2.1 - futures==3.1.1 - humanfriendly==2.4 - importlib-metadata==4.8.3 - iniconfig==1.1.1 - isodate==0.7.0 - isort==5.10.1 - jeepney==0.7.1 - jmespath==0.10.0 - keyring==23.4.1 - lazy-object-proxy==1.7.1 - mccabe==0.5.3 - mock==1.3.0 - msrest==0.4.29 - msrestazure==0.4.34 - nose==1.3.7 - oauthlib==3.2.2 - packaging==21.3 - paramiko==2.0.2 - pbr==6.1.1 - pep8==1.7.1 - pip==9.0.1 - pluggy==1.0.0 - prompt-toolkit==3.0.36 - py==1.11.0 - pyasn1==0.5.1 - pycodestyle==2.2.0 - pycparser==2.21 - pydocumentdb==2.3.5 - pyflakes==1.3.0 - pygments==2.1.3 - pyjwt==2.4.0 - pylint==1.7.1 - pyopenssl==16.2.0 - pyparsing==3.1.4 - pytest==7.0.1 - python-dateutil==2.9.0.post0 - pytz==2025.2 - pyyaml==3.11 - requests==2.9.1 - requests-oauthlib==2.0.0 - scp==0.15.0 - secretstorage==3.3.3 - setuptools==30.4.0 - six==1.10.0 - sshtunnel==0.4.0 - tabulate==0.7.7 - tomli==1.2.3 - typed-ast==1.5.5 - typing-extensions==4.1.1 - urllib3==1.16 - vcrpy==1.10.3 - vsts-cd-manager==1.0.2 - wcwidth==0.2.13 - whoosh==2.7.4 - wrapt==1.16.0 - xmltodict==0.14.2 - zipp==3.6.0 prefix: /opt/conda/envs/azure-cli
[ "src/command_modules/azure-cli-resource/tests/test_locks.py::ResourceLockTests::test_lock_create_list_delete", "src/command_modules/azure-cli-resource/tests/test_locks.py::ResourceLockTests::test_lock_create_list_delete_resource_group", "src/command_modules/azure-cli-resource/tests/test_resource_validators.py::Test_resource_validators::test_validate_lock_params", "src/command_modules/azure-cli-resource/tests/test_resource_validators.py::Test_resource_validators::test_validate_lock_params_invalid" ]
[]
[ "src/command_modules/azure-cli-resource/tests/test_locks.py::ResourceLockTests::test_list_locks", "src/command_modules/azure-cli-resource/tests/test_resource_validators.py::Test_resource_validators::test_generate_deployment_name_from_file" ]
[]
MIT License
1,276
[ "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py", "src/azure-cli/setup.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py" ]
[ "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py", "src/azure-cli/setup.py", "src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py" ]