When creating the fullfile and installing the bundle in targetfs we
need to preserve the owner and mode of file
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
XDG_CONFIG_DIRS variable was added with an incorrect name. XDG_CONF_DIRS was used instead.
Fixing that.
Fix#1443
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When a MoM contains an experimental bundle and the hashes in the MoM are
regenerated, the experimental bundles are being skipped. This commit
fixes that issue.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When creating test bundles, we are not including os-core in them by
default. This is how it works in production so we should do it so it
resembles the real production environment more accurately.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When the template used for creating the wrapper scripts changes, all
exported binaries should have the scripts regenerated during updates
regardless of if the binary changed.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The update_bundle() function of testlib has many different options to
create updates for test bundles, all of those supported the creation of
the update in a 3rd-party repository except for the --header-only
option. This commit adds that support do --header-nly flag can also be
used for 3rd-party repos.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit provides a minimal output to be displayed when the --quiet
flag is used for this command:
- swupd autoupdate
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:
- swupd info
- swupd 3rd-party info
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Current implementation was only removing test enviroment for envs created
on test setup. And test_teardown function needed to be overriden in case
global_setup() was used.
Now always cleaning the enviroment for both use cases, test_setup() and
global_setup(). The user doesn't have the control anymore on that and
if the user wants to keep the env KEEP_ENV variable should be used.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Test environment can be created on global_setup() or test_setup() and that
change the behavior of several operations on testlib.
Because of that, let the user create the test environment as desired instead
of forcing it on test_setup()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When generating the certificate for tests, openssl is printing messages
to the terminal, we are already selecting what to print by using the
debug_msg() function, so these unwanted messages shouldnot be printed.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Instead of requiring an external script (.prereq) to generate the certificates
we can regenerate them before running each test.
Also removes completly the .prereq script
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When updating a bundle using testlib, if the file is updated, and the
update includes a file type change, testlib was updating the manifest
with the correct type but was overwriting the other status flags, so if
a file was marked as 'x' (exported) before, that flag was being removed.
This commit fixes the issue by only updating the flag that relates to
the file type.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When running tests sometimes is useful to see how the filesystem of the
test target system looks like before and after a test. This commit adds
a function to show that chroot fs in a tree view, and it calls that
function in the setup and teardown of tests if DEBUG_TESTS is set.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit provides a function that can be used to generate update
content based on the content from a directory specified by the user.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds a function that retrieve the matching entry from a
manifest or all entries if no key is provided.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds a function to create a bundle based on the content form
a directory specified by the user.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit has a few small corrections in testlib:
- it removes some code that was used for iterative manifests
- it correct some help menus
- favors the use of debug_msg over an if statement for filtering
messages
- do not follow links in the function that creates tars from
fullfiles
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When a test is adding a symlink to a manifest, the file the link is
pointing to is also added to the manifest. This commit prevents the file
pointed by the link to be added, if the user wants to add this file they
can do it explicitely.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds support for file type changes when using bundle_update,
so the correct type is added to the manifest.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When trying to update if the mirror has an invalid signature file we should
try to use the default source url instead.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Alternative solution to solution proposed on #1318
Instead of trying to create a link just don't try to link symlinks.
Tested patch using bsdtar and implemented automated testing to
validate solution.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
The iterative manifest effort was droped so this commit removes the
iterative manifest support from testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When adding an upstream bundle, we apply some heuristics to the bundle
files and based on that some files are skipped from being installed.
These heuristics don't apply to 3rd-party bundles.
This commit skips running heuristics when adding 3rd-party bundles.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes a test fails before finisihing to create all the required
directories under the testdir. So destroy_environment thinks this is
not a valid test environment.
Touching a dot file to show that the directory is a test environment
instead on counting on its content.
Fixes bug #1135
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When a symlink is added to a 3rd-party repository it will be broken
on the statedir and stat command will fail. We need to use lstat, to
get information about the symlink and not the file that it's pointing
to.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
The repo.ini file was being created in the swupd state directory, this
was not ideal since it prevented the state directory from being used for
multiple target paths.
This commit moves the repo.ini file out of the state directory and into
the 3rd-party content directory.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The testlib had two functions to create 3rd-party repositories that were
very similar but with only one difference, one function only created the
3rd-party repo, the other one created the repo and also added it as if
the user had already done a "swupd 3rd-party add" on it.
This commit merges both functions into one to avoid code duplication,
make the test library easier to maintain, and make it less confusing.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When in a 3rd-party repository one bundle has one binary file that
is exported, and the same file is included in another bundle, only
it is not exported in this bundle, when we remove the bundle that
exports the file, the file should be unexported regardless of the file
still being installed since the bundle that is still in the system is
not exporting it.
Closes#1322
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Some commands were recently added to swupd which require user
interaction under certain circumstances, when this happens the user has
to manually enter either Y/N to continue or abort the current process.
This commit provides a --non-interactive=<yes/no> flag that can be used
to avoid getting this interactive prompts.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
If an update of 3rd-party content includes files with dangerous flags,
the user should be notified and the update should only continue if the
user accepts the risk, otherwise the update should be aborted.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
If a 3rd-party bundle include files that have either the setuid, setgid
or sticky bits set, then it should not be installed since they could
compromise the security of the system. In this case the user should be
asked to see if they want to assume the risk and continue, or abort the
process.
Closes#1281Closes#1282
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When a 3rd-party repository is updated, if one of the updated bundles
has updated binaries, the scripts that export those binaries should also
be updated. This commit implements that update.
Closes#1279
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes possible the creation of bundles with exported files
in test environments. These bundles will have the 'x' in the appropriate
place in the manifest plus those bundles that are to be installed in the
environment will have the "exporting script" created in the 3rd-party
bin directory.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This PR re-enables the failing auto-update
tests while moving from travis to github actions
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
This commit moves the path where the content from 3rd-party bundles is
going to be installed from opt/3rd-party/<bundle_name> to
/opt/3rd-party/bundles/<bundle_name> so bundle directories are separated
from other top level directories like bin.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The 3rd-party repository directory is currently 3rd_party, this name is
incorrect and needs to be changed to 3rd-party.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes when a test finds a problem in the source code it is difficult
to determine what is the problem in the code, so the code needs to be
debugged. In order to do this, the test environment of the particular
test has to be created but without running the test, so we can run the
command executed by the test with the debugger.
This commit adds a function (create_test_environment_only) to create a
specific test environment based on a bats file, but without running the
test.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
A spinner was added to swupd to show some kind of progress while
downloading content which its amount is unknown. Once the content is
downloaded the stopped spinner should be removed from the screen. This
commit does that.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When running an operation, swupd uses a certificate to validate things
ilke the MoM and the version file. The certificate that needs to be used
for 3rd-party repos is different than the one that has to be used for
upstream.
This commit enables the use of the 3rd-party repo certificate that will
be installed in the repo's directory with all swupd operations, except
when adding the repository, in those cases, since the os-core bundle
hasn't been installed yet, we need to provide the cert path through
other means, like using the -C flag..
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit modifies some of the functions of the test library so it is
possible to update bundles that belong to 3rd-party repositories.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds the ability to remove 3rd-party bundles. If a repo is
not specified the bundle will be searched for in all repositories. All
options from the normal bundle-remove command are supported with
3rd-party bundles.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The os-core file includes the os-release file, which has the
version of a content server. When adding a new 3rd-party repository we
need to install the os-core bundle from that repo so we can track the
current version of the repo.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Instead of getting the current version of a 3rd-party repo during a
bundle-list from the repo.ini file, this commit changes the code so it
is gotten from the os-release file in the appropriate path_prefix for
the repo.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds the --repo flag for the 3rd-party bundle-list command
which can be used to specify the repository from which the bundles are
going to be listed.
This commit adds the section that handles the "3rd-party bundle-add"
options into the default config file. It also enables the use of
the 3rd-party command and its subcommands in the config file.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>