@@ -121,30 +121,36 @@ def call(args, context):
121121 results = glob .glob (filepath , recursive = True )
122122
123123 if len (results ) < 1 :
124- print (f"No file found matching pattern { filepath } " )
124+ print (f"No file found matching pattern { filepath } " , file = sys . stderr )
125125 sys .exit (ExitCodes .FILE_ERROR )
126126
127127 if len (results ) > 1 :
128128 print (
129- f"warn: Found multiple files matching pattern { filepath } , using { results [0 ]} "
129+ f"warn: Found multiple files matching pattern { filepath } , using { results [0 ]} " ,
130+ file = sys .stderr ,
130131 )
131132
132133 filepath = results [0 ]
133134
134135 if not os .path .isfile (filepath ):
135- print (f"No file at { filepath } ; must be a path to a valid file." )
136+ print (
137+ f"No file at { filepath } ; must be a path to a valid file." ,
138+ file = sys .stderr ,
139+ )
136140 sys .exit (ExitCodes .FILE_ERROR )
137141
138142 # make sure it's not larger than the max upload size
139143 if os .path .getsize (filepath ) > MAX_UPLOAD_SIZE :
140144 print (
141- f"File { filepath } is too large; compressed size must be less than 5GB"
145+ f"File { filepath } is too large; compressed size must be less than 5GB" ,
146+ file = sys .stderr ,
142147 )
143148 sys .exit (ExitCodes .FILE_ERROR )
144149
145150 if not parsed .region :
146151 print (
147- "No region provided. Please set a default region or use --region"
152+ "No region provided. Please set a default region or use --region" ,
153+ file = sys .stderr ,
148154 )
149155 sys .exit (ExitCodes .ARGUMENT_ERROR )
150156
@@ -165,17 +171,22 @@ def call(args, context):
165171 print (
166172 "Your token was not authorized to use this endpoint. Please "
167173 "reconfigure the CLI with `linode-cli configure` to ensure you "
168- "can make this request."
174+ "can make this request." ,
175+ file = sys .stderr ,
169176 )
170177 sys .exit (ExitCodes .REQUEST_FAILED )
171178 if status == 404 :
172179 print (
173180 "It looks like you are not in the Machine Images Beta, and therefore "
174181 "cannot upload images yet. Please stay tuned, or open a support ticket "
175- "to request access."
182+ "to request access." ,
183+ file = sys .stderr ,
176184 )
177185 sys .exit (ExitCodes .REQUEST_FAILED )
178- print (f"Upload failed with status { status } ; response was { resp } " )
186+ print (
187+ f"Upload failed with status { status } ; response was { resp } " ,
188+ file = sys .stderr ,
189+ )
179190 sys .exit (ExitCodes .REQUEST_FAILED )
180191
181192 # grab the upload URL and image data
0 commit comments