saltstack / saltstack/salt

[BUG] salt-cloud keep_tmp setting in provider/profile configuration is ignored

Open
#58,305 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Salt-Cloud severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
keep_tmp: True argument in provider/profile conf files is ignored, tmp folder is not removed from minion
(it works from cli passing the option as an argument: salt-cloud --keep-tmp)
Looks like it's getting keep_tmp: False from opts dict and is not using whatever is set in provider/profile

salt/cloud/test1/deploying	{
    "event": "executing deploy script",
    "kwargs": {
        "keep_tmp": false,
        "vm_": {
                   "keep_tmp": true,

**Workaroud: set keep_tmp: True in master config /etc/salt/master.d/**

Or hardcode it in /usr/lib/python3.6/site-packages/salt/utils/cloud.py

deploy_kwargs = {
  "vm_": vm_,
       "keep_tmp": True,  # it was set to opts["keep_tmp"]

I printed out the opts dict from utils/cloud.py to verify
opts:

       "providers": {
           "my-ec2": {
               "ec2": {
                   "profiles": {
                       "aws-minions-linux-micro": {
                           "keep_tmp": true,
                       }
                   }
               }
           }
       },
       "profiles": {
           "aws-minions-linux-micro": {
               "keep_tmp": true,
           }
       },
       "keep_tmp": false,

Setup
Salt: 3001.1

Steps to Reproduce the behavior
Set keep_tmp: True in profile and/or provider conf
deploy a new instance: salt-cloud -p profile instance_name

Once deployed, check the tmp folder /tmp/.saltcloud* has not been preserved.

Repeat process setting up keep_tmp: True in /etc/salt/master.d/keep_tmp.conf, this way it gets set in the opts dict
The /tmp/.saltcloud* will be preserved this time.

Expected behavior
Use keep_tmp from provider/profile configurations, not from opts dict

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in salt/utils/cloud.py at the deploy_kwargs construction shown in the report, then reproduce with salt-cloud -p profile instance_name using keep_tmp: True in the provider or profile configuration. Confirm that the resulting deployment preserves /tmp/.saltcloud* without requiring the setting in /etc/salt/master.d/.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.