Repository: conda/conda

Issue:
conda install --dry-run with certain options will really install
I just executed:

``` bash
sudo -u wakari /opt/wakari/anaconda/bin/conda install  --no-deps --offline  -p /opt/wakari/anaconda --dry-run `cat ~/.py27_packages.txt`
```

And this command then went and installed the packages.

This might be related to #1317

conda install --dry-run with certain options will really install
I just executed:

``` bash
sudo -u wakari /opt/wakari/anaconda/bin/conda install  --no-deps --offline  -p /opt/wakari/anaconda --dry-run `cat ~/.py27_packages.txt`
```

And this command then went and installed the packages.

This might be related to #1317



Discussion:
I just tested this out and with conda 4.3.16 this issue is resolved:

```
$ conda install  --no-deps --offline  -p /tmp/test --dry-run `cat test.txt`
Fetching package metadata ...............
Solving package specifications: .

Package plan for installation in environment /tmp/test:

The following NEW packages will be INSTALLED:

    bokeh:        0.12.5-py27_0      anaconda
    matplotlib:   2.0.0-np112py27_0  anaconda
    mkl:          2017.0.1-0         anaconda
    numpy:        1.12.1-py27_0      anaconda
    pandas:       0.19.2-np112py27_1 anaconda
    scikit-learn: 0.18.1-np112py27_1 anaconda
    scipy:        0.19.0-np112py27_0 anaconda

$
```
I just tested this out and with conda 4.3.16 this issue is resolved:

```
$ conda install  --no-deps --offline  -p /tmp/test --dry-run `cat test.txt`
Fetching package metadata ...............
Solving package specifications: .

Package plan for installation in environment /tmp/test:

The following NEW packages will be INSTALLED:

    bokeh:        0.12.5-py27_0      anaconda
    matplotlib:   2.0.0-np112py27_0  anaconda
    mkl:          2017.0.1-0         anaconda
    numpy:        1.12.1-py27_0      anaconda
    pandas:       0.19.2-np112py27_1 anaconda
    scikit-learn: 0.18.1-np112py27_1 anaconda
    scipy:        0.19.0-np112py27_0 anaconda

$
```

Resolving patch:
diff --git a/conda/base/context.py b/conda/base/context.py
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -136,6 +136,7 @@ class Context(Configuration):
     always_yes = PrimitiveParameter(False, aliases=('yes',))
     channel_priority = PrimitiveParameter(True)
     debug = PrimitiveParameter(False)
+    dry_run = PrimitiveParameter(False)
     force = PrimitiveParameter(False)
     json = PrimitiveParameter(False)
     offline = PrimitiveParameter(False)
@@ -459,6 +460,7 @@ def list_parameters(self):
             'croot',
             'debug',
             'default_python',
+            'dry_run',
             'force_32bit',
             'migrated_custom_channels',
             'root_dir',
diff --git a/conda/core/link.py b/conda/core/link.py
--- a/conda/core/link.py
+++ b/conda/core/link.py
@@ -261,6 +261,7 @@ def execute(self):
         if not self._verified:
             self.verify()
 
+        assert not context.dry_run
         # make sure prefix directory exists
         if not isdir(self.target_prefix):
             try:
diff --git a/conda/core/package_cache.py b/conda/core/package_cache.py
--- a/conda/core/package_cache.py
+++ b/conda/core/package_cache.py
@@ -486,6 +486,7 @@ def execute(self):
         if not self._prepared:
             self.prepare()
 
+        assert not context.dry_run
         with signal_handler(conda_signal_handler):
             for action in concatv(self.cache_actions, self.extract_actions):
                 self._execute_action(action)


Test patch: