Closed jkmassel closed 1 year ago
@jkmassel Is there a good way for me to test this PR out?
@spencertransier – shoot sorry! Added a testing note in the PR description.
@jkmassel I'm seeing some errors when running that command. I'm not sure if it's something that needs to be fixed on our side or not since they're down in the async-http-client
package. I see that we're pinning to an older version because it broke S3. They've released several new versions of the package since then, maybe we could try updating it again?
spencer@16 ~/G/hostmgr (fix/vm-image-sync) [1]> swift run hostmgr sync authorized_keys
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:25:35: error: 'tls_protocol_version_t' is only available in macOS 10.15 or newer
var nwTLSProtocolVersion: tls_protocol_version_t {
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:25:13: note: add @available attribute to enclosing property
var nwTLSProtocolVersion: tls_protocol_version_t {
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:23:5: note: add @available attribute to enclosing extension
extension TLSVersion {
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:28:25: error: 'TLSv10' is only available in macOS 10.15 or newer
return .TLSv10
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:28:25: note: add 'if #available' version check
return .TLSv10
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:25:13: note: add @available attribute to enclosing property
var nwTLSProtocolVersion: tls_protocol_version_t {
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:23:5: note: add @available attribute to enclosing extension
extension TLSVersion {
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:30:25: error: 'TLSv11' is only available in macOS 10.15 or newer
return .TLSv11
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:30:25: note: add 'if #available' version check
return .TLSv11
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:25:13: note: add @available attribute to enclosing property
var nwTLSProtocolVersion: tls_protocol_version_t {
^
/Users/spencer/GitHub/hostmgr/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift:23:5: note: add @available attribute to enclosing extension
extension TLSVersion {
^
[14/15] Compiling AsyncHTTPClient ConnectionPool.swift
error: fatalError
@jkmassel I tried updating to the current version (1.11.0) of async-http-client
and confirmed that it did fix the issue I was seeing before by adding availability checks.
When I run swift run hostmgr sync authorized_keys
, I get this error:
2022-07-19T17:01:18-0600 debug com.automattic.hostmgr : Downloading file from s3:///authorized_keys in us-east-1 to /Users/spencer/.ssh/authorized_keys
2022-07-19T17:01:18-0600 trace com.automattic.hostmgr : Job schedule allows for running
Using configurationFile to connect to AWS
Error: NoSuchBucket: The specified bucket does not exist
Do you remember if this was the same error you ran into when updating async-http-client
last year? https://github.com/Automattic/hostmgr/pull/8/files
@jkmassel CI is getting a couple errors on that last commit:
/usr/local/var/buildkite-agent/builds/builder/automattic/hostmgr/Sources/libhostmgr/CommandPolicy.swift:3:13: error: type 'CommandPolicy' does not conform to protocol 'Decodable' | public enum CommandPolicy: Equatable, Codable { | ^ | /usr/local/var/buildkite-agent/builds/builder/automattic/hostmgr/Sources/libhostmgr/CommandPolicy.swift:3:13: error: type 'CommandPolicy' does not conform to protocol 'Encodable' | public enum CommandPolicy: Equatable, Codable { | ^ | Swift.Decodable:2:5: note: protocol requires initializer 'init(from:)' with type '(from: Decoder)' | init(from decoder: Decoder) throws | ^ | Swift.Encodable:2:10: note: protocol requires function 'encode(to:)' with type '(Encoder) throws -> ()' | func encode(to encoder: Encoder) throws
Running the swift run hostmgr sync authorized_keys
on my Mac with the latest commits pulled, I'm seeing this error:
ArgumentParser/Flag.swift:73: Fatal error:
Can't read a value from a parsable argument definition.
This error indicates that a property declared with an
@Argument
,@Option
,@Flag
, or@OptionGroup
property wrapper was neither initialized to a value nor decoded from command-line arguments.To get a valid value, either call one of the static parsing methods (
parse
,parseAsRoot
, ormain
) or define an initializer that initializes every property of your parsable type.
@spencertransier / @crazytonyli – this should finally be ready for re-review! Thanks for the great feedback 🙇
(I shared this with @jkmassel on Slack but thought it could be useful to include here) I'm seeing this error when testing out hostmgr
locally:
swift run hostmgr sync
Building for debugging...
Build complete! (0.80s)
Running authorized_keys
Error: The file “state” couldn’t be opened because there is no such file.
Fixes sync with better conditional checking.
To Test
swift run hostmgr sync authorized_keys
. Ensure that it runs correctly.