Skip to content

Implement a composer.installed/update option to disable cache #45093

Closed

Description

@boltronics

Description of Issue/Question

There is no obvious way to disable composer cache via the composer-related state and execution modules. It would be great to have one provided.

As it stands, using the composer.installed state with the user option causes the warnings:

Cannot create cache directory /root/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /root/cache/files/, or directory is not writable. Proceeding without cache

The current best option to avoid both cache and warnings is to create a directory under /tmp, set composer_home to whatever that directory was, and then delete it via onchanges states. This is not ideal.

According to composer/composer#6650 this can be achieved via the COMPOSER_CACHE_DIR environment variable. It might be more flexible to have an option simply expose this environment variable in a way that is similar to how the composer_home option exposes the COMPOSER_HOME environment variable. Then COMPOSER_CACHE_DIR can be set by the user to /dev/null.

Alternatively, a dedicated no_cache option could be implemented which is the equivalent of setting COMPOSER_CACHE_DIR to /dev/null which would be more intuitive but less flexible, so I'm guessing the former implementation method would probably be better.

Versions Report

Salt Version:
           Salt: 2017.7.2
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: 1.3.7
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Nov 24 2017, 17:33:09)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1
 
System Versions:
           dist: debian 9.3 
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-4-amd64
         system: Linux
        version: debian 9.3 

Activity

  1. Ch3LL commented on Dec 20, 2017

    @Ch3LL
    Contributor

    Sounds like a decent approach. Will approve as a feature request :) Please feel free to give a go at a PR

  2. added
    Feature
    on Dec 20, 2017
  3. added this to the Approved milestone on Dec 20, 2017
  4. stale commented on Apr 14, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Execution-ModuleFeaturestale

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions