custom user-agent header
This commit is contained in:
parent
ab47f575dd
commit
ea8147802a
4 changed files with 22 additions and 0 deletions
|
@ -150,6 +150,9 @@ EXAMPLES = '''
|
|||
|
||||
import sys
|
||||
|
||||
USER_AGENT_PRODUCT="Ansible-gce"
|
||||
USER_AGENT_VERSION="v1beta15"
|
||||
|
||||
try:
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.compute.providers import get_driver
|
||||
|
@ -367,6 +370,8 @@ def main():
|
|||
|
||||
try:
|
||||
gce = get_driver(Provider.GCE)(*ARGS, datacenter=zone, **KWARGS)
|
||||
gce.connection.user_agent_append("%s/%s" % (
|
||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||
except Exception as e:
|
||||
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
||||
|
||||
|
|
|
@ -128,6 +128,9 @@ EXAMPLES = '''
|
|||
|
||||
import sys
|
||||
|
||||
USER_AGENT_PRODUCT="Ansible-gce_lb"
|
||||
USER_AGENT_VERSION="v1beta15"
|
||||
|
||||
try:
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.compute.providers import get_driver
|
||||
|
@ -202,7 +205,11 @@ def main():
|
|||
|
||||
try:
|
||||
gce = get_driver(Provider.GCE)(*ARGS, **KWARGS)
|
||||
gce.connection.user_agent_append("%s/%s" % (
|
||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||
gcelb = get_driver_lb(Provider_lb.GCE)(gce_driver=gce)
|
||||
gcelb.connection.user_agent_append("%s/%s" % (
|
||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||
except Exception as e:
|
||||
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
||||
|
||||
|
|
|
@ -95,6 +95,9 @@ EXAMPLES = '''
|
|||
|
||||
import sys
|
||||
|
||||
USER_AGENT_PRODUCT="Ansible-gce_net"
|
||||
USER_AGENT_VERSION="v1beta15"
|
||||
|
||||
try:
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.compute.providers import get_driver
|
||||
|
@ -168,6 +171,8 @@ def main():
|
|||
|
||||
try:
|
||||
gce = get_driver(Provider.GCE)(*ARGS, **KWARGS)
|
||||
gce.connection.user_agent_append("%s/%s" % (
|
||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||
except Exception as e:
|
||||
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
||||
|
||||
|
|
|
@ -90,6 +90,9 @@ EXAMPLES = '''
|
|||
|
||||
import sys
|
||||
|
||||
USER_AGENT_PRODUCT="Ansible-gce_pd"
|
||||
USER_AGENT_VERSION="v1beta15"
|
||||
|
||||
try:
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.compute.providers import get_driver
|
||||
|
@ -149,6 +152,8 @@ def main():
|
|||
|
||||
try:
|
||||
gce = get_driver(Provider.GCE)(*ARGS, datacenter=zone, **KWARGS)
|
||||
gce.connection.user_agent_append("%s/%s" % (
|
||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||
except Exception as e:
|
||||
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
||||
|
||||
|
|
Loading…
Reference in a new issue