# Update : stat upside down

**URL:** <https://forum.ansible.com/t/update-stat-upside-down/15764>\
**Category:** Ansible Project\
**Created:** [July 24, 2014, 2:11pm UTC](https://forum.ansible.com/t/update-stat-upside-down/15764 "2014-07-24T14:11:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diogene\_Laerce](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Diogene\_Laerce](https://forum.ansible.com/u/Diogene_Laerce)\
**Post date:** [July 24, 2014, 2:11pm UTC](https://forum.ansible.com/t/update-stat-upside-down/15764/1 "2014-07-24T14:11:07Z")

</div>

Hi,

I have this strange issue. The following code was working fine (I think)  
as :

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 24, 2014, 10:44pm UTC](https://forum.ansible.com/t/update-stat-upside-down/15764/2 "2014-07-24T22:44:09Z")

</div>

I think I replied to the previous copy of this one, please see the other thread.

It can sometimes be confusing as the very first post to the list is moderated to prevent spam, so I occasionally double approve a duplicate post.

---

<div class="post-metadata">

**Author:** ![Diogene\_Laerce](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Diogene\_Laerce](https://forum.ansible.com/u/Diogene_Laerce)\
**Post date:** [July 27, 2014, 11:46am UTC](https://forum.ansible.com/t/update-stat-upside-down/15764/3 "2014-07-27T11:46:05Z")

</div>

> I think I replied to the previous copy of this one, please see the other  
> thread.

Sorry about that.

> However, I think you might really want this:  
> when: a is defined and a.stat.isfile  
> OR (depending on use case)  
> when: a is defined and not a.stat.isfile
> 
> Maybe try one of those first...

I played with that code where /usr/local/bin/python3.4 does not exist :

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 27, 2014, 1:20pm UTC](https://forum.ansible.com/t/update-stat-upside-down/15764/4 "2014-07-27T13:20:21Z")

</div>

I think you are misunderstanding the return codes of the stat module.

When the file is not there, it doesn’t register a “None” in the file location.

Insert this line, and you’ll see what I mean:

- debug: var=I

I would also recommend naming variables something other than “I”, for readability purposes. python34 would be a good variable name 🙂

---

<div class="post-metadata">

**Author:** ![Diogene\_Laerce](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Diogene\_Laerce](https://forum.ansible.com/u/Diogene_Laerce)\
**Post date:** [July 27, 2014, 1:55pm UTC](https://forum.ansible.com/t/update-stat-upside-down/15764/5 "2014-07-27T13:55:22Z")

</div>

> I think you are misunderstanding the return codes of the stat module.

Nooo.. Why would you say that ? 🙂

> When the file is not there, it doesn't register a "None" in the file  
> location.
> 
> Insert this line, and you'll see what I mean:
> 
> - debug: var=I

That, is the killer tip ! I was blind, now I see. 😃  
Problem solved !

> I would also recommend naming variables something other than "I", for  
> readability purposes. python34 would be a good variable name 🙂

I will. 😉

Thanks very thanks a lot for teaching me how to fish ! 🙂
