{"action":"created","comment":{"url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/comments/29562689","id":29562689,"diff_hunk":"@@ -0,0 +1,735 @@\n+#!/usr/bin/python\n+# -*- coding: utf-8 -*-\n+\n+# (c) 2015, Chris Long <alcamie@gmail.com>\n+#\n+# This file is a module for Ansible that interacts with Network Manager\n+#\n+# Ansible is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+#\n+# Ansible is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Ansible.    If not, see <http://www.gnu.org/licenses/>.\n+\n+\n+DOCUMENTATION='''\n+---\n+module: nmcli\n+author: Chris Long\n+version_added: \"0.1\"\n+short_description: Manage Networking\n+requirements: [ conadd, condel, conmod, conup, condown, constatus, conshow ]\n+description:\n+    - Manage the network devices. Create, modify, and manage, ethernet, teams, bonds, vlans etc.\n+options:\n+    name:\n+        required: true\n+        version_added: \"0.1\"\n+        required: False\n+        choices: [ add, modify, show, up, down ]\n+        description:\n+            - Set to 'add' if you want to add a connection.\n+            - Set to 'modify' if you want to modify a connection. Modify one or more properties in the connection profile.\n+            - Set to 'delete' if you want to delete a connection. Delete a configured connection. The connection to be deleted is identified by its name 'cfname'.\n+            - Set to 'show' if you want to show a connection. Will show all devices unless 'cfname' is set.\n+            - Set to 'up' if you want to bring a connection up. Requires 'cfname' to be set.\n+            - Set to 'down' if you want to bring a connection down. Requires 'cfname' to be set.\n+    cname:\n+        required: false\n+        version_added: \"0.1\"\n+        description:\n+            - Where CNAME will be the name used to call the connection. when not provided a default name is generated: <type>[-<ifname>][-<num>]\n+    autoconnect:\n+        required: false\n+        version_added: \"0.1\"\n+        default: yes\n+        choices: [ yes, no ]\n+        description:\n+            - Whether the connection profile can be automatically activated ( default: yes)\n+    ifname:\n+        required: false\n+        version_added: \"0.1\"\n+        description:\n+            - Where INAME will be the what we call the interface name. Required with 'up', 'down' modifiers.\n+            - interface to bind the connection to. The connection will only be applicable to this interface name.\n+            - A special value of \"*\" can be used for interface-independent connections.\n+            - The ifname argument is mandatory for all connection types except bond, team, bridge and vlan.\n+    type:\n+        required: false\n+        version_added: \"0.1\"\n+        choices: [ ethernet, team, team-slave, bond, bond-slave, bridge, vlan ]\n+        description:\n+            - This is the type of device or network connection that you wish to create.\n+    bondmode:\n+        required: false\n+        version_added: \"0.1\"\n+        choices: [ \"balance-rr\", \"active-backup\", \"balance-xor\", \"broadcast\", \"802.3ad\", \"balance-tlb\", \"balance-alb\" ]\n+        default: \"balance-rr\"\n+        description:\n+            - This is the type of device or network connection that you wish to create.\n+    master:\n+        required: false\n+        version_added: \"0.1\"\n+        description:\n+            - master <master (ifname, or connection UUID or cname) of bridge, team, bond master connection profile.\n+    ip4:\n+        required: false\n+        version_added: \"0.1\"\n+        description: The IPv4 address to this interface using this format ie: \"192.168.1.24/24\"\n+    gw4:\n+        required: false\n+        version_added: \"0.1\"\n+        description: The IPv4 gateway for this interface using this format ie: \"192.168.100.1\"\n+    dns4:\n+        required: false\n+        version_added: \"0.1\"\n+        description: A list of upto 3 dns servers, ipv4 format e.g. To add two IPv4 DNS server addresses: ['\"8.8.8.8 8.8.4.4\"']\n+    ip6:\n+        required: false\n+        version_added: \"0.1\"\n+        description:\n+            - The IPv6 address to this interface using this format ie: \"abbe::cafe\"\n+    gw:\n+        required: false\n+        version_added: \"0.1\"\n+        aliases: [ \"gw6\" ]\n+        description: The IPv6 gateway for this interface using this format ie: \"2001:db8::1\"\n+    dns6:\n+        required: false\n+        version_added: \"0.1\"\n+        description: A list of upto 3 dns servers, ipv6 format e.g. To add two IPv6 DNS server addresses: ['\"2001:4860:4860::8888 2001:4860:4860::8844\"']\n+    mtu:\n+        required: false\n+        version_added: \"0.1\"\n+        description:\n+            - The connection MTU, e.g. 9000. This can't be applied when creating the interface and is done once the interface has been created.\n+    stp:\n+        required: false\n+        version_added: \"0.1\"\n+        default: yes\n+        description:\n+            - This is only used with bridge and controls whether Spanning Tree Protocol (STP) is enabled for this bridge\n+    priority:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"128\"\n+        description:\n+            - This is only used with 'bridge' - sets STP priority (default: 128)\n+    slavepriority:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"128\"\n+        description:\n+            - This is only used with 'bridge-slave' - STP priority of this slave (default: 32)\n+    forwarddelay:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"15\"\n+        description:\n+            - This is only used with bridge - [forward-delay <2-30>] STP forwarding delay, in seconds (default: 15)\n+    hellotime:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"2\"\n+        description:\n+            - This is only used with bridge - [hello-time <1-10>] STP hello time, in seconds (default: 2)\n+    maxage:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"20\"\n+        description:\n+            - This is only used with bridge - [max-age <6-42>] STP maximum message age, in seconds (default: 20)\n+    ageingtime:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"300\"\n+        description:\n+            - This is only used with bridge - [ageing-time <0-1000000>] the Ethernet MAC address aging time, in seconds (default: 300)\n+    mac:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"300\"\n+        description:\n+            - This is only used with bridge - MAC address of the bridge (note: this requires a recent kernel feature, originally introduced in 3.15 upstream kernel)\n+    vlanid:\n+        required: false\n+        version_added: \"0.1\"\n+        description:\n+            - This is only used with VLAN - VLAN ID in range <0-4095>\n+        state:\n+            required: false\n+            default: \"present\"\n+            choices: [ present, absent ]\n+        description:\n+            - Whether the device should exist or not, taking action if the state is different from what is stated.\n+    enabled:\n+        required: false\n+        version_added: \"0.1\"\n+        default: \"yes\"\n+        choices: [ \"yes\", \"no\" ]\n+        description:\n+            - Whether the service should start on boot. B(At least one of state and enabled are required.)\n+'''\n+\n+EXAMPLES='''\n+# To add an Ethernet connection with static IP configuration, issue a command as follows\n+- nmcli: name=add cname=my-eth1 ifname=eth1 type=ethernet ip4=192.168.100.100/24 gw4=192.168.100.1 state=present\n+\n+# To add an Team connection with static IP configuration, issue a command as follows\n+- nmcli: name=add cname=my-team1 ifname=my-team1 type=team ip4=192.168.100.100/24 gw4=192.168.100.1 state=present enabled=yes\n+\n+# Optionally, at the same time specify IPv6 addresses for the device as follows:\n+- nmcli: name=add cname=my-eth1 ifname=eth1 type=ethernet ip4=192.168.100.100/24 gw4=192.168.100.1 ip6=abbe::cafe gw6=2001:db8::1 state=present\n+\n+# To add two IPv4 DNS server addresses:\n+-nmcli: name=mod cname=my-eth1 dns4=[\"8.8.8.8\", \"8.8.4.4\"]\n+\n+# To bring up the new connection, issue a command as follows\n+- nmcli: name=up cname=my-eth1 ifname=eth1 enabled=yes state=present\n+\n+# To lock a profile to a specific interface, issue a command as follows\n+- nmcli: name=add ctype=ethernet name=my-eth1 ifname=eth1 state=present\n+\n+# To make a profile usable for all compatible Ethernet interfaces, issue a command as follows\n+- nmcli: name=add ctype=ethernet name=my-eth1 ifname=\"*\" state=present\n+\n+# To change the property of a setting e.g. MTU, issue a command as follows:\n+- nmcli: name=modify cname=my-eth1 mtu=9000\n+\n+    Exit Status's:\n+        - nmcli exits with status 0 if it succeeds, a value greater than 0 is\n+        returned if an error occurs.\n+        - 0 Success - indicates the operation succeeded\n+        - 1 Unknown or unspecified error\n+        - 2 Invalid user input, wrong nmcli invocation\n+        - 3 Timeout expired (see --wait option)\n+        - 4 Connection activation failed\n+        - 5 Connection deactivation failed\n+        - 6 Disconnecting device failed\n+        - 7 Connection deletion failed\n+        - 8 NetworkManager is not running\n+        - 9 nmcli and NetworkManager versions mismatch\n+        - 10 Connection, device, or access point does not exist.\n+'''\n+import ansible.module_utils.basic\n+import os\n+import syslog\n+import sys\n+import NetworkManager\n+import dbus\n+\n+\n+class Nmcli(object):\n+    \"\"\"\n+    This is the generic nmcli manipulation class that is subclassed based on platform.\n+    A subclass may wish to override the following action methods:-\n+            - create_connection()\n+            - delete_connection()\n+            - modify_connection()\n+            - show_connection()\n+            - up_connection()\n+            - down_connection()\n+    All subclasses MUST define platform and distribution (which may be None).\n+    \"\"\"\n+\n+    platform='Generic'\n+    distribution=None\n+\n+    def __new__(cls, *args, **kwargs):\n+        return load_platform_subclass(Nmcli, args, kwargs)\n+\n+    def __init__(self, module):\n+        self.module=module\n+        self.state=module.params['state']\n+        self.enabled=module.params['enabled']\n+        self.name=module.params['name']\n+        self.cname=module.params['cname']\n+        self.master=module.params['master']\n+        self.autoconnect=module.params['autoconnect']\n+        self.ifname=module.params['ifname']\n+        self.type=module.params['type']\n+        self.ip4=module.params['ip4']\n+        self.gw4=module.params['gw4']\n+        self.dns4=module.params['dns4']\n+        self.ip6=module.params['ip6']\n+        self.gw6=module.params['gw6']\n+        self.dns6=module.params['dns6']\n+        self.mtu=module.params['mtu']\n+        self.stp=module.params['stp']\n+        self.priority=module.params['priority']\n+        self.slavepriority=module.params['slavepriority']\n+        self.forwarddelay=module.params['forwarddelay']\n+        self.hellotime=module.params['hellotime']\n+        self.maxage=module.params['maxage']\n+        self.ageingtime=module.params['ageingtime']\n+        self.mac=module.params['mac']\n+        self.vlanid=module.params['vlanid']\n+        # The following is going to be used in dbus code\n+        self.devtypes={1: \"Ethernet\",\n+                       2: \"Wi-Fi\",\n+                       5: \"Bluetooth\",\n+                       6: \"OLPC\",\n+                       7: \"WiMAX\",\n+                       8: \"Modem\",\n+                       9: \"InfiniBand\",\n+                       10: \"Bond\",\n+                       11: \"VLAN\",\n+                       12: \"ADSL\",\n+                       13: \"Bridge\",\n+                       14: \"Generic\",\n+                       15: \"Team\"\n+                       }\n+        self.states={0: \"Unknown\",\n+                     10: \"Unmanaged\",\n+                     20: \"Unavailable\",\n+                     30: \"Disconnected\",\n+                     40: \"Prepare\",\n+                     50: \"Config\",\n+                     60: \"Need Auth\",\n+                     70: \"IP Config\",\n+                     80: \"IP Check\",\n+                     90: \"Secondaries\",\n+                     100: \"Activated\",\n+                     110: \"Deactivating\",\n+                     120: \"Failed\"}\n+        # select whether we dump additional debug info through syslog\n+        self.syslogging=True\n+\n+    def execute_command(self, cmd, use_unsafe_shell=False, data=None):\n+        if self.syslogging:\n+            syslog.openlog('ansible-%s' % os.path.basename(__file__))\n+            syslog.syslog(syslog.LOG_NOTICE, 'Command %s' % '|'.join(cmd))\n+\n+        return self.module.run_command(cmd, use_unsafe_shell=use_unsafe_shell, data=data)\n+\n+    def list_connection_info(self):\n+\n+        bus=dbus.SystemBus()\n+        connection_list=[]\n+\n+        # Get a proxy for the base NetworkManager object\n+        proxy=bus.get_object(\"org.freedesktop.NetworkManager\", \"/org/freedesktop/NetworkManager\")\n+        manager=dbus.Interface(proxy, \"org.freedesktop.NetworkManager\")\n+\n+        # Get all devices known to NM and list interface names\n+        devices=manager.GetDevices()\n+        for d in devices:\n+            dev_proxy=bus.get_object(\"org.freedesktop.NetworkManager\", d)\n+            prop_iface=dbus.Interface(dev_proxy, \"org.freedesktop.DBus.Properties\")\n+            props=prop_iface.GetAll(\"org.freedesktop.NetworkManager.Device\")\n+            connection_list.append(props['Interface'])\n+            # try:\n+            #     devtype = devtypes[props['DeviceType']]\n+            # except KeyError:\n+            #     devtype = \"Unknown\"\n+            # print \"Type: %s\" % devtype\n+            #\n+            # print \"Driver: %s\" % props['Driver']\n+            #\n+            # try:\n+            #     state = states[props['State']]\n+            # except KeyError:\n+            #     state = \"Unknown\"\n+            # print \"State: %s\" % state\n+        return connection_list\n+\n+    def connection_exists(self):\n+        # we are going to use name and type in this instance to find if that connection exists and is of type x\n+        connections=self.list_connection_info()\n+\n+        for con_item in connections:\n+            if self.cname==con_item:\n+                return True\n+        return False\n+\n+    def connection_down(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # if self.connection_exists():\n+        cmd.append('con')\n+        cmd.append('down')\n+        cmd.append(self.cname)\n+        return self.execute_command(cmd)\n+\n+    def create_connection_team(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # if connection_exists()\n+        #     self.module.fail_json(msg=\"this connection exists already\")\n+        # else:\n+        # format for creating team interface\n+        cmd.append('connection')\n+        cmd.append('add')\n+        cmd.append('type')\n+        cmd.append(self.type)\n+        cmd.append('con-name')\n+        if self.cname is not None:\n+            cmd.append(self.cname)\n+        elif self.ifname is not None:\n+            cmd.append(self.ifname)\n+        else:\n+            self.module.fail_json(msg=\"You haven't specified a name for the connection\")\n+            # cmd.append(self.cname)\n+        cmd.append('ifname')\n+        if self.ifname is not None:\n+            cmd.append(self.ifname)\n+        elif self.cname is not None:\n+            cmd.append(self.cname)\n+        if self.ip4 is not None:\n+            cmd.append('ip4')\n+            cmd.append(self.ip4)\n+        if self.gw4 is not None:\n+            cmd.append('gw4')\n+            cmd.append(self.gw4)\n+        # if self.dns4 is not None:\n+        #     cmd.append('ipv4.dns')\n+        #     cmd.append(self.dns4)\n+        # if self.ip6 is not None:\n+        #     cmd.append('ip6')\n+        #     cmd.append(self.ip6)\n+        # if self.gw6 is not None:\n+        #     cmd.append('gw6')\n+        #     cmd.append(self.gw4)\n+        # if self.dns6 is not None:\n+        #     cmd.append('dns6')\n+        #     cmd.append(self.dns6)\n+        if self.enabled is not None:\n+            cmd.append('autoconnect')\n+            cmd.append(self.enabled)\n+        return cmd\n+\n+    def modify_connection_team(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # if connection_exists()\n+        #     self.module.fail_json(msg=\"this connection exists already\")\n+        # else:\n+        # format for modifying team interface\n+        cmd.append('con')\n+        cmd.append('mod')\n+        if self.cname is not None:\n+            cmd.append(self.cname)\n+        else:\n+            self.module.fail_json(msg=\"You haven't specified a name for the connection\")\n+        if self.ip4 is not None:\n+            cmd.append('ip4')\n+            cmd.append(self.ip4)\n+        if self.gw4 is not None:\n+            cmd.append('gw4')\n+            cmd.append(self.gw4)\n+        if self.dns4 is not None:\n+            cmd.append('ipv4.dns')\n+            cmd.append(self.dns4)\n+        if self.ip6 is not None:\n+            cmd.append('ip6')\n+            cmd.append(self.ip6)\n+        if self.gw6 is not None:\n+            cmd.append('gw6')\n+            cmd.append(self.gw4)\n+        if self.dns6 is not None:\n+            cmd.append('ipv6.dns')\n+            cmd.append(self.dns6)\n+        if self.enabled is not None:\n+            cmd.append('autoconnect')\n+            cmd.append(self.enabled)\n+        return cmd\n+\n+    def create_connection_team_slave(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for creating team-slave interface\n+        return cmd\n+\n+    def modify_connection_team_slave(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for modifying team-slave interface\n+        return cmd\n+\n+    def create_connection_bond(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for creating bond interface\n+        return cmd\n+\n+    def modify_connection_bond(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for modifying bond interface\n+        return cmd\n+\n+    def create_connection_bond_slave(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for creating bond-slave interface\n+        return cmd\n+\n+    def modify_connection_bond_slave(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for modifying bond-slave interface\n+        return cmd\n+\n+    def create_connection_ethernet(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for creating ethernet interface\n+        # To add an Ethernet connection with static IP configuration, issue a command as follows\n+        # - nmcli: name=add cname=my-eth1 ifname=eth1 type=ethernet ip4=192.168.100.100/24 gw4=192.168.100.1 state=present\n+        #        nmcli con add con-name my-eth1 ifname eth1 type ethernet ip4 192.168.100.100/24 gw4 192.168.100.1\n+        # if self.type == 'ethernet':\n+        #     cmd.append = 'con'\n+        #     cmd.append = self.name\n+        #     cmd.append('con-name')\n+        #     if self.cname is not None:\n+        #         cmd.append(self.cname)\n+        #     elif self.cname is None:\n+        #         if self.ifname is not None:\n+        #             cmd.append(self.ifname)\n+        #     cmd.append('ifname')\n+        #     cmd.append(self.ifname)\n+        #     cmd.append('type')\n+        #     cmd.append(self.type)\n+        #     if self.ip4 is not None:\n+        #         cmd.append('ip4')\n+        #         cmd.append(self.ip4)\n+        #     if self.gw4 is not None:\n+        #         cmd.append('gw4')\n+        #         cmd.append(self.gw4)\n+        #     if self.dns4 is not None:\n+        #         cmd.append('dns4')\n+        #         cmd.append(self.dns4)\n+        #     if self.ip6 is not None:\n+        #         cmd.append('ip6')\n+        #         cmd.append(self.ip6)\n+        #     if self.gw6 is not None:\n+        #         cmd.append('gw6')\n+        #         cmd.append(self.gw4)\n+        #     if self.dns6 is not None:\n+        #         cmd.append('dns6')\n+        #         cmd.append(self.dns6)\n+        return cmd\n+\n+    def modify_connection_ethernet(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for  modifying ethernet interface\n+        # To add an Ethernet connection with static IP configuration, issue a command as follows\n+        # - nmcli: name=add cname=my-eth1 ifname=eth1 type=ethernet ip4=192.168.100.100/24 gw4=192.168.100.1 state=present\n+        #        nmcli con add con-name my-eth1 ifname eth1 type ethernet ip4 192.168.100.100/24 gw4 192.168.100.1\n+        # if self.type == 'ethernet':\n+        #     cmd.append = 'con'\n+        #     cmd.append = self.name\n+        #     cmd.append('con-name')\n+        #     if self.cname is not None:\n+        #         cmd.append(self.cname)\n+        #     elif self.cname is None:\n+        #         if self.ifname is not None:\n+        #             cmd.append(self.ifname)\n+        #     cmd.append('ifname')\n+        #     cmd.append(self.ifname)\n+        #     cmd.append('type')\n+        #     cmd.append(self.type)\n+        #     if self.ip4 is not None:\n+        #         cmd.append('ip4')\n+        #         cmd.append(self.ip4)\n+        #     if self.gw4 is not None:\n+        #         cmd.append('gw4')\n+        #         cmd.append(self.gw4)\n+        #     if self.dns4 is not None:\n+        #         cmd.append('dns4')\n+        #         cmd.append(self.dns4)\n+        #     if self.ip6 is not None:\n+        #         cmd.append('ip6')\n+        #         cmd.append(self.ip6)\n+        #     if self.gw6 is not None:\n+        #         cmd.append('gw6')\n+        #         cmd.append(self.gw4)\n+        #     if self.dns6 is not None:\n+        #         cmd.append('dns6')\n+        #         cmd.append(self.dns6)\n+        return cmd\n+\n+    def create_connection_bridge(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for creating bridge interface\n+        return cmd\n+\n+    def modify_connection_bridge(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for modifying bridge interface\n+        return cmd\n+\n+    def create_connection_vlan(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for creating ethernet interface\n+        return cmd\n+\n+    def modify_connection_vlan(self):\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        # format for modifying ethernet interface\n+        return cmd\n+\n+    def create_connection(self):\n+        cmd=[]\n+        if self.type=='team':\n+            cmd=self.create_connection_team()\n+        elif self.type=='team-slave':\n+            cmd=self.create_connection_team_slave()\n+        elif self.type=='bond':\n+            cmd=self.create_connection_bond()\n+        elif self.type=='bond-slave':\n+            cmd=self.create_connection_bond_slave()\n+        elif self.type=='ethernet':\n+            cmd=self.create_connection_ethernet()\n+        elif self.type=='bridge':\n+            cmd=self.create_connection_bridge()\n+        elif self.type=='vlan':\n+            cmd=self.create_connection_vlan()\n+        return self.execute_command(cmd)\n+\n+    def remove_connection(self):\n+        # self.connection_down()\n+\n+        cmd=[self.module.get_bin_path('nmcli', True)]\n+        cmd.append('con')\n+        cmd.append('del')\n+        cmd.append(self.cname)\n+        return self.execute_command(cmd)\n+\n+    def modify_connection(self):\n+        cmd=[]\n+        if self.type=='team':","path":"library/nmcli.py","position":598,"original_position":598,"commit_id":"bc6d60cce02a40646ded7560c30dcb7c36de683d","original_commit_id":"bc6d60cce02a40646ded7560c30dcb7c36de683d","user":{"login":"willthames","id":391807,"avatar_url":"https://avatars.githubusercontent.com/u/391807?v=3","gravatar_id":"","url":"https://api.github.com/users/willthames","html_url":"https://github.com/willthames","followers_url":"https://api.github.com/users/willthames/followers","following_url":"https://api.github.com/users/willthames/following{/other_user}","gists_url":"https://api.github.com/users/willthames/gists{/gist_id}","starred_url":"https://api.github.com/users/willthames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willthames/subscriptions","organizations_url":"https://api.github.com/users/willthames/orgs","repos_url":"https://api.github.com/users/willthames/repos","events_url":"https://api.github.com/users/willthames/events{/privacy}","received_events_url":"https://api.github.com/users/willthames/received_events","type":"User","site_admin":false},"body":"you can create a dict of type to method call\r\n\r\ncommands = { 'team': self.modify_connection_team, 'team-slave', ... }\r\nreturn self.execute_command(commands[self.type])","created_at":"2015-05-04T01:08:21Z","updated_at":"2015-05-04T01:08:21Z","html_url":"https://github.com/alcamie101/ansible-nmcli/pull/1#discussion_r29562689","pull_request_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/comments/29562689"},"html":{"href":"https://github.com/alcamie101/ansible-nmcli/pull/1#discussion_r29562689"},"pull_request":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1","id":34611170,"html_url":"https://github.com/alcamie101/ansible-nmcli/pull/1","diff_url":"https://github.com/alcamie101/ansible-nmcli/pull/1.diff","patch_url":"https://github.com/alcamie101/ansible-nmcli/pull/1.patch","issue_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/1","number":1,"state":"open","locked":false,"title":"nmcli.py by itself","user":{"login":"alcamie101","id":1836567,"avatar_url":"https://avatars.githubusercontent.com/u/1836567?v=3","gravatar_id":"","url":"https://api.github.com/users/alcamie101","html_url":"https://github.com/alcamie101","followers_url":"https://api.github.com/users/alcamie101/followers","following_url":"https://api.github.com/users/alcamie101/following{/other_user}","gists_url":"https://api.github.com/users/alcamie101/gists{/gist_id}","starred_url":"https://api.github.com/users/alcamie101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcamie101/subscriptions","organizations_url":"https://api.github.com/users/alcamie101/orgs","repos_url":"https://api.github.com/users/alcamie101/repos","events_url":"https://api.github.com/users/alcamie101/events{/privacy}","received_events_url":"https://api.github.com/users/alcamie101/received_events","type":"User","site_admin":false},"body":"If you could review this thanks Will","created_at":"2015-05-04T00:56:02Z","updated_at":"2015-05-04T01:08:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbeb8a3f10740aa3f8278a368c22d47bebabe642","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1/commits","review_comments_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1/comments","review_comment_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/1/comments","statuses_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/statuses/bc6d60cce02a40646ded7560c30dcb7c36de683d","head":{"label":"alcamie101:review","ref":"review","sha":"bc6d60cce02a40646ded7560c30dcb7c36de683d","user":{"login":"alcamie101","id":1836567,"avatar_url":"https://avatars.githubusercontent.com/u/1836567?v=3","gravatar_id":"","url":"https://api.github.com/users/alcamie101","html_url":"https://github.com/alcamie101","followers_url":"https://api.github.com/users/alcamie101/followers","following_url":"https://api.github.com/users/alcamie101/following{/other_user}","gists_url":"https://api.github.com/users/alcamie101/gists{/gist_id}","starred_url":"https://api.github.com/users/alcamie101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcamie101/subscriptions","organizations_url":"https://api.github.com/users/alcamie101/orgs","repos_url":"https://api.github.com/users/alcamie101/repos","events_url":"https://api.github.com/users/alcamie101/events{/privacy}","received_events_url":"https://api.github.com/users/alcamie101/received_events","type":"User","site_admin":false},"repo":{"id":35005765,"name":"ansible-nmcli","full_name":"alcamie101/ansible-nmcli","owner":{"login":"alcamie101","id":1836567,"avatar_url":"https://avatars.githubusercontent.com/u/1836567?v=3","gravatar_id":"","url":"https://api.github.com/users/alcamie101","html_url":"https://github.com/alcamie101","followers_url":"https://api.github.com/users/alcamie101/followers","following_url":"https://api.github.com/users/alcamie101/following{/other_user}","gists_url":"https://api.github.com/users/alcamie101/gists{/gist_id}","starred_url":"https://api.github.com/users/alcamie101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcamie101/subscriptions","organizations_url":"https://api.github.com/users/alcamie101/orgs","repos_url":"https://api.github.com/users/alcamie101/repos","events_url":"https://api.github.com/users/alcamie101/events{/privacy}","received_events_url":"https://api.github.com/users/alcamie101/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alcamie101/ansible-nmcli","description":"This is a module that will allows to access to nmcli through ansible interface.","fork":false,"url":"https://api.github.com/repos/alcamie101/ansible-nmcli","forks_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/forks","keys_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/teams","hooks_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/hooks","issue_events_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/events{/number}","events_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/events","assignees_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/assignees{/user}","branches_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/branches{/branch}","tags_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/tags","blobs_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/refs{/sha}","trees_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/statuses/{sha}","languages_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/languages","stargazers_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/stargazers","contributors_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/contributors","subscribers_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/subscribers","subscription_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/subscription","commits_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/commits{/sha}","git_commits_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/commits{/sha}","comments_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/comments{/number}","issue_comment_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/comments{/number}","contents_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/contents/{+path}","compare_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/merges","archive_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/downloads","issues_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues{/number}","pulls_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls{/number}","milestones_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/milestones{/number}","notifications_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/labels{/name}","releases_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/releases{/id}","created_at":"2015-05-04T00:17:47Z","updated_at":"2015-05-04T00:21:41Z","pushed_at":"2015-05-04T00:56:02Z","git_url":"git://github.com/alcamie101/ansible-nmcli.git","ssh_url":"git@github.com:alcamie101/ansible-nmcli.git","clone_url":"https://github.com/alcamie101/ansible-nmcli.git","svn_url":"https://github.com/alcamie101/ansible-nmcli","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"alcamie101:empty","ref":"empty","sha":"947a53043c2cdddc9b259ea1d51efc34d3e90585","user":{"login":"alcamie101","id":1836567,"avatar_url":"https://avatars.githubusercontent.com/u/1836567?v=3","gravatar_id":"","url":"https://api.github.com/users/alcamie101","html_url":"https://github.com/alcamie101","followers_url":"https://api.github.com/users/alcamie101/followers","following_url":"https://api.github.com/users/alcamie101/following{/other_user}","gists_url":"https://api.github.com/users/alcamie101/gists{/gist_id}","starred_url":"https://api.github.com/users/alcamie101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcamie101/subscriptions","organizations_url":"https://api.github.com/users/alcamie101/orgs","repos_url":"https://api.github.com/users/alcamie101/repos","events_url":"https://api.github.com/users/alcamie101/events{/privacy}","received_events_url":"https://api.github.com/users/alcamie101/received_events","type":"User","site_admin":false},"repo":{"id":35005765,"name":"ansible-nmcli","full_name":"alcamie101/ansible-nmcli","owner":{"login":"alcamie101","id":1836567,"avatar_url":"https://avatars.githubusercontent.com/u/1836567?v=3","gravatar_id":"","url":"https://api.github.com/users/alcamie101","html_url":"https://github.com/alcamie101","followers_url":"https://api.github.com/users/alcamie101/followers","following_url":"https://api.github.com/users/alcamie101/following{/other_user}","gists_url":"https://api.github.com/users/alcamie101/gists{/gist_id}","starred_url":"https://api.github.com/users/alcamie101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcamie101/subscriptions","organizations_url":"https://api.github.com/users/alcamie101/orgs","repos_url":"https://api.github.com/users/alcamie101/repos","events_url":"https://api.github.com/users/alcamie101/events{/privacy}","received_events_url":"https://api.github.com/users/alcamie101/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alcamie101/ansible-nmcli","description":"This is a module that will allows to access to nmcli through ansible interface.","fork":false,"url":"https://api.github.com/repos/alcamie101/ansible-nmcli","forks_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/forks","keys_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/teams","hooks_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/hooks","issue_events_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/events{/number}","events_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/events","assignees_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/assignees{/user}","branches_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/branches{/branch}","tags_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/tags","blobs_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/refs{/sha}","trees_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/statuses/{sha}","languages_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/languages","stargazers_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/stargazers","contributors_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/contributors","subscribers_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/subscribers","subscription_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/subscription","commits_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/commits{/sha}","git_commits_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/git/commits{/sha}","comments_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/comments{/number}","issue_comment_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/comments{/number}","contents_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/contents/{+path}","compare_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/merges","archive_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/downloads","issues_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues{/number}","pulls_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls{/number}","milestones_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/milestones{/number}","notifications_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/labels{/name}","releases_url":"https://api.github.com/repos/alcamie101/ansible-nmcli/releases{/id}","created_at":"2015-05-04T00:17:47Z","updated_at":"2015-05-04T00:21:41Z","pushed_at":"2015-05-04T00:56:02Z","git_url":"git://github.com/alcamie101/ansible-nmcli.git","ssh_url":"git@github.com:alcamie101/ansible-nmcli.git","clone_url":"https://github.com/alcamie101/ansible-nmcli.git","svn_url":"https://github.com/alcamie101/ansible-nmcli","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1"},"html":{"href":"https://github.com/alcamie101/ansible-nmcli/pull/1"},"issue":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/1"},"comments":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/alcamie101/ansible-nmcli/statuses/bc6d60cce02a40646ded7560c30dcb7c36de683d"}}}}