MCPcopy Index your code
hub / github.com/aws/aws-cli / _create_config

Method _create_config

awscli/customizations/codedeploy/register.py:161–185  ·  view source on GitHub ↗
(self, params)

Source from the content-addressed store, hash-verified

159 )
160
161 def _create_config(self, params):
162 sys.stdout.write(
163 f'Creating the on-premises instance configuration file named {DEFAULT_CONFIG_FILE}'
164 '...'
165 )
166 try:
167 fd = os.open(
168 DEFAULT_CONFIG_FILE,
169 os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
170 0o600,
171 )
172 with os.fdopen(fd, 'w') as f:
173 os.chmod(DEFAULT_CONFIG_FILE, 0o600)
174 f.write(
175 '---\n'
176 f'region: {params.region}\n'
177 f'iam_user_arn: {params.iam_user_arn}\n'
178 f'aws_access_key_id: {params.access_key_id}\n'
179 f'aws_secret_access_key: {params.secret_access_key}\n'
180 )
181 except OSError as e:
182 raise RuntimeError(
183 f'Failed to create config file {DEFAULT_CONFIG_FILE}: {e}'
184 )
185 sys.stdout.write('DONE\n')
186
187 def _register_instance(self, params):
188 sys.stdout.write('Registering the on-premises instance... ')

Callers 1

_run_mainMethod · 0.95

Calls 2

writeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected