{"action":"created","issue":{"url":"https://api.github.com/repos/rapid7/nexpose-client/issues/148","labels_url":"https://api.github.com/repos/rapid7/nexpose-client/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/rapid7/nexpose-client/issues/148/comments","events_url":"https://api.github.com/repos/rapid7/nexpose-client/issues/148/events","html_url":"https://github.com/rapid7/nexpose-client/issues/148","id":64744879,"number":148,"title":"Delete assets from sites if there is no deviceid","user":{"login":"98231jssa","id":11679165,"avatar_url":"https://avatars.githubusercontent.com/u/11679165?v=3","gravatar_id":"","url":"https://api.github.com/users/98231jssa","html_url":"https://github.com/98231jssa","followers_url":"https://api.github.com/users/98231jssa/followers","following_url":"https://api.github.com/users/98231jssa/following{/other_user}","gists_url":"https://api.github.com/users/98231jssa/gists{/gist_id}","starred_url":"https://api.github.com/users/98231jssa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/98231jssa/subscriptions","organizations_url":"https://api.github.com/users/98231jssa/orgs","repos_url":"https://api.github.com/users/98231jssa/repos","events_url":"https://api.github.com/users/98231jssa/events{/privacy}","received_events_url":"https://api.github.com/users/98231jssa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rapid7/nexpose-client/labels/Bug","name":"Bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"sgreen-r7","id":10285110,"avatar_url":"https://avatars.githubusercontent.com/u/10285110?v=3","gravatar_id":"","url":"https://api.github.com/users/sgreen-r7","html_url":"https://github.com/sgreen-r7","followers_url":"https://api.github.com/users/sgreen-r7/followers","following_url":"https://api.github.com/users/sgreen-r7/following{/other_user}","gists_url":"https://api.github.com/users/sgreen-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/sgreen-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgreen-r7/subscriptions","organizations_url":"https://api.github.com/users/sgreen-r7/orgs","repos_url":"https://api.github.com/users/sgreen-r7/repos","events_url":"https://api.github.com/users/sgreen-r7/events{/privacy}","received_events_url":"https://api.github.com/users/sgreen-r7/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2015-03-27T11:46:11Z","updated_at":"2015-04-15T09:58:20Z","closed_at":null,"body":"Hi,\r\nI'm managing an instance of nexpose with about 100K assets, split in quite some groups, and I have frequently the need to delete/add/tag assets in the various sites so I do it via the ruby API.\r\n\r\nTake this example code:\r\n```ruby\r\nnsc = Connection.new(NexposeIP, NexposeUN,NexposePW)\r\n[...]\r\n            if not assetid.nil? # Is a device\r\n                $log.debug \"Deleting device #{asset.hostip} - ID #{assetid} from site #{asset.sitename}\"\r\n                nsc.delete_device(assetid)\r\n            else # is only an asset\r\n                $log.debug \"Deleting asset #{asset.hostip} from site #{asset.sitename} - Current site is #{site.name}\"\r\n                site.remove_asset(asset.hostip)\r\n            end\r\n[...]\r\nsite.save(nsc)\r\n```\r\nf I have an assetID the device gets always deleted properly, but the remove_asset function doesn't work as expected when the asset doesn't have an ID.\r\nThe behaviour I observe is that even if I issue a remove_asset on the site and save it, the site definition still contains the asset (in the site.assets array).\r\nMy biggest problem is that when I delete an asset from a site I must be sure it doesn't get scanned in the next discovery scan.\r\n\r\nIs my code wrong or is it a bug?\r\nYou can cross-related this with internal support case  00122399 for more details.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rapid7/nexpose-client/issues/comments/93296740","html_url":"https://github.com/rapid7/nexpose-client/issues/148#issuecomment-93296740","issue_url":"https://api.github.com/repos/rapid7/nexpose-client/issues/148","id":93296740,"user":{"login":"98231jssa","id":11679165,"avatar_url":"https://avatars.githubusercontent.com/u/11679165?v=3","gravatar_id":"","url":"https://api.github.com/users/98231jssa","html_url":"https://github.com/98231jssa","followers_url":"https://api.github.com/users/98231jssa/followers","following_url":"https://api.github.com/users/98231jssa/following{/other_user}","gists_url":"https://api.github.com/users/98231jssa/gists{/gist_id}","starred_url":"https://api.github.com/users/98231jssa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/98231jssa/subscriptions","organizations_url":"https://api.github.com/users/98231jssa/orgs","repos_url":"https://api.github.com/users/98231jssa/repos","events_url":"https://api.github.com/users/98231jssa/events{/privacy}","received_events_url":"https://api.github.com/users/98231jssa/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T09:58:20Z","updated_at":"2015-04-15T09:58:20Z","body":"Hi, I'm back and can run all the tests required.\r\nShall I update to 1.0 before checking again whether the Site#remove_asset works as expected or the change didn't make it for release?\r\n"}}