summaryrefslogtreecommitdiff
path: root/lib/leap_cli/macros/provider.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-08-12 14:37:21 -0700
committerelijah <elijah@riseup.net>2015-08-19 12:24:51 -0700
commit64787942086b6fbfdf432cd6250f0937c785de1a (patch)
tree06634196af8066cb782032f731ee7cae939367ce /lib/leap_cli/macros/provider.rb
parente6f6324ebea9fc46d5d617a08c2eb239349d9f90 (diff)
mv commands and macros to lib/leap_cli
Diffstat (limited to 'lib/leap_cli/macros/provider.rb')
-rw-r--r--lib/leap_cli/macros/provider.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/leap_cli/macros/provider.rb b/lib/leap_cli/macros/provider.rb
new file mode 100644
index 00000000..84c4e1b8
--- /dev/null
+++ b/lib/leap_cli/macros/provider.rb
@@ -0,0 +1,20 @@
+#
+# These macros are intended only for use in provider.json, although they are
+# currently loaded in all .json contexts.
+#
+
+module LeapCli
+ module Macro
+
+ #
+ # returns an array of the service names, including only those services that
+ # are enabled for this environment.
+ #
+ def enabled_services
+ manager.env(self.environment).services[:service_type => :user_service].field(:name).select { |service|
+ manager.nodes[:environment => self.environment][:services => service].any?
+ }
+ end
+
+ end
+end