caktus / django-project-template

Django project template for startproject (Requires 2.2+)
209 stars 53 forks source link

Use npm salt state to install less #174

Closed vkurup closed 9 years ago

vkurup commented 9 years ago

This:

  1. Removes the chris-lea PPA (which has been deprecated). I didn't replace it with the nodesource PPA, since Ubuntu's default versions seem adequate (nodejs=v0.10.25, npm=1.3.10)
  2. Uses the new(ish) salt state to install less

Addresses caktus/margarita#46 and #163

vkurup commented 9 years ago

I updated the code, unfortunately, I'm seeing a bug in salt that doesn't install the version specified. I added my findings to the bug report: https://github.com/saltstack/salt/issues/23343#issuecomment-114173434

dpoirier commented 9 years ago

How about just using 'cmd.run' to invoke 'npm install'?

vkurup commented 9 years ago

That's what we currently do. I was trying to find a way to get rid of the 'pipe-to-grep' unless statement which is problematic in salt 2015. I thought this would be a simple way to get rid of that...

vkurup commented 9 years ago

OK, I just tested this 'the old fashioned way'. I installed less 2.5.1 on the server and then I ran a deploy using the unless command with the pipe-to-grep in it, and salt successfully downgraded less to 2.1.0 (the version specified in the pillar). As noted in #163, the salt release notes mentioned that the cmd module was unaffected, so maybe that truly is the case.

I also included the nodejs-legacy package which is needed to make the debian/ubuntu node package act like the deprecated chris-lea PPA package.

mlavin commented 9 years ago

The more we look into these issues the less I feel like I understand what actually changed here. The only thing I'm getting here is that they added npm states to Salt but they don't actually work (╯°□°)╯︵ ┻━┻

vkurup commented 9 years ago

I feel the same way. I just did one final test: a redeploy, when the proper version of less had already been installed. This should make the unless clause run, which should find the properly-installed version of less, and therefore the state should not run. That's exactly what happened:

2015-06-23 15:01:24,216 [salt.state       ][INFO    ][16440] Running state [npm install less@2.1.0 -g] at time 15:01:24.215808
2015-06-23 15:01:24,216 [salt.state       ][INFO    ][16440] Executing state cmd.run for npm install less@2.1.0 -g
2015-06-23 15:01:24,239 [salt.loaded.int.module.cmdmod][INFO    ][16440] Executing command 'which lessc && lessc --version | grep 2.1.0' as user 'root' in directory '/root'
2015-06-23 15:01:24,333 [salt.state       ][INFO    ][16440] unless execution succeeded
2015-06-23 15:01:24,334 [salt.state       ][INFO    ][16440] Completed state [npm install less@2.1.0 -g] at time 15:01:24.333746

This is on salt 2015.0. So, I'm also confused... it seems like pipe-to-grep works perfectly. The only thing I can think of is that the Postgres state that was malfunctioning was a cmd.wait state and all the other states with 'shellisms' are cmd.run states. The salt source code for those 2 states looks very different, so I wouldn't be surprised if they had different behaviors.

Bottom line: This PR doesn't address #163 at all... it only changes from using the chris-lea repo to using the standard Ubuntu repo, which I think may be valid, but totally unrelated. I'm happy to close this and create a new issue for it, so it can be discussed (the other option would be switching to the nodesource PPA)

mlavin commented 9 years ago

There are still good changes here. We shouldn't continue to use the deprecated PPA. :ship:

kelein commented 7 years ago

salt-call output occurs npm debug info

when I execute commands on a minion salt-call sys.list_modules --output=json, the output is:

[INFO    ] Executing command 'npm --version' in directory '/root'
{
    "local": [
        "acl", 
        "aliases", 
        "alternatives", 
        "apache", 
        "archive", 
         ...
        "user", 
        "vbox_guest", 
        "virtualenv", 
        "webutil", 
        "xfs"
    ]
}

I don't know why it contains this: [INFO ] Executing command 'npm --version' in directory '/root'

Salt-Version

salt-minion 2016.3.1 (Boron)