{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/24036","labels_url":"https://api.github.com/repos/saltstack/salt/issues/24036/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/24036/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/24036/events","html_url":"https://github.com/saltstack/salt/issues/24036","id":79066333,"number":24036,"title":"[salt-cloud] Protect against passing command line arguments as names for the --destroy command in map files","user":{"login":"arthurlogilab","id":445200,"avatar_url":"https://avatars.githubusercontent.com/u/445200?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurlogilab","html_url":"https://github.com/arthurlogilab","followers_url":"https://api.github.com/users/arthurlogilab/followers","following_url":"https://api.github.com/users/arthurlogilab/following{/other_user}","gists_url":"https://api.github.com/users/arthurlogilab/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurlogilab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurlogilab/subscriptions","organizations_url":"https://api.github.com/users/arthurlogilab/orgs","repos_url":"https://api.github.com/users/arthurlogilab/repos","events_url":"https://api.github.com/users/arthurlogilab/events{/privacy}","received_events_url":"https://api.github.com/users/arthurlogilab/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P3","name":"P3","color":"0a3d77"},{"url":"https://api.github.com/repos/saltstack/salt/labels/RIoT","name":"RIoT","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Salt-Cloud","name":"Salt-Cloud","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":2383,"closed_issues":2231,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-06-26T19:51:54Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-05-21T16:16:31Z","updated_at":"2015-06-26T23:08:44Z","closed_at":null,"body":"One can create a subset of a map by using the following command : \r\n\r\n```\r\nsalt-cloud -m my_map one_machine another_machine\r\n```\r\nIt seems that adding a --destroy offers to destroy all machines \r\n\r\n```\r\n# salt-cloud -m -d my_map one_machine another_machine\r\n[snip] \r\nThe following virtual machines are set to be destroyed:\r\n  ursa-lxc:\r\n    lxc:\r\n      third_machine\r\n      one_machine\r\n      another_machine\r\nProceed? [N/y] \r\n\r\n```\r\n\r\n```\r\n# salt-run --versions-report\r\n                  Salt: 2015.5.0\r\n                Python: 2.7.6 (default, Mar 22 2014, 22:59:56)\r\n                Jinja2: 2.7.2\r\n              M2Crypto: 0.21.1\r\n        msgpack-python: 0.3.0\r\n          msgpack-pure: Not Installed\r\n              pycrypto: 2.6.1\r\n               libnacl: Not Installed\r\n                PyYAML: 3.10\r\n                 ioflo: Not Installed\r\n                 PyZMQ: 14.0.1\r\n                  RAET: Not Installed\r\n                   ZMQ: 4.0.4\r\n                  Mako: 0.9.1\r\n Debian source package: 2015.5.0+ds-1trusty1\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/115913546","html_url":"https://github.com/saltstack/salt/issues/24036#issuecomment-115913546","issue_url":"https://api.github.com/repos/saltstack/salt/issues/24036","id":115913546,"user":{"login":"rallytime","id":6547906,"avatar_url":"https://avatars.githubusercontent.com/u/6547906?v=3","gravatar_id":"","url":"https://api.github.com/users/rallytime","html_url":"https://github.com/rallytime","followers_url":"https://api.github.com/users/rallytime/followers","following_url":"https://api.github.com/users/rallytime/following{/other_user}","gists_url":"https://api.github.com/users/rallytime/gists{/gist_id}","starred_url":"https://api.github.com/users/rallytime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rallytime/subscriptions","organizations_url":"https://api.github.com/users/rallytime/orgs","repos_url":"https://api.github.com/users/rallytime/repos","events_url":"https://api.github.com/users/rallytime/events{/privacy}","received_events_url":"https://api.github.com/users/rallytime/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T23:08:44Z","updated_at":"2015-06-26T23:08:44Z","body":"@arthurlogilab I am not sure how are you getting to that point where `salt-cloud -d` is asking you if you want to delete those machines. I was attempting to add a check to make sure you can't delete your entire map file, but it's stacktracing before I even get to that point:\r\n```\r\n# salt-cloud -m -d ~/mapfile nt-14\r\n[INFO    ] salt-cloud starting\r\n[ERROR   ] An un-handled exception was caught by salt's global exception handler:\r\nSaltCloudNotFound: The specified map file does not exist: -d\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/salt-cloud\", line 10, in <module>\r\n    salt_cloud()\r\n  File \"/root/SaltStack/salt/salt/scripts.py\", line 316, in salt_cloud\r\n    client.run()\r\n  File \"/root/SaltStack/salt/salt/cloud/cli.py\", line 86, in run\r\n    mapper = salt.cloud.Map(self.config)\r\n  File \"/root/SaltStack/salt/salt/cloud/__init__.py\", line 1558, in __init__\r\n    self.rendered_map = self.read()\r\n  File \"/root/SaltStack/salt/salt/cloud/__init__.py\", line 1646, in read\r\n    self.opts['map']\r\nSaltCloudNotFound: The specified map file does not exist: -d\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/salt-cloud\", line 10, in <module>\r\n    salt_cloud()\r\n  File \"/root/SaltStack/salt/salt/scripts.py\", line 316, in salt_cloud\r\n    client.run()\r\n  File \"/root/SaltStack/salt/salt/cloud/cli.py\", line 86, in run\r\n    mapper = salt.cloud.Map(self.config)\r\n  File \"/root/SaltStack/salt/salt/cloud/__init__.py\", line 1558, in __init__\r\n    self.rendered_map = self.read()\r\n  File \"/root/SaltStack/salt/salt/cloud/__init__.py\", line 1646, in read\r\n    self.opts['map']\r\nsalt.exceptions.SaltCloudNotFound: The specified map file does not exist: -d\r\n```\r\nVersions Report:\r\n```\r\n# salt-cloud --versions\r\n            Salt: 2015.5.0\r\n          Python: 2.7.6 (default, Mar 22 2014, 22:59:56)\r\n          Jinja2: 2.7.3\r\n        M2Crypto: 0.21.1\r\n  msgpack-python: 0.4.4\r\n    msgpack-pure: Not Installed\r\n        pycrypto: 2.6.1\r\n         libnacl: Not Installed\r\n          PyYAML: 3.11\r\n           ioflo: Not Installed\r\n           PyZMQ: 14.0.1\r\n            RAET: Not Installed\r\n             ZMQ: 4.0.4\r\n            Mako: 0.9.1\r\n Apache Libcloud: 0.14.1\r\n```\r\nThe stacktrace should be cleaned up, but I am not sure how you're getting past that stacktrace. I tried this on 2015.5.0, as well as 2015.5.2. "}}