Skip to content

Commit

Permalink
Renaming some variables and fixing help text.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Reed committed Aug 14, 2019
1 parent 65303e2 commit 2e825ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/listener/server-profile-templates.js
Expand Up @@ -46,12 +46,12 @@ class ServerProfileTemplateListener extends Listener {
this.respond(this.LIST_DEPLOYED_PROFILES, this.GetDeployedProfiles.bind(this));
this.capabilities.push(this.BULLET + "Show profile(s) using a server profile template (e.g. show profiles using docker swarm).");

this.CREATE_PROFILES_FROM_TEMPATE = /(?:deploy|create) a profile (?:from|for|using) (:<host>.*?)(?:\/rest\/server-profile-templates\/)(:<templateId>[a-zA-Z0-9_-]*?)\.$/i;
this.respond(this.CREATE_PROFILES_FROM_TEMPATE, this.DeployProfiles.bind(this));
this.capabilities.push(this.BULLET + "Create profile(s) using a server profile template (e.g. create 1 profile from docker swarm).");
this.CREATE_PROFILE_FROM_TEMPATE = /(?:deploy|create) a profile (?:from|for|using) (:<host>.*?)(?:\/rest\/server-profile-templates\/)(:<templateId>[a-zA-Z0-9_-]*?)\.$/i;
this.respond(this.CREATE_PROFILE_FROM_TEMPATE, this.DeployProfile.bind(this));
this.capabilities.push(this.BULLET + "Create a profile using a server profile template (e.g. create a profile from docker swarm).");

this.GROW_TEMPLATE = /(?:flex|grow)(?: the)? (:<host>.*?)(?:\/rest\/server-profile-templates\/)(:<templateId>[a-zA-Z0-9_-]*?) by (:<count>\d+)(?: profile| profiles| hardware| servers)?\.$/i;
this.respond(this.GROW_TEMPLATE, this.DeployProfiles.bind(this));
this.respond(this.GROW_TEMPLATE, this.DeployProfile.bind(this));
this.capabilities.push(this.BULLET + "Flex/grow a server profile template by a given amount (e.g. grow docker swarm by 4 profiles).");

this.UNDEPLOY_PROFILES_USING_TEMPLATE = /(?:undeploy|remove) (:<count>\d+) profile[s]{0,1} (?:from|that were deployed from|that were using) (:<host>.*?)(?:\/rest\/server-profile-templates\/)(:<templateId>[a-zA-Z0-9_-]*?)\.$/i;
Expand Down Expand Up @@ -103,7 +103,7 @@ class ServerProfileTemplateListener extends Listener {
});
}

