ReticentRobot / SnipeAgent

Windows Agent for Snipe-IT Open Source Asset Management
Apache License 2.0
26 stars 6 forks source link

Series of JSON errors when attempting to run #2

Open LucianTheDivine opened 3 years ago

LucianTheDivine commented 3 years ago

Unhandled Exception: SnipeSharp.Exceptions.InvalidStatusLabelTypeException: In Stock / Storage Is an invalid status label. Use undeployable, deployable, pending, archived, in production, ready to deploy at SnipeSharp.Endpoints.Models.StatusLabel.set_Type(String value) in C:\Users\mccrory\Source\SnipeSharp\SnipeSharp\Endpoints\Models\StatusLabel.cs:line 36 at SnipeSharp.Endpoints.Models.StatusLabel..ctor(String name) in C:\Users\mccrory\Source\SnipeSharp\SnipeSharp\Endpoints\Models\StatusLabel.cs:line 13 at Void .ctor(System.String)(Object[] ) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) at SnipeSharp.Endpoints.ExtendedManagers.AssetEndpointManager.FindBySerial(String serial) in C:\Users\mccrory\Source\SnipeSharp\SnipeSharp\Endpoints\ExtendedManagers\AssetEndpointManager.cs:line 35 at SnipeAgent.Broker.SyncAll(SnipeItApi snipe, Asset currentAsset, Model currentModel, Manufacturer currentManufacturer, Category currentCategory, Company currentCompany, StatusLabel currentStatusLabel, Location currentLocation) in C:\Users\mccrory\Source\SnipeAgent\Broker.cs:line 194 at SnipeAgent.SnipeAgent.Main(String[] args) in C:\Users\mccrory\Source\SnipeAgent\SnipeAgent.cs:line 354

Received this error after installing agent, copying over known working config file, and then triggering the agent.exe via PSEXEC remotely.

LucianTheDivine commented 3 years ago

This "In Stock / Storage" is a custom label we have, but I don't know where it's pulling that from. It's not set as the default label, and it's not the label set in the config file either.

boingball commented 3 years ago

Hi Lucian, The SnipeSharp Reference

Library in Endpoints > Models > StatusLabel.cs on line 29 has the following code string[] validTypes = {"undeployable", "deployable", "pending", "archived", "in production", "ready to deploy" };

Custom status labels throw an exception as they are not on this list. You can add to this list and recompile - it accepts small case

I've had to do it for my install and set it too string[] validTypes = {"undeployable", "deployable", "pending", "archived", "in production", "ready to deploy", "with user" };

as I use the with user status.

I've compiled a SnipeSharp.dll with "in stock / storage" and attached it here SnipeSharp.zip

You should be able to drop this dll and overwrite the SnipeSharp.dll in your SnipeAgent install directory.

SnipeSharp needs an update to get the Status Labels from SnipeIT instead off assuming the defaults

SashkaNebesny commented 1 year ago

Hi Lucian, The SnipeSharp Reference

Library in Endpoints > Models > StatusLabel.cs on line 29 has the following code string[] validTypes = {"undeployable", "deployable", "pending", "archived", "in production", "ready to deploy" };

Custom status labels throw an exception as they are not on this list. You can add to this list and recompile - it accepts small case

I've had to do it for my install and set it too string[] validTypes = {"undeployable", "deployable", "pending", "archived", "in production", "ready to deploy", "with user" };

as I use the with user status.

I've compiled a SnipeSharp.dll with "in stock / storage" and attached it here SnipeSharp.zip

You should be able to drop this dll and overwrite the SnipeSharp.dll in your SnipeAgent install directory.

SnipeSharp needs an update to get the Status Labels from SnipeIT instead off assuming the defaults

Please recompile the file with the statuses for me as well: Доступні для використання, На зберіганні (склад), На зберіганні (розукомплектація), Списані з обліку I don't know if there is Cyrillic support