Created
January 10, 2011 19:19
-
-
Save arbales/773292 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mycroft | |
module Action | |
class Base | |
def initialize(options) | |
@options = options | |
end | |
def self.create(options) | |
self.new(options).save | |
end | |
def perform | |
end | |
def log | |
end | |
def save | |
# Writes a file to /var/mycroft/actions/#{type}.#{uuid}.act | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mycroft | |
module Action | |
class Nginx < Base | |
def self.restart | |
self.create({'action': 'restart'}) | |
end | |
def self.reload | |
self.create({'action': 'reload'}) | |
end | |
def perform | |
system "/usr/local/bin/nginx -s #{@options['action']}" | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mycroft | |
module Action | |
class PasswordChange < Base | |
def initialize(options) | |
@options = options | |
@options['shadow'] = Mycroft::Utils.shadow @options['password'] | |
@options['password'] = nil | |
end | |
def perform | |
system "usermod -p #{@options['shadow']} #{@options['username']}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment