/* * builtin-probe.c * * Builtin probe command: Set up probe events by C expression * * Written by Masami Hiramatsu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include "perf.h" #include "builtin.h" #include "util/util.h" #include "util/strlist.h" #include "util/strfilter.h" #include "util/symbol.h" #include "util/debug.h" #include "util/parse-options.h" #include "util/probe-finder.h" #include "util/probe-event.h" #include "util/probe-file.h" #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*" #define DEFAULT_FUNC_FILTER "!_*" #define DEFAULT_LIST_FILTER "*:*" /* Session management structure */ static struct { int command; /* Command short_name */ bool list_events; bool uprobes; bool quiet; bool target_used; int nevents; struct perf_probe_event events[MAX_PROBES]; struct line_range line_range; char *target; struct strfilter *filter; } params; /* Parse an event definition. Note that any error must die. */ static int parse_probe_event(const char *str) { struct perf_probe_event *pev = ¶ms.events[params.nevents]; int ret; pr_debug("probe-definition(%d): %s\n", params.nevents, str); if (++params.nevents == MAX_PROBES) { pr_err("Too many probes (> %d) were specified.", MAX_PROBES); return -1; } pev->uprobes = params.uprobes; if (params.target) { pev->target = strdup(params.target); if (!pev->target) return -ENOMEM; params.target_used = true; } /* Parse a perf-probe command into event */ ret = parse_perf_probe_command(str, pev); pr_debug("%d arguments\n", pev->nargs); return ret; } static int params_add_filter(const char *str) { const char *err = NULL; int ret = 0; pr_debug2("Add filter: %s\n", str); if (!params.filter) { params.filter = strfilter__new(str, &err); if (!params.filter) ret = err ? -EINVAL : -ENOMEM; } else ret = strfilter__or(params.filter, str, &err); if (ret == -EINVAL) { pr_err("Filter parse error at %td.\n", err - str + 1); pr_err("Source: \"%s\"\n", str); pr_err(" %*c\n", (int)(err - str + 1), '^'); } return ret; } static int set_target(const char *ptr) { int found = 0; const char *buf; /* * The first argument after options can be an absolute path * to an executable / library or kernel module. * * TODO: Support relative path, and $PATH, $LD_LIBRARY_PATH, * short module name. */ if (!params.target && ptr && *ptr == '/') { params.target = strdup(ptr); if (!params.target) return -ENOMEM; params.target_used = false; found = 1; buf = ptr + (strlen(ptr) - 3); if (strcmp(buf, ".ko")) params.uprobes = true; } return found; } static int parse_probe_event_argv(int argc, const char **argv) { int i, len, ret, found_target; char *buf; found_target = set_target(argv[0]); if (found_target < 0) return found_target; if (found_target && argc == 1) return 0; /* Bind up rest arguments */ len = 0; for (i = 0; i < argc; i++) { if (i == 0 && found_target) continue; len += strlen(argv[i]) + 1; } buf = zalloc(len + 1); if (buf == NULL) return -ENOMEM; len = 0; for (i = 0; i < argc; i++) { if (i == 0 && found_target) continue; len += sprintf(&buf[len], "%s ", argv[i]); } ret = parse_probe_event(buf); free(buf); return ret; } static int opt_set_target(const struct option *opt, const char *str, int unset __maybe_unused) { int ret = -ENOENT; char *tmp; if (str) { if (!strcmp(opt->long_name, "exec")) params.uprobes = true; else if (!strcmp(opt->long_name, "module")) params.uprobes = false; else return ret; /* Expand given path to absolute path, except for modulename */ if (params.uprobes || strchr(str, '/')) { tmp = realpath(str, NULL); if (!tmp) { pr_warning("Failed to get the absolute path of %s: %m\n", str); return ret; } } else { tmp = strdup(str); if (!tmp) return -ENOMEM; } free(params.target); params.target = tmp; params.target_used = false; ret = 0; } return ret; } /* Command option callbacks */ #ifdef HAVE_DWARF_SUPPORT static int opt_show_lines(const struct option *opt, const char *str, int unset __maybe_unused) { int ret = 0; if (!str) return 0; if (pa
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Sat, 5 Aug 2017 02:03:01 +0200
Subject: [PATCH] maas: region: skip credentials update

Password update for maas psql database breaks ulterior acesses
to maas-region syncdb.
For now, limit regiond.conf changes to maas_url, and skip
updating credentials.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---

diff --git a/maas/region.sls b/maas/region.sls
index d3227ca..8a2243d 100644
--- a/maas/region.sls
+++ b/maas/region.sls
@@ -6,10 +6,9 @@
     - names: {{ region.pkgs }}

 /etc/maas/regiond.conf:
-  file.managed:
-  - source: salt://maas/files/regiond.conf
-  - template: jinja
-  - group: maas
+  file.replace:
+  - pattern: ^maas_url.*$
+  - repl: "maas_url: http://{{ region.bind.host }}:5240/MAAS"
   - require:
     - pkg: maas_region_packages
et) { ret = __cmd_probe(argc, argv, prefix); cleanup_params(); } return ret < 0 ? ret : 0; }