Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
cfc24993
Commit
cfc24993
authored
Oct 08, 2013
by
Eric Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom user-agent header
parent
9ca824c1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
1 deletions
+29
-1
library/cloud/gce
+5
-0
library/cloud/gce_lb
+7
-0
library/cloud/gce_net
+5
-0
library/cloud/gce_pd
+5
-0
plugins/inventory/gce.py
+7
-1
No files found.
library/cloud/gce
View file @
cfc24993
...
...
@@ -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
)
...
...
library/cloud/gce_lb
View file @
cfc24993
...
...
@@ -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
)
...
...
library/cloud/gce_net
View file @
cfc24993
...
...
@@ -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
)
...
...
library/cloud/gce_pd
View file @
cfc24993
...
...
@@ -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
)
...
...
plugins/inventory/gce.py
View file @
cfc24993
...
...
@@ -72,6 +72,9 @@ Author: Eric Johnson <erjohnso@google.com>
Version: 0.0.1
'''
USER_AGENT_PRODUCT
=
"Ansible-gce_inventory_plugin"
USER_AGENT_VERSION
=
"v1beta15"
import
sys
import
os
import
argparse
...
...
@@ -147,7 +150,10 @@ class GceInventory(object):
)
kwargs
=
{
'project'
:
config
.
get
(
'gce'
,
'gce_project_id'
)}
return
get_driver
(
Provider
.
GCE
)(
*
args
,
**
kwargs
)
gce
=
get_driver
(
Provider
.
GCE
)(
*
args
,
**
kwargs
)
gce
.
connection
.
user_agent_append
(
"
%
s/
%
s"
%
(
USER_AGENT_PRODUCT
,
USER_AGENT_VERSION
))
return
gce
def
parse_cli_args
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment