Merge "Consolidate user visible spelling of keypair vs Key Pair"

This commit is contained in:
Jenkins 2014-01-22 05:51:24 +00:00 committed by Gerrit Code Review
commit 09f64ed0e2
16 changed files with 47 additions and 46 deletions

View File

@ -545,7 +545,7 @@ class BatchAction(Action):
.. attribute:: data_type_singular
A display name for the type of data that receives the
action. ("Keypair", "Floating IP", etc.)
action. ("Key Pair", "Floating IP", etc.)
.. attribute:: data_type_plural

View File

@ -31,14 +31,14 @@ from openstack_dashboard import api
NEW_LINES = re.compile(r"\r|\n")
KEYPAIR_ERROR_MESSAGES = {'invalid': _('Keypair names may '
KEYPAIR_ERROR_MESSAGES = {'invalid': _('Key pair names may '
'only contain letters, numbers, underscores '
'and hyphens.')}
class CreateKeypair(forms.SelfHandlingForm):
name = forms.CharField(max_length="255",
label=_("Keypair Name"),
label=_("Key Pair Name"),
validators=[validators.validate_slug],
error_messages=KEYPAIR_ERROR_MESSAGES)
@ -47,7 +47,7 @@ class CreateKeypair(forms.SelfHandlingForm):
class ImportKeypair(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Keypair Name"),
name = forms.CharField(max_length="255", label=_("Key Pair Name"),
validators=[validators.validate_slug],
error_messages=KEYPAIR_ERROR_MESSAGES)
public_key = forms.CharField(label=_("Public Key"), widget=forms.Textarea)
@ -64,5 +64,5 @@ class ImportKeypair(forms.SelfHandlingForm):
return keypair
except Exception:
exceptions.handle(request, ignore=True)
self.api_error(_('Unable to import keypair.'))
self.api_error(_('Unable to import key pair.'))
return False

View File

@ -24,8 +24,8 @@ from openstack_dashboard.usage import quotas
class DeleteKeyPairs(tables.DeleteAction):
data_type_singular = _("Keypair")
data_type_plural = _("Keypairs")
data_type_singular = _("Key Pair")
data_type_plural = _("Key Pairs")
def delete(self, request, obj_id):
api.nova.keypair_delete(request, obj_id)
@ -33,14 +33,14 @@ class DeleteKeyPairs(tables.DeleteAction):
class ImportKeyPair(tables.LinkAction):
name = "import"
verbose_name = _("Import Keypair")
verbose_name = _("Import Key Pair")
url = "horizon:project:access_and_security:keypairs:import"
classes = ("ajax-modal", "btn-upload")
class CreateKeyPair(tables.LinkAction):
name = "create"
verbose_name = _("Create Keypair")
verbose_name = _("Create Key Pair")
url = "horizon:project:access_and_security:keypairs:create"
classes = ("ajax-modal", "btn-create")
@ -54,14 +54,14 @@ class CreateKeyPair(tables.LinkAction):
self.verbose_name = string_concat(self.verbose_name, ' ',
_("(Quota exceeded)"))
else:
self.verbose_name = _("Create Keypair")
self.verbose_name = _("Create Key Pair")
classes = [c for c in self.classes if c != "disabled"]
self.classes = classes
return True
class KeypairsTable(tables.DataTable):
name = tables.Column("name", verbose_name=_("Keypair Name"))
name = tables.Column("name", verbose_name=_("Key Pair Name"))
fingerprint = tables.Column("fingerprint", verbose_name=_("Fingerprint"))
def get_object_id(self, keypair):
@ -69,6 +69,6 @@ class KeypairsTable(tables.DataTable):
class Meta:
name = "keypairs"
verbose_name = _("Keypairs")
verbose_name = _("Key Pairs")
table_actions = (CreateKeyPair, ImportKeyPair, DeleteKeyPairs,)
row_actions = (DeleteKeyPairs,)

View File

@ -126,7 +126,7 @@ class KeyPairViewTests(test.TestCase):
url = reverse('horizon:project:access_and_security:keypairs:import')
res = self.client.post(url, formData, follow=True)
self.assertEqual(res.redirect_chain, [])
msg = 'Unable to import keypair.'
msg = 'Unable to import key pair.'
self.assertFormErrors(res, count=1, message=msg)
def test_import_keypair_invalid_key_name(self):

View File

@ -70,7 +70,7 @@ class GenerateView(View):
except Exception:
redirect = reverse('horizon:project:access_and_security:index')
exceptions.handle(self.request,
_('Unable to create keypair: %(exc)s'),
_('Unable to create key pair: %(exc)s'),
redirect=redirect)
response = http.HttpResponse(mimetype='application/binary')

View File

@ -57,7 +57,7 @@ class SecurityGroupsTab(tabs.TableTab):
class KeypairsTab(tabs.TableTab):
table_classes = (KeypairsTable,)
name = _("Keypairs")
name = _("Key Pairs")
slug = "keypairs_tab"
template_name = "horizon/common/_detail_table.html"
@ -67,7 +67,7 @@ class KeypairsTab(tabs.TableTab):
except Exception:
keypairs = []
exceptions.handle(self.request,
_('Unable to retrieve keypair list.'))
_('Unable to retrieve key pair list.'))
return keypairs

View File

@ -5,7 +5,7 @@
{% block form_id %}create_keypair_form{% endblock %}
{% block form_action %}{% url 'horizon:project:access_and_security:keypairs:create' %}{% endblock %}
{% block modal-header %}{% trans "Create Keypair" %}{% endblock %}
{% block modal-header %}{% trans "Create Key Pair" %}{% endblock %}
{% block modal-body %}
<div class="left">
@ -15,12 +15,12 @@
</div>
<div class="right">
<h3>{% trans "Description" %}:</h3>
<p>{% trans "Keypairs are ssh credentials which are injected into images when they are launched. Creating a new key pair registers the public key and downloads the private key (a .pem file)." %}</p>
<p>{% trans "Key pairs are ssh credentials which are injected into images when they are launched. Creating a new key pair registers the public key and downloads the private key (a .pem file)." %}</p>
<p>{% trans "Protect and use the key as you would any normal ssh private key." %}</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Keypair" %}" />
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Key Pair" %}" />
<a href="{% url 'horizon:project:access_and_security:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -5,7 +5,7 @@
{% block form_id %}import_keypair_form{% endblock %}
{% block form_action %}{% url 'horizon:project:access_and_security:keypairs:import' %}{% endblock %}
{% block modal-header %}{% trans "Import Keypair" %}{% endblock %}
{% block modal-header %}{% trans "Import Key Pair" %}{% endblock %}
{% block modal-body %}
<div class="left">
@ -15,9 +15,9 @@
</div>
<div class="right">
<h3>{% trans "Description" %}:</h3>
<p>{% trans "Keypairs are how you login to your instance after it is launched." %}</p>
<p>{% trans "Choose a keypair name you will recognise and paste your SSH public key into the space provided." %}</p>
<p>{% trans "SSH keypairs can be generated with the ssh-keygen command:" %}</p>
<p>{% trans "Key Pairs are how you login to your instance after it is launched." %}</p>
<p>{% trans "Choose a key pair name you will recognise and paste your SSH public key into the space provided." %}</p>
<p>{% trans "SSH key pairs can be generated with the ssh-keygen command:" %}</p>
<p><pre>ssh-keygen -t rsa -f cloud.key</pre></p>
<p>{% trans "This generates a pair of keys: a key you keep private (cloud.key) and a public key (cloud.key.pub). Paste the contents of the public key file here." %}</p>
<p>{% trans "After launching an instance, you login using the private key (the username might be different depending on the image you launched):" %}</p>
@ -28,6 +28,6 @@
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Import Keypair" %}" />
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Import Key Pair" %}" />
<a href="{% url 'horizon:project:access_and_security:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -1,9 +1,9 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Create Keypair" %}{% endblock %}
{% block title %}{% trans "Create Key Pair" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create Keypair") %}
{% include "horizon/common/_page_header.html" with title=_("Create Key Pair") %}
{% endblock page_header %}
{% block main %}

View File

@ -1,19 +1,19 @@
{% extends 'base.html' %}
{% load i18n %}
{% load url from future %}
{% block title %}{% blocktrans %}Download Keypair{% endblocktrans %}{% endblock %}
{% block title %}{% blocktrans %}Download Key Pair{% endblocktrans %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Download Keypair") %}
{% include "horizon/common/_page_header.html" with title=_("Download Key Pair") %}
{% endblock page_header %}
{% block main %}
<div class="modal-header">
<h3>{% blocktrans %}The keypair &quot;{{ keypair_name }}&quot; should download automatically. If not use the link below.{% endblocktrans %}</h3>
<h3>{% blocktrans %}The key pair &quot;{{ keypair_name }}&quot; should download automatically. If not use the link below.{% endblocktrans %}</h3>
</div>
<div class="modal-body clearfix">
<a href="{% url 'horizon:project:access_and_security:keypairs:generate' keypair_name %}">
{% blocktrans %}Download keypair &quot;{{ keypair_name}}&quot;{% endblocktrans %}
{% blocktrans %}Download key pair &quot;{{ keypair_name}}&quot;{% endblocktrans %}
</a>
</div>
<script type="text/javascript" charset="utf-8">

View File

@ -1,9 +1,9 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Import Keypair" %}{% endblock %}
{% block title %}{% trans "Import Key Pair" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Import Keypair") %}
{% include "horizon/common/_page_header.html" with title=_("Import Key Pair") %}
{% endblock page_header %}
{% block main %}

View File

@ -577,7 +577,7 @@ class InstancesTable(tables.DataTable):
size = tables.Column(get_size,
verbose_name=_("Size"),
attrs={'data-type': 'size'})
keypair = tables.Column(get_keyname, verbose_name=_("Keypair"))
keypair = tables.Column(get_keyname, verbose_name=_("Key Pair"))
status = tables.Column("status",
filters=(title, filters.replace_underscores),
verbose_name=_("Status"),

View File

@ -1908,10 +1908,11 @@ class InstanceTests(test.TestCase):
url = reverse('horizon:project:instances:launch')
res = self.client.get(url)
self.assertContains(res, "<option selected='selected' value='%(key)s'>"
"%(key)s</option>" % {'key': keypair.name},
html=True,
msg_prefix="The default keypair was not selected.")
self.assertContains(
res, "<option selected='selected' value='%(key)s'>"
"%(key)s</option>" % {'key': keypair.name},
html=True,
msg_prefix="The default key pair was not selected.")
@test.create_stubs({api.network: ('floating_ip_target_get_by_instance',
'tenant_floating_ip_allocate',

View File

@ -408,9 +408,9 @@ KEYPAIR_IMPORT_URL = "horizon:project:access_and_security:keypairs:import"
class SetAccessControlsAction(workflows.Action):
keypair = forms.DynamicChoiceField(label=_("Keypair"),
keypair = forms.DynamicChoiceField(label=_("Key Pair"),
required=False,
help_text=_("Which keypair to use for "
help_text=_("Which key pair to use for "
"authentication."),
add_item_link=KEYPAIR_IMPORT_URL)
admin_pass = forms.RegexField(
@ -432,7 +432,7 @@ class SetAccessControlsAction(workflows.Action):
class Meta:
name = _("Access & Security")
help_text = _("Control access to your instance via keypairs, "
help_text = _("Control access to your instance via key pairs, "
"security groups, and other mechanisms.")
def __init__(self, request, *args, **kwargs):
@ -448,13 +448,13 @@ class SetAccessControlsAction(workflows.Action):
except Exception:
keypair_list = []
exceptions.handle(request,
_('Unable to retrieve keypairs.'))
_('Unable to retrieve key pairs.'))
if keypair_list:
if len(keypair_list) == 1:
self.fields['keypair'].initial = keypair_list[0][0]
keypair_list.insert(0, ("", _("Select a keypair")))
keypair_list.insert(0, ("", _("Select a key pair")))
else:
keypair_list = (("", _("No keypairs available")),)
keypair_list = (("", _("No key pairs available")),)
return keypair_list
def populate_groups_choices(self, request, context):

View File

@ -24,7 +24,7 @@ TEMPLATE = """
"Description": "AWS CloudFormation Sample Template.",
"Parameters": {
"KeyName": {
"Description": "Name of an EC2 KeyPair to enable SSH access to the instances",
"Description": "Name of an EC2 Key Pair to enable SSH access to the instances",
"Type": "String"
},
"InstanceType": {
@ -267,7 +267,7 @@ VALIDATE = """
},
"KeyName": {
"Type": "String",
"Description": "Name of an EC2 KeyPair to enable SSH access to the instances"
"Description": "Name of an EC2 Key Pair to enable SSH access to the instances"
},
"DBName": {
"Type": "String",

View File

@ -264,7 +264,7 @@ def data(TEST):
"flavor_id": "dddddddd-dddd-dddd-dddd-dddddddddddd"})
TEST.flavor_access.add(flavor_access_1, flavor_access_2)
# Keypairs
# Key pairs
keypair = keypairs.Keypair(keypairs.KeypairManager(None),
dict(name='keyName'))
TEST.keypairs.add(keypair)