Skip to content

Commit 5331ddb

Browse files
committed
Fixing some linting and removing some debugging
1 parent 49fdd37 commit 5331ddb

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

lib/docker.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const isWsl = require('is-wsl');
77
* @return {Object}
88
*/
99
function dockerCommand(options) {
10-
console.log("dockerCommand")
11-
console.log(options)
1210
const cmd = 'docker';
1311
const ps = spawnSync(cmd, options, {'encoding': 'utf-8'});
1412
if (ps.error) {
@@ -28,8 +26,6 @@ function dockerCommand(options) {
2826
* @return {string} The name of the built docker image.
2927
*/
3028
function buildImage(dockerFile) {
31-
console.log("buildImage")
32-
console.log(dockerFile)
3329
const imageName = 'sls-py-reqs-custom';
3430
const options = [
3531
'build', '-f', dockerFile, '-t', imageName, '.',
@@ -44,8 +40,6 @@ function buildImage(dockerFile) {
4440
* @return {boolean}
4541
*/
4642
function tryBindPath(bindPath) {
47-
console.log("tryBindPath")
48-
console.log(bindPath)
4943
const options = ['run', '--rm', '-v', `${bindPath}:/test`,
5044
'alpine', 'ls', '/test/serverless.yml'];
5145
try {
@@ -63,8 +57,6 @@ function tryBindPath(bindPath) {
6357
* @return {string} The bind path.
6458
*/
6559
function getBindPath(servicePath) {
66-
console.log("getBindPath")
67-
console.log(servicePath)
6860
// Determine bind path
6961
if (process.platform !== 'win32' && !isWsl) {
7062
return servicePath;
@@ -116,8 +108,6 @@ function getBindPath(servicePath) {
116108
* @return {boolean}
117109
*/
118110
function getDockerUid(bindPath) {
119-
console.log("getDockerUid")
120-
console.log(bindPath)
121111
const options = ['run', '--rm', '-v', `${bindPath}:/test`,
122112
'alpine', 'stat', '-c', '%u', '/bin/sh'];
123113
const ps = dockerCommand(options);

lib/pip.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function installRequirementsFile(requirementsPath, targetFile, serverless, servi
4545
* @param {Object} options
4646
* @return {undefined}
4747
*/
48-
function installRequirements(targetFolder, servicePath, serverless, options) {
48+
function installRequirements(targetFolder, serverless, options) {
4949
const targetRequirementsTxt = path.join(targetFolder, 'requirements.txt');
5050

5151
serverless.cli.log(`Installing requirements from ${targetRequirementsTxt} ...`);
@@ -56,13 +56,13 @@ function installRequirements(targetFolder, servicePath, serverless, options) {
5656
options.pythonBin, '-m', 'pip', '--isolated', 'install',
5757
...options.pipCmdExtraArgs,
5858
];
59-
59+
6060
// If we're not dockerizing pip
6161
if (!options.dockerizePip) {
6262
// Push our local OS-specific paths for requirements and target directory
6363
pipCmd.push('-t', targetFolder);
6464
pipCmd.push('-r', targetRequirementsTxt);
65-
65+
6666
// If we want a download cache...
6767
if (options.useDownloadCache) {
6868
const downloadCacheDir = path.join(getUserCachePath(options), 'downloadCache_slspyc');
@@ -100,11 +100,11 @@ function installRequirements(targetFolder, servicePath, serverless, options) {
100100
dockerImage = options.dockerImage;
101101
}
102102
serverless.cli.log(`Docker Image: ${dockerImage}`);
103-
103+
104104
// Push docker-specific paths for requirements and target directory
105105
pipCmd.push('-t', '/var/task/');
106106
pipCmd.push('-r', '/var/task/requirements.txt');
107-
107+
108108
// Prepare bind path depending on os platform
109109
const bindPath = getBindPath(targetFolder);
110110

@@ -148,13 +148,7 @@ function installRequirements(targetFolder, servicePath, serverless, options) {
148148
cmd = pipCmd[0];
149149
cmdOptions = pipCmd.slice(1);
150150
}
151-
serverless.cli.log(`Trying to run command...`);
152-
console.log(cmd)
153-
console.log(cmdOptions)
154151
const res = spawnSync(cmd, cmdOptions, {cwd: targetFolder, shell: true});
155-
serverless.cli.log(`Ran command`);
156-
serverless.cli.log(res)
157-
158152
if (res.error) {
159153
if (res.error.code === 'ENOENT') {
160154
if (options.dockerizePip) {
@@ -281,7 +275,6 @@ function installRequirementsIfNeeded(servicePath, modulePath, options, serverles
281275
// Then install our requirements from this folder
282276
installRequirements(
283277
workingReqsFolder,
284-
servicePath,
285278
serverless,
286279
options
287280
);

0 commit comments

Comments
 (0)