puppetfactory 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/puppetfactory +1 -1
- data/public/css/style.css +58 -16
- data/public/js/jquery-ui.min.js +11 -11
- data/public/js/jquery.js +4 -9789
- data/public/js/scripts.js +4 -0
- data/public/js/usermanagement.js +20 -3
- data/views/currentuser.erb +54 -40
- data/views/index.erb +3 -6
- data/views/logs.erb +1 -1
- data/views/newuser.erb +35 -15
- data/views/shell.erb +41 -31
- metadata +3 -4
- data/views/userlogin.erb +0 -9
    
        data/public/js/scripts.js
    CHANGED
    
    
    
        data/public/js/usermanagement.js
    CHANGED
    
    | @@ -35,6 +35,17 @@ $(document).ready(function(){ | |
| 35 35 | 
             
                close();
         | 
| 36 36 | 
             
              });
         | 
| 37 37 |  | 
| 38 | 
            +
              $('.tab').on('click', function(event) {
         | 
| 39 | 
            +
                event.preventDefault();
         | 
| 40 | 
            +
                var tabs = $(this).closest('.tabs-wrapper');
         | 
| 41 | 
            +
                
         | 
| 42 | 
            +
                tabs.find('.tab.active').removeClass('active');
         | 
| 43 | 
            +
                $(this).addClass('active');
         | 
| 44 | 
            +
                
         | 
| 45 | 
            +
                tabs.find('.tab-content.current').removeClass('current');
         | 
| 46 | 
            +
                $('#' + this.dataset.tabcontent).addClass('current');
         | 
| 47 | 
            +
              });
         | 
| 48 | 
            +
             | 
