prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  junos_facts - config parameter should have a default value
  ##### COMPONENT NAME
  
  module : junos_facts
  
  ```
  network/junos_facts.py
  ```
  ##### ANSIBLE VERSION
  
  2.1.0.0
  ##### OS / ENVIRONMENT
  
  Mac OS 10.11.5
  ##### SUMMARY
  
  Currently the parameter `config` for junos_facts is mandatory and do not have a default value
  I think it would be better to set a default value to `false` and not make this parameter mandatory.
  
  Playbooks will be simplified
  
  I'm happy to send a pull request for it, but I wanted to discuss this change before
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `network/junos/junos_facts.py`
  Content:
  ```
  1 #!/usr/bin/python
  2 #
  3 # This file is part of Ansible
  4 #
  5 # Ansible is free software: you can redistribute it and/or modify
  6 # it under the terms of the GNU General Public License as published by
  7 # the Free Software Foundation, either version 3 of the License, or
  8 # (at your option) any later version.
  9 #
  10 # Ansible is distributed in the hope that it will be useful,
  11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 # GNU General Public License for more details.
  14 #
  15 # You should have received a copy of the GNU General Public License
  16 # along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
  17 #
  18 
  19 DOCUMENTATION = """
  20 ---
  21 module: junos_facts
  22 version_added: "2.1"
  23 author: "Peter Sprygada (@privateip)"
  24 short_description: Collect facts from remote device running Junos
  25 description:
  26   - Collects fact information from a remote device running the Junos
  27     operating system.  By default, the module will collect basic fact
  28     information from the device to be included with the hostvars.
  29     Additional fact information can be collected based on the
  30     configured set of arguments.
  31 extends_documentation_fragment: junos
  32 options:
  33   config:
  34     description:
  35       - The C(config) argument instructs the fact module to collect
  36         the configuration from the remote device.  The configuration
  37         is then included in return facts.  By default, the configuration
  38         is returned as text.  The C(config_format) can be used to return
  39         different Junos configuration formats.
  40     required: true
  41     default: false
  42   config_format:
  43     description:
  44       - The C(config_format) argument is used to specify the desired
  45         format of the configuration file.  Devices support three
  46         configuration file formats.  By default, the configuration
  47         from the device is returned as text.  The other options include
  48         set and xml.  If the xml option is choosen, the configuration file
  49         is returned as both xml and json.
  50     required: false
  51     default: text
  52     choices: ['xml', 'text', 'set']
  53 requirements:
  54   - junos-eznc
  55 notes:
  56   - This module requires the netconf system service be enabled on
  57     the remote device being managed
  58 """
  59 
  60 EXAMPLES = """
  61 # the required set of connection arguments have been purposely left off
  62 # the examples for brevity
  63 
  64 - name: collect default set of facts
  65   junos_facts:
  66 
  67 - name: collect default set of facts and configuration
  68   junos_facts:
  69     config: yes
  70 
  71 - name: collect default set of facts and configuration in set format
  72   junos_facts:
  73     config: yes
  74     config_format: set
  75 
  76 - name: collect default set of facts and configuration in XML and JSON format
  77   junos_facts:
  78     config: yes
  79     config_format: xml
  80 """
  81 
  82 RETURN = """
  83 ansible_facts:
  84   descrption: Returns the facts collect from the device
  85   returned: always
  86   type: dict
  87 """
  88 
  89 def main():
  90     """ Main entry point for AnsibleModule
  91     """
  92     spec = dict(
  93         config=dict(required=True, type='bool'),
  94         config_format=dict(default='text', choices=['xml', 'set', 'text']),
  95         transport=dict(default='netconf', choices=['netconf'])
  96     )
  97 
  98     module = get_module(argument_spec=spec,
  99                         supports_check_mode=True)
  100 
  101     result = dict(changed=False)
  102 
  103     facts = module.get_facts()
  104 
  105     if '2RE' in facts:
  106         facts['has_2RE'] = facts['2RE']
  107         del facts['2RE']
  108 
  109     facts['version_info'] = dict(facts['version_info'])
  110 
  111     if module.params['config']:
  112         config_format = module.params['config_format']
  113         resp_config = module.get_config( config_format=config_format)
  114 
  115         if config_format in ['text', 'set']:
  116            facts['config'] = resp_config
  117         elif config_format == "xml":
  118            facts['config'] = xml_to_string(resp_config)
  119            facts['config_json'] = xml_to_json(resp_config)
  120 
  121     result['ansible_facts'] = facts
  122     module.exit_json(**result)
  123 
  124 from ansible.module_utils.basic import *
  125 from ansible.module_utils.junos import *
  126 
  127 if __name__ == '__main__':
  128     main()
  129
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/network/junos/junos_facts.py b/network/junos/junos_facts.py
  --- a/network/junos/junos_facts.py
  +++ b/network/junos/junos_facts.py
  @@ -37,8 +37,8 @@
           is then included in return facts.  By default, the configuration
           is returned as text.  The C(config_format) can be used to return
           different Junos configuration formats.
  -    required: true
  -    default: false
  +    required: false
  +    default: null
     config_format:
       description:
         - The C(config_format) argument is used to specify the desired
  @@ -90,7 +90,7 @@
       """ Main entry point for AnsibleModule
       """
       spec = dict(
  -        config=dict(required=True, type='bool'),
  +        config=dict(type='bool'),
           config_format=dict(default='text', choices=['xml', 'set', 'text']),
           transport=dict(default='netconf', choices=['netconf'])
       )
  @@ -108,7 +108,7 @@
   
       facts['version_info'] = dict(facts['version_info'])
   
  -    if module.params['config']:
  +    if module.params['config'] is True:
           config_format = module.params['config_format']
           resp_config = module.get_config( config_format=config_format)
  
verification_info: {"golden_diff": "diff --git a/network/junos/junos_facts.py b/network/junos/junos_facts.py\n--- a/network/junos/junos_facts.py\n+++ b/network/junos/junos_facts.py\n@@ -37,8 +37,8 @@\n         is then included in return facts.  By default, the configuration\n         is returned as text.  The C(config_format) can be used to return\n         different Junos configuration formats.\n-    required: true\n-    default: false\n+    required: false\n+    default: null\n   config_format:\n     description:\n       - The C(config_format) argument is used to specify the desired\n@@ -90,7 +90,7 @@\n     \"\"\" Main entry point for AnsibleModule\n     \"\"\"\n     spec = dict(\n-        config=dict(required=True, type='bool'),\n+        config=dict(type='bool'),\n         config_format=dict(default='text', choices=['xml', 'set', 'text']),\n         transport=dict(default='netconf', choices=['netconf'])\n     )\n@@ -108,7 +108,7 @@\n \n     facts['version_info'] = dict(facts['version_info'])\n \n-    if module.params['config']:\n+    if module.params['config'] is True:\n         config_format = module.params['config_format']\n         resp_config = module.get_config( config_format=config_format)\n", "issue": "junos_facts - config parameter should have a default value\n##### COMPONENT NAME\n\nmodule : junos_facts\n\n```\nnetwork/junos_facts.py\n```\n##### ANSIBLE VERSION\n\n2.1.0.0\n##### OS / ENVIRONMENT\n\nMac OS 10.11.5\n##### SUMMARY\n\nCurrently the parameter `config` for junos_facts is mandatory and do not have a default value\nI think it would be better to set a default value to `false` and not make this parameter mandatory.\n\nPlaybooks will be simplified\n\nI'm happy to send a pull request for it, but I wanted to discuss this change before\n\n", "before_files": [{"content": "#!/usr/bin/python\n#\n# This file is part of Ansible\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\nDOCUMENTATION = \"\"\"\n---\nmodule: junos_facts\nversion_added: \"2.1\"\nauthor: \"Peter Sprygada (@privateip)\"\nshort_description: Collect facts from remote device running Junos\ndescription:\n  - Collects fact information from a remote device running the Junos\n    operating system.  By default, the module will collect basic fact\n    information from the device to be included with the hostvars.\n    Additional fact information can be collected based on the\n    configured set of arguments.\nextends_documentation_fragment: junos\noptions:\n  config:\n    description:\n      - The C(config) argument instructs the fact module to collect\n        the configuration from the remote device.  The configuration\n        is then included in return facts.  By default, the configuration\n        is returned as text.  The C(config_format) can be used to return\n        different Junos configuration formats.\n    required: true\n    default: false\n  config_format:\n    description:\n      - The C(config_format) argument is used to specify the desired\n        format of the configuration file.  Devices support three\n        configuration file formats.  By default, the configuration\n        from the device is returned as text.  The other options include\n        set and xml.  If the xml option is choosen, the configuration file\n        is returned as both xml and json.\n    required: false\n    default: text\n    choices: ['xml', 'text', 'set']\nrequirements:\n  - junos-eznc\nnotes:\n  - This module requires the netconf system service be enabled on\n    the remote device being managed\n\"\"\"\n\nEXAMPLES = \"\"\"\n# the required set of connection arguments have been purposely left off\n# the examples for brevity\n\n- name: collect default set of facts\n  junos_facts:\n\n- name: collect default set of facts and configuration\n  junos_facts:\n    config: yes\n\n- name: collect default set of facts and configuration in set format\n  junos_facts:\n    config: yes\n    config_format: set\n\n- name: collect default set of facts and configuration in XML and JSON format\n  junos_facts:\n    config: yes\n    config_format: xml\n\"\"\"\n\nRETURN = \"\"\"\nansible_facts:\n  descrption: Returns the facts collect from the device\n  returned: always\n  type: dict\n\"\"\"\n\ndef main():\n    \"\"\" Main entry point for AnsibleModule\n    \"\"\"\n    spec = dict(\n        config=dict(required=True, type='bool'),\n        config_format=dict(default='text', choices=['xml', 'set', 'text']),\n        transport=dict(default='netconf', choices=['netconf'])\n    )\n\n    module = get_module(argument_spec=spec,\n                        supports_check_mode=True)\n\n    result = dict(changed=False)\n\n    facts = module.get_facts()\n\n    if '2RE' in facts:\n        facts['has_2RE'] = facts['2RE']\n        del facts['2RE']\n\n    facts['version_info'] = dict(facts['version_info'])\n\n    if module.params['config']:\n        config_format = module.params['config_format']\n        resp_config = module.get_config( config_format=config_format)\n\n        if config_format in ['text', 'set']:\n           facts['config'] = resp_config\n        elif config_format == \"xml\":\n           facts['config'] = xml_to_string(resp_config)\n           facts['config_json'] = xml_to_json(resp_config)\n\n    result['ansible_facts'] = facts\n    module.exit_json(**result)\n\nfrom ansible.module_utils.basic import *\nfrom ansible.module_utils.junos import *\n\nif __name__ == '__main__':\n    main()\n", "path": "network/junos/junos_facts.py"}], "after_files": [{"content": "#!/usr/bin/python\n#\n# This file is part of Ansible\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\nDOCUMENTATION = \"\"\"\n---\nmodule: junos_facts\nversion_added: \"2.1\"\nauthor: \"Peter Sprygada (@privateip)\"\nshort_description: Collect facts from remote device running Junos\ndescription:\n  - Collects fact information from a remote device running the Junos\n    operating system.  By default, the module will collect basic fact\n    information from the device to be included with the hostvars.\n    Additional fact information can be collected based on the\n    configured set of arguments.\nextends_documentation_fragment: junos\noptions:\n  config:\n    description:\n      - The C(config) argument instructs the fact module to collect\n        the configuration from the remote device.  The configuration\n        is then included in return facts.  By default, the configuration\n        is returned as text.  The C(config_format) can be used to return\n        different Junos configuration formats.\n    required: false\n    default: null\n  config_format:\n    description:\n      - The C(config_format) argument is used to specify the desired\n        format of the configuration file.  Devices support three\n        configuration file formats.  By default, the configuration\n        from the device is returned as text.  The other options include\n        set and xml.  If the xml option is choosen, the configuration file\n        is returned as both xml and json.\n    required: false\n    default: text\n    choices: ['xml', 'text', 'set']\nrequirements:\n  - junos-eznc\nnotes:\n  - This module requires the netconf system service be enabled on\n    the remote device being managed\n\"\"\"\n\nEXAMPLES = \"\"\"\n# the required set of connection arguments have been purposely left off\n# the examples for brevity\n\n- name: collect default set of facts\n  junos_facts:\n\n- name: collect default set of facts and configuration\n  junos_facts:\n    config: yes\n\n- name: collect default set of facts and configuration in set format\n  junos_facts:\n    config: yes\n    config_format: set\n\n- name: collect default set of facts and configuration in XML and JSON format\n  junos_facts:\n    config: yes\n    config_format: xml\n\"\"\"\n\nRETURN = \"\"\"\nansible_facts:\n  descrption: Returns the facts collect from the device\n  returned: always\n  type: dict\n\"\"\"\n\ndef main():\n    \"\"\" Main entry point for AnsibleModule\n    \"\"\"\n    spec = dict(\n        config=dict(type='bool'),\n        config_format=dict(default='text', choices=['xml', 'set', 'text']),\n        transport=dict(default='netconf', choices=['netconf'])\n    )\n\n    module = get_module(argument_spec=spec,\n                        supports_check_mode=True)\n\n    result = dict(changed=False)\n\n    facts = module.get_facts()\n\n    if '2RE' in facts:\n        facts['has_2RE'] = facts['2RE']\n        del facts['2RE']\n\n    facts['version_info'] = dict(facts['version_info'])\n\n    if module.params['config'] is True:\n        config_format = module.params['config_format']\n        resp_config = module.get_config( config_format=config_format)\n\n        if config_format in ['text', 'set']:\n           facts['config'] = resp_config\n        elif config_format == \"xml\":\n           facts['config'] = xml_to_string(resp_config)\n           facts['config_json'] = xml_to_json(resp_config)\n\n    result['ansible_facts'] = facts\n    module.exit_json(**result)\n\nfrom ansible.module_utils.basic import *\nfrom ansible.module_utils.junos import *\n\nif __name__ == '__main__':\n    main()\n", "path": "network/junos/junos_facts.py"}]}