DeployProfiles(msg) {
DeployProfile(msg) {
let host = msg.host;
if (this.client.isReadOnly()) {
return this.transform.text(msg, "Hold on a sec... You'll have to set readOnly mode to false in your config file first if you want to do that... ");
Expand Down
10 changes: 5 additions & 5 deletions test/listener/bot.js
Expand Up @@ -211,7 +211,7 @@ Server Profile help (e.g. sp help).\n\t\u2022 Server Profile Template help \
'Server Profile Template commands:\n\t\u2022 Show all (server) profile templates (e.g. show all templates).\
\n\t\u2022 Show available targets for a server profile template (e.g. show available targets for docker swarm).\
\n\t\u2022 Show profile(s) using a server profile template (e.g. show profiles using docker swarm).\
\n\t\u2022 Create profile(s) using a server profile template (e.g. create 1 profile from docker swarm).\
\n\t\u2022 Create a profile using a server profile template (e.g. create a profile from docker swarm).\
\n\t\u2022 Flex/grow a server profile template by a given amount (e.g. grow docker swarm by 4 profiles).\
\n\t\u2022 Remove a number of profiles/servers from a profile template (e.g. remove 2 profiles from docker swarm).\
\n\t\u2022 Fix compliance for a profile template (e.g. fix compliance for docker swarm).'.should.equal(msg.send.args[0][0]);
Expand Down Expand Up @@ -243,8 +243,8 @@ Server Profile help (e.g. sp help).\n\t\u2022 Server Profile Template help \
\n\t\u2022 Power on/off a specific (server) profile (e.g. turn on hadoop cluster).\n\t\u2022 List all critical/warning/ok/disabled (server) \
profiles (e.g. list all critical profiles).\nServer Profile Template commands:\n\t\u2022 Show all (server) profile templates (e.g. show all \
templates).\n\t\u2022 Show available targets for a server profile template (e.g. show available targets for docker swarm).\n\t\u2022 Show \
profile(s) using a server profile template (e.g. show profiles using docker swarm).\n\t\u2022 Create profile(s) using a server profile template \
(e.g. create 1 profile from docker swarm).\n\t\u2022 Flex/grow a server profile template by a given amount (e.g. grow docker swarm by 4 profiles).\
profile(s) using a server profile template (e.g. show profiles using docker swarm).\n\t\u2022 Create a profile using a server profile template \
(e.g. create a profile from docker swarm).\n\t\u2022 Flex/grow a server profile template by a given amount (e.g. grow docker swarm by 4 profiles).\
\n\t\u2022 Remove a number of profiles/servers from a profile template (e.g. remove 2 profiles from docker swarm).\n\t\u2022 Fix compliance \
for a profile template (e.g. fix compliance for docker swarm).\nServer hardware commands:\n\t\u2022 Power on/off a specific (server) hardware \
(e.g. turn on Encl1, bay 1).\n\t• List all (server) hardware (e.g. list all hardware).\n\t\u2022 List server hardware utilization (e.g. list \
Expand Down Expand Up @@ -279,8 +279,8 @@ List all powered on/off (server) hardware.\n.'.should.equal(msg.send.args[0][0])
\n\t\u2022 Power on/off a specific (server) profile (e.g. turn on hadoop cluster).\n\t\u2022 List all critical/warning/ok/disabled (server) \
profiles (e.g. list all critical profiles).\nServer Profile Template commands:\n\t\u2022 Show all (server) profile templates (e.g. show all \
templates).\n\t\u2022 Show available targets for a server profile template (e.g. show available targets for docker swarm).\n\t\u2022 Show \
profile(s) using a server profile template (e.g. show profiles using docker swarm).\n\t\u2022 Create profile(s) using a server profile template \
(e.g. create 1 profile from docker swarm).\n\t\u2022 Flex/grow a server profile template by a given amount (e.g. grow docker swarm by 4 profiles).\
profile(s) using a server profile template (e.g. show profiles using docker swarm).\n\t\u2022 Create a profile using a server profile template \
(e.g. create a profile from docker swarm).\n\t\u2022 Flex/grow a server profile template by a given amount (e.g. grow docker swarm by 4 profiles).\
\n\t\u2022 Remove a number of profiles/servers from a profile template (e.g. remove 2 profiles from docker swarm).\n\t\u2022 Fix compliance \
for a profile template (e.g. fix compliance for docker swarm).\nServer hardware commands:\n\t\u2022 Power on/off a specific (server) hardware \
(e.g. turn on Encl1, bay 1).\n\t• List all (server) hardware (e.g. list all hardware).\n\t\u2022 List server hardware utilization (e.g. list \
Expand Down
8 changes: 4 additions & 4 deletions test/listener/server-profile-templates.js
Expand Up @@ -101,7 +101,7 @@ describe('ServerProfileTemplateListener', () => {
let rgx0 = new NamedRegExp(serverProfileTemplateListener.LIST_ALL);
let rgx1 = new NamedRegExp(serverProfileTemplateListener.LIST_AVAILABLE_TARGETS);
let rgx2 = new NamedRegExp(serverProfileTemplateListener.LIST_DEPLOYED_PROFILES);
let rgx3 = new NamedRegExp(serverProfileTemplateListener.CREATE_PROFILES_FROM_TEMPATE);
let rgx3 = new NamedRegExp(serverProfileTemplateListener.CREATE_PROFILE_FROM_TEMPATE);
let rgx4 = new NamedRegExp(serverProfileTemplateListener.GROW_TEMPLATE);
let rgx5 = new NamedRegExp(serverProfileTemplateListener.UNDEPLOY_PROFILES_USING_TEMPLATE);
let rgx6 = new NamedRegExp(serverProfileTemplateListener.UNDEPLOY_PROFILES_USING_SERVERS_IN_TEMPLATE);
Expand All @@ -126,12 +126,12 @@ describe('ServerProfileTemplateListener', () => {

rgx3.should.deep.equal(constructorArgs[3].args[0]);
assert(typeof constructorArgs[3].args[2] === 'function');
'bound DeployProfiles'.should.equal(constructorArgs[3].args[2].name);
'bound DeployProfile'.should.equal(constructorArgs[3].args[2].name);
assert.isFalse(constructorArgs[3].args[2].hasOwnProperty('prototype'));

rgx4.should.deep.equal(constructorArgs[4].args[0]);
assert(typeof constructorArgs[4].args[2] === 'function');
'bound DeployProfiles'.should.equal(constructorArgs[4].args[2].name);
'bound DeployProfile'.should.equal(constructorArgs[4].args[2].name);
assert.isFalse(constructorArgs[4].args[2].hasOwnProperty('prototype'));

rgx5.should.deep.equal(constructorArgs[5].args[0]);
Expand Down Expand Up @@ -160,7 +160,7 @@ describe('ServerProfileTemplateListener', () => {
let rgx0 = new NamedRegExp(serverProfileTemplateListener.LIST_ALL);
let rgx1 = new NamedRegExp(serverProfileTemplateListener.LIST_AVAILABLE_TARGETS);
let rgx2 = new NamedRegExp(serverProfileTemplateListener.LIST_DEPLOYED_PROFILES);
let rgx3 = new NamedRegExp(serverProfileTemplateListener.CREATE_PROFILES_FROM_TEMPATE);
let rgx3 = new NamedRegExp(serverProfileTemplateListener.CREATE_PROFILE_FROM_TEMPATE);
let rgx4 = new NamedRegExp(serverProfileTemplateListener.GROW_TEMPLATE);
let rgx5 = new NamedRegExp(serverProfileTemplateListener.UNDEPLOY_PROFILES_USING_TEMPLATE);
let rgx6 = new NamedRegExp(serverProfileTemplateListener.UNDEPLOY_PROFILES_USING_SERVERS_IN_TEMPLATE);
Expand Down

0 comments on commit 2e825ac

Please sign in to comment.