| 38 49 | 
             
              $('article').on('click', '#users .select a, #user-logout', function(event){
         | 
| 39 50 | 
             
                event.preventDefault();
         | 
| 40 51 | 
             
                var action = $(this).attr('href');
         | 
| @@ -50,10 +61,16 @@ $(document).ready(function(){ | |
| 50 61 |  | 
| 51 62 | 
             
              $('#login-submit').click(function (event) {
         | 
| 52 63 | 
             
                event.preventDefault();
         | 
| 53 | 
            -
                var action = $(this).attr('href');
         | 
| 54 | 
            -
                var user = $('#login-user').val();
         | 
| 64 | 
            +
                var action = $(this).attr('href') + $('#login-user').val();
         | 
| 55 65 |  | 
| 56 | 
            -
                $.get(action, { | 
| 66 | 
            +
                $.get(action, function(data) {
         | 
| 67 | 
            +
                  var results = $.parseJSON(data);
         | 
| 68 | 
            +
                  if (results.status == 'ok') {
         | 
| 69 | 
            +
                    location.replace('/');
         | 
| 70 | 
            +
                  } else {
         | 
| 71 | 
            +
                    alert('User selection failed');
         | 
| 72 | 
            +
                  }
         | 
| 73 | 
            +
                });
         | 
| 57 74 | 
             
              });
         | 
| 58 75 |  | 
| 59 76 | 
             
              // save the new user
         | 
    
        data/views/currentuser.erb
    CHANGED
    
    | @@ -1,44 +1,59 @@ | |
| 1 | 
            -
            <div id="currentuser-wrapper">
         | 
| 2 1 | 
             
            <% if @current %>
         | 
| 3 | 
            -
              < | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
                < | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
                 | 
| 12 | 
            -
            <%  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
            <%  | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
            <%  | 
| 30 | 
            -
               | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
               | 
| 2 | 
            +
              <div id="currentuser">
         | 
| 3 | 
            +
                <div>
         | 
| 4 | 
            +
                  <label for="">Username</label>
         | 
| 5 | 
            +
                  <div><%= @current[:username] %> <a id="user-logout" class="pull-right" href="/users/deactive">Logout</a></div>
         | 
| 6 | 
            +
                </div>
         | 
| 7 | 
            +
                <div>
         | 
| 8 | 
            +
                  <label for="">Certname</label>
         | 
| 9 | 
            +
                  <div><%= @current[:certname] %></div> 
         | 
| 10 | 
            +
                </div>
         | 
| 11 | 
            +
              <% if @current[:port] -%>
         | 
| 12 | 
            +
                  <div>
         | 
| 13 | 
            +
                    <label for="">Webserver URL</label>
         | 
| 14 | 
            +
                    <div><a href="/port/<%= @current[:port] %>/"><%= @current[:url] %></a></div> 
         | 
| 15 | 
            +
                  </div>
         | 
| 16 | 
            +
              <% end -%>
         | 
| 17 | 
            +
              <% if @current[:container_status] -%>
         | 
| 18 | 
            +
                  <div>
         | 
| 19 | 
            +
                    <label for="">Container</label>
         | 
| 20 | 
            +
                    <div><%= @current[:container_status]['Description'] %></div> 
         | 
| 21 | 
            +
                  </div>
         | 
| 22 | 
            +
              <% end -%>
         | 
| 23 | 
            +
              <% if @current[:node_group_url] -%>
         | 
| 24 | 
            +
                  <div>
         | 
| 25 | 
            +
                    <label for="">Node Group</label>
         | 
| 26 | 
            +
                    <div><a href="https://<%= request.host %>/<%= @current[:node_group_url] %>" target="_console">Console login</a></div> 
         | 
| 27 | 
            +
                  </div>
         | 
| 28 | 
            +
              <% end -%>
         | 
| 29 | 
            +
              <% if @current[:controlrepo] -%>
         | 
| 30 | 
            +
                  <div>
         | 
| 31 | 
            +
                    <label for="">Control Repo</label>
         | 
| 32 | 
            +
                    <div><a href="<%= @current[:controlrepo] %>" target="_repository"><%= @current[:controlrepo] %></a></div> 
         | 
| 33 | 
            +
                  </div>
         | 
| 34 | 
            +
              <% end -%>
         | 
| 35 | 
            +
              <% if @current[:latestcommit] -%>
         | 
| 36 | 
            +
                  <div>
         | 
| 37 | 
            +
                    <label for="">Latest Commit</label>
         | 
| 38 | 
            +
                    <div><a href="<%= @current[:latestcommit][:url] %>" target="_repository"><%= @current[:latestcommit][:message] %></a>
         | 
| 39 | 
            +
                      <small>(<%= @current[:latestcommit][:time] %>)</small></div> 
         | 
| 40 | 
            +
                  </div>
         | 
| 41 | 
            +
              <% end -%>
         | 
| 42 | 
            +
              <% if settings.plugins.include? :Dashboard -%>
         | 
| 43 | 
            +
                  <div>
         | 
| 44 | 
            +
                    <label for="">Spec Tests</label>
         | 
| 45 | 
            +
                    <div><a href="/dashboard/details/<%= @current[:username] %>" target="_results">results</a> <small>(may not always be available)</small></div> 
         | 
| 46 | 
            +
                  </div>
         | 
| 47 | 
            +
              <% end -%>
         | 
| 48 | 
            +
              <% if @current[:tree] -%>
         | 
| 49 | 
            +
                <div>
         | 
| 50 | 
            +
                  <label for="">Environment Structure:</label>
         | 
| 51 | 
            +
                  <div id="tree"></div>
         | 
| 52 | 
            +
                </div>
         | 
| 53 | 
            +
              <% end -%>
         | 
| 36 54 | 
             
              <% if action_enabled? :deploy -%>
         | 
| 37 | 
            -
                < | 
| 55 | 
            +
                <input type="button" id="deploy" data-user="<%= @current[:username] %>" value="Deploy Environment">
         | 
| 38 56 | 
             
              <% end -%>
         | 
| 39 | 
            -
              <div>
         | 
| 40 | 
            -
                <a class="user-logout" href="/users/deactive">Logout</a>
         | 
| 41 | 
            -
              </div>
         | 
| 42 57 | 
             
            <% end %>
         | 
| 43 58 |  | 
| 44 59 | 
             
            <% if @current and @current[:tree] %>
         | 
| @@ -47,5 +62,4 @@ | |
| 47 62 | 
             
                  $('#tree').jstree({ 'core': { 'data': <%= @current[:tree] %> } });
         | 
| 48 63 | 
             
              });
         | 
| 49 64 | 
             
            </script>
         | 
| 50 | 
            -
            <% end %>
         | 
| 51 | 
            -
            </div>
         | 
| 65 | 
            +
            <% end %>
         | 
    
        data/views/index.erb
    CHANGED
    
    | @@ -14,7 +14,7 @@ | |
| 14 14 | 
             
            <body>
         | 
| 15 15 | 
             
              <div id="tabs">
         | 
| 16 16 | 
             
                <header>
         | 
| 17 | 
            -
             | 
| 17 | 
            +
                    <img src="/images/Puppet-Logo-Mark-Amber-sm.png" alt="logo" id="nav-logo"> Classroom
         | 
| 18 18 | 
             
                  <ul>
         | 
| 19 19 | 
             
                    <li><a href="#home" class="cache">Home</a></li>
         | 
| 20 20 | 
             
                    <% if privileged? %>
         | 
| @@ -36,19 +36,16 @@ | |
| 36 36 | 
             
                  <% end %>
         | 
| 37 37 | 
             
                </header>
         | 
| 38 38 | 
             
                <article>    
         | 
| 39 | 
            -
                  <h2>Puppet Classroom</h2>
         | 
| 40 39 | 
             
                  <div id="home">
         | 
| 41 40 | 
             
                    <div class="flexrow">
         | 
| 42 | 
            -
                      <div class="flex- | 
| 41 | 
            +
                      <div class="flex-6 flex-left">
         | 
| 43 42 | 
             
                        <%= erb :shell %>
         | 
| 44 43 | 
             
                      </div>
         | 
| 45 | 
            -
                      <div  | 
| 44 | 
            +
                      <div class="flex-2 flex-right">
         | 
| 46 45 | 
             
                      <% if @current %>
         | 
| 47 46 | 
             
                        <%= erb :currentuser %>
         | 
| 48 47 | 
             
                      <% else %>
         | 
| 49 48 | 
             
                        <%= erb :newuser %>
         | 
| 50 | 
            -
                        <hr>
         | 
| 51 | 
            -
                        <%= erb :userlogin %>
         | 
| 52 49 | 
             
                      <% end -%>
         | 
| 53 50 | 
             
                      </div>
         | 
| 54 51 | 
             
                    </div>
         | 
    
        data/views/logs.erb
    CHANGED
    
    | @@ -9,7 +9,7 @@ | |
| 9 9 | 
             
                  var elem = $(this)[0]
         | 
| 10 10 | 
             
                  // track the bottom of the logs, unless we've scrolled away
         | 
| 11 11 | 
             
                  if(force || (elem.scrollHeight - elem.scrollTop - elem.clientHeight < 100)) {
         | 
| 12 | 
            -
                    $( | 
| 12 | 
            +
                    $('body').animate({scrollTop: elem.scrollHeight}, 500);
         | 
| 13 13 | 
             
                  }
         | 
| 14 14 |  | 
| 15 15 | 
             
                  // use timeout instead of an interval so that in case of network error
         | 
    
        data/views/newuser.erb
    CHANGED
    
    | @@ -1,19 +1,39 @@ | |
| 1 | 
            -
            <div  | 
| 2 | 
            -
              < | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 1 | 
            +
            <div class="tabs-wrapper">
         | 
| 2 | 
            +
              <div class="tabs">
         | 
| 3 | 
            +
                <div class="tab active" data-tabcontent="newuser">
         | 
| 4 | 
            +
                  New User
         | 
| 5 | 
            +
                </div>
         | 
| 6 | 
            +
                <div class="tab" data-tabcontent="login">
         | 
| 7 | 
            +
                  Login
         | 
| 8 | 
            +
                </div>
         | 
| 5 9 | 
             
              </div>
         | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 10 | 
            +
             | 
| 11 | 
            +
              <div id="newuser" class="tab-content current">
         | 
| 12 | 
            +
                <div>
         | 
| 13 | 
            +
                  <label for="user">Username:</label><input type="text" id="user" value="" />
         | 
| 14 | 
            +
                </div>
         | 
| 15 | 
            +
                <div>
         | 
| 16 | 
            +
                  <label for="password">Password:</label><input type="password" id="password" value="" />
         | 
| 17 | 
            +
                </div>
         | 
| 18 | 
            +
                <div>
         | 
| 19 | 
            +
                  <label for="password2">Repeat:</label><input type="password" id="password2" value="" />
         | 
| 20 | 
            +
                </div>
         | 
| 21 | 
            +
                <div>
         | 
| 22 | 
            +
                  <label for="session">Session ID:</label><input type="text" id="session" value="" />
         | 
| 23 | 
            +
                  <p></p>
         | 
| 24 | 
            +
                </div>
         | 
| 25 | 
            +
                <div>
         | 
| 26 | 
            +
                  <input type="button" id="save" value="Submit" />
         | 
| 27 | 
            +
                </div>
         | 
| 8 28 | 
             
              </div>
         | 
| 9 | 
            -
               | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
                 | 
| 14 | 
            -
                < | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                <input type="button" id="save" value="Submit" />
         | 
| 29 | 
            +
              
         | 
| 30 | 
            +
              <div id="login" class="tab-content">
         | 
| 31 | 
            +
                <div>
         | 
| 32 | 
            +
                  <label for="login-user">Username:</label><input type="text" id="login-user" value="" />
         | 
| 33 | 
            +
                </div>
         | 
| 34 | 
            +
                <div>
         | 
| 35 | 
            +
                  <a href="/users/active/" id="login-submit" class="button">Login</a>
         | 
| 36 | 
            +
                </div>
         | 
| 18 37 | 
             
              </div>
         | 
| 38 | 
            +
             | 
| 19 39 | 
             
            </div>
         | 
    
        data/views/shell.erb
    CHANGED
    
    | @@ -1,35 +1,45 @@ | |
| 1 1 | 
             
            <div id="shell">
         | 
| 2 | 
            -
            <% if @current %>
         | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
            < | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            </ | 
| 12 | 
            -
             | 
| 13 | 
            -
               | 
| 14 | 
            -
             | 
| 15 | 
            -
            <p>
         | 
| 16 | 
            -
             | 
| 17 | 
            -
              < | 
| 18 | 
            -
                 | 
| 19 | 
            -
             | 
| 20 | 
            -
                   | 
| 21 | 
            -
             | 
| 22 | 
            -
                 | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
                 | 
| 2 | 
            +
              <% if @current %>
         | 
| 3 | 
            +
                <iframe id="console" src="/shell/login/"></iframe>
         | 
| 4 | 
            +
                <div>
         | 
| 5 | 
            +
                  <i id="instruction-toggle" class="fa fa-question-circle-o toggle" data-target="instruction"></i>
         | 
| 6 | 
            +
                </div>
         | 
| 7 | 
            +
                <script>
         | 
| 8 | 
            +
                  $(document).ready(function() {
         | 
| 9 | 
            +
                    $("#instruction").hide();
         | 
| 10 | 
            +
                  });
         | 
| 11 | 
            +
                </script>
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              <% else %>
         | 
| 14 | 
            +
                <h2>Welcome to the Puppet Classroom.</h2>
         | 
| 15 | 
            +
                <p>Please log in or create a user account.</p>    
         | 
| 16 | 
            +
              <% end -%>
         | 
| 17 | 
            +
              <div id="instruction">
         | 
| 18 | 
            +
                <p>
         | 
| 19 | 
            +
                  We will provision a Puppet agent node for you and you'll use it to complete labs and
         | 
| 20 | 
            +
                  exercises. This node can be accessed through a web terminal once you've logged in.
         | 
| 21 | 
            +
                </p>
         | 
| 22 | 
            +
                <p>
         | 
| 23 | 
            +
                  If you prefer, you may also use any standard SSH client using the username
         | 
| 24 | 
            +
                  and password you specified. Some common SSH clients include:
         | 
| 25 | 
            +
                <p>
         | 
| 26 26 | 
             
                <ul>
         | 
| 27 | 
            -
                  <li | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 27 | 
            +
                  <li>
         | 
| 28 | 
            +
                    Built-in to Mac OSX and Linux:
         | 
| 29 | 
            +
                    <ol>
         | 
| 30 | 
            +
                      <li>Start Terminal.app or any terminal emulator to get to the command line</li>
         | 
| 31 | 
            +
                      <li>Run <code>ssh <%= request.host %></code></li>
         | 
| 32 | 
            +
                    </ol>
         | 
| 33 | 
            +
                  </li>
         | 
| 34 | 
            +
                  <li>
         | 
| 35 | 
            +
                    Windows:
         | 
| 36 | 
            +
                    <ul>
         | 
| 37 | 
            +
                      <li><a href="https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH">OpenSSH</a></li>    
         | 
| 38 | 
            +
                      <li><a href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe">PuTTY</a></li>
         | 
| 39 | 
            +
                      <li><a href="http://winscp.net/eng/download.php#download2" target="_new">WinSCP</a></li>
         | 
| 40 | 
            +
                      <li><a href="http://www.vandyke.com/download/securecrt/download.html" target="_new">SecureCRT</a></li>
         | 
| 41 | 
            +
                    </ul>
         | 
| 42 | 
            +
                  </li>
         | 
| 31 43 | 
             
                </ul>
         | 
| 32 | 
            -
              </ | 
| 33 | 
            -
            </ul>
         | 
| 34 | 
            -
            <% end -%>  
         | 
| 44 | 
            +
              </div>
         | 
| 35 45 | 
             
            </div>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: puppetfactory
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.6. | 
| 4 | 
            +
              version: 0.6.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ben Ford
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date:  | 
| 13 | 
            +
            date: 2018-01-03 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: sinatra
         | 
| @@ -253,7 +253,6 @@ files: | |
| 253 253 | 
             
            - views/logs.erb
         | 
| 254 254 | 
             
            - views/newuser.erb
         | 
| 255 255 | 
             
            - views/shell.erb
         | 
| 256 | 
            -
            - views/userlogin.erb
         | 
| 257 256 | 
             
            - views/users.erb
         | 
| 258 257 | 
             
            homepage: https://github.com/puppetlabs/puppetfactory
         | 
| 259 258 | 
             
            licenses:
         | 
| @@ -275,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 275 274 | 
             
                  version: '0'
         | 
| 276 275 | 
             
            requirements: []
         | 
| 277 276 | 
             
            rubyforge_project: 
         | 
| 278 | 
            -
            rubygems_version: 2. | 
| 277 | 
            +
            rubygems_version: 2.5.2
         | 
| 279 278 | 
             
            signing_key: 
         | 
| 280 279 | 
             
            specification_version: 4
         | 
| 281 280 | 
             
            summary: Stands up a graphical classroom manager with containerized puppet agents.
         |