bl4ko / netbox-ssot

Microservice that synces objects from multiple sources into netbox and makes it automatic SSOT.
MIT License
29 stars 4 forks source link

HTTPScheme is not being read from config.yaml. #54

Closed bitstreambiker closed 6 months ago

bitstreambiker commented 6 months ago

If you set HTTPScheme: "http" in the config.yaml it is not getting picked up by the parser and is being set to "https" by default.

netbox: apiToken: "170397d82a14d3b6d50a74d1b7241fc90b0ef567" hostname: "127.0.0.1" port: 8080 timeout: 30 sourcePriority: ["olvm"] # Not required, but recommended HTTPScheme: "http" validateCert: false

Debug output:

❯ go run main.go Netbox-SSOT has started at 2024-03-12T11:13:19-04:00 2024/03/12 11:13:19 main.go:38 DEBUG (main): Parsed Logger config: LoggerConfig{Level: 0, Dest: stdout} 2024/03/12 11:13:19 main.go:39 DEBUG (main): Parsed Netbox config: NetboxConfig{ApiToken: 170397d82a14d3b6d50a74d1b7241fc90b0ef567, Hostname: 127.0.0.1, Port: 8080, HTTPScheme: https, ValidateCert: false, Timeout: 30, Tag: netbox-ssot, TagColor: 00add8, RemoveOrphans: true} 2024/03/12 11:13:19 main.go:40 DEBUG (main): Parsed Source config: [SourceConfig{Name: olvm, Type: ovirt, HTTPScheme: https, Hostname: he-prod.phx.ipengine360.net, Port: 443, Username: mark.hudson@internal, Password: xyzpok-mAfzyq-xekpy1, PermittedSubnets: [], ValidateCert: false, Tag: Source: olvm, TagColor: aa1409, HostSiteRelations: [], ClusterSiteRelations: [], clusterTenantRelations: [], HostTenantRelations: [], VmTenantRelations [], VlanGroupRelations: [], VlanTenantRelations: []}] 2024/03/12 11:13:19 main.go:48 DEBUG (main): Netbox inventory: NetBoxInventory{Logger: &{Logger:0xc00033e690 level:0}, NetboxConfig: NetboxConfig{ApiToken: 170397d82a14d3b6d50a74d1b7241fc90b0ef567, Hostname: 127.0.0.1, Port: 8080, HTTPScheme: https, ValidateCert: false, Timeout: 30, Tag: netbox-ssot, TagColor: 00add8, RemoveOrphans: true}...} 2024/03/12 11:13:19 main.go:50 INFO (main): Starting initializing netbox inventory 2024/03/12 11:13:19 inventory.go:171 DEBUG (inventory): Initializing Netbox API with baseURL: https://127.0.0.1:8080 2024/03/12 11:13:19 api.go:44 WARNING (inventory): TLS certificate validation is disabled 2024/03/12 11:13:19 rest.go:61 DEBUG (inventory): Getting all objects.CustomField from Netbox 2024/03/12 11:13:19 rest.go:64 DEBUG (inventory): Getting objects.CustomField with limit=100 and offset=0 2024/03/12 11:13:19 main.go:53 ERROR (main): Get "https://127.0.0.1:8080/api/extras/custom-fields/?limit=100&offset=0": tls: first record does not look like a TLS handshake: InitCustomFields-fm

bl4ko commented 6 months ago

Hello, thanks for reporting the issue, it is wrongly documented, the variable should be named httpScheme instead of HTTPScheme:

netbox:
    httpScheme: http
bl4ko commented 6 months ago

@bitstreambiker does this solve the problem for you, can I close the issue?

bitstreambiker commented 6 months ago

It does, thank you.

On Thu, Mar 14, 2024 at 4:56 AM Gasper Oblak @.***> wrote:

@bitstreambiker https://github.com/bitstreambiker does this solve the problem for you, can I close the issue?

— Reply to this email directly, view it on GitHub https://github.com/bl4ko/netbox-ssot/issues/54#issuecomment-1996904794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI4S3TOBFV26H36ZOFG65LYYFQ2JAVCNFSM6AAAAABESN4INSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWHEYDINZZGQ . You are receiving this because you were mentioned.Message ID: @.***>