@@ -116,10 +116,6 @@ class Flavor(UuidAuditedModel):
116116 params = fields .ParamsField ()
117117 init = fields .CloudInitField ()
118118
119- ssh_username = models .CharField (max_length = 64 , default = 'ubuntu' )
120- ssh_private_key = models .TextField ()
121- ssh_public_key = models .TextField ()
122-
123119 class Meta :
124120 unique_together = (('owner' , 'id' ),)
125121
@@ -187,6 +183,10 @@ class Formation(UuidAuditedModel):
187183 image = models .CharField (max_length = 256 , default = 'ubuntu' )
188184 structure = fields .JSONField (default = '{}' , blank = True )
189185
186+ ssh_username = models .CharField (max_length = 64 , default = 'ubuntu' )
187+ ssh_private_key = models .TextField ()
188+ ssh_public_key = models .TextField ()
189+
190190 class Meta :
191191 unique_together = (('owner' , 'id' ),)
192192
@@ -506,11 +506,11 @@ def _prepare_launch_args(self):
506506 'proxy' , {}).setdefault ('formations' , [ self .formation .id ])
507507 # add the formation's ssh pubkey
508508 init .setdefault ('ssh_authorized_keys' , []).append (
509- self .formation .flavor . ssh_public_key )
509+ self .formation .ssh_public_key )
510510 # add all of the owner's SSH keys
511511 init ['ssh_authorized_keys' ].extend ([k .public for k in self .formation .owner .key_set .all () ])
512- ssh_username = self .formation .flavor . ssh_username
513- ssh_private_key = self .formation .flavor . ssh_private_key
512+ ssh_username = self .formation .ssh_username
513+ ssh_private_key = self .formation .ssh_private_key
514514 args = (self .uuid , creds , params , init , ssh_username , ssh_private_key )
515515 return args
516516
@@ -521,9 +521,9 @@ def converge(self, *args, **kwargs):
521521 return tasks .converge_node .subtask (args )
522522
523523 def _prepare_converge_args (self ):
524- ssh_username = self .formation .flavor . ssh_username
524+ ssh_username = self .formation .ssh_username
525525 fqdn = self .fqdn
526- ssh_private_key = self .formation .flavor . ssh_private_key
526+ ssh_private_key = self .formation .ssh_private_key
527527 args = (self .uuid , ssh_username , fqdn , ssh_private_key )
528528 return args
529529
0 commit comments