cmd.run not respecting "unless"

278 views
Skip to first unread message

Barry Morrison

unread,
Jun 6, 2013, 9:28:09 PM6/6/13
to salt-...@googlegroups.com
I have this

#get jenkins.war
wget -O /var/lib/tomcat7/webapps/ROOT.war http://mirrors.jenkins-ci.org/war/latest/jenkins.war:
    cmd:
        - run
    require:
        - pkg:
           - tomcat7
        - unless: ls /var/lib/tomcat7/webapps|grep ROOT.war

I have tried putting " " around the command, I have tried 'find /var/lib/tomcat7/webapps' -name 'ROOT.war' -type f

It still continues to download this file every time! 

What am I missing?  

Thanks!  

Colton Myers

unread,
Jun 6, 2013, 10:44:55 PM6/6/13
to salt-...@googlegroups.com
First, what version are you running?

It may be the e-mail, but I'm seeing some formatting problems with indentation.  Additionally, I would put the unless before the require, because the unless is part of cmd.run, while require is global.  (However, I don't think it matters)  Here's how I would write that state:

wget -O /var/lib/tomcat7/webapps/ROOT.war http://mirrors.jenkins-ci.org/war/latest/jenkins.war:
    cmd:
        - run
        - unless: ls /var/lib/tomcat7/webapps | grep ROOT.war
        - require:
            - pkg: tomcat7

Keep me posted if that works for you.


--
Colton Myers


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Barry Morrison

unread,
Jun 6, 2013, 10:55:23 PM6/6/13
to salt-...@googlegroups.com
0.15.3

And you're correct...moving the unless fixed this.

Much appreciated! 

--
You received this message because you are subscribed to a topic in the Google Groups "Salt-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/salt-users/Dkzv3qf2JrE/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to salt-users+...@googlegroups.com.

Colton Myers

unread,
Jun 6, 2013, 10:57:39 PM6/6/13
to salt-...@googlegroups.com
Awesome!  Glad we got it figured out. =)

--
Colton Myers

Corey Quinn

unread,
Jun 6, 2013, 10:58:19 PM6/6/13
to salt-...@googlegroups.com, salt-...@googlegroups.com
I'd probably go a step further and have Jenkins stuff the WAR into an rpm or deb, then add it to a repository. Then you can pkg.install or pkg.latest.

--Corey

Barry Morrison

unread,
Jun 6, 2013, 11:01:26 PM6/6/13
to salt-...@googlegroups.com
I think the end goal is system packages.  Jenkins/FPM/something else? Need to investigate further.

--
You received this message because you are subscribed to a topic in the Google Groups "Salt-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/salt-users/Dkzv3qf2JrE/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to salt-users+...@googlegroups.com.

Corey Quinn

unread,
Jun 6, 2013, 11:06:21 PM6/6/13
to salt-...@googlegroups.com, salt-...@googlegroups.com
Rpm or deb shop?

Barry Morrison

unread,
Jun 6, 2013, 11:12:04 PM6/6/13
to salt-...@googlegroups.com
Deb -- Ubuntu specifically.

Corey Quinn

unread,
Jun 7, 2013, 12:27:35 AM6/7/13
to salt-...@googlegroups.com
All right, screw it, time for me to do a random good deed, namely packaging a WAR for you / anyone else who needs such a thing.

I've built https://github.com/KB1JWQ/packaging-stub for you, check it out, copy in your war, run debuild, and let me know what breaks, as I haven't tested it, I'll fix it until it works.

And Jenkins offers a debian/ubuntu package repository, if that helps anything. :-)

-- Corey

Joe Healy

unread,
Jun 7, 2013, 2:12:33 AM6/7/13
to salt-...@googlegroups.com
Hey Corey,

I think you need a dh $@ line in your debian/rules file.

Cheers,

Joe

Corey Quinn

unread,
Jun 7, 2013, 8:46:56 AM6/7/13
to salt-...@googlegroups.com
Doh, right you are.

Fixed.

-- Corey
Reply all
Reply to author
Forward
0 new messages