Skip to content

Instantly share code, notes, and snippets.

@justinkinney
Last active April 27, 2016 22:51
Show Gist options
  • Save justinkinney/b8dd817c5d7cfeeb898dd1ebb94ecfb2 to your computer and use it in GitHub Desktop.
Save justinkinney/b8dd817c5d7cfeeb898dd1ebb94ecfb2 to your computer and use it in GitHub Desktop.
cog failing to launch
bash-4.3$ cat scripts/docker-start
#!/bin/bash -x
set -eo pipefail
export ALLOW_WARNINGS=true
export PATH="${PATH}:$(dirname $0)"
echo "Waiting for Postgres to become available..."
#wait-for-it.sh -s -t 0 -h localhost -p 5432 && true
echo "Apply database migrations..."
mix ecto.migrate --no-compile --no-deps-check
echo "Launching Cog server..."
elixir --no-halt --name cog@127.0.0.1 -S mix phoenix.server --no-compile --no-deps-check
bash-4.3$ scripts/docker-start
+ set -eo pipefail
+ export ALLOW_WARNINGS=true
+ ALLOW_WARNINGS=true
++ dirname scripts/docker-start
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:scripts
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:scripts
+ echo 'Waiting for Postgres to become available...'
Waiting for Postgres to become available...
+ echo 'Apply database migrations...'
Apply database migrations...
+ mix ecto.migrate --no-compile --no-deps-check
22:43:23.081 [info] == Running Cog.Repo.Migrations.CreateUsers.change/0 forward
22:43:23.081 [info] create table users
22:43:23.309 [info] == Migrated in 2.2s
22:43:23.991 [info] == Running Cog.Repo.Migrations.CreatePermissions.change/0 forward
22:43:23.992 [info] create table permissions
22:43:24.217 [info] create index permissions_namespace_name_index
22:43:24.438 [info] == Migrated in 4.4s
22:43:25.105 [info] == Running Cog.Repo.Migrations.UserPermissionGrants.change/0 forward
22:43:25.105 [info] create table user_permissions
22:43:25.323 [info] create index user_permissions_user_id_permission_id_index
22:43:25.544 [info] == Migrated in 4.3s
22:43:26.207 [info] == Running Cog.Repo.Migrations.Groups.change/0 forward
22:43:26.207 [info] create table groups
22:43:26.431 [info] create index groups_name_index
22:43:26.651 [info] == Migrated in 4.4s
22:43:27.315 [info] == Running Cog.Repo.Migrations.GroupPermissionGrants.change/0 forward
22:43:27.315 [info] create table group_permissions
22:43:27.532 [info] create index group_permissions_group_id_permission_id_index
22:43:27.753 [info] == Migrated in 4.3s
22:43:28.418 [info] == Running Cog.Repo.Migrations.UserGroupMembership.change/0 forward
22:43:28.419 [info] create table user_group_membership
22:43:28.637 [info] create index user_group_membership_member_id_group_id_index
22:43:28.857 [info] == Migrated in 4.3s
22:43:29.523 [info] == Running Cog.Repo.Migrations.PermissionCheck.up/0 forward
22:43:29.529 [info] execute "CREATE OR REPLACE FUNCTION user_has_permission(\np_user users.id%TYPE,\n p_perm permissions.id%TYPE)\nRETURNS BOOLEAN\nLANGUAGE plpgsql\nSTABLE -- <- this function doesn't alter the database; just queries it\nSTRICT -- <- returns NULL immediately if any arguments are NULL\nAS $$\nDECLARE\nhas_result uuid;\nBEGIN\n -- Check to see if the actor has the permission directly\n SELECT up.permission_id FROM user_permissions AS up\n WHERE up.user_id = p_user\n AND up.permission_id = p_perm\n INTO has_result;\n\n -- If that returned anything, we're done\n IF has_result IS NOT NULL THEN\n RETURN TRUE;\n END IF;\n\n -- The permission wasn't granted directly to the user, we need\n -- to check the groups the user is in\n SELECT gp.permission_id\n FROM group_permissions AS gp\n JOIN user_group_membership AS ugm\n ON gp.group_id = ugm.group_id\n WHERE ugm.member_id = p_user\n AND gp.permission_id = p_perm\n INTO has_result;\n\n -- If anything was found, we're done\n IF has_result IS NOT NULL THEN\n RETURN TRUE;\n END IF;\n\n -- The user doesn't have the permission\n RETURN FALSE;\nEND;\n$$;\n"
22:43:29.747 [info] == Migrated in 2.2s
22:43:30.411 [info] == Running Cog.Repo.Migrations.GroupGroupMembership.change/0 forward
22:43:30.411 [info] create table group_group_membership
22:43:30.629 [info] create index group_group_membership_member_id_group_id_index
22:43:30.850 [info] == Migrated in 4.3s
22:43:31.517 [info] == Running Cog.Repo.Migrations.AddChatHandles.up/0 forward
22:43:31.518 [info] create table chat_providers
22:43:31.744 [info] create index chat_providers_name_index
22:43:31.965 [info] execute "INSERT INTO chat_providers(name, inserted_at, updated_at)\nVALUES ('Slack', now(), now()),\n ('HipChat', now(), now()),\n ('irc', now(), now()),\n ('Test', now(), now())\n"
22:43:32.182 [info] create table chat_handles
22:43:32.409 [info] create index chat_handles_user_id_provider_id_handle_index
22:43:32.630 [info] create index chat_handles_provider_id_handle_index
22:43:32.851 [info] == Migrated in 13.3s
22:43:33.515 [info] == Running Cog.Repo.Migrations.GroupsForUser.up/0 forward
22:43:33.515 [info] execute "CREATE OR REPLACE FUNCTION groups_for_user(users.id%TYPE)\nRETURNS TABLE(group_id groups.id%TYPE)\nLANGUAGE SQL STABLE STRICT\nAS $$\nWITH RECURSIVE\n in_groups(id) AS (\n -- direct group membership\n SELECT group_id\n FROM user_group_membership\n WHERE member_id = $1\n\n UNION\n\n -- indirect group membership; find parent groups of all groups\n -- the user is a direct member of, recursively\n SELECT ggm.group_id\n FROM group_group_membership AS ggm\n JOIN in_groups ON in_groups.id = ggm.member_id\n)\nSELECT id from in_groups;\n$$;\n"
22:43:33.732 [info] == Migrated in 2.1s
22:43:34.397 [info] == Running Cog.Repo.Migrations.PermissionCheckHandlesGroupNesting.up/0 forward
22:43:34.398 [info] execute "CREATE OR REPLACE FUNCTION user_has_permission(\np_user users.id%TYPE,\np_perm permissions.id%TYPE)\nRETURNS BOOLEAN\nLANGUAGE plpgsql STABLE STRICT\nAS $$\nDECLARE\nhas_result uuid;\nBEGIN\n-- Check to see if the actor has the permission directly\nSELECT up.permission_id FROM user_permissions AS up\nWHERE up.user_id = p_user\n AND up.permission_id = p_perm\n INTO has_result;\n\n-- If that returned anything, we're done\nIF has_result IS NOT NULL THEN\n RETURN TRUE;\nEND IF;\n\n-- The permission wasn't granted directly to the user, we need\n-- to check the groups the user is in\nSELECT gp.permission_id\n FROM group_permissions AS gp\n JOIN groups_for_user(p_user) AS gfu(id)\n ON gp.group_id = gfu.id\nWHERE gp.permission_id = p_perm\n INTO has_result;\n\n-- If anything was found, we're done\nIF has_result IS NOT NULL THEN\n RETURN TRUE;\nEND IF;\n\n-- The user doesn't have the permission\nRETURN FALSE;\n\nEND;\n$$;\n"
22:43:34.614 [info] == Migrated in 2.1s
22:43:35.281 [info] == Running Cog.Repo.Migrations.ForbidGroupCycles.up/0 forward
22:43:35.282 [info] execute "CREATE OR REPLACE FUNCTION forbid_group_cycles()\nRETURNS TRIGGER\nLANGUAGE plpgsql\nAS $$\nDECLARE\n cycle_root BOOLEAN DEFAULT FALSE;\nBEGIN\n SELECT INTO cycle_root (\n WITH RECURSIVE\n parents(id) AS (\n -- parent(s) of the current child group\n SELECT group_id\n FROM group_group_membership\n WHERE member_id = NEW.member_id\n\n UNION\n\n -- grandparents and other ancestors\n SELECT ggm.group_id\n FROM group_group_membership AS ggm\n JOIN parents AS p ON ggm.member_id = p.id\n )\n SELECT TRUE\n FROM parents\n WHERE id = NEW.member_id\n );\n\n IF cycle_root THEN\n RAISE EXCEPTION 'group cycles are forbidden';\n END IF;\n RETURN NULL;\nEND;\n$$;\n"
22:43:35.499 [info] execute "CREATE CONSTRAINT TRIGGER no_long_range_cycles\nAFTER INSERT OR UPDATE\nON group_group_membership\nFOR EACH ROW\nEXECUTE PROCEDURE forbid_group_cycles();\n"
22:43:35.714 [info] == Migrated in 4.3s
22:43:36.379 [info] == Running Cog.Repo.Migrations.Roles.change/0 forward
22:43:36.379 [info] create table roles
22:43:36.604 [info] create index roles_name_index
22:43:36.824 [info] == Migrated in 4.4s
22:43:37.496 [info] == Running Cog.Repo.Migrations.RolePermissions.change/0 forward
22:43:37.496 [info] create table role_permissions
22:43:37.713 [info] create index role_permissions_role_id_permission_id_index
22:43:37.933 [info] == Migrated in 4.3s
22:43:38.605 [info] == Running Cog.Repo.Migrations.UserRoles.change/0 forward
22:43:38.605 [info] create table user_roles
22:43:38.822 [info] create index user_roles_user_id_role_id_index
22:43:39.044 [info] == Migrated in 4.3s
22:43:39.708 [info] == Running Cog.Repo.Migrations.GroupRoles.change/0 forward
22:43:39.709 [info] create table group_roles
22:43:39.926 [info] create index group_roles_group_id_role_id_index
22:43:40.148 [info] == Migrated in 4.3s
22:43:40.818 [info] == Running Cog.Repo.Migrations.PermissionCheckHandlesUserRoleGrants.up/0 forward
22:43:40.819 [info] execute "CREATE OR REPLACE FUNCTION user_has_permission(\np_user users.id%TYPE,\np_perm permissions.id%TYPE)\nRETURNS BOOLEAN\nLANGUAGE plpgsql STABLE STRICT\nAS $$\nDECLARE\nhas_result uuid;\nBEGIN\n-- Check to see if the actor has the permission directly\nSELECT up.permission_id FROM user_permissions AS up\nWHERE up.user_id = p_user\n AND up.permission_id = p_perm\n INTO has_result;\n\n-- If that returned anything, we're done\nIF has_result IS NOT NULL THEN\n RETURN TRUE;\nEND IF;\n\n-- The user might have a role, though; check that!\nSELECT rp.permission_id\n FROM role_permissions AS rp\n JOIN user_roles AS ur\n ON rp.role_id = ur.role_id\nWHERE ur.user_id = p_user\n AND rp.permission_id = p_perm\n INTO has_result;\n\n-- If that returned anything, we're done\nIF has_result IS NOT NULL THEN\n RETURN TRUE;\nEND IF;\n\n-- The permission wasn't granted directly to the user, we need\n-- to check the groups the user is in\nWITH all_groups AS (\n SELECT id FROM groups_for_user(p_user) AS g(id)\n),\ngroup_permissions AS (\n SELECT gp.permission_id\n FROM group_permissions AS gp\n JOIN all_groups AS gfu\n ON gp.group_id = gfu.id\n WHERE gp.permission_id = p_perm\n),\ngroup_role_permissions AS (\n SELECT rp.permission_id\n FROM role_permissions AS rp\n JOIN group_roles AS gr\n ON rp.role_id = gr.role_id\n JOIN all_groups AS ag\n ON gr.group_id = ag.id -- group_id, natural joins\n WHERE rp.permission_id = p_perm\n),\neverything AS (\n SELECT permission_id FROM group_permissions\n UNION DISTINCT\n SELECT permission_id FROM group_role_permissions\n)\nSELECT permission_id\nFROM everything\nINTO has_result;\n\n-- If anything was found, we're done\nIF has_result IS NOT NULL THEN\n RETURN TRUE;\nEND IF;\n\n-- The user doesn't have the permission\nRETURN FALSE;\n\nEND;\n$$;\n"
22:43:41.142 [info] == Migrated in 3.2s
22:43:41.811 [info] == Running Cog.Repo.Migrations.CommandDataModel.change/0 forward
22:43:41.811 [info] create table commands
22:43:42.036 [info] create index commands_name_index
22:43:42.257 [info] create table rules
22:43:42.483 [info] create index rules_command_id_parse_tree_index
22:43:42.704 [info] create table rule_permissions
22:43:42.922 [info] create index rule_permissions_rule_id_permission_id_index
22:43:43.143 [info] == Migrated in 13.3s
22:43:43.808 [info] == Running Cog.Repo.Migrations.PermissionNamespace.change/0 forward
22:43:43.808 [info] create table namespaces
22:43:44.033 [info] create index namespaces_name_index
22:43:44.254 [info] alter table permissions
22:43:44.471 [info] create index permissions_namespace_id_name_index
22:43:44.692 [info] == Migrated in 8.8s
22:43:45.355 [info] == Running Cog.Repo.Migrations.UserPasswords.change/0 forward
22:43:45.355 [info] alter table users
22:43:45.572 [info] == Migrated in 2.1s
22:43:46.234 [info] == Running Cog.Repo.Migrations.UserLoginNames.change/0 forward
22:43:46.235 [info] alter table users
22:43:46.451 [info] create index users_username_index
22:43:46.671 [info] == Migrated in 4.3s
22:43:47.340 [info] == Running Cog.Repo.Migrations.AddCommandArgs.change/0 forward
22:43:47.340 [info] create table command_option_types
22:43:47.567 [info] create index command_option_types_name_index
22:43:47.786 [info] execute "create temp table option_type_names (\nname text not null\n);\n"
22:43:48.003 [info] execute "insert into option_type_names values ('int'), ('float'), ('bool'), ('string'), ('incr');\n"
22:43:48.219 [info] execute "insert into command_option_types(id, name)\nselect md5(random()::text || clock_timestamp()::text)::uuid, otn.name from option_type_names as otn;\n"
22:43:48.436 [info] execute "drop table option_type_names;\n"
22:43:48.652 [info] create table command_options
22:43:48.880 [info] create index command_options_command_id_name_index
22:43:49.102 [info] execute "ALTER TABLE command_options\nADD CONSTRAINT flags_check CHECK(long_flag IS NOT NULL or short_flag IS NOT NULL);\n"
22:43:49.318 [info] == Migrated in 19.7s
22:43:49.980 [info] == Running Cog.Repo.Migrations.Tokens.change/0 forward
22:43:49.980 [info] create table tokens
22:43:50.202 [info] create index tokens_user_id_value_index
22:43:50.423 [info] == Migrated in 4.4s
_build/dev/lib/cog/priv/repo/migrations/20151028025449_add_ssh_adapter.exs:4: warning: unused alias Repo
22:43:51.089 [info] == Running Cog.Repo.Migrations.AddSshAdapter.up/0 forward
22:43:51.090 [info] execute "INSERT INTO chat_providers ( name, inserted_at, updated_at )\nVALUES ( 'ssh', NOW(), NOW() )\n"
22:43:51.307 [info] == Migrated in 2.1s
22:43:51.986 [info] == Running Cog.Repo.Migrations.AddWebsocketProvider.up/0 forward
22:43:52.211 [debug] INSERT INTO "chat_providers" ("inserted_at", "updated_at", "name") VALUES ($1, $2, $3) RETURNING "id" [{{2016, 4, 27}, {22, 43, 51, 0}}, {{2016, 4, 27}, {22, 43, 51, 0}}, "websocket"] OK query=216.0ms
22:43:52.211 [info] == Migrated in 2.2s
22:43:52.873 [info] == Running Cog.Repo.Migrations.CreateBundles.change/0 forward
22:43:52.873 [info] create table bundles
22:43:53.099 [info] create index bundles_name_index
22:43:53.319 [info] == Migrated in 4.4s
22:43:53.982 [info] == Running Bishop.Repo.Migrations.AddBundleIdToCommands.change/0 forward
22:43:53.983 [info] alter table commands
22:43:54.199 [info] == Migrated in 2.1s
22:43:54.862 [info] == Running Cog.Repo.Migrations.AddUniqueIndexToBundlesNameAndVersion.change/0 forward
22:43:54.862 [info] drop index bundles_name_index
22:43:55.078 [info] == Migrated in 2.1s
22:43:55.742 [info] == Running Cog.Repo.Migrations.AssociateNamespaceWithBundle.change/0 forward
22:43:55.742 [info] alter table namespaces
22:43:55.959 [info] == Migrated in 2.1s
22:43:56.626 [info] == Running Cog.Repo.Migrations.FetchUserPermissions.up/0 forward
22:43:56.627 [info] execute "CREATE OR REPLACE FUNCTION fetch_user_permissions (\np_user users.id%TYPE)\nRETURNS TABLE(id uuid, name text)\nLANGUAGE plpgsql STABLE STRICT\nAS $$\nBEGIN\n\nRETURN QUERY WITH\n\n-- Walk the tree of group memberships and find\n-- all the groups the user is a direct and\n-- indirect member of.\nall_groups as (\nSELECT group_id\n FROM groups_for_user(p_user)\n),\nall_permissions as (\n\n-- Retrieve all permissions granted to the list\n-- groups returned from all_groups\nSELECT gp.permission_id\n FROM group_permissions as gp\n JOIN all_groups as ag\n ON gp.group_id = ag.group_id\nUNION DISTINCT\n\n-- Retrieve all permissions granted to the user\n-- via roles\nSELECT rp.permission_id\n FROM role_permissions as rp\n JOIN user_roles as ur\n ON rp.role_id = ur.role_id\n WHERE ur.user_id = p_user\nUNION DISTINCT\n\n-- Retrieve all permissions granted directly to the user\nSELECT up.permission_id\n FROM user_permissions as up\nWHERE up.user_id = p_user\n)\n\n-- Join the permission ids returned by the CTE against\n-- the permissions and namespaces tables to produce\n-- the final result\nSELECT p.id, ns.name||':'||p.name as name\nFROM permissions as p, namespaces as ns, all_permissions as ap\nWHERE ap.permission_id = p.id and p.namespace_id = ns.id;\nEND;\n$$;\n"
22:43:56.844 [info] == Migrated in 2.1s
22:43:57.504 [info] == Running Cog.Repo.Migrations.AddCommandDocumentation.change/0 forward
22:43:57.504 [info] alter table commands
22:43:57.720 [info] == Migrated in 2.1s
22:43:58.381 [info] == Running Cog.Repo.Migrations.AddBundleCommandNameConstraint.change/0 forward
22:43:58.381 [info] create index bundled_command_name
22:43:58.625 [info] drop index commands_name_index
22:43:58.841 [info] == Migrated in 4.6s
22:43:59.508 [info] == Running Cog.Repo.Migrations.CreateTemplates.change/0 forward
22:43:59.508 [info] create table templates
22:43:59.734 [info] create index templates_bundle_id_adapter_name_index
22:43:59.954 [info] == Migrated in 4.4s
22:44:00.618 [info] == Running Cog.Repo.Migrations.AddEnforcing.change/0 forward
22:44:00.618 [info] alter table commands
22:44:00.849 [info] == Migrated in 2.3s
22:44:01.513 [info] == Running Cog.Repo.Migrations.AddCallingConvention.change/0 forward
22:44:01.513 [info] alter table commands
22:44:01.743 [info] execute "ALTER TABLE commands\nADD CONSTRAINT calling_convention_check\nCHECK(calling_convention = 'all' AND enforcing = false OR calling_convention = 'bound');\n"
22:44:01.960 [info] == Migrated in 4.4s
22:44:02.622 [info] == Running Cog.Repo.Migrations.AddExecution.change/0 forward
22:44:02.622 [info] alter table commands
22:44:02.852 [info] == Migrated in 2.3s
22:44:03.520 [info] == Running Cog.Repo.Migrations.BundleStatus.change/0 forward
22:44:03.520 [info] alter table bundles
22:44:03.746 [info] == Migrated in 2.2s
22:44:04.410 [info] == Running Cog.Repo.Migrations.LowercaseChatProviders.up/0 forward
22:44:04.410 [info] execute "UPDATE chat_providers SET name = lower(name)\n"
22:44:04.627 [info] == Migrated in 2.1s
22:44:05.292 [info] == Running Cog.Repo.Migrations.VarcharToText.change/0 forward
22:44:05.293 [info] alter table tokens
22:44:05.514 [info] alter table commands
22:44:05.732 [info] alter table templates
22:44:05.949 [info] == Migrated in 6.5s
22:44:06.614 [info] == Running Cog.Repo.Migrations.AddAliases.change/0 forward
22:44:06.615 [info] create table site_command_aliases
22:44:06.839 [info] create index site_command_aliases_name_index
22:44:07.060 [info] create table user_command_aliases
22:44:07.286 [info] create index user_command_aliases_name_user_id_index
22:44:07.507 [info] == Migrated in 8.9s
22:44:08.166 [info] == Running Cog.Repo.Migrations.AddListCommandOptionType.change/0 forward
warning: cast/3 is deprecated, please use cast/4
lib/cog/models/command_opt.ex:21: Cog.Models.CommandOptionType.changeset/2
_build/dev/lib/cog/priv/repo/migrations/20160211192002_add_list_command_option_type.exs:9: Cog.Repo.Migrations.AddListCommandOptionType.change/0
(stdlib) timer.erl:197: :timer.tc/3
(ecto) lib/ecto/migration/runner.ex:25: Ecto.Migration.Runner.run/6
22:44:08.387 [debug] INSERT INTO "command_option_types" ("id", "name") VALUES ($1, $2) [<<117, 62, 112, 31, 182, 57, 74, 244, 184, 38, 78, 215, 237, 53, 122, 220>>, "list"] OK query=215.2ms
22:44:08.387 [info] == Migrated in 2.2s
22:44:09.045 [info] == Running Cog.Repo.Migrations.BundlesAreDisabledByDefault.change/0 forward
22:44:09.045 [info] alter table bundles
22:44:09.262 [info] == Migrated in 2.1s
22:44:09.925 [info] == Running Cog.Repo.Migrations.GroupsWithPermission.up/0 forward
22:44:09.925 [info] execute "CREATE FUNCTION groups_with_permission(\n p_permission permissions.id%TYPE)\nRETURNS SETOF groups.id%TYPE\nLANGUAGE SQL STABLE STRICT\nAS $$\n WITH RECURSIVE\n direct_grants AS (\n SELECT group_id\n FROM group_permissions\n WHERE permission_id = p_permission\n ),\n role_grants AS (\n SELECT gr.group_id\n FROM group_roles AS gr\n JOIN role_permissions AS rp\n USING (role_id)\n WHERE rp.permission_id = p_permission\n ),\n in_groups AS (\n SELECT group_id FROM direct_grants\n UNION\n SELECT group_id FROM role_grants\n UNION\n -- find all groups that are members of that group, etc.\n SELECT ggm.member_id\n FROM group_group_membership AS ggm\n JOIN in_groups AS ig\n USING (group_id)\n )\n SELECT group_id\n FROM in_groups;\n$$;\n"
22:44:10.141 [info] == Migrated in 2.1s
22:44:10.803 [info] == Running Cog.Repo.Migrations.UsersWithPermission.up/0 forward
22:44:10.804 [info] execute "CREATE FUNCTION users_with_permission(\n p_permission permissions.id%TYPE)\nRETURNS SETOF users.id%TYPE\nLANGUAGE SQL STABLE STRICT\nAS $$\n WITH direct_grants AS (\n SELECT up.user_id\n FROM user_permissions AS up\n WHERE up.permission_id = p_permission\n ),\n role_grants AS (\n SELECT ur.user_id\n FROM user_roles AS ur\n JOIN role_permissions AS rp\n USING(role_id)\n WHERE rp.permission_id = p_permission\n ),\n all_groups AS (\n SELECT group_id\n FROM groups_with_permission(p_permission) AS g(group_id)\n ),\n group_grants AS (\n SELECT ugm.member_id AS user_id\n FROM user_group_membership AS ugm\n JOIN all_groups AS ag\n USING(group_id)\n )\n SELECT user_id FROM direct_grants\n UNION\n SELECT user_id FROM role_grants\n UNION\n SELECT user_id FROM group_grants\n ;\n$$;\n"
22:44:11.019 [info] == Migrated in 2.1s
22:44:11.677 [info] == Running Cog.Repo.Migrations.Delete_ssh_irc_websocket.change/0 forward
22:44:11.678 [info] execute "DELETE FROM chat_providers where name in ('ssh', 'irc', 'websocket')"
22:44:11.894 [info] == Migrated in 2.1s
22:44:12.553 [info] == Running Cog.Repo.Migrations.UniqueBundleNames.change/0 forward
22:44:12.553 [info] create index bundles_name_index
22:44:12.775 [info] == Migrated in 2.2s
22:44:13.434 [info] == Running Cog.Repo.Migrations.DropCommandVersions.change/0 forward
22:44:13.434 [info] alter table commands
22:44:13.650 [info] == Migrated in 2.1s
22:44:14.310 [info] == Running Cog.Repo.Migrations.AddIrcChatProvider.up/0 forward
22:44:14.526 [debug] INSERT INTO "chat_providers" ("inserted_at", "updated_at", "name") VALUES ($1, $2, $3) RETURNING "id" [{{2016, 4, 27}, {22, 44, 14, 0}}, {{2016, 4, 27}, {22, 44, 14, 0}}, "irc"] OK query=215.4ms
22:44:14.526 [info] == Migrated in 2.1s
22:44:15.185 [info] == Running Cog.Repo.Migrations.FirstNameLastNameOptional.change/0 forward
22:44:15.185 [info] alter table users
22:44:15.401 [info] == Migrated in 2.1s
22:44:16.060 [info] == Running Cog.Repo.Migrations.AddChatProviderUserIdToChatHandles.change/0 forward
22:44:16.061 [info] alter table chat_handles
22:44:16.276 [info] create index chat_handles_provider_id_chat_provider_user_id_index
22:44:16.497 [info] execute "UPDATE chat_handles SET chat_provider_user_id = handle"
22:44:16.714 [info] alter table chat_handles
22:44:16.931 [info] == Migrated in 8.7s
22:44:17.591 [info] == Running Cog.Repo.Migrations.AddNullChatProvider.up/0 forward
22:44:17.807 [debug] INSERT INTO "chat_providers" ("inserted_at", "updated_at", "name") VALUES ($1, $2, $3) RETURNING "id" [{{2016, 4, 27}, {22, 44, 17, 0}}, {{2016, 4, 27}, {22, 44, 17, 0}}, "null"] OK query=215.3ms
22:44:17.807 [info] == Migrated in 2.1s
22:44:18.466 [info] == Running Cog.Repo.Migrations.DropCommandCallingConvention.change/0 forward
22:44:18.467 [info] alter table commands
22:44:18.683 [info] == Migrated in 2.1s
22:44:19.348 [info] == Running Cog.Repo.Migrations.AddRelays.change/0 forward
22:44:19.348 [info] create table relays
22:44:19.574 [info] create index relays_name_index
22:44:19.794 [info] == Migrated in 4.4s
22:44:20.461 [info] == Running Cog.Repo.Migrations.CreateRelayGroups.change/0 forward
22:44:20.462 [info] create table relay_groups
22:44:20.687 [info] create index relay_groups_name_index
22:44:20.907 [info] create table relay_group_memberships
22:44:21.125 [info] create index relay_group_memberships_relay_id_group_id_index
22:44:21.345 [info] == Migrated in 8.8s
22:44:22.011 [info] == Running Cog.Repo.Migrations.AddBundleRelayGroupAssignments.change/0 forward
22:44:22.011 [info] create table relay_group_assignments
22:44:22.228 [info] create index relay_group_assignments_bundle_id_group_id_index
22:44:22.450 [info] == Migrated in 4.3s
22:44:23.116 [info] == Running Cog.Repo.Migrations.Triggers.change/0 forward
22:44:23.116 [info] create table triggers
22:44:23.342 [info] create index triggers_name_index
22:44:23.562 [info] == Migrated in 4.4s
22:44:24.226 [info] == Running Cog.Repo.Migrations.AllowTemplatesBundleIdToBeNull.change/0 forward
22:44:24.227 [info] alter table templates
22:44:24.443 [info] == Migrated in 2.1s
22:44:25.110 [info] == Running Cog.Repo.Migrations.InsertFallbackTemplates.change/0 forward
22:44:25.328 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<233, 71, 221, 119, 58, 216, 73, 62, 142, 160, 62, 118, 172, 24, 69, 161>>, {{2016, 4, 27}, {22, 44, 25, 0}}, {{2016, 4, 27}, {22, 44, 25, 0}}, "slack", nil, "json", "```\n{{> json}}\n\n```\n"] OK query=216.8ms
22:44:25.544 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<102, 65, 197, 162, 76, 201, 73, 35, 162, 227, 42, 190, 111, 241, 194, 183>>, {{2016, 4, 27}, {22, 44, 25, 0}}, {{2016, 4, 27}, {22, 44, 25, 0}}, "hipchat", nil, "json", "/code\n{{> json}}\n"] OK query=215.9ms
22:44:25.760 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<25, 179, 114, 225, 171, 54, 72, 38, 153, 125, 184, 20, 121, 156, 207, 68>>, {{2016, 4, 27}, {22, 44, 25, 0}}, {{2016, 4, 27}, {22, 44, 25, 0}}, "any", nil, "raw", "{{> json}}\n"] OK query=215.9ms
22:44:25.977 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<72, 14, 55, 174, 98, 135, 72, 63, 164, 145, 106, 66, 142, 254, 161, 213>>, {{2016, 4, 27}, {22, 44, 25, 0}}, {{2016, 4, 27}, {22, 44, 25, 0}}, "any", nil, "json", "{{> json}}\n"] OK query=215.7ms
22:44:26.194 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<250, 104, 100, 145, 46, 253, 64, 228, 150, 126, 70, 143, 244, 200, 239, 121>>, {{2016, 4, 27}, {22, 44, 25, 0}}, {{2016, 4, 27}, {22, 44, 25, 0}}, "any", nil, "text", "{{> text}}\n"] OK query=216.5ms
22:44:26.194 [info] == Migrated in 10.8s
22:44:26.862 [info] == Running Cog.Repo.Migrations.FetchUserPermissionsHonorsRoles.up/0 forward
22:44:26.863 [info] execute "CREATE OR REPLACE FUNCTION fetch_user_permissions (\np_user users.id%TYPE)\nRETURNS TABLE(id uuid, name text)\nLANGUAGE plpgsql STABLE STRICT\nAS $$\nBEGIN\n\nRETURN QUERY WITH\n\n-- Walk the tree of group memberships and find\n-- all the groups the user is a direct and\n-- indirect member of.\nall_groups as (\nSELECT group_id\n FROM groups_for_user(p_user)\n),\nall_permissions as (\n\n-- Retrieve all permissions granted to the list\n-- groups returned from all_groups\nSELECT gp.permission_id\n FROM group_permissions as gp\n JOIN all_groups as ag\n ON gp.group_id = ag.group_id\nUNION DISTINCT\n\n-- Retrieve all permissions granted to the user\n-- via roles\nSELECT rp.permission_id\n FROM role_permissions as rp\n JOIN user_roles as ur\n ON rp.role_id = ur.role_id\n WHERE ur.user_id = p_user\nUNION DISTINCT\n\n-- Retrieve all permissions granted to the groups\n-- via roles\nSELECT rp.permission_id\n FROM role_permissions as rp\n JOIN group_roles as gr\n ON rp.role_id = gr.role_id\n JOIN all_groups AS ag\n ON gr.group_id = ag.group_id\nUNION DISTINCT\n\n-- Retrieve all permissions granted directly to the user\nSELECT up.permission_id\n FROM user_permissions as up\nWHERE up.user_id = p_user\n)\n\n-- Join the permission ids returned by the CTE against\n-- the permissions and namespaces tables to produce\n-- the final result\nSELECT p.id, ns.name||':'||p.name as name\nFROM permissions as p, namespaces as ns, all_permissions as ap\nWHERE ap.permission_id = p.id and p.namespace_id = ns.id;\nEND;\n$$;\n"
22:44:27.187 [info] == Migrated in 3.2s
22:44:27.850 [info] == Running Cog.Repo.Migrations.RemoveManifestFileFromBundle.change/0 forward
22:44:27.850 [info] alter table bundles
22:44:28.066 [info] == Migrated in 2.1s
22:44:28.733 [info] == Running Cog.Repo.Migrations.InsertErrorTemplates.change/0 forward
22:44:28.950 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<151, 66, 86, 224, 117, 76, 77, 144, 184, 125, 176, 109, 181, 55, 138, 207>>, {{2016, 4, 27}, {22, 44, 28, 0}}, {{2016, 4, 27}, {22, 44, 28, 0}}, "any", nil, "unregistered_user", "{{mention_name}}: I'm sorry, but either I don't have a Cog account for you, or your {{display_name}} chat handle has not been registered. Currently, only registered users can interact with me.\n\nYou'll need to ask a Cog administrator to fix this situation and to register your {{display_name}} handle. {{#user_creators?}}The following users can help you right here in chat:{{#user_creators}} {{.}}{{/user_creators}}{{/user_creators?}}\n"] OK query=216.2ms
22:44:29.167 [debug] INSERT INTO "templates" ("id", "inserted_at", "updated_at", "adapter", "bundle_id", "name", "source") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<227, 120, 74, 9, 212, 77, 75, 221, 146, 74, 115, 136, 134, 94, 176, 230>>, {{2016, 4, 27}, {22, 44, 28, 0}}, {{2016, 4, 27}, {22, 44, 28, 0}}, "any", nil, "error", "An error has occurred.\n\nAt `{{started}}`, {{initiator}} initiated the following pipeline, assigned the unique ID `{{id}}`:\n\n `{{{pipeline_text}}}`\n\n{{#planning_failure}}\nThe pipeline failed planning the invocation:\n\n `{{{planning_failure}}}`\n\n{{/planning_failure}}\n{{#execution_failure}}\nThe pipeline failed executing the command:\n\n `{{{execution_failure}}}`\n\n{{/execution_failure}}\nThe specific error was:\n\n {{{error_message}}}\n\n"] OK query=215.9ms
22:44:29.167 [info] == Migrated in 4.3s
_build/dev/lib/cog/priv/repo/migrations/20160411203730_add_version_to_bundles.exs:4: warning: unused alias Bundle
_build/dev/lib/cog/priv/repo/migrations/20160411203730_add_version_to_bundles.exs:3: warning: unused alias Repo
22:44:29.833 [info] == Running Cog.Repo.Migrations.AddVersionToBundles.change/0 forward
22:44:29.833 [info] alter table bundles
22:44:30.049 [info] execute "UPDATE bundles SET version = '0.0.1'"
22:44:30.265 [info] alter table bundles
22:44:30.481 [info] == Migrated in 6.4s
22:44:31.161 [info] == Running Cog.Repo.Migrations.ProtectAdminRoleAndGroup.up/0 forward
22:44:31.162 [info] execute "CREATE OR REPLACE FUNCTION protect_admin_role()\nRETURNS TRIGGER\nLANGUAGE plpgsql\nAS $$\nBEGIN\n IF OLD.NAME = 'cog-admin' THEN\n RAISE EXCEPTION 'cannot modify admin role';\n END IF;\n RETURN NULL;\nEND;\n$$;\n"
22:44:31.379 [info] execute "CREATE CONSTRAINT TRIGGER protect_admin_role\nAFTER UPDATE OR DELETE\nON roles\nFOR EACH ROW\nEXECUTE PROCEDURE protect_admin_role();\n"
22:44:31.595 [info] execute "CREATE OR REPLACE FUNCTION protect_admin_group()\nRETURNS TRIGGER\nLANGUAGE plpgsql\nAS $$\nBEGIN\n IF OLD.NAME = 'cog-admin' THEN\n RAISE EXCEPTION 'cannot modify admin group';\n END IF;\n RETURN NULL;\nEND;\n$$;\n"
22:44:31.812 [info] execute "CREATE CONSTRAINT TRIGGER protect_admin_group\nAFTER UPDATE OR DELETE\nON groups\nFOR EACH ROW\nEXECUTE PROCEDURE protect_admin_group();\n"
22:44:32.028 [info] execute "CREATE OR REPLACE FUNCTION protect_embedded_bundle()\nRETURNS TRIGGER\nLANGUAGE plpgsql\nAS $$\nBEGIN\n IF OLD.NAME = 'operable' THEN\n RAISE EXCEPTION 'cannot modify embedded bundle';\n END IF;\n RETURN NULL;\nEND;\n$$;\n"
22:44:32.245 [info] execute "CREATE CONSTRAINT TRIGGER protect_embedded_bundle\nAFTER UPDATE OR DELETE\nON bundles\nFOR EACH ROW\nEXECUTE PROCEDURE protect_embedded_bundle();\n"
22:44:32.461 [info] == Migrated in 12.9s
22:44:33.123 [info] == Running Cog.Repo.Migrations.TriggersEnabled.change/0 forward
22:44:33.123 [info] rename column active to enabled on table triggers
22:44:33.340 [info] == Migrated in 2.1s
22:44:34.007 [info] == Running Cog.Repo.Migrations.ProtectAdminRolePermissions.up/0 forward
22:44:34.008 [info] execute "CREATE OR REPLACE FUNCTION protect_admin_role_permissions()\nRETURNS TRIGGER\nLANGUAGE plpgsql\nAS $$\nDECLARE\n role TEXT;\n namespace TEXT;\nBEGIN\n SELECT roles.name INTO role FROM roles WHERE roles.id=OLD.role_id;\n\n SELECT namespaces.name\n INTO namespace\n FROM namespaces, permissions\n WHERE namespaces.id=permissions.namespace_id\n AND permissions.id=OLD.permission_id;\n\n IF role = 'cog-admin' AND namespace = 'operable' THEN\n RAISE EXCEPTION 'cannot remove embedded permissions from admin role';\n END IF;\n RETURN NULL;\nEND;\n$$;\n"
22:44:34.224 [info] execute "CREATE CONSTRAINT TRIGGER protect_admin_role_permissions\nAFTER UPDATE OR DELETE\nON role_permissions\nFOR EACH ROW\nEXECUTE PROCEDURE protect_admin_role_permissions();\n"
22:44:34.440 [info] == Migrated in 4.3s
+ echo 'Launching Cog server...'
Launching Cog server...
+ elixir --no-halt --name cog@127.0.0.1 -S mix phoenix.server --no-compile --no-deps-check
2016-04-27T22:44:37.0052 (Probe:11) [info] Starting Probe
2016-04-27T22:44:37.0057 (Probe.Configuration:38) [info] Writing audit logs to the `/home/operable/cog/data/audit_logs` directory
2016-04-27T22:44:37.0058 (Probe.JSONLogHandler:24) [info] Attempting to open JSON-formatted event log file `/home/operable/cog/data/audit_logs/events.log`
2016-04-27T22:44:37.0059 (Probe.JSONLogHandler:27) [info] Logging JSON-formatted event stream to `/home/operable/cog/data/audit_logs/events.log`
2016-04-27T22:44:37.0197 (Porcelain.Init:30) [info] [Porcelain]: goon executable not found
2016-04-27T22:44:37.0197 (Porcelain.Init:31) [info] [Porcelain]: falling back to the basic driver.
2016-04-27T22:44:37.0197 (Porcelain.Init:32) [info] [Porcelain]: (set `config :porcelain, driver: Porcelain.Driver.Basic` or `config :porcelain, goon_warn_if_missing: false` to disable this warning)
2016-04-27T22:44:37.0203 (Cog:113) [info] Using Cog.Adapters.Slack chat adapter
2016-04-27T22:44:37.0222 (Cog.BusDriver:62) [info] Message bus configured for plain TCP
2016-04-27T22:44:37.0235 () [info] Starting emqttd on node 'cog@127.0.0.1'
2016-04-27T22:44:39.0204 () [info] Started 'emqttd ctl'
2016-04-27T22:44:39.0205 () [info] Started 'emqttd trace'
2016-04-27T22:44:39.0205 () [info] Started 'emqttd pubsub'
2016-04-27T22:44:39.0212 () [info] Started 'emqttd stats'
2016-04-27T22:44:39.0219 () [info] Started 'emqttd metrics'
2016-04-27T22:44:39.0219 () [info] Started 'emqttd retained'
2016-04-27T22:44:39.0219 () [info] Started 'emqttd pooler'
2016-04-27T22:44:39.0219 () [info] Started 'emqttd client manager'
2016-04-27T22:44:39.0220 () [info] Started 'emqttd session manager'
2016-04-27T22:44:39.0220 () [info] Started 'emqttd session supervisor'
2016-04-27T22:44:39.0221 () [info] Started 'emqttd broker'
2016-04-27T22:44:39.0221 () [info] Started 'emqttd alarm'
2016-04-27T22:44:39.0221 () [info] Started 'emqttd mod supervisor'
2016-04-27T22:44:39.0221 () [info] Started 'emqttd bridge supervisor'
2016-04-27T22:44:39.0221 () [info] Started 'emqttd access control'
2016-04-27T22:44:39.0222 () [info] Started 'emqttd system monitor'
mqtt listen on 127.0.0.1:1883 with 16 acceptors.
2016-04-27T22:44:39.0255 () [info] Erlang MQTT Broker 0.13.1 is running now
2016-04-27T22:44:39.0255 (Cog.TokenReaper:55) [info] Scheduling next expired token reaping for approximately 0 hours from now
2016-04-27T22:44:39.0265 (Carrier.CredentialManager:36) [info] ready.
2016-04-27T22:44:39.0386 (Carrier.Messaging.Connection:63) [info] Connection #PID<0.586.0> connected to message bus
2016-04-27T22:44:39.0386 (Cog.Relay.Relays:66) [info] Starting
2016-04-27T22:44:39.0388 (Carrier.Messaging.Connection:63) [info] Connection #PID<0.591.0> connected to message bus
2016-04-27T22:44:39.0388 (Cog.Relay.Info:31) [info] Starting relay information service
2016-04-27T22:44:39.0389 (Cog.Bundle.Embedded:56) [info] Announcing embedded bundle
2016-04-27T22:44:40.0503 (Cog.Repo:2) [debug] SELECT b0."id", b0."name", b0."version", b0."config_file", b0."enabled", b0."inserted_at", b0."updated_at" FROM "bundles" AS b0 WHERE (b0."name" = $1) ["operable"] OK query=1102.6ms queue=4.6ms
2016-04-27T22:44:40.0503 (Cog.Relay.Relays:199) [info] Installing bundle: "operable"
2016-04-27T22:44:40.0720 (Cog.Repo:2) [debug] BEGIN [] OK query=216.1ms queue=0.2ms
2016-04-27T22:44:41.0043 (Cog.Repo:2) [debug] DELETE FROM "tokens" AS t0 WHERE ((t0."inserted_at"::timestamp + ($1::numeric * interval '1 second'))::timestamp <= $2) [#Decimal<604800>, {{2016, 4, 27}, {22, 44, 40, 0}}] OK query=784.6ms queue=0.6ms
2016-04-27T22:44:41.0043 (Cog.TokenReaper:65) [info] No expired tokens to delete
2016-04-27T22:44:41.0043 (Cog.TokenReaper:55) [info] Scheduling next expired token reaping for approximately 24 hours from now
2016-04-27T22:44:41.0161 (Cog.Repo:2) [debug] INSERT INTO "bundles" ("id", "inserted_at", "updated_at", "config_file", "enabled", "name", "version") VALUES ($1, $2, $3, $4, $5, $6, $7) [<<196, 184, 66, 134, 100, 207, 67, 169, 166, 187, 115, 127, 16, 63, 53, 31>>, {{2016, 4, 27}, {22, 44, 40, 0}}, {{2016, 4, 27}, {22, 44, 40, 0}}, %{"commands" => %{"alias" => %{"documentation" => "Manages aliases\n\nSubcommands\n* new <alias-name> <alias-definition> -- creates a new alias visible to the creating user.\n* mv <alias-name> <site | user>:[new-alias-name] -- moves aliases between user and site visibility. Optionally renames aliases.\n* rm <alias-name> -- Removes aliases\n* ls [pattern] -- Returns the list of aliases optionally filtered by pattern. Pattern support basic wildcards with '*'.\n\n## Example\n\n @bot operable:alias new my-awesome-alias \"echo \"My Awesome Alias\"\"\n > user:my-awesome-alias has been created\n\n @bot operable:alias mv my-awesome-alias site:awesome-alias\n > Moved user:my-awesome-alias to site:awesome-alias\n\n @bot operable:alias rm awesome-alias\n > Removed site:awesome-alias\n\n @bot operable:alias ls\n > Name: 'my-awesome-alias'\n Visibility: 'user'\n Pipeline: 'echo my-awesome-alias'\n\n Name: 'my-other-awesome-alias'\n Visibility: 'site'\n Pipeline: 'echo my-other-awesome-alias'\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Alias", "options" => %{}, "rules" => []}, "bundle" => %{"documentation" => "\n## Overview\n\nManipulate and interrogate command bundle status.\n\nA bundle may be either `enabled` or `disabled`. If a bundle is\nenabled, chat invocations of commands contained within the bundle\nwill be executed. If the bundle is disabled, on the other hand, no\nsuch commands will be run.\n\nBundles may be enabled or disabled independently of whether or not\nany Relays are currently _running_ the bundles. The status of a\nbundle is managed centrally; when a Relay serving the bundle comes\nonline, the status of the bundle is respected. Thus a bundle may be\nenabled, but not running on any Relays, just as it can be disabled,\nbut running on _every_ Relay.\n\nThis can be used to either quickly disable a bundle, or as the first\nstep in deleting a bundle from the bot.\n\nNote that the `operable` bundle is a protected bundle;\nthis bundle is always enabled and is in fact embedded in the bot\nitself. Core pieces of bot functionality would not work (including\nthis very command itself!) if this bundle were ever disabled (though\nmany functions would remain available via the REST API). As a\nresult, calling either of the mutator subcommands `enable` or\n`disable` (see below) on the `operable` bundle is an\nerror.\n\n## Subcommands\n\n* `status`\n\n bundle status <bundle_name>\n\n Shows the current status of the bundle, whether `enabled` or\n `disabled`. Additionally shows which Relays (if any) are running\n the code for the bundle.\n\n The `enable` and `disable` subcommands (see below) also return\n this information.\n\n Can be called on any bundle, including `operable`.\n\n* `enable`\n\n bundle enable <bundle_name>\n\n Enabling a bundle allows chat commands to be routed to it. Running\n this subcommand has no effect if a bundle is already enabled.\n\n Cannot be used on the `operable` bundle.\n\n* `disable`\n\n bundle disable <bundle_name>\n\n Disabling a bundle prevents commands from being routed to it. The\n bundle is not uninstalled, and all custom rules remain\n intact. The bundle still exists, but commands in it will not be\n executed.\n\n A disabled bundle can be re-enabled using this the `enable`\n sub-command; see above.\n\n Running this subcommand has no effect if a bundle is already\n disabled.\n\n Cannot be used on the `operable` bundle.\n\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Bundle", "options" => %{}, "rules" => ["when command is operable:bundle must have operable:manage_commands"]}, "echo" => %{"documentation" => "Repeats whatever it is passed.\n\n## Example\n\n @bot operable:echo this is nifty\n > this if nifty\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Echo", "options" => %{}, "rules" => []}, "filter" => %{"documentation" => "Filters a collection where the `path` equals the `matches`.\nThe `path` option is the key that you would like to focus on;\nThe `matches` option is the value that you are searching for.\n\n## Example\n\n @bot operable:rules --list --for-command=\"operable:permissions\" | operable:filter --path=\"rule\" --matches=\"/manage_users/\"\n > { \"id\": \"91edb472-04cf-4bca-ba05-e51b63f26758\",\n \"rule\": \"operable:manage_users\",\n \"command\": \"operable:permissions\" }\n @bot operable:seed --list --for-command=\"operable:permissions\" | operable:filter --path=\"rule\" --matches=\"/manage_users/\"\n > { \"id\": \"91edb472-04cf-4bca-ba05-e51b63f26758\",\n \"rule\": \"operable:manage_users\",\n \"command\": \"operable:permissions\" }\n @bot operable:seed '[{\"foo\":{\"bar.qux\":{\"baz\":\"stuff\"}}}, {\"foo\": {\"bar\":{\"baz\":\"me\"}}}]' | operable:filter --path=\"foo.bar.baz\"\"\n > [ {\"foo\": {\"bar.qux\": {\"baz\": \"stuff\"} } }, {\"foo\": {\"bar\": {\"baz\": \"me\"} } } ]\n @bot operable:seed '[{\"foo\":{\"bar.qux\":{\"baz\":\"stuff\"}}}, {\"foo\": {\"bar\":{\"baz\":\"me\"}}}]' | operable:filter --path=\"foo.\\\"bar.qux\\\".baz\"\"\n > { \"foo\": {\"bar.qux\": {\"baz\": \"stuff\"} } }\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Filter", "options" => %{"matches" => %{"required" => false, "type" => "string"}, "path" => %{"required" => false, "type" => "string"}}, "rules" => []}, "greet" => %{"documentation" => "Introduce the bot to new coworkers!\n\n## Example\n\n @bot operable:greet @new_hire\n > Hello @new_hire\n > I'm Cog! I can do lots of things ...\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Greet", "options" => %{}, "rules" => []}, "group" => %{"documentation" => "This command allows the user to manage groups of users.\n\nUsage:\n group --create <groupname>\n group --drop <groupname>\n group --add --user=<username> <groupname>\n group --remove --user=<username> <groupname>\n group --list\nExamples:\n> @bot operable:group --create ops\n> @bot operable:group --create engineering\n> @bot operable:group --add --user=bob ops\n> @bot operable:group --remove --user=bob ops\n> @bot operable:group --drop ops\n> @bot operable:group --list\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Group", "options" => %{"add" => %{"required" => false, "type" => "bool"}, "create" => %{"required" => false, "type" => "bool"}, "drop" => %{"required" => false, "type" => "bool"}, "list" => %{"required" => false, "type" => "bool"}, "remove" => %{"required" => false, "type" => "bool"}, "user" => %{"required" => false, "type" => "string"}}, "rules" => ["when command is operable:group with option[add] == true must have operable:manage_users", "when command is operable:group with option[create] == true must have operable:manage_groups", "when command is operable:group with option[drop] == true must have operable:manage_groups", "when command is operable:group with option[list] == true must have operable:manage_groups", "when command is operable:group with option[remove] == true must have operable:manage_users"]}, "help" => %{"documentation" => "Get help on all installed Cog bot commands.\n\n * `@bot operable:help` - list all enabled commands\n * `@bot operable:help --disabled` - list all disabled commands\n * `@bot operable:help --all` - list all known commands, enabled and disabled\n * `@bot operable:help \"operable:help\"` - list help for a specific command\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Help", "options" => %{"all" => %{"required" => false, "type" => "bool"}, "disabled" => %{"required" => false, "type" => "bool"}}, "rules" => []}, "max" = (truncated)
2016-04-27T22:44:41.0378 (Cog.Repo:2) [debug] INSERT INTO "namespaces" ("id", "bundle_id", "name") VALUES ($1, $2, $3) [<<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>, <<196, 184, 66, 134, 100, 207, 67, 169, 166, 187, 115, 127, 16, 63, 53, 31>>, "operable"] OK query=216.5ms
2016-04-27T22:44:41.0594 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<120, 123, 252, 253, 25, 61, 77, 218, 145, 77, 3, 249, 158, 237, 220, 223>>, "manage_commands", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=216.4ms
2016-04-27T22:44:41.0811 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<138, 104, 26, 18, 154, 230, 74, 152, 132, 27, 119, 36, 23, 236, 74, 161>>, "manage_groups", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=215.9ms
2016-04-27T22:44:42.0027 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<175, 136, 247, 18, 142, 9, 73, 20, 145, 160, 140, 59, 73, 4, 198, 53>>, "manage_permissions", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=215.8ms
2016-04-27T22:44:42.0243 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<243, 59, 13, 220, 96, 39, 65, 211, 133, 251, 229, 188, 19, 201, 27, 9>>, "manage_roles", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=215.7ms
2016-04-27T22:44:42.0460 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<147, 141, 36, 35, 146, 56, 66, 15, 148, 174, 184, 21, 77, 112, 188, 60>>, "manage_users", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=216.4ms
2016-04-27T22:44:42.0676 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<46, 175, 162, 0, 161, 15, 67, 217, 145, 68, 167, 12, 55, 10, 78, 164>>, "manage_relays", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=216.2ms
2016-04-27T22:44:42.0892 (Cog.Repo:2) [debug] INSERT INTO "permissions" ("id", "name", "namespace_id") VALUES ($1, $2, $3) [<<201, 151, 4, 210, 37, 56, 69, 39, 135, 100, 88, 176, 156, 209, 48, 178>>, "manage_triggers", <<173, 191, 157, 93, 209, 151, 67, 22, 163, 177, 136, 237, 213, 140, 142, 166>>] OK query=215.5ms
2016-04-27T22:44:43.0110 (Cog.Repo:2) [debug] INSERT INTO "commands" ("id", "bundle_id", "documentation", "enforcing", "execution", "name") VALUES ($1, $2, $3, $4, $5, $6) [<<77, 11, 58, 153, 119, 67, 75, 237, 190, 37, 174, 221, 189, 253, 255, 159>>, <<196, 184, 66, 134, 100, 207, 67, 169, 166, 187, 115, 127, 16, 63, 53, 31>>, "Manages aliases\n\nSubcommands\n* new <alias-name> <alias-definition> -- creates a new alias visible to the creating user.\n* mv <alias-name> <site | user>:[new-alias-name] -- moves aliases between user and site visibility. Optionally renames aliases.\n* rm <alias-name> -- Removes aliases\n* ls [pattern] -- Returns the list of aliases optionally filtered by pattern. Pattern support basic wildcards with '*'.\n\n## Example\n\n @bot operable:alias new my-awesome-alias \"echo \"My Awesome Alias\"\"\n > user:my-awesome-alias has been created\n\n @bot operable:alias mv my-awesome-alias site:awesome-alias\n > Moved user:my-awesome-alias to site:awesome-alias\n\n @bot operable:alias rm awesome-alias\n > Removed site:awesome-alias\n\n @bot operable:alias ls\n > Name: 'my-awesome-alias'\n Visibility: 'user'\n Pipeline: 'echo my-awesome-alias'\n\n Name: 'my-other-awesome-alias'\n Visibility: 'site'\n Pipeline: 'echo my-other-awesome-alias'\n", false, "multiple", "alias"] OK query=217.2ms
2016-04-27T22:44:43.0435 (Cog.Repo:2) [debug] INSERT INTO "commands" ("id", "bundle_id", "documentation", "enforcing", "execution", "name") VALUES ($1, $2, $3, $4, $5, $6) [<<253, 115, 41, 68, 18, 53, 69, 117, 151, 66, 124, 176, 156, 249, 213, 223>>, <<196, 184, 66, 134, 100, 207, 67, 169, 166, 187, 115, 127, 16, 63, 53, 31>>, "\n## Overview\n\nManipulate and interrogate command bundle status.\n\nA bundle may be either `enabled` or `disabled`. If a bundle is\nenabled, chat invocations of commands contained within the bundle\nwill be executed. If the bundle is disabled, on the other hand, no\nsuch commands will be run.\n\nBundles may be enabled or disabled independently of whether or not\nany Relays are currently _running_ the bundles. The status of a\nbundle is managed centrally; when a Relay serving the bundle comes\nonline, the status of the bundle is respected. Thus a bundle may be\nenabled, but not running on any Relays, just as it can be disabled,\nbut running on _every_ Relay.\n\nThis can be used to either quickly disable a bundle, or as the first\nstep in deleting a bundle from the bot.\n\nNote that the `operable` bundle is a protected bundle;\nthis bundle is always enabled and is in fact embedded in the bot\nitself. Core pieces of bot functionality would not work (including\nthis very command itself!) if this bundle were ever disabled (though\nmany functions would remain available via the REST API). As a\nresult, calling either of the mutator subcommands `enable` or\n`disable` (see below) on the `operable` bundle is an\nerror.\n\n## Subcommands\n\n* `status`\n\n bundle status <bundle_name>\n\n Shows the current status of the bundle, whether `enabled` or\n `disabled`. Additionally shows which Relays (if any) are running\n the code for the bundle.\n\n The `enable` and `disable` subcommands (see below) also return\n this information.\n\n Can be called on any bundle, including `operable`.\n\n* `enable`\n\n bundle enable <bundle_name>\n\n Enabling a bundle allows chat commands to be routed to it. Running\n this subcommand has no effect if a bundle is already enabled.\n\n Cannot be used on the `operable` bundle.\n\n* `disable`\n\n bundle disable <bundle_name>\n\n Disabling a bundle prevents commands from being routed to it. The\n bundle is not uninstalled, and all custom rules remain\n intact. The bundle still exists, but commands in it will not be\n executed.\n\n A disabled bundle can be re-enabled using this the `enable`\n sub-command; see above.\n\n Running this subcommand has no effect if a bundle is already\n disabled.\n\n Cannot be used on the `operable` bundle.\n\n", true, "multiple", "bundle"] OK query=323.8ms
2016-04-27T22:44:43.0674 (Cog.Repo:2) [debug] SELECT c0."id", c0."name", c0."documentation", c0."enforcing", c0."execution", c0."bundle_id" FROM "commands" AS c0 INNER JOIN "bundles" AS b1 ON b1."id" = c0."bundle_id" WHERE (b1."name" = $1) AND (c0."name" = $2) ["operable", "bundle"] OK query=216.8ms
2016-04-27T22:44:43.0891 (Cog.Repo:2) [debug] SELECT p0."id", p0."namespace_id", p0."name" FROM "permissions" AS p0 INNER JOIN "namespaces" AS n1 ON n1."id" = p0."namespace_id" WHERE ((p0."name" = $1) AND (n1."name" = $2)) ["manage_commands", "operable"] OK query=216.2ms
2016-04-27T22:44:44.0121 (Cog.Repo:2) [debug] INSERT INTO "rules" ("id", "command_id", "parse_tree", "score") VALUES ($1, $2, $3, $4) [<<199, 151, 182, 247, 215, 45, 76, 208, 155, 130, 10, 25, 178, 219, 139, 67>>, <<253, 115, 41, 68, 18, 53, 69, 117, 151, 66, 124, 176, 156, 249, 213, 223>>, "{\"score\":0,\"permission_selector\":{\"perms\":{\"value\":\"operable:manage_commands\",\"quotes\":null,\"line\":1,\"col\":42,\"$ast$\":\"string\"},\"op\":\"has\",\"line\":1,\"col\":42,\"$ast$\":\"perm_expr\"},\"command_selector\":{\"right\":{\"value\":\"operable:bundle\",\"quotes\":null,\"line\":1,\"col\":16,\"$ast$\":\"string\"},\"parens\":false,\"op\":\"is\",\"line\":1,\"left\":{\"name\":\"command\",\"$ast$\":\"var\"},\"col\":13,\"$ast$\":\"binary_expr\"},\"command\":\"operable:bundle\",\"$ast$\":\"rule\"}", 0] OK query=216.4ms
2016-04-27T22:44:44.0339 (Cog.Repo:2) [debug] INSERT INTO rule_permissions(rule_id, permission_id)
SELECT $1, $2
WHERE (NOT
(EXISTS (
SELECT * FROM rule_permissions
WHERE rule_id = $1
AND permission_id = $2
)))
[<<199, 151, 182, 247, 215, 45, 76, 208, 155, 130, 10, 25, 178, 219, 139, 67>>, <<120, 123, 252, 253, 25, 61, 77, 218, 145, 77, 3, 249, 158, 237, 220, 223>>] OK query=217.4ms
2016-04-27T22:44:44.0408 () [info] Application cog exited: Cog.start(:normal, []) returned an error: shutdown: failed to start child: Cog.Relay.RelaySup
** (EXIT) shutdown: failed to start child: Cog.Bundle.Embedded
** (EXIT) exited in: GenServer.call(Cog.Relay.Relays, {:announce_embedded_relay, %{"announce" => %{"bundles" => [%{"commands" => %{"alias" => %{"documentation" => "Manages aliases\n\nSubcommands\n* new <alias-name> <alias-definition> -- creates a new alias visible to the creating user.\n* mv <alias-name> <site | user>:[new-alias-name] -- moves aliases between user and site visibility. Optionally renames aliases.\n* rm <alias-name> -- Removes aliases\n* ls [pattern] -- Returns the list of aliases optionally filtered by pattern. Pattern support basic wildcards with '*'.\n\n## Example\n\n @bot operable:alias new my-awesome-alias \"echo \"My Awesome Alias\"\"\n > user:my-awesome-alias has been created\n\n @bot operable:alias mv my-awesome-alias site:awesome-alias\n > Moved user:my-awesome-alias to site:awesome-alias\n\n @bot operable:alias rm awesome-alias\n > Removed site:awesome-alias\n\n @bot operable:alias ls\n > Name: 'my-awesome-alias'\n Visibility: 'user'\n Pipeline: 'echo my-awesome-alias'\n\n Name: 'my-other-awesome-alias'\n Visibility: 'site'\n Pipeline: 'echo my-other-awesome-alias'\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Alias", "options" => %{}, "rules" => []}, "bundle" => %{"documentation" => "\n## Overview\n\nManipulate and interrogate command bundle status.\n\nA bundle may be either `enabled` or `disabled`. If a bundle is\nenabled, chat invocations of commands contained within the bundle\nwill be executed. If the bundle is disabled, on the other hand, no\nsuch commands will be run.\n\nBundles may be enabled or disabled independently of whether or not\nany Relays are currently _running_ the bundles. The status of a\nbundle is managed centrally; when a Relay serving the bundle comes\nonline, the status of the bundle is respected. Thus a bundle may be\nenabled, but not running on any Relays, just as it can be disabled,\nbut running on _every_ Relay.\n\nThis can be used to either quickly disable a bundle, or as the first\nstep in deleting a bundle from the bot.\n\nNote that the `operable` bundle is a protected bundle;\nthis bundle is always enabled and is in fact embedded in the bot\nitself. Core pieces of bot functionality would not work (including\nthis very command itself!) if this bundle were ever disabled (though\nmany functions would remain available via the REST API). As a\nresult, calling either of the mutator subcommands `enable` or\n`disable` (see below) on the `operable` bundle is an\nerror.\n\n## Subcommands\n\n* `status`\n\n bundle status <bundle_name>\n\n Shows the current status of the bundle, whether `enabled` or\n `disabled`. Additionally shows which Relays (if any) are running\n the code for the bundle.\n\n The `enable` and `disable` subcommands (see below) also return\n this information.\n\n Can be called on any bundle, including `operable`.\n\n* `enable`\n\n bundle enable <bundle_name>\n\n Enabling a bundle allows chat commands to be routed to it. Running\n this subcommand has no effect if a bundle is already enabled.\n\n Cannot be used on the `operable` bundle.\n\n* `disable`\n\n bundle disable <bundle_name>\n\n Disabling a bundle prevents commands from being routed to it. The\n bundle is not uninstalled, and all custom rules remain\n intact. The bundle still exists, but commands in it will not be\n executed.\n\n A disabled bundle can be re-enabled using this the `enable`\n sub-command; see above.\n\n Running this subcommand has no effect if a bundle is already\n disabled.\n\n Cannot be used on the `operable` bundle.\n\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Bundle", "options" => %{}, "rules" => ["when command is operable:bundle must have operable:manage_commands"]}, "echo" => %{"documentation" => "Repeats whatever it is passed.\n\n## Example\n\n @bot operable:echo this is nifty\n > this if nifty\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Echo", "options" => %{}, "rules" => []}, "filter" => %{"documentation" => "Filters a collection where the `path` equals the `matches`.\nThe `path` option is the key that you would like to focus on;\nThe `matches` option is the value that you are searching for.\n\n## Example\n\n @bot operable:rules --list --for-command=\"operable:permissions\" | operable:filter --path=\"rule\" --matches=\"/manage_users/\"\n > { \"id\": \"91edb472-04cf-4bca-ba05-e51b63f26758\",\n \"rule\": \"operable:manage_users\",\n \"command\": \"operable:permissions\" }\n @bot operable:seed --list --for-command=\"operable:permissions\" | operable:filter --path=\"rule\" --matches=\"/manage_users/\"\n > { \"id\": \"91edb472-04cf-4bca-ba05-e51b63f26758\",\n \"rule\": \"operable:manage_users\",\n \"command\": \"operable:permissions\" }\n @bot operable:seed '[{\"foo\":{\"bar.qux\":{\"baz\":\"stuff\"}}}, {\"foo\": {\"bar\":{\"baz\":\"me\"}}}]' | operable:filter --path=\"foo.bar.baz\"\"\n > [ {\"foo\": {\"bar.qux\": {\"baz\": \"stuff\"} } }, {\"foo\": {\"bar\": {\"baz\": \"me\"} } } ]\n @bot operable:seed '[{\"foo\":{\"bar.qux\":{\"baz\":\"stuff\"}}}, {\"foo\": {\"bar\":{\"baz\":\"me\"}}}]' | operable:filter --path=\"foo.\\\"bar.qux\\\".baz\"\"\n > { \"foo\": {\"bar.qux\": {\"baz\": \"stuff\"} } }\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Filter", "options" => %{"matches" => %{"required" => false, "type" => "string"}, "path" => %{"required" => false, "type" => "string"}}, "rules" => []}, "greet" => %{"documentation" => "Introduce the bot to new coworkers!\n\n## Example\n\n @bot operable:greet @new_hire\n > Hello @new_hire\n > I'm Cog! I can do lots of things ...\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Greet", "options" => %{}, "rules" => []}, "group" => %{"documentation" => "This command allows the user to manage groups of users.\n\nUsage:\n group --create <groupname>\n group --drop <groupname>\n group --add --user=<username> <groupname>\n group --remove --user=<username> <groupname>\n group --list\nExamples:\n> @bot operable:group --create ops\n> @bot operable:group --create engineering\n> @bot operable:group --add --user=bob ops\n> @bot operable:group --remove --user=bob ops\n> @bot operable:group --drop ops\n> @bot operable:group --list\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Group", "options" => %{"add" => %{"required" => false, "type" => "bool"}, "create" => %{"required" => false, "type" => "bool"}, "drop" => %{"required" => false, "type" => "bool"}, "list" => %{"required" => false, "type" => "bool"}, "remove" => %{"required" => false, "type" => "bool"}, "user" => %{"required" => false, "type" => "string"}}, "rules" => ["when command is operable:group with option[add] == true must have operable:manage_users", "when command is operable:group with option[create] == true must have operable:manage_groups", "when command is operable:group with option[drop] == true must have operable:manage_groups", "when command is operable:group with option[list] == true must have operable:manage_groups", "when command is operable:group with option[remove] == true must have operable:manage_users"]}, "help" => %{"documentation" => "Get help on all installed Cog bot commands.\n\n * `@bot operable:help` - list all enabled commands\n * `@bot operable:help --disabled` - list all disabled commands\n * `@bot operable:help --all` - list all known commands, enabled and disabled\n * `@bot operable:help \"operable:help\"` - list help for a specific command\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Help", "options" => %{"all" => %{"required" => false, "type" => "bool"}, "disabled" => %{"required" => false, "type" => "bool"}}, "ru (truncated)
2016-04-27T22:44:44.0408 () [info] Application exirc exited: :stopped
2016-04-27T22:44:44.0408 () [info] Application spanner exited: :stopped
2016-04-27T22:44:44.0408 () [info] Application porcelain exited: :stopped
2016-04-27T22:44:44.0408 () [info] Application yaml_elixir exited: :stopped
2016-04-27T22:44:44.0408 () [info] Application yamerl exited: :stopped
2016-04-27T22:44:44.0408 () [info] Application comeonin exited: :stopped
2016-04-27T22:44:44.0408 () [info] Application phoenix_html exited: :stopped
2016-04-27T22:44:44.0409 () [info] Application postgrex exited: :stopped
2016-04-27T22:44:44.0410 () [info] Application db_connection exited: :stopped
2016-04-27T22:44:44.0410 () [info] Application connection exited: :stopped
2016-04-27T22:44:44.0410 () [info] Application phoenix_ecto exited: :stopped
2016-04-27T22:44:44.0410 () [info] Application ecto exited: :stopped
2016-04-27T22:44:44.0410 () [info] Application poolboy exited: :stopped
2016-04-27T22:44:44.0410 () [info] Application decimal exited: :stopped
2016-04-27T22:44:44.0411 () [info] Application phoenix exited: :stopped
2016-04-27T22:44:44.0411 () [info] Application eex exited: :stopped
2016-04-27T22:44:44.0411 () [info] Application poison exited: :stopped
2016-04-27T22:44:44.0412 () [info] Application plug exited: :stopped
2016-04-27T22:44:44.0412 () [info] Application cowboy exited: :stopped
2016-04-27T22:44:44.0412 () [info] Application cowlib exited: :stopped
2016-04-27T22:44:44.0414 () [info] Application ranch exited: :stopped
2016-04-27T22:44:44.0414 () [info] Application slack exited: :stopped
2016-04-27T22:44:44.0414 () [info] Application exjsx exited: :stopped
2016-04-27T22:44:44.0414 () [info] Application jsx exited: :stopped
2016-04-27T22:44:44.0414 () [info] Application httpoison exited: :stopped
2016-04-27T22:44:44.0415 () [info] Application hackney exited: :stopped
2016-04-27T22:44:44.0415 () [info] Application metrics exited: :stopped
2016-04-27T22:44:44.0415 () [info] Application ssl_verify_fun exited: :stopped
stopped mqtt on 127.0.0.1:1883
2016-04-27T22:44:44.0415 () [info] Application certifi exited: :stopped
2016-04-27T22:44:44.0415 () [info] Application mimerl exited: :stopped
2016-04-27T22:44:44.0415 () [info] Application idna exited: :stopped
2016-04-27T22:44:44.0416 () [info] Application hedwig exited: :stopped
2016-04-27T22:44:44.0416 () [info] Application exml exited: :stopped
2016-04-27T22:44:44.0417 () [info] Application esockd exited: :stopped
2016-04-27T22:44:44.0418 () [info] Application gproc exited: :stopped
2016-04-27T22:44:44.0418 () [info] Application httpotion exited: :stopped
2016-04-27T22:44:44.0419 () [info] Application ibrowse exited: :stopped
2016-04-27T22:44:44.0419 () [info] Application logger_file_backend exited: :stopped
2016-04-27T22:44:44.0419 () [info] Application probe exited: :stopped
=INFO REPORT==== 27-Apr-2016::22:44:44 ===
application: logger
exited: stopped
type: temporary
** (Mix) Could not start application cog: Cog.start(:normal, []) returned an error: shutdown: failed to start child: Cog.Relay.RelaySup
** (EXIT) shutdown: failed to start child: Cog.Bundle.Embedded
** (EXIT) exited in: GenServer.call(Cog.Relay.Relays, {:announce_embedded_relay, %{"announce" => %{"bundles" => [%{"commands" => %{"alias" => %{"documentation" => "Manages aliases\n\nSubcommands\n* new <alias-name> <alias-definition> -- creates a new alias visible to the creating user.\n* mv <alias-name> <site | user>:[new-alias-name] -- moves aliases between user and site visibility. Optionally renames aliases.\n* rm <alias-name> -- Removes aliases\n* ls [pattern] -- Returns the list of aliases optionally filtered by pattern. Pattern support basic wildcards with '*'.\n\n## Example\n\n @bot operable:alias new my-awesome-alias \"echo \"My Awesome Alias\"\"\n > user:my-awesome-alias has been created\n\n @bot operable:alias mv my-awesome-alias site:awesome-alias\n > Moved user:my-awesome-alias to site:awesome-alias\n\n @bot operable:alias rm awesome-alias\n > Removed site:awesome-alias\n\n @bot operable:alias ls\n > Name: 'my-awesome-alias'\n Visibility: 'user'\n Pipeline: 'echo my-awesome-alias'\n\n Name: 'my-other-awesome-alias'\n Visibility: 'site'\n Pipeline: 'echo my-other-awesome-alias'\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Alias", "options" => %{}, "rules" => []}, "bundle" => %{"documentation" => "\n## Overview\n\nManipulate and interrogate command bundle status.\n\nA bundle may be either `enabled` or `disabled`. If a bundle is\nenabled, chat invocations of commands contained within the bundle\nwill be executed. If the bundle is disabled, on the other hand, no\nsuch commands will be run.\n\nBundles may be enabled or disabled independently of whether or not\nany Relays are currently _running_ the bundles. The status of a\nbundle is managed centrally; when a Relay serving the bundle comes\nonline, the status of the bundle is respected. Thus a bundle may be\nenabled, but not running on any Relays, just as it can be disabled,\nbut running on _every_ Relay.\n\nThis can be used to either quickly disable a bundle, or as the first\nstep in deleting a bundle from the bot.\n\nNote that the `operable` bundle is a protected bundle;\nthis bundle is always enabled and is in fact embedded in the bot\nitself. Core pieces of bot functionality would not work (including\nthis very command itself!) if this bundle were ever disabled (though\nmany functions would remain available via the REST API). As a\nresult, calling either of the mutator subcommands `enable` or\n`disable` (see below) on the `operable` bundle is an\nerror.\n\n## Subcommands\n\n* `status`\n\n bundle status <bundle_name>\n\n Shows the current status of the bundle, whether `enabled` or\n `disabled`. Additionally shows which Relays (if any) are running\n the code for the bundle.\n\n The `enable` and `disable` subcommands (see below) also return\n this information.\n\n Can be called on any bundle, including `operable`.\n\n* `enable`\n\n bundle enable <bundle_name>\n\n Enabling a bundle allows chat commands to be routed to it. Running\n this subcommand has no effect if a bundle is already enabled.\n\n Cannot be used on the `operable` bundle.\n\n* `disable`\n\n bundle disable <bundle_name>\n\n Disabling a bundle prevents commands from being routed to it. The\n bundle is not uninstalled, and all custom rules remain\n intact. The bundle still exists, but commands in it will not be\n executed.\n\n A disabled bundle can be re-enabled using this the `enable`\n sub-command; see above.\n\n Running this subcommand has no effect if a bundle is already\n disabled.\n\n Cannot be used on the `operable` bundle.\n\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Bundle", "options" => %{}, "rules" => ["when command is operable:bundle must have operable:manage_commands"]}, "echo" => %{"documentation" => "Repeats whatever it is passed.\n\n## Example\n\n @bot operable:echo this is nifty\n > this if nifty\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Echo", "options" => %{}, "rules" => []}, "filter" => %{"documentation" => "Filters a collection where the `path` equals the `matches`.\nThe `path` option is the key that you would like to focus on;\nThe `matches` option is the value that you are searching for.\n\n## Example\n\n @bot operable:rules --list --for-command=\"operable:permissions\" | operable:filter --path=\"rule\" --matches=\"/manage_users/\"\n > { \"id\": \"91edb472-04cf-4bca-ba05-e51b63f26758\",\n \"rule\": \"operable:manage_users\",\n \"command\": \"operable:permissions\" }\n @bot operable:seed --list --for-command=\"operable:permissions\" | operable:filter --path=\"rule\" --matches=\"/manage_users/\"\n > { \"id\": \"91edb472-04cf-4bca-ba05-e51b63f26758\",\n \"rule\": \"operable:manage_users\",\n \"command\": \"operable:permissions\" }\n @bot operable:seed '[{\"foo\":{\"bar.qux\":{\"baz\":\"stuff\"}}}, {\"foo\": {\"bar\":{\"baz\":\"me\"}}}]' | operable:filter --path=\"foo.bar.baz\"\"\n > [ {\"foo\": {\"bar.qux\": {\"baz\": \"stuff\"} } }, {\"foo\": {\"bar\": {\"baz\": \"me\"} } } ]\n @bot operable:seed '[{\"foo\":{\"bar.qux\":{\"baz\":\"stuff\"}}}, {\"foo\": {\"bar\":{\"baz\":\"me\"}}}]' | operable:filter --path=\"foo.\\\"bar.qux\\\".baz\"\"\n > { \"foo\": {\"bar.qux\": {\"baz\": \"stuff\"} } }\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Filter", "options" => %{"matches" => %{"required" => false, "type" => "string"}, "path" => %{"required" => false, "type" => "string"}}, "rules" => []}, "greet" => %{"documentation" => "Introduce the bot to new coworkers!\n\n## Example\n\n @bot operable:greet @new_hire\n > Hello @new_hire\n > I'm Cog! I can do lots of things ...\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Greet", "options" => %{}, "rules" => []}, "group" => %{"documentation" => "This command allows the user to manage groups of users.\n\nUsage:\n group --create <groupname>\n group --drop <groupname>\n group --add --user=<username> <groupname>\n group --remove --user=<username> <groupname>\n group --list\nExamples:\n> @bot operable:group --create ops\n> @bot operable:group --create engineering\n> @bot operable:group --add --user=bob ops\n> @bot operable:group --remove --user=bob ops\n> @bot operable:group --drop ops\n> @bot operable:group --list\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Group", "options" => %{"add" => %{"required" => false, "type" => "bool"}, "create" => %{"required" => false, "type" => "bool"}, "drop" => %{"required" => false, "type" => "bool"}, "list" => %{"required" => false, "type" => "bool"}, "remove" => %{"required" => false, "type" => "bool"}, "user" => %{"required" => false, "type" => "string"}}, "rules" => ["when command is operable:group with option[add] == true must have operable:manage_users", "when command is operable:group with option[create] == true must have operable:manage_groups", "when command is operable:group with option[drop] == true must have operable:manage_groups", "when command is operable:group with option[list] == true must have operable:manage_groups", "when command is operable:group with option[remove] == true must have operable:manage_users"]}, "help" => %{"documentation" => "Get help on all installed Cog bot commands.\n\n * `@bot operable:help` - list all enabled commands\n * `@bot operable:help --disabled` - list all disabled commands\n * `@bot operable:help --all` - list all known commands, enabled and disabled\n * `@bot operable:help \"operable:help\"` - list help for a specific command\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Help", "options" => %{"all" => %{"required" => false, "type" => "bool"}, "disabled" => %{"required" => false, "type" => "bool"}}, "rules" => []}, "max" => %{"documentation" => "This command allows the user to determine the maximum value given a\nlist of inputs.\n\nExamples:\n> @bot operable:max 49 9 2 2\n> @bot operable:max 0.48 0.2 1.8 3548.4 0.078\n> @bot operable:max \"apple\" \"ball\" \"car\" \"zebra\"\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Max", "options" => %{}, "rules" => []}, "min" => %{"documentation" => "This command allows the user to determine the minimum value given a\nlist of inputs.\n\nExamples:\n> @bot operable:min 49 9 2 2\n> @bot operable:min 0.48 0.2 1.8 3548.4 0.078\n> @bot operable:min \"apple\" \"ball\" \"car\" \"zebra\"\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Min", "options" => %{}, "rules" => []}, "permissions" => %{"documentation" => "Manipulate authorization permissions.\n\n* Create permissions in the `site` namespace\n* Delete permissions in the `site` namespace\n* List all permissions in the system\n* Grant and revoke permissions from roles.\n\nFormat:\n\n --list\n --create --permission=site:<name>\n --delete --permission=site:<name>\n --grant --permission=<namespace>:<permission> --role=<name>\"\n --revoke --permission=<namespace>:<permission> --role=<name>\"\n\nExamples:\n\n> !operable:permissions --list\n> !operable:permissions --create --permission=site:admin\n> !operable:permissions --delete --permission=site:admin\n> !operable:permissions --grant --role=dev --permission=site:write\n> !operable:permissions --revoke --role=dev --permission=giphy:giphy\n\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Permissions", "options" => %{"create" => %{"required" => false, "type" => "bool"}, "delete" => %{"required" => false, "type" => "bool"}, "grant" => %{"required" => false, "type" => "bool"}, "list" => %{"required" => false, "type" => "bool"}, "permission" => %{"required" => false, "type" => "string"}, "revoke" => %{"required" => false, "type" => "bool"}, "role" => %{"required" => false, "type" => "string"}}, "rules" => ["when command is operable:permissions with option[create] == true must have operable:manage_permissions", "when command is operable:permissions with option[delete] == true must have operable:manage_permissions", "when command is operable:permissions with option[grant] == true must have operable:manage_roles", "when command is operable:permissions with option[list] == true must have operable:manage_permissions", "when command is operable:permissions with option[revoke] == true must have operable:manage_roles"]}, "raw" => %{"documentation" => "Show the raw output of a command, exclusive of any templating.\n\nUseful for seeing the difference between `multiple` and `once`\nexecution modes, as well as seeing which fields are available for\nuse in `bound` and `all` calling conventions.\n\nAlso useful as a debugging tool for command authors.\n\nExample:\n\n @bot operable:echo foo | operable:raw\n > {\n \"body\": [\n \"foo\"\n ]\n }\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Command.Raw", "options" => %{}, "rules" => []}, "role" => %{"documentation" => "This command allows the user to manage roles.\n\nUsage:\n role --create <rolename>\n role --drop <rolename>\n role --grant --group=<groupname> <rolename>\n role --revoke --group=<groupname> <rolename>\n role --list\nExamples:\n> @bot operable:role --create deployment\n> @bot operable:role --grant --group=ops deployment\n> @bot operable:role --revoke --group=ops deployment\n> @bot operable:role --drop deployment\n> @bot operable:role --list\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Role", "options" => %{"create" => %{"required" => false, "type" => "bool"}, "drop" => %{"required" => false, "type" => "bool"}, "grant" => %{"required" => false, "type" => "bool"}, "group" => %{"required" => false, "type" => "string"}, "list" => %{"required" => false, "type" => "bool"}, "revoke" => %{"required" => false, "type" => "bool"}}, "rules" => ["when command is operable:role with option[create] == true must have operable:manage_roles", "when command is operable:role with option[drop] == true must have operable:manage_roles", "when command is operable:role with option[grant] == true must have operable:manage_groups", "when command is operable:role with option[list] == true must have operable:manage_roles", "when command is operable:role with option[revoke] == true must have operable:manage_groups"]}, "rules" => %{"documentation" => "This command allows the user to manage rules for commands.\n\nFormat:\n Rules -\n rules --add \"when command is <full_command_name> must have <namespace>:<permission>\"\n rules --add --for-command=<full_command_name> --permission=<namespace>:<permission>\n rules --list --for-command=<full_command_name>\n rules --drop --for-command=<full_command_name>\n rules --drop --id=<rule_id>\n\nExamples:\n> @bot operable:rules --add \"when command is operable:ec2-terminate must have operable:ec2\"\n", "enforcing" => true, "execution" => "multiple", "module" => "Cog.Commands.Rules", "options" => %{"add" => %{"required" => false, "type" => "bool"}, "drop" => %{"required" => false, "type" => "bool"}, "for-command" => %{"required" => false, "type" => "string"}, "id" => %{"required" => false, "type" => "string"}, "list" => %{"required" => false, "type" => "bool"}, "permission" => %{"required" => false, "type" => "string"}}, "rules" => ["when command is operable:rules must have operable:manage_commands"]}, "seed" => %{"documentation" => "Seed a pipeline with arbitrary data.\n\nAccepts a single string argument, which must be valid JSON for\neither a map or a list of maps.\n\nThough some values may be able to be typed without enclosing quotes,\nit is highly recommended to single-quote your entire string.\n\nBest used for debugging and experimentation.\n\nExamples:\n\n !seed '{\"thing\":\"stuff\"}' | echo $thing\n > stuff\n\n !seed '[{\"thing\":\"stuff\"},{\"thing\":\"more stuff\"}]' | echo $thing\n > stuff\n > more stuff\n\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Command.Seed", "options" => %{}, "rules" => []}, "sleep" => %{"documentation" => "Sleep for a configurable number of seconds. Useful\nfor testing timeout handling in executor logic.\n\nPasses COG_ENV through unchanged.\n\nNote, however, that invocations of this command are still subject to\nthe current per-invocation timeout in the executor (1 minute).\n\nCurrently useful mainly for debugging purposes.\n\nExample:\n\n !echo \"Get up and stretch\" | sleep 10 | echo $body > me`\n\n", "enforcing" => false, "execution" => "once", "module" => "Cog.Commands.Sleep", "options" => %{}, "rules" => []}, "sort" => %{"documentation" => "Sorts the given inputs.\n\nExamples\n @bot operable:sort 3 2 1 5 4\n > [1, 2, 3, 4, 5]\n @bot operable:sort --asc 4.5 1.8 0.032 0.6 1.5 0.4\n > [0.032, 0.4, 0.6, 1.5, 1.8, 4.5]\n @bot operable:sort --desc Life is 10 percent what happens to us and 90% how we react to it\n > [what, we, us, to, to, react, percent, it, is, how, happens, and, Life, %, 90, 10]\n @bot operable:rules --for-command=rules| sort --field=rule\n > {\n\"rule\": \"when command is operable:permissions with option[user] == /.*/ must have operable:manage_users\",\n\"id\": \"12345678-abcd-efgh-ijkl-0987654321ab\",\n\"command\": \"operable:permissions\"\n}\n{\n\"rule\": \"when command is operable:permissions with option[role] == /.*/ must have operable:manage_roles\",\n\"id\": \"87654321-mnop-qrst-uvwx-0123456789ab\",\n\"command\": \"operable:permissions\"\n}\n{\n\"rule\": \"when command is operable:permissions with option[group] == /.*/ must have operable:manage_groups\",\n\"id\": \"24680135-azby-cxdw-evfu-ab0123456789\",\n\"command\": \"operable:permissions\"\n}\n", "enforcing" => false, "execution" => "once", "module" => "Cog.Commands.Sort", "options" => %{"asc" => %{"required" => false, "type" => "bool"}, "desc" => %{"required" => false, "type" => "bool"}, "field" => %{"required" => false, "type" => "string"}}, "rules" => []}, "sum" => %{"documentation" => "This command allows the user to sum together a list of numbers\n\nExamples:\n> @bot operable:sum 2 2\n> @bot operable:sum 2 \"-9\"\n> @bot operable:sum 2 24 57 3.7 226.78\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Sum", "options" => %{}, "rules" => []}, "table" => %{"documentation" => "Converts lists of maps into a table of columns specified.\n\n## Example\n\n @bot operable:stackoverflow vim | operable:table —fields=\"title, score\" $items\n > title score\n > What is your most productive shortcut with Vim? 1129\n > Vim clear last search highlighting 843\n > How to replace a character for a newline in Vim? 920\n\n", "enforcing" => false, "execution" => "once", "module" => "Cog.Commands.Table", "options" => %{"fields" => %{"required" => true, "type" => "list"}}, "rules" => []}, "thorn" => %{"documentation" => "This command replaces `Th` following a word boundary with þ\n\nExamples:\n> @bot operable:thorn foo-Thbar-Thbaz\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Thorn", "options" => %{}, "rules" => []}, "unique" => %{"documentation" => "This command returns unique values given list of inputs\n\nExamples:\n> @bot operable:unique 49.3 9 2 2 42 49.3\n> @bot operable:unique \"apple\" \"apple\" \"ball\" \"car\" \"car\" \"zebra\"\n", "enforcing" => false, "execution" => "once", "module" => "Cog.Commands.Unique", "options" => %{}, "rules" => []}, "wc" => %{"documentation" => "This command allows the user to count the number of words or lines in the input string.\n wc [--words | --lines] <input string>\n\nExamples:\n> @bot wc --words \"Hey, what will we do today?\"\n> @bot wc --lines \"From time to time\nThe clouds give rest\nTo the moon-beholders.\"\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Wc", "options" => %{"lines" => %{"required" => false, "type" => "bool"}, "words" => %{"required" => false, "type" => "bool"}}, "rules" => []}, "which" => %{"documentation" => "Determine whether a given input is a command or an alias. Returns the type of\ninput and it's bundle or visibility. In the case of aliases it also returns\nthe aliased command string. This command is only useful non fully qualified\ncommands or aliases. Fully qualified commands or aliases will return no match.\n\nNote: If a command is shadowed, it has an alias with the same name, the alias\nwill be returned.\n\n## Example\n\n @bot operable:which my-awesome-alias\n > alias - user:my-awesome-alias -> \"echo my awesome alias\"\n\n @bot operable:which an-awesome-command\n > command - operable:an-awesome-command\n\n @bot operable:which not-anything\n > No matching commands or aliases.\n", "enforcing" => false, "execution" => "multiple", "module" => "Cog.Commands.Which", "options" => %{}, "rules" => []}}, "name" => "operable", "permissions" => ["operable:manage_commands", "operable:manage_groups", "operable:manage_permissions", "operable:manage_roles", "operable:manage_users", "operable:manage_relays", "operable:manage_triggers"], "templates" => %{"alias-ls" => %{"slack" => "{{^.}}\nNo matching aliases\n{{/.}}\n{{#.}}\nName: `{{name}}`\nVisibility: `{{visibility}}`\nPipeline: `{{pipeline}}`\n{{/.}}\n"}, "alias-mv" => %{"slack" => "Successfully moved {{source.visibility}}:{{source.name}} to {{destination.visibility}}:{{destination.name}}\n"}, "alias-new" => %{"slack" => "Success, 'user:{{ name }}' has been created\"\n"}, "alias-rm" => %{"slack" => "Successfully removed '{{visibility}}:{{name}}'\n"}, "bundle" => %{"slack" => "{{#error}}\n An error occurred!\n {{error}}\n{{/error}}\n\n{{^error}}\n The bundle `{{bundle}}` is currently `{{status}}`.\n The following Relays are running the bundle:\n {{#relays}}\n * `{{.}}`\n {{/relays}}\n {{^relays}}None!{{/relays}}\n{{/error}}\n"}, "filter" => %{"slack" => "{{^.}}No items found{{/.}}\n{{#.}}\n```\n{{{.}}}\n```\n{{/.}}\n"}, "greet" => %{"slack" => "Hello {{greetee}}\nI'm Cog. I can do lots of things. To find out what, try using the `operable:help` command.\n"}, "help" => %{"slack" => "{{#command}}\n Documentation for `{{command}}`\n\n {{{documentation}}}\n{{/command}}\n\n{{^command}}\n I know about these commands:\n\n {{#commands}}\n * {{.}}\n {{/commands}}\n\n Try calling `operable:help COMMAND` to find out more.\n{{/command}}\n"}, "rules-add" => %{"slack" => "{{#.}}\nSuccess!\nAdded `{{rule}}`\nwith ID `{{id}}`\n{{/.}}\n"}, "rules-drop" => %{"slack" => "{{^.}}\nNo rules to drop.\n{{/.}}\n\n{{#.}}\nID: `{{id}}`: `{{rule}}`\n{{/.}}\n"}, "rules-list" => %{"slack" => "{{^.}}\nNo rules found.\n{{/.}}\n\n{{#.}}\nID: `{{id}}`: `{{rule}}`\n{{/.}}\n"}, "table" => %{"slack" => "```{{table}}```\n"}, "which" => %{"slack" => "{{#not_found}}\nNo matching commands or aliases.\n{{/not_found}}\n{{#type}}\n{{type}} - {{scope}}:{{name}} {{#pipeline}} -> \"{{pipeline}}\" {{/pipeline}}\n{{/type}}\n"}}, "type" => "elixir", "version" => "0.0.1"}], "online" => true, "relay" => "2d403542-36b7-42ec-86f3-e4a71359fc3a", "snapshot" => true}}}, 5000)
** (EXIT) time out
bash-4.3$ exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment