kas/libcmds: add creation of $HOME/.aws
Bitbake provides a S3 fetcher (`lib/bb/fetch2/s3.py`), however the `AWS_CONFIG_FILE` and `AWS_SHARED_CREDENTIALS_FILE` variables are not transfered to the environment of the fetcher command (`aws` in this case) in the `runfetchcmd` function (`lib/bb/fetch2/__init__.py`). That means the location of these files need to be the default one, so copying it in KAS to the new HOME directory is necessary. This patch implements the copying of those files if the `AWS_CONFIG_FILE` and `AWS_SHARED_CREDENTIALS_FILE` are set. Per default there variables are not available in the bitbake environment. To have them available there a `env` entry in the kas configuration will be necessary. Signed-off-by: Claudius Heine <ch@denx.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
e61dfb7650
commit
267a53e78d
@ -109,6 +109,9 @@ Environment variables
|
||||
+-----------------------+-----------------------------------------------------+
|
||||
| ``TERM`` | The terminal options used in the `shell` plugin. |
|
||||
+-----------------------+-----------------------------------------------------+
|
||||
| ``AWS_CONFIG_FILE`` | Path to the awscli configuration and credentials |
|
||||
| ``AWS_SHARED_CREDENTIALS_FILE`` | file that are copied to the kas home dir. |
|
||||
+-----------------------+-----------------------------------------------------+
|
||||
|
||||
Use Cases
|
||||
---------
|
||||
|
@ -131,6 +131,16 @@ class SetupHome(Command):
|
||||
fds.write('[User]\n'
|
||||
'\temail = kas@example.com\n'
|
||||
'\tname = Kas User\n')
|
||||
|
||||
if (os.environ.get('AWS_CONFIG_FILE', False)
|
||||
and os.environ.get('AWS_SHARED_CREDENTIALS_FILE', False)):
|
||||
os.makedirs(self.tmpdirname + "/.aws")
|
||||
|
||||
shutil.copy(os.environ['AWS_CONFIG_FILE'],
|
||||
self.tmpdirname + "/.aws/config")
|
||||
shutil.copy(os.environ['AWS_SHARED_CREDENTIALS_FILE'],
|
||||
self.tmpdirname + "/.aws/credentials")
|
||||
|
||||
ctx.environ['HOME'] = self.tmpdirname
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user