Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

azure_rm_autoscale #120

Closed
nergalex opened this issue May 16, 2020 · 4 comments · Fixed by #212
Closed

azure_rm_autoscale #120

nergalex opened this issue May 16, 2020 · 4 comments · Fixed by #212

Comments

@nergalex
Copy link

SUMMARY

azure_rm_autoscale module generates a warning "[WARNING]: Azure API profile latest does not define an entry for MonitorManagementClient" and nothing is done

note also to replace "service_url" by "service_uri". Generated error: AttributeError: 'WebhookNotification' object has no attribute 'service_url'

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_autoscale

ANSIBLE VERSION
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
# /var/lib/awx/venv/cloudbuilder/bin/pip freeze | grep azure-mgmt-monitor
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
azure-mgmt-monitor==0.5.2
CONFIGURATION
(none)
OS / ENVIRONMENT

I use Ansible Tower
CentOS Linux release 7.6.1810 (Core)

STEPS TO REPRODUCE

Example shared in azure_rm_autoscale module

- name: CREATE autoscale policy
  delegate_to: localhost
  azure_rm_autoscale:
    resource_group: "rg-{{ extra_platform_name }}"
    name: "autoscale-{{ extra_vmss_name }}"
    target: "{{ output_vmss_info.vmss.0.id }}"
    enabled: true
    profiles:
    - count: '1'
      recurrence_days:
      - Monday
      name: Auto created scale condition
      recurrence_timezone: China Standard Time
      recurrence_mins:
      - '0'
      min_count: '1'
      max_count: '1'
      recurrence_frequency: Week
      recurrence_hours:
      - '18'
EXPECTED RESULTS

Create an autoscaling policy

ACTUAL RESULTS
Using module file /etc/ansible/roles/azure.azure_preview_modules/library/azure_rm_autoscale.py
<localhost> PUT /var/lib/awx/.ansible/tmp/ansible-local-306hC2f/tmpED2XRZ TO /var/lib/awx/.ansible/tmp/ansible-tmp-1589588855.16-207568799216910/AnsiballZ_azure_rm_autoscale.py
<localhost> EXEC /bin/sh -c 'chmod u+x /var/lib/awx/.ansible/tmp/ansible-tmp-1589588855.16-207568799216910/ /var/lib/awx/.ansible/tmp/ansible-tmp-1589588855.16-207568799216910/AnsiballZ_azure_rm_autoscale.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /var/lib/awx/.ansible/tmp/ansible-tmp-1589588855.16-207568799216910/AnsiballZ_azure_rm_autoscale.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /var/lib/awx/.ansible/tmp/ansible-tmp-1589588855.16-207568799216910/ > /dev/null 2>&1 && sleep 0'
[WARNING]: Azure API profile latest does not define an entry for
MonitorManagementClient

{
    "target": "/subscriptions/XXX/resourceGroups/rg-XXX/providers/Microsoft.Compute/virtualMachineScaleSets/nginxapigw",
    "tags": {},
    "changed": false,
    "enabled": true,
    "profiles": [
        {
            "count": "1",
            "recurrence_days": [
                "Monday"
            ],
            "name": "Auto created scale condition",
            "recurrence_timezone": "China Standard Time",
            "recurrence_mins": [
                "0"
            ],
            "min_count": "1",
            "max_count": "1",
            "recurrence_frequency": "Week",
            "recurrence_hours": [
                "18"
            ]
        }
    ],
    "name": "autoscale-nginxapigw",
    "location": "eastus2",
    "warnings": [
        "Azure API profile latest does not define an entry for MonitorManagementClient"
    ],
    "invocation": {
        "module_args": {
            "profile": null,
            "resource_group": "rg-XXX",
            "tags": null,
            "ad_user": null,
            "notifications": null,
            "state": "present",
            "client_id": null,
            "api_profile": "latest",
            "adfs_authority_url": null,
            "password": null,
            "tenant": null,
            "target": "/subscriptions/YYY/resourceGroups/rg-XXX/providers/Microsoft.Compute/virtualMachineScaleSets/nginxapigw",
            "name": "autoscale-nginxapigw",
            "append_tags": true,
            "cloud_environment": "AzureCloud",
            "cert_validation_mode": null,
            "profiles": [
                {
                    "count": "1",
                    "fixed_date_start": null,
                    "recurrence_days": [
                        "Monday"
                    ],
                    "name": "Auto created scale condition",
                    "rules": null,
                    "recurrence_timezone": "China Standard Time",
                    "fixed_date_timezone": null,
                    "min_count": "1",
                    "recurrence_mins": [
                        "0"
                    ],
                    "max_count": "1",
                    "recurrence_frequency": "Week",
                    "recurrence_hours": [
                        "18"
                    ],
                    "fixed_date_end": null
                }
            ],
            "secret": null,
            "location": null,
            "auth_source": null,
            "subscription_id": null,
            "enabled": true
        }
    },
    "_ansible_delegated_vars": {
        "ansible_host": "localhost"
    },
    "id": "/subscriptions/YYY/resourceGroups/rg-XXX/providers/microsoft.insights/autoscalesettings/autoscale-nginxapigw",
    "notifications": [],
    "_ansible_no_log": false
}
@nergalex
Copy link
Author

Sorry it's OK, the object is well created.

Please just replace "service_url" by "service_uri". Generated error: AttributeError: 'WebhookNotification' object has no attribute 'service_url'

@haiyuazhang
Copy link
Contributor

so is it close this issue? @nergalex

@nergalex
Copy link
Author

nergalex commented May 22, 2020

No error is still there: line 446 webhooks=[to_native(w.service_url) for w in notification.webhooks or []])

replace service_url with service_uri

@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 3, 2020

fixed by #212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants