Commit 70cc6755 by Serge Hallyn Committed by GitHub

Merge pull request #1849 from brauner/2017-10-10/update_config

confile: make update warning opt-in
parents 7c8f5d1d 70952c01
......@@ -2009,13 +2009,15 @@ static int parse_line(char *buffer, void *data)
/* [START]: REMOVE IN LXC 3.0 */
if (config->is_legacy_key && !plc->conf->contains_legacy_key) {
plc->conf->contains_legacy_key = true;
/* Warn the user once loud and clear that there is at least one
* legacy configuration item in the configuration file and then
* an update is required.
*/
fprintf(stderr, "The configuration file contains legacy "
"configuration keys.\nPlease update your "
"configuration file!\n");
if (getenv("LXC_UPDATE_CONFIG_FORMAT")) {
/* Warn the user once loud and clear that there is at
* least one legacy configuration item in the
* configuration file and then an update is required.
*/
fprintf(stderr, "The configuration file contains "
"legacy configuration keys.\nPlease "
"update your configuration file!\n");
}
}
/* [END]: REMOVE IN LXC 3.0 */
......
......@@ -406,6 +406,9 @@ int main(int argc, char *argv[])
}
}
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
struct lxc_container *c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c)
exit(EXIT_FAILURE);
......
......@@ -368,6 +368,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
count = list_defined_containers(my_args.lxcpath[0], NULL, &containers);
if (count < 0)
......
......@@ -21,16 +21,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <sys/types.h>
#include <lxc/lxccontainer.h>
#include "lxc.h"
#include "log.h"
#include "arguments.h"
#include "log.h"
#include "lxc.h"
lxc_log_define(lxc_cgroup_ui, lxc);
......@@ -86,6 +87,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
state_object = my_args.argv[0];
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
......
......@@ -255,6 +255,9 @@ int main(int argc, char *argv[])
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "System error loading %s\n", my_args.name);
......
......@@ -176,6 +176,8 @@ int main(int argc, char *argv[])
usage(argv[0]);
}
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c1 = lxc_container_new(orig, lxcpath);
if (!c1)
exit(EXIT_FAILURE);
......
......@@ -62,6 +62,8 @@ int main(int argc, char *argv[])
struct lxc_config_items *i;
const char *value;
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
if (argc < 2)
usage(argv[0]);
if (strcmp(argv[1], "-l") == 0)
......
......@@ -119,6 +119,9 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "System error loading container\n");
......
......@@ -190,6 +190,9 @@ int main(int argc, char *argv[])
exit(ret);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
if (geteuid()) {
if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
if (!my_args.quiet)
......
......@@ -229,6 +229,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
if (!my_args.template) {
fprintf(stderr, "A template must be specified.\n");
fprintf(stderr, "Use \"none\" if you really want a container without a rootfs.\n");
......
......@@ -89,6 +89,9 @@ int main(int argc, char *argv[])
if (my_args.quiet)
quiet = true;
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
if (!quiet)
......@@ -278,4 +281,3 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
return bret;
}
......@@ -127,6 +127,9 @@ int main(int argc, char *argv[])
goto err;
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
ERROR("%s doesn't exist", my_args.name);
......
......@@ -136,6 +136,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
ERROR("Failed to create lxc_container");
......
......@@ -76,6 +76,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
ERROR("No such container: %s:%s", my_args.lxcpath[0], my_args.name);
......
......@@ -413,6 +413,9 @@ int main(int argc, char *argv[])
exit(ret);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
if (print_info(my_args.name, my_args.lxcpath[0]) == 0)
ret = EXIT_SUCCESS;
......
......@@ -233,6 +233,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
struct lengths max_len = {
/* default header length */
.name_length = 4, /* NAME */
......
......@@ -113,6 +113,9 @@ int main(int argc, char *argv[])
exit(rc_main);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
if (quit_monitord) {
int ret = EXIT_SUCCESS;
for (i = 0; i < my_args.lxcpath_cnt; i++) {
......
......@@ -101,6 +101,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
if (geteuid()) {
if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
fprintf(stderr, "You lack access to %s\n",
......@@ -304,4 +307,3 @@ static void print_file(char *path)
free(line);
fclose(f);
}
......@@ -244,6 +244,9 @@ int main(int argc, char *argv[])
const char *lxcpath = my_args.lxcpath[0];
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
/*
* rcfile possibilities:
* 1. rcfile from random path specified in cli option
......
......@@ -173,6 +173,9 @@ int main(int argc, char *argv[])
exit(ret);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
/* Set default timeout */
if (my_args.timeout == -2) {
if (my_args.hardstop)
......
......@@ -75,6 +75,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
ERROR("No such container: %s:%s", my_args.lxcpath[0], my_args.name);
......
......@@ -102,6 +102,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c)
exit(EXIT_FAILURE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment