Bug in File absent=True?


I've been using opsmop to set up my Vespene server, and I noticed this when absenting an already absent File.

The file doesn't exist.

$ ls -la /etc/nginx/sites-enabled/default
ls: cannot access '/etc/nginx/sites-enabled/default': No such file or directory

With a Resource like this,


You get a check like this:

$ python deploy.py --check --local

1. NginxRole => File: /etc/nginx/sites-enabled/default:

    | absent: True
    | signals: nginx_changed
needs: rm
signaled: nginx_changed

There should be nothing under planning, I think?

If you apply the policy, you get an exception.

AttributeError: 'File' object has no attribute 'path'

I found this in the plan method of the providers/file.py module:

    # removal?
    if self.absent:
        if not exists:

Remove the file if it doesn't exist. Remove the not in if not exists to fix this?

Is this a good place for bug reports like this at this time, or do you want github issues / pull requests?


Thanks for testing and it's awesome you are writing opsmop for Vespene. Even I have not done that yet :)

It's fine to ask questions here but definitely file bugs in github.

If you want to send me a pull request that would be great too!

It's no secret things have been very lightly tested in module land as I have mostly been working on core features. I would be quite interested if more people could exercise SSH push mode, ideally at larger scales.


Re pull request, will do.

Re push mode, I'm just poking around in docs and code at the moment, trying to wrap my head around what you're up to, but I have some Ansible that builds an image that would use push mode, and I've been thinking that I should port it to OpsMop (and build it in Vespene), so I'll do that to test. It's just a one-of image that we copy, run an update on to configure board-specific stuff and then deploy, so I haven't got much that I can do at scale at the moment.

I've just started looking at OpsMop, but I like what you're doing, the abstractions make a lot of sense to me (and thank you for the excellent docs - I've found that you can tell a quality project by the quality of the docs). One of the first things I did with Ansible was try to figure out what I could import as a module, but I figured it would have been hacky, so I ended up writing a lot of custom modules and running playbooks with Python subprocess. (Please don't tell me there was a way, at this point I don't want to know ;))

Looking forward to seeing how it turns out and hopefully making some kind of contribution.


Excellent, thanks! ...