Merge branch '20541-less-fetching-mounts'
[arvados.git] / lib / cloud / azure / azure.go
index 1ff0798ea6e499396667d70091b62de2eddaaadf..494db854ed3c857fbf47f714f46b5c605120e30e 100644 (file)
@@ -514,20 +514,23 @@ func (az *azureInstanceSet) Create(
                                AdminUsername: to.StringPtr(az.azconfig.AdminUsername),
                                LinuxConfiguration: &compute.LinuxConfiguration{
                                        DisablePasswordAuthentication: to.BoolPtr(true),
-                                       SSH: &compute.SSHConfiguration{
-                                               PublicKeys: &[]compute.SSHPublicKey{
-                                                       {
-                                                               Path:    to.StringPtr("/home/" + az.azconfig.AdminUsername + "/.ssh/authorized_keys"),
-                                                               KeyData: to.StringPtr(string(ssh.MarshalAuthorizedKey(publicKey))),
-                                                       },
-                                               },
-                                       },
                                },
                                CustomData: &customData,
                        },
                },
        }
 
+       if publicKey != nil {
+               vmParameters.VirtualMachineProperties.OsProfile.LinuxConfiguration.SSH = &compute.SSHConfiguration{
+                       PublicKeys: &[]compute.SSHPublicKey{
+                               {
+                                       Path:    to.StringPtr("/home/" + az.azconfig.AdminUsername + "/.ssh/authorized_keys"),
+                                       KeyData: to.StringPtr(string(ssh.MarshalAuthorizedKey(publicKey))),
+                               },
+                       },
+               }
+       }
+
        if instanceType.Preemptible {
                // Setting maxPrice to -1 is the equivalent of paying spot price, up to the
                // normal price. This means the node will not be pre-empted for price
@@ -785,6 +788,10 @@ func (ai *azureInstance) Address() string {
        }
 }
 
+func (ai *azureInstance) PriceHistory(arvados.InstanceType) []cloud.InstancePrice {
+       return nil
+}
+
 func (ai *azureInstance) RemoteUser() string {
        return ai.provider.azconfig.AdminUsername
 }