Trying to scan for a literal in our Octo config and repository.Spaces.FindAll().ToList() works fine, spaceRepository.LibraryVariableSets.FindAll() works fine but spaceRepository.Projects.GetAll().ToList() results in OctopusResourceNotFoundException.
Tried the CLI as well and get the following:
The guys that own the platform suggested I try these forums. Any tips to get the API to work? I’m happy to take the option (if that exists) of going to the search box that checks all config for a particular server name. Even okay to export the whole DB to a text file and searching that if its a thing.
I was just using server name as an example of the type of literal I’m searching for. It could show up in any artifact including variable values, variable names, project names, package names, release names, etc.
I’m sure I can do SQL queries if you have something to get me started. Guess the intent would be to scan everything but sensitive values.
I just did some quick testing here and I think there are a few things you could try here. The first thing that comes to mind is to try replacing .ToList() with .ToArray() when using the Octopus.Client. This let powershell create an array object with everything returned in the call. However, I think it’s worth taking a look at our repository of existing scripts on GitHub.
I tried ToArray and get the same error. As you called out (and Donny recommended as well), I’m trying to get DB access to run some SQL queries.
The repository was useful for some initial ideas and examples while scripting up the searches. As indicated though they are failing and it looks like a data consistency issue to me. The repository also helped to understand the hierarchy of artifacts.
Thanks for the update. The fact that you’re seeing 404 is interesting and may hint towards a different issue (If you’re seeing it via the Octopus.Client). Seeing it via the CLI could just mean that it was simply unable to find the resource based on the input. I think for what you’re trying to achieve, SQL is still likely be the best option.
If you get stuck or have any further questions on this, please don’t hesitate to let me know.