mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 12:57:40 -02:30
rewording, typo corrections
This commit is contained in:
@@ -50,5 +50,7 @@ these tests, you may import needed functions from [fixtures.js](fixtures.js), wh
|
|||||||
via API, which might include organizations, users, and job templates.
|
via API, which might include organizations, users, and job templates.
|
||||||
|
|
||||||
The `commands` directory provides extra functions for the client object in
|
The `commands` directory provides extra functions for the client object in
|
||||||
nightwatch.js tests. For more information on these functions and how to
|
nightwatch.js tests. These functions are automatically made available for use by the
|
||||||
create your own, refer to the nightwatch.js documentation on custom commands.
|
client object. For more information on these functions and how to
|
||||||
|
create your own, refer to the [nightwatch.js documentation on custom commands]
|
||||||
|
(http://nightwatchjs.org/guide/#writing-custom-commands).
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ const session = `e2e-${uuid().substr(0, 8)}`;
|
|||||||
const store = {};
|
const store = {};
|
||||||
|
|
||||||
/* Utility function for accessing awx resources. This includes resources like
|
/* Utility function for accessing awx resources. This includes resources like
|
||||||
* users, organizations, and job templates. Creates the resource if it does
|
* users, organizations, and job templates. Retrieves the end point, and creates
|
||||||
* not already exist, then returns it.
|
* it if it does not exist.
|
||||||
*
|
*
|
||||||
* @param endpoint - The REST API url suffix.
|
* @param endpoint - The REST API url suffix.
|
||||||
* @param data - Attributes used to create a new endpoint.
|
* @param data - Attributes used to create a new endpoint.
|
||||||
@@ -50,7 +50,7 @@ const getOrCreate = (endpoint, data, unique = ['name']) => {
|
|||||||
return store[lookup].then(created => created.data);
|
return store[lookup].then(created => created.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Creates an organization if one does not already exist, and returns it.
|
/* Retrieves an organization, and creates it if it does not exist.
|
||||||
*
|
*
|
||||||
* @param [namespace=session] - A unique name prefix for the organization.
|
* @param [namespace=session] - A unique name prefix for the organization.
|
||||||
*
|
*
|
||||||
@@ -60,7 +60,7 @@ const getOrganization = (namespace = session) => getOrCreate('/organizations/',
|
|||||||
description: namespace
|
description: namespace
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Creates an inventory if one does not already exist, and returns it.
|
/* Retrieves an inventory, and creates it if it does not exist.
|
||||||
* Also creates an organization with the same name prefix if needed.
|
* Also creates an organization with the same name prefix if needed.
|
||||||
*
|
*
|
||||||
* @param [namespace=session] - A unique name prefix for the inventory.
|
* @param [namespace=session] - A unique name prefix for the inventory.
|
||||||
@@ -78,7 +78,8 @@ const getInventory = (namespace = session) => getOrganization(namespace)
|
|||||||
variables: JSON.stringify({ ansible_connection: 'local' }),
|
variables: JSON.stringify({ ansible_connection: 'local' }),
|
||||||
}, ['name', 'inventory']).then(() => inventory)));
|
}, ['name', 'inventory']).then(() => inventory)));
|
||||||
|
|
||||||
/* Identical to getInventory except it provides a unique suffix, "*-inventory-nosource".
|
/* Identical to getInventory except it provides a unique suffix,
|
||||||
|
* "*-inventory-nosource".
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the inventory.
|
* @param[namespace=session] - A unique name prefix for the inventory.
|
||||||
*/
|
*/
|
||||||
@@ -94,7 +95,7 @@ const getInventoryNoSource = (namespace = session) => getOrganization(namespace)
|
|||||||
variables: JSON.stringify({ ansible_connection: 'local' }),
|
variables: JSON.stringify({ ansible_connection: 'local' }),
|
||||||
}, ['name', 'inventory']).then(() => inventory)));
|
}, ['name', 'inventory']).then(() => inventory)));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates an host with the given name prefix.
|
/* Retrieves a host with the given name prefix, and creates it if it does not exist.
|
||||||
* If an inventory does not exist with the same prefix, it is created as well.
|
* If an inventory does not exist with the same prefix, it is created as well.
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the host.
|
* @param[namespace=session] - A unique name prefix for the host.
|
||||||
@@ -107,8 +108,8 @@ const getHost = (namespace = session) => getInventory(namespace)
|
|||||||
variables: JSON.stringify({ ansible_connection: 'local' }),
|
variables: JSON.stringify({ ansible_connection: 'local' }),
|
||||||
}, ['name', 'inventory']));
|
}, ['name', 'inventory']));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates an inventory script with the given
|
/* Retrieves an inventory script with the given name prefix, and creates it if it
|
||||||
* name prefix. If an organization does not exist with the same prefix, it is
|
* does not exist. If an organization does not exist with the same prefix, it is
|
||||||
* created as well.
|
* created as well.
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the host.
|
* @param[namespace=session] - A unique name prefix for the host.
|
||||||
@@ -121,6 +122,12 @@ const getInventoryScript = (namespace = session) => getOrganization(namespace)
|
|||||||
script: '#!/usr/bin/env python'
|
script: '#!/usr/bin/env python'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
/* Retrieves an inventory source, and creates it if it does not exist. If the
|
||||||
|
* required dependent inventory and inventory script do not exist, they are also
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* @param[namespace=session] - A unique name prefix for the inventory source.
|
||||||
|
*/
|
||||||
const getInventorySource = (namespace = session) => {
|
const getInventorySource = (namespace = session) => {
|
||||||
const promises = [
|
const promises = [
|
||||||
getInventory(namespace),
|
getInventory(namespace),
|
||||||
@@ -137,6 +144,10 @@ const getInventorySource = (namespace = session) => {
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Retrieves an AWS credential, and creates it if it does not exist.
|
||||||
|
*
|
||||||
|
* @param[namespace=session] - A unique name prefix for the AWS credential.
|
||||||
|
*/
|
||||||
const getAdminAWSCredential = (namespace = session) => {
|
const getAdminAWSCredential = (namespace = session) => {
|
||||||
const promises = [
|
const promises = [
|
||||||
get('/me/'),
|
get('/me/'),
|
||||||
@@ -163,6 +174,10 @@ const getAdminAWSCredential = (namespace = session) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Retrieves a machine credential, and creates it if it does not exist.
|
||||||
|
*
|
||||||
|
* @param[namespace=session] - A unique name prefix for the machine credential.
|
||||||
|
*/
|
||||||
const getAdminMachineCredential = (namespace = session) => {
|
const getAdminMachineCredential = (namespace = session) => {
|
||||||
const promises = [
|
const promises = [
|
||||||
get('/me/'),
|
get('/me/'),
|
||||||
@@ -181,8 +196,8 @@ const getAdminMachineCredential = (namespace = session) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a team with the given
|
/* Retrieves a team, and creates it if it does not exist.
|
||||||
* name prefix. If an organization does not exist with the same prefix, it is
|
* If an organization does not exist with the same prefix, it is
|
||||||
* created as well.
|
* created as well.
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the team.
|
* @param[namespace=session] - A unique name prefix for the team.
|
||||||
@@ -194,7 +209,7 @@ const getTeam = (namespace = session) => getOrganization(namespace)
|
|||||||
organization: organization.id,
|
organization: organization.id,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a smart inventory with the given
|
/* Retrieves a smart inventory, and creates it if it does not exist.
|
||||||
* name prefix. If an organization does not exist with the same prefix, it is
|
* name prefix. If an organization does not exist with the same prefix, it is
|
||||||
* created as well.
|
* created as well.
|
||||||
*
|
*
|
||||||
@@ -209,7 +224,7 @@ const getSmartInventory = (namespace = session) => getOrganization(namespace)
|
|||||||
kind: 'smart'
|
kind: 'smart'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a notification template with the given
|
/* Retrieves a notification template, and creates it if it does not exist.
|
||||||
* name prefix. If an organization does not exist with the same prefix, it is
|
* name prefix. If an organization does not exist with the same prefix, it is
|
||||||
* created as well.
|
* created as well.
|
||||||
*
|
*
|
||||||
@@ -227,7 +242,7 @@ const getNotificationTemplate = (namespace = session) => getOrganization(namespa
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a project with the given
|
/* Retrieves a project, and creates it if it does not exist.
|
||||||
* name prefix. If an organization does not exist with the same prefix, it is
|
* name prefix. If an organization does not exist with the same prefix, it is
|
||||||
* created as well.
|
* created as well.
|
||||||
*
|
*
|
||||||
@@ -278,7 +293,7 @@ const getUpdatedProject = (namespace = session) => getProject(namespace)
|
|||||||
return project;
|
return project;
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a job template with the given
|
/* Retrieves a job template, and creates it if it does not exist.
|
||||||
* name prefix. This function also runs getOrCreate for an inventory,
|
* name prefix. This function also runs getOrCreate for an inventory,
|
||||||
* credential, and project with the same prefix.
|
* credential, and project with the same prefix.
|
||||||
*
|
*
|
||||||
@@ -315,7 +330,7 @@ const getJob = (namespace = session) => getJobTemplate(namespace)
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a workflow template with the given
|
/* Retrieves a workflow template, and creates it if it does not exist.
|
||||||
* name prefix. If an organization does not exist with the same prefix, it is
|
* name prefix. If an organization does not exist with the same prefix, it is
|
||||||
* created as well. A basic workflow node setup is also created.
|
* created as well. A basic workflow node setup is also created.
|
||||||
*
|
*
|
||||||
@@ -361,11 +376,11 @@ const getWorkflowTemplate = (namespace = session) => {
|
|||||||
.then(([workflowTemplate, nodes]) => workflowTemplate);
|
.then(([workflowTemplate, nodes]) => workflowTemplate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a auditor user with the given
|
/* Retrieves a auditor user, and creates it if it does not exist.
|
||||||
* name prefix. If an organization does not exist with the same prefix,
|
* name prefix. If an organization does not exist with the same prefix,
|
||||||
* it is also created.
|
* it is also created.
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the project admin.
|
* @param[namespace=session] - A unique name prefix for the auditor.
|
||||||
*/
|
*/
|
||||||
const getAuditor = (namespace = session) => getOrganization(namespace)
|
const getAuditor = (namespace = session) => getOrganization(namespace)
|
||||||
.then(organization => getOrCreate(`/organizations/${organization.id}/users/`, {
|
.then(organization => getOrCreate(`/organizations/${organization.id}/users/`, {
|
||||||
@@ -379,6 +394,12 @@ const getAuditor = (namespace = session) => getOrganization(namespace)
|
|||||||
password: AWX_E2E_PASSWORD
|
password: AWX_E2E_PASSWORD
|
||||||
}, ['username']));
|
}, ['username']));
|
||||||
|
|
||||||
|
/* Retrieves a user, and creates it if it does not exist.
|
||||||
|
* name prefix. If an organization does not exist with the same prefix,
|
||||||
|
* it is also created.
|
||||||
|
*
|
||||||
|
* @param[namespace=session] - A unique name prefix for the user.
|
||||||
|
*/
|
||||||
const getUser = (namespace = session) => getOrganization(namespace)
|
const getUser = (namespace = session) => getOrganization(namespace)
|
||||||
.then(organization => getOrCreate(`/organizations/${organization.id}/users/`, {
|
.then(organization => getOrCreate(`/organizations/${organization.id}/users/`, {
|
||||||
username: `user-${uuid().substr(0, 8)}`,
|
username: `user-${uuid().substr(0, 8)}`,
|
||||||
@@ -403,11 +424,11 @@ const getUserExact = (namespace = session, name) => getOrganization(namespace)
|
|||||||
password: AWX_E2E_PASSWORD
|
password: AWX_E2E_PASSWORD
|
||||||
}, ['username']));
|
}, ['username']));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a job template admin with the given
|
/* Retrieves a job template admin, and creates it if it does not exist.
|
||||||
* name prefix. If a job template or organization does not exist with the same
|
* If a job template or organization does not exist with the same
|
||||||
* prefix, they are also created.
|
* prefix, they are also created.
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the project admin.
|
* @param[namespace=session] - A unique name prefix for the template admin.
|
||||||
*/
|
*/
|
||||||
const getJobTemplateAdmin = (namespace = session) => {
|
const getJobTemplateAdmin = (namespace = session) => {
|
||||||
const rolePromise = getJobTemplate(namespace)
|
const rolePromise = getJobTemplate(namespace)
|
||||||
@@ -432,8 +453,8 @@ const getJobTemplateAdmin = (namespace = session) => {
|
|||||||
.then(([user, assignment]) => user);
|
.then(([user, assignment]) => user);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a project admin with the given
|
/* Retrieves a project admin, and creates it if it does not exist.
|
||||||
* name prefix. If a project or organization does not exist with the same
|
* If a job template or organization does not exist with the same
|
||||||
* prefix, they are also created.
|
* prefix, they are also created.
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the project admin.
|
* @param[namespace=session] - A unique name prefix for the project admin.
|
||||||
@@ -461,6 +482,11 @@ const getProjectAdmin = (namespace = session) => {
|
|||||||
.then(([user, assignment]) => user);
|
.then(([user, assignment]) => user);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Retrieves a inventory source schedule, and creates it if it does not exist.
|
||||||
|
* If an inventory source does not exist with the same prefix, it is also created.
|
||||||
|
*
|
||||||
|
* @param[namespace=session] - A unique name prefix for the schedule.
|
||||||
|
*/
|
||||||
const getInventorySourceSchedule = (namespace = session) => getInventorySource(namespace)
|
const getInventorySourceSchedule = (namespace = session) => getInventorySource(namespace)
|
||||||
.then(source => getOrCreate(source.related.schedules, {
|
.then(source => getOrCreate(source.related.schedules, {
|
||||||
name: `${source.name}-schedule`,
|
name: `${source.name}-schedule`,
|
||||||
@@ -468,9 +494,8 @@ const getInventorySourceSchedule = (namespace = session) => getInventorySource(n
|
|||||||
rrule: 'DTSTART:20171104T040000Z RRULE:FREQ=DAILY;INTERVAL=1;COUNT=1'
|
rrule: 'DTSTART:20171104T040000Z RRULE:FREQ=DAILY;INTERVAL=1;COUNT=1'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/* Gets or, if it does not exist, creates a job template schedule with the given
|
/* Retrieves a job template schedule, and creates it if it does not exist.
|
||||||
* name prefix. If a job template does not exist with the same prefix, it is
|
* If an job template does not exist with the same prefix, it is also created.
|
||||||
* created as well.
|
|
||||||
*
|
*
|
||||||
* @param[namespace=session] - A unique name prefix for the schedule.
|
* @param[namespace=session] - A unique name prefix for the schedule.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user