Skip to content

Remove option "--profile" when running pip to install dependencies. #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lambda_cron/cli/command/cloudformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def zip_lambda_function_dependencies(self, zip_file, tmp_directory):
get_requirements_txt(),
"--target", dependencies_directory,
"--ignore-installed"]
self.exec_command(pip_install_command)
self.exec_command(pip_install_command, use_profile=False)
zip_dir(zip_file, dependencies_directory)

def generate_lambda_functions_config(self, config_file_path):
Expand Down
4 changes: 2 additions & 2 deletions lambda_cron/cli/command/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class AwsCommand(Command):
def run(self):
raise NotImplementedError

def exec_command(self, command):
if self.arguments.aws_profile:
def exec_command(self, command, use_profile=True):
if self.arguments.aws_profile and use_profile:
command.append('--profile')
command.append(self.arguments.aws_profile)
return Command.exec_command(self, command)
Expand Down
3 changes: 3 additions & 0 deletions tests/cli/command/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def bucket_exists():

assert len(create_command.commands_list) == 4
assert 'pip' in create_command.commands_list[0]
assert '--profile' not in create_command.commands_list[0]
assert 's3' in create_command.commands_list[1] and 'cp' in create_command.commands_list[1]
assert 's3://test-bucket-custom' in create_command.commands_list[1][4]
assert '--profile' not in create_command.commands_list[1]
Expand Down Expand Up @@ -128,6 +129,7 @@ def bucket_exists():
assert len(create_command.commands_list) == 5
assert set(['aws', 's3', 'mb']).issubset(create_command.commands_list[0])
assert 'pip' in create_command.commands_list[1]
assert '--profile' not in create_command.commands_list[1]
assert 's3' in create_command.commands_list[2] and 'cp' in create_command.commands_list[2]
assert 's3://test-bucket-custom' in create_command.commands_list[2][4]
assert '--profile' not in create_command.commands_list[2]
Expand Down Expand Up @@ -164,6 +166,7 @@ def bucket_exists():

assert '--profile' in create_command.commands_list[0]
assert 'test-profile' in create_command.commands_list[0]
assert '--profile' not in create_command.commands_list[1]
assert '--profile' in create_command.commands_list[2]
assert 'test-profile' in create_command.commands_list[2]
assert '--profile' in create_command.commands_list[3]
Expand Down
2 changes: 2 additions & 0 deletions tests/cli/command/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def test_update_command(config_parser):

assert len(update_command.commands_list) == 4
assert 'pip' in update_command.commands_list[0]
assert '--profile' not in update_command.commands_list[0]
assert 's3' in update_command.commands_list[1] and 'cp' in update_command.commands_list[1]
assert 's3://test-bucket-custom' in update_command.commands_list[1][4]
assert '--profile' not in update_command.commands_list[1]
Expand Down Expand Up @@ -79,6 +80,7 @@ def test_update_command_with_profile(config_parser):

update_command.run()

assert '--profile' not in update_command.commands_list[0]
assert '--profile' in update_command.commands_list[1]
assert 'test-profile' in update_command.commands_list[1]
assert '--profile' in update_command.commands_list[2]
Expand Down