<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">copy module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.0.0
  config file = 
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.2.0.0
  config file = 
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
gathering = smart
gather_subset = !virtual,!facter,!ohai
hash_behaviour = merge
host_key_checking = False
log_path = /var/log/ansible.log

[ssh_connection]
pipelining = False"><pre class="notranslate"><code class="notranslate">[defaults]
gathering = smart
gather_subset = !virtual,!facter,!ohai
hash_behaviour = merge
host_key_checking = False
log_path = /var/log/ansible.log

[ssh_connection]
pipelining = False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">RHEL 7.3</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Copy task errors out and outputs a stacktrace when trying to copy a file to a disk that is full.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<ol dir="auto">
<li>Pick a destination disk on the target machine, and create a file that will almost fill up the disk (ie to fill up 2G on /tmp: <code class="notranslate">dd if=/dev/zero of=/tmp/filler.dat bs=2G count=1</code></li>
<li>Create a file that we will use as the source of the copy task that doesn't fit on the target disk, for example if there is 50M left, generate a 70M file somewhere <code class="notranslate">dd if=/dev/zero of=/opt/test.dat bs=70M count=1</code></li>
<li>Run a sample playbook that attempts to copy the file to a disk that is full</li>
</ol>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: all
  remote_user: root
  tasks:
    - copy: src=&quot;/opt/test.dat&quot; dest=&quot;/tmp/test.dat&quot;"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">all</span>
  <span class="pl-ent">remote_user</span>: <span class="pl-s">root</span>
  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">copy</span>: <span class="pl-s">src="/opt/test.dat" dest="/tmp/test.dat"</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Copy should fail with an exception showing the result of the copy command (disk full, couldn't copy, etc...</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Stack trace is output (global name 'exception' is not defined):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [10.0.0.97]

TASK [copy] ********************************************************************
fatal: [10.0.0.97]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;checksum&quot;: &quot;e1e0abec2de9ed580fcd89c1b50d4b60e49f979e&quot;, &quot;failed&quot;: true, &quot;module_stderr&quot;: &quot;Shared connection to 10.0.0.97 closed.\r\n&quot;, &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_sNI2Il/ansible_module_copy.py\&quot;, line 364, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_sNI2Il/ansible_module_copy.py\&quot;, line 343, in main\r\n    module.atomic_move(b_mysrc, dest, unsafe_writes=module.params['unsafe_writes'])\r\n  File \&quot;/tmp/ansible_sNI2Il/ansible_modlib.zip/ansible/module_utils/basic.py\&quot;, line 2003, in atomic_move\r\nNameError: global name 'exception' is not defined\r\n&quot;, &quot;msg&quot;: &quot;MODULE FAILURE&quot;}
	to retry, use: --limit @/opt/build/test/test.retry

PLAY RECAP *********************************************************************
10.0.0.97                  : ok=1    changed=0    unreachable=0    failed=1   
"><pre class="notranslate"><code class="notranslate">PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [10.0.0.97]

TASK [copy] ********************************************************************
fatal: [10.0.0.97]: FAILED! =&gt; {"changed": false, "checksum": "e1e0abec2de9ed580fcd89c1b50d4b60e49f979e", "failed": true, "module_stderr": "Shared connection to 10.0.0.97 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_sNI2Il/ansible_module_copy.py\", line 364, in &lt;module&gt;\r\n    main()\r\n  File \"/tmp/ansible_sNI2Il/ansible_module_copy.py\", line 343, in main\r\n    module.atomic_move(b_mysrc, dest, unsafe_writes=module.params['unsafe_writes'])\r\n  File \"/tmp/ansible_sNI2Il/ansible_modlib.zip/ansible/module_utils/basic.py\", line 2003, in atomic_move\r\nNameError: global name 'exception' is not defined\r\n", "msg": "MODULE FAILURE"}
	to retry, use: --limit @/opt/build/test/test.retry

PLAY RECAP *********************************************************************
10.0.0.97                  : ok=1    changed=0    unreachable=0    failed=1   

</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">module_utils/junos</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2.5"><pre class="notranslate"><code class="notranslate">2.5
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Refactor junos modules common library to use CLIconf plugin</p>