1# -*- coding: utf-8 -*- 2# This code is part of Ansible, but is an independent component. 3# This particular file snippet, and this file snippet only, is BSD licensed. 4# Modules you write using this snippet, which is embedded dynamically by Ansible 5# still belong to the author of the module, and may assign their own license 6# to the complete work. 7# 8# Copyright (c), Luke Murphy @decentral1se 9# 10# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) 11 12from __future__ import (absolute_import, division, print_function) 13__metaclass__ = type 14 15 16def get_user_agent(module): 17 """Retrieve a user-agent to send with LinodeClient requests.""" 18 try: 19 from ansible.module_utils.ansible_release import __version__ as ansible_version 20 except ImportError: 21 ansible_version = 'unknown' 22 return 'Ansible-%s/%s' % (module, ansible_version) 23